Add daily project summary export

This commit is contained in:
Frédéric Guillot
2014-11-16 21:36:46 -05:00
parent 1e466a66db
commit d4ae2f135d
20 changed files with 144 additions and 11 deletions

View File

@@ -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
*