Implement result viewer for experiments
This commit is contained in:
@@ -25,6 +25,7 @@
|
|||||||
* Result browser.
|
* Result browser.
|
||||||
*
|
*
|
||||||
* @author Karsten Heiken <karsten@disposed.de>
|
* @author Karsten Heiken <karsten@disposed.de>
|
||||||
|
* @author Eike Foken <kontakt@eikefoken.de>
|
||||||
*/
|
*/
|
||||||
class Results extends MY_Controller {
|
class Results extends MY_Controller {
|
||||||
|
|
||||||
@@ -36,6 +37,7 @@ class Results extends MY_Controller {
|
|||||||
$this->load->model('program');
|
$this->load->model('program');
|
||||||
$this->load->model('job');
|
$this->load->model('job');
|
||||||
$this->load->model('server');
|
$this->load->model('server');
|
||||||
|
$this->load->model('experiment');
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -58,6 +60,19 @@ class Results extends MY_Controller {
|
|||||||
* @param string $experimentId The experiment for which to get the results
|
* @param string $experimentId The experiment for which to get the results
|
||||||
*/
|
*/
|
||||||
public function experiment($experimentId) {
|
public function experiment($experimentId) {
|
||||||
|
$experiment = $this->experiment->getById($experimentId);
|
||||||
|
|
||||||
|
// execute program runner
|
||||||
|
$program = $this->program->getById($experiment['program_id']);
|
||||||
|
$this->load->library('program_runner', array('program_driver' => $program['driver']));
|
||||||
|
$results = $this->program_runner->getResults($experiment['id']);
|
||||||
|
|
||||||
|
$data = array(); // empty data array
|
||||||
|
$data['experiment'] = $experiment;
|
||||||
|
$data['project'] = $this->project->getById($experiment['project_id']);
|
||||||
|
$data['results'] = $results;
|
||||||
|
|
||||||
|
$this->load->view('results/experiment', $data);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -24,6 +24,7 @@
|
|||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* @package ScattPort
|
* @package ScattPort
|
||||||
|
* @subpackage Libraries
|
||||||
* @author Eike Foken <kontakt@eikefoken.de>
|
* @author Eike Foken <kontakt@eikefoken.de>
|
||||||
*/
|
*/
|
||||||
class Program_runner {
|
class Program_runner {
|
||||||
@@ -74,6 +75,14 @@ class Program_runner {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param string $experimentId
|
||||||
|
*/
|
||||||
|
public function getResults($experimentId) {
|
||||||
|
return $this->driver->_getResults($experimentId);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* End of file Program_runner.php */
|
/* End of file Program_runner.php */
|
||||||
|
|||||||
@@ -1,7 +1,30 @@
|
|||||||
<?php
|
<?php defined('BASEPATH') || exit('No direct script access allowed');
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2011 Karsten Heiken, Eike Foken
|
||||||
|
*
|
||||||
|
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
* of this software and associated documentation files (the "Software"), to deal
|
||||||
|
* in the Software without restriction, including without limitation the rights
|
||||||
|
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
* copies of the Software, and to permit persons to whom the Software is
|
||||||
|
* furnished to do so, subject to the following conditions:
|
||||||
|
*
|
||||||
|
* The above copyright notice and this permission notice shall be included in
|
||||||
|
* all copies or substantial portions of the Software.
|
||||||
|
*
|
||||||
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
* THE SOFTWARE.
|
||||||
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
|
* @package ScattPort
|
||||||
|
* @subpackage Libraries
|
||||||
* @author Eike Foken <kontakt@eikefoken.de>
|
* @author Eike Foken <kontakt@eikefoken.de>
|
||||||
*/
|
*/
|
||||||
class Scatt extends Program_runner {
|
class Scatt extends Program_runner {
|
||||||
@@ -17,7 +40,7 @@ class Scatt extends Program_runner {
|
|||||||
$this->CI->load->model('program');
|
$this->CI->load->model('program');
|
||||||
$this->program = $this->CI->program->getByDriver(strtolower(__CLASS__));
|
$this->program = $this->CI->program->getByDriver(strtolower(__CLASS__));
|
||||||
|
|
||||||
log_message('debug', "Scatt Class Initialized");
|
log_message('debug', "ScaTT Class Initialized");
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -39,4 +62,43 @@ class Scatt extends Program_runner {
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param string $experimentId
|
||||||
|
*/
|
||||||
|
public function _getResults($experimentId) {
|
||||||
|
$this->CI->load->helper('array');
|
||||||
|
|
||||||
|
$experiment = $this->CI->experiment->getById($experimentId);
|
||||||
|
|
||||||
|
$path = FCPATH . 'uploads/' . $experiment['project_id'] . '/' . $experiment['id'] . '/';
|
||||||
|
|
||||||
|
if (!file_exists($path . 'default.out')) {
|
||||||
|
return array();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
$handler = fopen($path . 'default.out', "r");
|
||||||
|
|
||||||
|
$results = array();
|
||||||
|
|
||||||
|
while (($line = fgets($handler)) !== false) {
|
||||||
|
$values = array();
|
||||||
|
$i = 0;
|
||||||
|
|
||||||
|
foreach (preg_split("/\s+/", $line) as $value) {
|
||||||
|
if ($value != '') {
|
||||||
|
$values[] = trim($value);
|
||||||
|
}
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
$results[] = $values;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $results;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
/* End of file Scatt.php */
|
||||||
|
/* Location: ./application/libraries/programs/Scatt.php */
|
||||||
|
|||||||
10
application/libraries/programs/index.html
Executable file
10
application/libraries/programs/index.html
Executable file
@@ -0,0 +1,10 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>403 Forbidden</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<p>Directory access is forbidden.</p>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
58
application/views/results/experiment.php
Normal file
58
application/views/results/experiment.php
Normal file
@@ -0,0 +1,58 @@
|
|||||||
|
<?php $this->load->view('header');?>
|
||||||
|
|
||||||
|
<div id="content">
|
||||||
|
<div class="title">
|
||||||
|
<h2><?=anchor('projects', _('Projects'));?> » <?=anchor('projects/detail/' . $project['id'], $project['name']);?> » <?=anchor('experiments/detail/' . $experiment['id'], $experiment['name']);?> » <?=_('Results');?></h2>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="box">
|
||||||
|
<h3><?=_('Results');?></h3>
|
||||||
|
<table class="tableList">
|
||||||
|
<?php
|
||||||
|
$i = 0;
|
||||||
|
foreach ($results as $result):
|
||||||
|
if ($i == 0):
|
||||||
|
?>
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<?php
|
||||||
|
foreach ($result as $headline):
|
||||||
|
?>
|
||||||
|
<th scope="col"><?=$headline;?></th>
|
||||||
|
<?php
|
||||||
|
endforeach;
|
||||||
|
?>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<?php
|
||||||
|
else:
|
||||||
|
if ($i == 1):
|
||||||
|
?>
|
||||||
|
<tbody>
|
||||||
|
<?php
|
||||||
|
endif;
|
||||||
|
?>
|
||||||
|
<tr>
|
||||||
|
<?php
|
||||||
|
foreach ($result as $value):
|
||||||
|
?>
|
||||||
|
<td><?=$value;?></td>
|
||||||
|
<?php
|
||||||
|
endforeach;
|
||||||
|
?>
|
||||||
|
</tr>
|
||||||
|
<?php
|
||||||
|
if ($i == sizeof($results)):
|
||||||
|
?>
|
||||||
|
</tbody>
|
||||||
|
<?php
|
||||||
|
endif;
|
||||||
|
endif;
|
||||||
|
$i++;
|
||||||
|
endforeach;
|
||||||
|
?>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<?php $this->load->view('footer');?>
|
||||||
10
application/views/results/index.html
Executable file
10
application/views/results/index.html
Executable file
@@ -0,0 +1,10 @@
|
|||||||
|
<html>
|
||||||
|
<head>
|
||||||
|
<title>403 Forbidden</title>
|
||||||
|
</head>
|
||||||
|
<body>
|
||||||
|
|
||||||
|
<p>Directory access is forbidden.</p>
|
||||||
|
|
||||||
|
</body>
|
||||||
|
</html>
|
||||||
Reference in New Issue
Block a user