Add feature to download results
This commit is contained in:
@@ -84,11 +84,27 @@ class Results extends MY_Controller {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the results of a given job.
|
* Downloads the results of a given experiment.
|
||||||
*
|
*
|
||||||
* @param string $job_id the job for which to get the results
|
* @param string $experimentId
|
||||||
*/
|
*/
|
||||||
public function job($jobId) {
|
public function download($experimentId = '') {
|
||||||
|
$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.out')) {
|
||||||
|
// load download helper
|
||||||
|
$this->load->helper('download');
|
||||||
|
// download the file
|
||||||
|
$data = file_get_contents($path.'default.out');
|
||||||
|
force_download('default.out', $data);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -7,6 +7,15 @@
|
|||||||
|
|
||||||
<div class="box">
|
<div class="box">
|
||||||
<h3><?=_('Results');?></h3>
|
<h3><?=_('Results');?></h3>
|
||||||
|
<?php
|
||||||
|
if (count($results) > 0):
|
||||||
|
?>
|
||||||
|
<p>
|
||||||
|
<a href="<?=site_url('results/download/'.$experiment['id']);?>" class="button download"><?=_('Download');?></a>
|
||||||
|
</p>
|
||||||
|
<?php
|
||||||
|
endif;
|
||||||
|
?>
|
||||||
<table class="tableList">
|
<table class="tableList">
|
||||||
<?php
|
<?php
|
||||||
$i = 0;
|
$i = 0;
|
||||||
|
|||||||
@@ -544,6 +544,11 @@ a.upload {
|
|||||||
padding-left: 30px;
|
padding-left: 30px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
a.download {
|
||||||
|
background: url(../images/icons/drive-download.png) 10px center no-repeat #f3f3f3;
|
||||||
|
padding-left: 30px;
|
||||||
|
}
|
||||||
|
|
||||||
a.add {
|
a.add {
|
||||||
background: url(../images/icons/plus-circle.png) 10px center no-repeat #f3f3f3;
|
background: url(../images/icons/plus-circle.png) 10px center no-repeat #f3f3f3;
|
||||||
padding-left: 30px;
|
padding-left: 30px;
|
||||||
|
|||||||
Reference in New Issue
Block a user