* @author Eike Foken */ class Results extends MY_Controller { /** * Constructor. */ public function __construct() { parent::__construct(); $this->load->model('program'); $this->load->model('job'); $this->load->model('server'); $this->load->model('experiment'); } /** * */ public function index() { } /** * Get the results of a given project. * * @param string $prj_id the project for which to get the results */ public function project($projectId) { } /** * Get the results of a given experiment. * * @param string $experimentId The experiment for which to get the results */ public function experiment($experimentId = '') { $experiment = $this->experiment->getById($experimentId); if (!is_array($experiment) || !isset($experiment['id'])) { show_404(); } // 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; // mark the project as seen $job = $this->job->getByExperimentId($experimentId); $this->job->markSeen($job['id']); $this->load->view('results/experiment', $data); } /** * Downloads the results of a given experiment. * * @param string $experimentId * @param string $what */ public function download($experimentId = '', $what = 'out') { // only allow download of specific files if(!in_array($what, array('out', 'tma', 'log'))) show_404(); $job = $this->job->getByExperimentId($experimentId); if (empty($experimentId) || !$job) { show_404(); } $experiment = $this->experiment->getById($job['experiment_id']); $path = FCPATH.'uploads/'.$experiment['project_id'].'/'.$experiment['id'].'/'; if (file_exists($path.'default.'.$what)) { // load download helper $this->load->helper('download'); // download the file $data = file_get_contents($path.'default.'.$what); force_download('default.'.$what, $data); } } } /* End of file results.php */ /* Location: ./application/controllers/results.php */