summaryrefslogtreecommitdiff
path: root/app/Controller
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2014-11-16 21:36:46 -0500
committerFrédéric Guillot <fred@kanboard.net>2014-11-16 21:36:46 -0500
commitd4ae2f135dd8ef3e5d5b09e29d21396f626f0dd7 (patch)
tree50fc3749129f98fc660a8a0248ab34eb13699af5 /app/Controller
parent1e466a66dbb6e060b2fc7c0c5d3edb2b19079e4a (diff)
Add daily project summary export
Diffstat (limited to 'app/Controller')
-rw-r--r--app/Controller/Project.php41
1 files changed, 37 insertions, 4 deletions
diff --git a/app/Controller/Project.php b/app/Controller/Project.php
index cac5e0b8..22139323 100644
--- a/app/Controller/Project.php
+++ b/app/Controller/Project.php
@@ -64,7 +64,7 @@ class Project extends Base
*
* @access public
*/
- public function export()
+ public function exportTasks()
{
$project = $this->getProjectManagement();
$from = $this->request->getStringParam('from');
@@ -72,14 +72,14 @@ class Project extends Base
if ($from && $to) {
$data = $this->taskExport->export($project['id'], $from, $to);
- $this->response->forceDownload('Export_'.date('Y_m_d_H_i_S').'.csv');
+ $this->response->forceDownload('Tasks_'.date('Y_m_d_H_i').'.csv');
$this->response->csv($data);
}
- $this->response->html($this->projectLayout('project_export', array(
+ $this->response->html($this->projectLayout('project/export_tasks', array(
'values' => array(
'controller' => 'project',
- 'action' => 'export',
+ 'action' => 'exportTasks',
'project_id' => $project['id'],
'from' => $from,
'to' => $to,
@@ -93,6 +93,39 @@ class Project extends Base
}
/**
+ * Daily project summary export
+ *
+ * @access public
+ */
+ public function exportDailyProjectSummary()
+ {
+ $project = $this->getProjectManagement();
+ $from = $this->request->getStringParam('from');
+ $to = $this->request->getStringParam('to');
+
+ if ($from && $to) {
+ $data = $this->ProjectDailySummary->getAggregatedMetrics($project['id'], $from, $to);
+ $this->response->forceDownload('Daily_Summary_'.date('Y_m_d_H_i').'.csv');
+ $this->response->csv($data);
+ }
+
+ $this->response->html($this->projectLayout('project/export_daily_summary', array(
+ 'values' => array(
+ 'controller' => 'project',
+ 'action' => 'exportDailyProjectSummary',
+ 'project_id' => $project['id'],
+ 'from' => $from,
+ 'to' => $to,
+ ),
+ 'errors' => array(),
+ 'date_format' => $this->config->get('application_date_format'),
+ 'date_formats' => $this->dateParser->getAvailableFormats(),
+ 'project' => $project,
+ 'title' => t('Daily project summary export')
+ )));
+ }
+
+ /**
* Public access management
*
* @access public