Merge branch 'master' of disposed.de:scattport
This commit is contained in:
@@ -64,7 +64,7 @@ $autoload['libraries'] = array('session', 'lang_detect', 'database', 'access', '
|
||||
| $autoload['helper'] = array('url', 'file');
|
||||
*/
|
||||
|
||||
$autoload['helper'] = array('url', 'html', 'language', 'hash');
|
||||
$autoload['helper'] = array('date', 'url', 'html', 'language', 'hash');
|
||||
|
||||
|
||||
/*
|
||||
|
||||
@@ -55,10 +55,8 @@ class Projects extends CI_Controller {
|
||||
// run form validation
|
||||
if ($this->form_validation->run() === true) {
|
||||
$data = array(
|
||||
'name' => $this->input->post('name'),
|
||||
'description' => $this->input->post('description'),
|
||||
'defaultmodel' => $modelData['file_name'],
|
||||
'defaultconfig' => $configData['file_name'],
|
||||
'name' => $this->input->post('name'),
|
||||
'description' => $this->input->post('description'),
|
||||
);
|
||||
|
||||
$data['project_id'] = $this->project->create($data);
|
||||
@@ -69,24 +67,31 @@ class Projects extends CI_Controller {
|
||||
mkdirs($projectPath);
|
||||
|
||||
$config = array(
|
||||
'upload_path' => $projectPath,
|
||||
'allowed_types' => '*',
|
||||
'upload_path' => $projectPath,
|
||||
'allowed_types' => '*',
|
||||
'overwrite' => true,
|
||||
);
|
||||
$this->load->library('upload', $config);
|
||||
|
||||
if (!empty($_FILES['defaultmodel']['tmp_name'])) {
|
||||
if ($_FILES['defaultmodel']['tmp_name'] != '') {
|
||||
$config['file_name'] = 'defaultmodel';
|
||||
$this->upload->initialize($config);
|
||||
|
||||
if (!$this->upload->do_upload('defaultmodel')) {
|
||||
if ($this->upload->do_upload('defaultmodel')) {
|
||||
$default = $this->upload->data();
|
||||
$this->project->update($data['project_id'], array('default_model' => $default['file_name']));
|
||||
} else {
|
||||
$this->messages->add(_('The default model could not be uploaded.'), 'error');
|
||||
}
|
||||
}
|
||||
if (!empty($_FILES['defaultconfig']['tmp_name'])) {
|
||||
if ($_FILES['defaultconfig']['tmp_name'] != '') {
|
||||
$config['file_name'] = 'defaultconfig';
|
||||
$this->upload->initialize($config);
|
||||
|
||||
if (!$this->upload->do_upload('defaultconfig')) {
|
||||
if ($this->upload->do_upload('defaultconfig')) {
|
||||
$default = $this->upload->data();
|
||||
$this->project->update($data['project_id'], array('default_config' => $default['file_name']));
|
||||
} else {
|
||||
$this->messages->add(_('The default config could not be uploaded.'), 'error');
|
||||
}
|
||||
}
|
||||
@@ -111,6 +116,7 @@ class Projects extends CI_Controller {
|
||||
*/
|
||||
public function detail($id) {
|
||||
$this->load->helper('typography');
|
||||
$this->load->model('job');
|
||||
|
||||
$project = $this->project->getById($id);
|
||||
if (!$project) {
|
||||
@@ -120,7 +126,7 @@ class Projects extends CI_Controller {
|
||||
|
||||
$data['project'] = $project;
|
||||
$data['trials'] = $this->trial->getByProjectId($id);
|
||||
$data['jobsDone'] = null;
|
||||
$data['jobs'] = $this->job->getRecent();
|
||||
|
||||
$this->load->view('projects/detail', $data);
|
||||
}
|
||||
|
||||
@@ -28,10 +28,10 @@
|
||||
class Job extends CI_Model {
|
||||
|
||||
/**
|
||||
* Create a new job.
|
||||
* Creates a new job.
|
||||
*
|
||||
* @param array $data the data of the new job
|
||||
* @return bool was the insert successful
|
||||
* @param array $data The data of the new job
|
||||
* @return boolean Returns TRUE if the insert was successful.
|
||||
*/
|
||||
public function create($data) {
|
||||
$this->load->helper('date');
|
||||
@@ -49,18 +49,18 @@ class Job extends CI_Model {
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete a job.
|
||||
* @param string the job id to delete
|
||||
* @return bool was the deletion successful
|
||||
* Deletes a job.
|
||||
* @param string The job ID to delete
|
||||
* @return boolean Returns TRUE if the deletion was successful.
|
||||
*/
|
||||
public function delete($job_id) {
|
||||
return $this->db->delete('jobs', array('id' => $job_id));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the details of a given job.
|
||||
* Updates the details of a given job.
|
||||
*
|
||||
* @param string $job_id The job's id you want to update.
|
||||
* @param string $job_id The job ID you want to update
|
||||
* @param integer $data The data of the job.
|
||||
*/
|
||||
public function update($job_id, $data) {
|
||||
@@ -68,7 +68,27 @@ class Job extends CI_Model {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of results that the owner has not yet seen.
|
||||
* Gets a list of recent jobs.
|
||||
*
|
||||
* @param string $projectId The project's ID you want to get the jobs for
|
||||
* @return array
|
||||
*/
|
||||
public function getRecent($projectId = '') {
|
||||
$this->db->select('jobs.*, trials.project_id, trials.name');
|
||||
$this->db->join('trials', 'jobs.trial_id = trials.id', 'left');
|
||||
$this->db->where('finished_at', 0);
|
||||
|
||||
if (!empty($projectId)) {
|
||||
$this->db->where('project_id', $projectId);
|
||||
}
|
||||
|
||||
return $this->db->get('jobs')->result_array();
|
||||
}
|
||||
|
||||
/**
|
||||
* Gets a list of results that the owner has not yet seen.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function getUnseenResults() {
|
||||
$query = $this->db->order_by('started_at', 'asc')
|
||||
@@ -83,7 +103,9 @@ class Job extends CI_Model {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a list of jobs that have not yet started running.
|
||||
* Gets a list of jobs that have not yet started running.
|
||||
*
|
||||
* @return mixed
|
||||
*/
|
||||
public function getWaitingJob() {
|
||||
$query = $this->db->order_by('created_at', 'asc')->get_where('jobs', array('started_at' => '0000-00-00 00:00:00'), 1);
|
||||
|
||||
@@ -11,12 +11,14 @@
|
||||
<?=link_tag('assets/css/form.css');?>
|
||||
|
||||
<?=script_tag('assets/js/minmax.js');?>
|
||||
<?=script_tag('assets/js/jsc3d.min.js');?>
|
||||
<?=script_tag('https://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js');?>
|
||||
<?=script_tag('assets/js/scattport.js');?>
|
||||
<?=script_tag('assets/js/tablednd.jquery.js');?>
|
||||
<?=script_tag('assets/js/jtip.js');?>
|
||||
<script type="text/javascript">
|
||||
var SITE_URL = '<?=site_url()?>';
|
||||
var BASE_URL = '<?=base_url()?>';
|
||||
</script>
|
||||
</head>
|
||||
|
||||
@@ -26,8 +28,14 @@
|
||||
<h1><?=anchor('', img('assets/images/logo.png'))?></h1>
|
||||
<div class="status">
|
||||
<select name="activeProject">
|
||||
<option value="<?=site_url('');?>">Beispielprojekt</option>
|
||||
<option value="<?=site_url('projects');?>">Projekte verwalten</option>
|
||||
<?php
|
||||
$projects = $this->project->getAll();
|
||||
foreach ($projects as $project):
|
||||
?>
|
||||
<option value="<?=site_url('projects/detail/' . $project['id'] . '?active_project=' . $project['id']);?>"<?=($this->input->get('active_project') == $project['id']) ? ' selected' : '';?>><?=$project['name'];?></option>
|
||||
<?php
|
||||
endforeach;
|
||||
?>
|
||||
</select>
|
||||
</div>
|
||||
<div class="menu"><?= _('Hello,') ?> <a href="<?=site_url('');?>"><?=$this->user->profile()->firstname;?> <?=$this->user->profile()->lastname;?></a>! | <?=lang_select('assets/images');?> | <a href="#"><?=_('Help')?></a> | <?=anchor('auth/settings', _('Settings'));?> | <?=anchor('auth/logout', _('Logout'));?></div>
|
||||
|
||||
@@ -11,6 +11,29 @@
|
||||
<div class="editInPlace"><?=auto_typography($project['description']);?></div>
|
||||
<p></p>
|
||||
|
||||
<?php
|
||||
if ($project['default_model'] != ''):
|
||||
?>
|
||||
<canvas id="cv" style="border: #e8e8e8 1px solid;" width="120" height="120"></canvas>
|
||||
<p></p>
|
||||
|
||||
<script type="text/javascript">
|
||||
var canvas = document.getElementById('cv');
|
||||
var viewer = new JSC3D.Viewer(canvas);
|
||||
viewer.setParameter('SceneUrl', BASE_URL + 'uploads/<?=$project['id'];?>/<?=$project['default_model'];?>');
|
||||
viewer.setParameter('InitRotationX', -20);
|
||||
viewer.setParameter('InitRotationY', 20);
|
||||
viewer.setParameter('InitRotationZ', 0);
|
||||
viewer.setParameter('ModelColor', '#cccccc');
|
||||
viewer.setParameter('BackgroundColor1', '#ffffff');
|
||||
viewer.setParameter('BackgroundColor2', '#ffffff');
|
||||
viewer.setParameter('RenderMode', 'flat');
|
||||
viewer.init();
|
||||
viewer.update();
|
||||
</script>
|
||||
<?php
|
||||
endif;
|
||||
?>
|
||||
<h3><?=_('Trials');?></h3>
|
||||
<table class="tableList">
|
||||
<thead>
|
||||
@@ -60,21 +83,21 @@
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col"><?=_('Trial');?></th>
|
||||
<th scope="col"><?=_('Finished');?></th>
|
||||
<th scope="col"><?=_('Started');?></th>
|
||||
<th scope="col"><?=_('Actions');?></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php
|
||||
if (count($jobsDone) > 0):
|
||||
foreach ($jobsDone as $job):
|
||||
if (count($jobs) > 0):
|
||||
foreach ($jobs as $job):
|
||||
?>
|
||||
<tr>
|
||||
<td>Versuchsname</td>
|
||||
<td>Heute, 09:32</td>
|
||||
<td><?=$job['name'];?></td>
|
||||
<td><?=$job['started_at'];?></td>
|
||||
<td>
|
||||
<a href="<?=site_url('trials/results/' . $trial['id']);?>" title="<?= sprintf(_('Show results for the trial "%s"'), $trial['name']);?>"><?=_('Show results');?></a> |
|
||||
<a href="<?=site_url('trials/edit/' . $trial['id']);?>" title="<?= sprintf(_('Edit trial "%s"'), $trial['name']);?>"><?=_('Edit');?></td>
|
||||
<a href="<?=site_url('trials/results/' . $job['id']);?>" title="<?= sprintf(_('Show results for the trial "%s"'), $job['name']);?>"><?=_('Show results');?></a> |
|
||||
<a href="<?=site_url('trials/edit/' . $job['id']);?>" title="<?= sprintf(_('Edit trial "%s"'), $job['name']);?>"><?=_('Edit');?></td>
|
||||
</tr>
|
||||
<?php
|
||||
endforeach;
|
||||
|
||||
Reference in New Issue
Block a user