Implement result viewer for experiments
This commit is contained in:
@@ -24,6 +24,7 @@
|
||||
/**
|
||||
*
|
||||
* @package ScattPort
|
||||
* @subpackage Libraries
|
||||
* @author Eike Foken <kontakt@eikefoken.de>
|
||||
*/
|
||||
class Program_runner {
|
||||
@@ -74,6 +75,14 @@ class Program_runner {
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param string $experimentId
|
||||
*/
|
||||
public function getResults($experimentId) {
|
||||
return $this->driver->_getResults($experimentId);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/* 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>
|
||||
*/
|
||||
class Scatt extends Program_runner {
|
||||
@@ -17,7 +40,7 @@ class Scatt extends Program_runner {
|
||||
$this->CI->load->model('program');
|
||||
$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;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @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>
|
||||
Reference in New Issue
Block a user