diff --git a/web/application/controllers/history.php b/web/application/controllers/history.php index da41fab..d31a6fa 100644 --- a/web/application/controllers/history.php +++ b/web/application/controllers/history.php @@ -39,12 +39,16 @@ class history extends base try { if (count($idArr) == 2) { /** @var \application\models\Histories $historyArr */ - //$historyArr = \application\models\Histories::getByField("jobs_id", $idArr[1]); $historyArr = DB::fetchObject("SELECT * FROM histories WHERE jobs_id = ? ORDER BY run_date DESC", '\application\models\Histories', [$idArr[1]]); /** @var \application\models\Jobs[] $jobObject */ $jobObject = \application\models\Jobs::getByField("id", $idArr[1]); if ($this->checkAccess($jobObject[0])) { - echo $this->loadRender("history.html", ["job" => $jobObject[0], "histories" => $historyArr]); + $csv = []; + /** @var \application\models\histories $history */ + foreach($historyArr as $history) { + $csv[] = "\"" . str_replace("-", "/", $history->run_date) . "," . $history->time_taken . "," . $history->getRawSize() . "," . $history->result . "\\n\""; + } + echo $this->loadRender("history.html", ["csv" => implode("+", $csv), "job" => $jobObject[0], "histories" => $historyArr]); } } } catch (\Exception $e) { diff --git a/web/application/models/histories.php b/web/application/models/histories.php index b8d9dfc..6caee57 100644 --- a/web/application/models/histories.php +++ b/web/application/models/histories.php @@ -36,7 +36,11 @@ class Histories extends \system\engine\HF_Model { return round($bytes, $precision) . ' ' . $units[$pow]; } -public function getSize() { + public function getSize() { return $this->formatBytes(strlen($this->output)); } + + public function getRawSize() { + return strlen($this->output); + } } \ No newline at end of file diff --git a/web/application/views/history.html b/web/application/views/history.html index 3f5a034..05e78f0 100644 --- a/web/application/views/history.html +++ b/web/application/views/history.html @@ -13,6 +13,13 @@