From d4ae2f135dd8ef3e5d5b09e29d21396f626f0dd7 Mon Sep 17 00:00:00 2001 From: Frédéric Guillot Date: Sun, 16 Nov 2014 21:36:46 -0500 Subject: Add daily project summary export --- app/Controller/Project.php | 41 ++++++++++++++++++++++++--- app/Locale/da_DK/translations.php | 5 ++++ app/Locale/de_DE/translations.php | 5 ++++ app/Locale/es_ES/translations.php | 5 ++++ app/Locale/fi_FI/translations.php | 5 ++++ app/Locale/fr_FR/translations.php | 5 ++++ app/Locale/it_IT/translations.php | 5 ++++ app/Locale/ja_JP/translations.php | 5 ++++ app/Locale/pl_PL/translations.php | 5 ++++ app/Locale/pt_BR/translations.php | 5 ++++ app/Locale/ru_RU/translations.php | 5 ++++ app/Locale/sv_SE/translations.php | 5 ++++ app/Locale/th_TH/translations.php | 5 ++++ app/Locale/zh_CN/translations.php | 5 ++++ app/Model/Acl.php | 4 +-- app/Template/project/export_daily_summary.php | 26 +++++++++++++++++ app/Template/project/export_tasks.php | 24 ++++++++++++++++ app/Template/project_export.php | 24 ---------------- app/Template/project_sidebar.php | 15 ++++++++-- assets/css/app.css | 2 +- assets/css/sidebar.css | 2 +- 21 files changed, 168 insertions(+), 35 deletions(-) create mode 100644 app/Template/project/export_daily_summary.php create mode 100644 app/Template/project/export_tasks.php delete mode 100644 app/Template/project_export.php 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, @@ -92,6 +92,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 * diff --git a/app/Locale/da_DK/translations.php b/app/Locale/da_DK/translations.php index 34533e94..5c2002ec 100644 --- a/app/Locale/da_DK/translations.php +++ b/app/Locale/da_DK/translations.php @@ -594,4 +594,9 @@ return array( // 'Unable to create this task.' => '', // 'Cumulative flow diagram' => '', // 'Cumulative flow diagram for "%s"' => '', + // 'Daily project summary' => '', + // 'Daily project summary export' => '', + // 'Daily project summary export for "%s"' => '', + // 'Exports' => '', + // 'This export contains the number of tasks per column grouped per day.' => '', ); diff --git a/app/Locale/de_DE/translations.php b/app/Locale/de_DE/translations.php index bce2c233..b304fc18 100644 --- a/app/Locale/de_DE/translations.php +++ b/app/Locale/de_DE/translations.php @@ -594,4 +594,9 @@ return array( // 'Unable to create this task.' => '', // 'Cumulative flow diagram' => '', // 'Cumulative flow diagram for "%s"' => '', + // 'Daily project summary' => '', + // 'Daily project summary export' => '', + // 'Daily project summary export for "%s"' => '', + // 'Exports' => '', + // 'This export contains the number of tasks per column grouped per day.' => '', ); diff --git a/app/Locale/es_ES/translations.php b/app/Locale/es_ES/translations.php index e26be0a1..5740279c 100644 --- a/app/Locale/es_ES/translations.php +++ b/app/Locale/es_ES/translations.php @@ -594,4 +594,9 @@ return array( // 'Unable to create this task.' => '', // 'Cumulative flow diagram' => '', // 'Cumulative flow diagram for "%s"' => '', + // 'Daily project summary' => '', + // 'Daily project summary export' => '', + // 'Daily project summary export for "%s"' => '', + // 'Exports' => '', + // 'This export contains the number of tasks per column grouped per day.' => '', ); diff --git a/app/Locale/fi_FI/translations.php b/app/Locale/fi_FI/translations.php index 7af506a5..9565178f 100644 --- a/app/Locale/fi_FI/translations.php +++ b/app/Locale/fi_FI/translations.php @@ -594,4 +594,9 @@ return array( // 'Unable to create this task.' => '', // 'Cumulative flow diagram' => '', // 'Cumulative flow diagram for "%s"' => '', + // 'Daily project summary' => '', + // 'Daily project summary export' => '', + // 'Daily project summary export for "%s"' => '', + // 'Exports' => '', + // 'This export contains the number of tasks per column grouped per day.' => '', ); diff --git a/app/Locale/fr_FR/translations.php b/app/Locale/fr_FR/translations.php index ace478e2..b6735322 100644 --- a/app/Locale/fr_FR/translations.php +++ b/app/Locale/fr_FR/translations.php @@ -594,4 +594,9 @@ return array( 'Unable to create this task.' => 'Impossible de créer cette tâche', 'Cumulative flow diagram' => 'Diagramme de flux cumulé', 'Cumulative flow diagram for "%s"' => 'Diagramme de flux cumulé pour « %s »', + 'Daily project summary' => 'Résumé journalier du projet', + 'Daily project summary export' => 'Export du résumé journalier du projet', + 'Daily project summary export for "%s"' => 'Export du résumé quotidien du projet pour « %s »', + 'Exports' => 'Exports', + 'This export contains the number of tasks per column grouped per day.' => 'Cet export contient le nombre de tâches par colonne groupé par jour.', ); diff --git a/app/Locale/it_IT/translations.php b/app/Locale/it_IT/translations.php index 6630f7f7..9a0fd02e 100644 --- a/app/Locale/it_IT/translations.php +++ b/app/Locale/it_IT/translations.php @@ -594,4 +594,9 @@ return array( // 'Unable to create this task.' => '', // 'Cumulative flow diagram' => '', // 'Cumulative flow diagram for "%s"' => '', + // 'Daily project summary' => '', + // 'Daily project summary export' => '', + // 'Daily project summary export for "%s"' => '', + // 'Exports' => '', + // 'This export contains the number of tasks per column grouped per day.' => '', ); diff --git a/app/Locale/ja_JP/translations.php b/app/Locale/ja_JP/translations.php index 0312a402..1885d779 100644 --- a/app/Locale/ja_JP/translations.php +++ b/app/Locale/ja_JP/translations.php @@ -594,4 +594,9 @@ return array( // 'Unable to create this task.' => '', // 'Cumulative flow diagram' => '', // 'Cumulative flow diagram for "%s"' => '', + // 'Daily project summary' => '', + // 'Daily project summary export' => '', + // 'Daily project summary export for "%s"' => '', + // 'Exports' => '', + // 'This export contains the number of tasks per column grouped per day.' => '', ); diff --git a/app/Locale/pl_PL/translations.php b/app/Locale/pl_PL/translations.php index f48f0615..34ea087f 100644 --- a/app/Locale/pl_PL/translations.php +++ b/app/Locale/pl_PL/translations.php @@ -594,4 +594,9 @@ return array( // 'Unable to create this task.' => '', // 'Cumulative flow diagram' => '', // 'Cumulative flow diagram for "%s"' => '', + // 'Daily project summary' => '', + // 'Daily project summary export' => '', + // 'Daily project summary export for "%s"' => '', + // 'Exports' => '', + // 'This export contains the number of tasks per column grouped per day.' => '', ); diff --git a/app/Locale/pt_BR/translations.php b/app/Locale/pt_BR/translations.php index 647348b9..9aa52bc3 100644 --- a/app/Locale/pt_BR/translations.php +++ b/app/Locale/pt_BR/translations.php @@ -594,4 +594,9 @@ return array( // 'Unable to create this task.' => '', // 'Cumulative flow diagram' => '', // 'Cumulative flow diagram for "%s"' => '', + // 'Daily project summary' => '', + // 'Daily project summary export' => '', + // 'Daily project summary export for "%s"' => '', + // 'Exports' => '', + // 'This export contains the number of tasks per column grouped per day.' => '', ); diff --git a/app/Locale/ru_RU/translations.php b/app/Locale/ru_RU/translations.php index 1d220902..b584b759 100644 --- a/app/Locale/ru_RU/translations.php +++ b/app/Locale/ru_RU/translations.php @@ -594,4 +594,9 @@ return array( // 'Unable to create this task.' => '', // 'Cumulative flow diagram' => '', // 'Cumulative flow diagram for "%s"' => '', + // 'Daily project summary' => '', + // 'Daily project summary export' => '', + // 'Daily project summary export for "%s"' => '', + // 'Exports' => '', + // 'This export contains the number of tasks per column grouped per day.' => '', ); diff --git a/app/Locale/sv_SE/translations.php b/app/Locale/sv_SE/translations.php index ca79904a..e1997f6c 100644 --- a/app/Locale/sv_SE/translations.php +++ b/app/Locale/sv_SE/translations.php @@ -594,4 +594,9 @@ return array( // 'Unable to create this task.' => '', // 'Cumulative flow diagram' => '', // 'Cumulative flow diagram for "%s"' => '', + // 'Daily project summary' => '', + // 'Daily project summary export' => '', + // 'Daily project summary export for "%s"' => '', + // 'Exports' => '', + // 'This export contains the number of tasks per column grouped per day.' => '', ); diff --git a/app/Locale/th_TH/translations.php b/app/Locale/th_TH/translations.php index f5423c8e..a5c7a251 100644 --- a/app/Locale/th_TH/translations.php +++ b/app/Locale/th_TH/translations.php @@ -594,4 +594,9 @@ return array( // 'Unable to create this task.' => '', // 'Cumulative flow diagram' => '', // 'Cumulative flow diagram for "%s"' => '', + // 'Daily project summary' => '', + // 'Daily project summary export' => '', + // 'Daily project summary export for "%s"' => '', + // 'Exports' => '', + // 'This export contains the number of tasks per column grouped per day.' => '', ); diff --git a/app/Locale/zh_CN/translations.php b/app/Locale/zh_CN/translations.php index 1da74b13..d176b081 100644 --- a/app/Locale/zh_CN/translations.php +++ b/app/Locale/zh_CN/translations.php @@ -594,4 +594,9 @@ return array( // 'Unable to create this task.' => '', // 'Cumulative flow diagram' => '', // 'Cumulative flow diagram for "%s"' => '', + // 'Daily project summary' => '', + // 'Daily project summary export' => '', + // 'Daily project summary export for "%s"' => '', + // 'Exports' => '', + // 'This export contains the number of tasks per column grouped per day.' => '', ); diff --git a/app/Model/Acl.php b/app/Model/Acl.php index 25e98850..4a161714 100644 --- a/app/Model/Acl.php +++ b/app/Model/Acl.php @@ -33,7 +33,7 @@ class Acl extends Base private $user_actions = array( 'app' => array('index'), 'board' => array('index', 'show', 'save', 'check', 'changeassignee', 'updateassignee', 'changecategory', 'updatecategory', 'movecolumn', 'edit', 'update', 'add', 'confirm', 'remove'), - 'project' => array('index', 'show', 'export', 'share', 'edit', 'update', 'users', 'remove', 'duplicate', 'disable', 'enable', 'activity', 'search', 'tasks', 'create', 'save'), + 'project' => array('index', 'show', 'exporttasks', 'exportdaily', 'share', 'edit', 'update', 'users', 'remove', 'duplicate', 'disable', 'enable', 'activity', 'search', 'tasks', 'create', 'save'), 'user' => array('edit', 'forbidden', 'logout', 'show', 'external', 'unlinkgoogle', 'unlinkgithub', 'sessions', 'removesession', 'last', 'notifications', 'password'), 'comment' => array('create', 'save', 'confirm', 'remove', 'update', 'edit', 'forbidden'), 'file' => array('create', 'save', 'download', 'confirm', 'remove', 'open', 'image'), @@ -41,7 +41,7 @@ class Acl extends Base 'task' => array('show', 'create', 'save', 'edit', 'update', 'close', 'open', 'duplicate', 'remove', 'description', 'move', 'copy', 'time'), 'category' => array('index', 'save', 'edit', 'update', 'confirm', 'remove'), 'action' => array('index', 'event', 'params', 'create', 'confirm', 'remove'), - 'analytic' => array('tasks', 'users'), + 'analytic' => array('tasks', 'users', 'cfd'), ); /** diff --git a/app/Template/project/export_daily_summary.php b/app/Template/project/export_daily_summary.php new file mode 100644 index 00000000..763cd81c --- /dev/null +++ b/app/Template/project/export_daily_summary.php @@ -0,0 +1,26 @@ + + +

+ +
+ + + + + + +
+ + + + +
+ +
+ +
+
\ No newline at end of file diff --git a/app/Template/project/export_tasks.php b/app/Template/project/export_tasks.php new file mode 100644 index 00000000..02eb389f --- /dev/null +++ b/app/Template/project/export_tasks.php @@ -0,0 +1,24 @@ + + +
+ + + + + + +
+ + + + +
+ +
+ +
+
\ No newline at end of file diff --git a/app/Template/project_export.php b/app/Template/project_export.php deleted file mode 100644 index 02eb389f..00000000 --- a/app/Template/project_export.php +++ /dev/null @@ -1,24 +0,0 @@ - - -
- - - - - - -
- - - - -
- -
- -
-
\ No newline at end of file diff --git a/app/Template/project_sidebar.php b/app/Template/project_sidebar.php index 7d6e0bfb..bd56edaf 100644 --- a/app/Template/project_sidebar.php +++ b/app/Template/project_sidebar.php @@ -6,9 +6,6 @@ -
  • - -
  • @@ -44,4 +41,16 @@ + + +

    +