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
*

View File

@ -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.' => '',
);

View File

@ -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.' => '',
);

View File

@ -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.' => '',
);

View File

@ -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.' => '',
);

View File

@ -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.',
);

View File

@ -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.' => '',
);

View File

@ -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.' => '',
);

View File

@ -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.' => '',
);

View File

@ -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.' => '',
);

View File

@ -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.' => '',
);

View File

@ -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.' => '',
);

View File

@ -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.' => '',
);

View File

@ -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.' => '',
);

View File

@ -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'),
);
/**

View File

@ -0,0 +1,26 @@
<div class="page-header">
<h2>
<?= t('Daily project summary export for "%s"', $project['name']) ?>
</h2>
</div>
<p class="alert alert-info"><?= t('This export contains the number of tasks per column grouped per day.') ?></p>
<form method="get" action="?" autocomplete="off">
<?= Helper\form_hidden('controller', $values) ?>
<?= Helper\form_hidden('action', $values) ?>
<?= Helper\form_hidden('project_id', $values) ?>
<?= Helper\form_label(t('Start Date'), 'from') ?>
<?= Helper\form_text('from', $values, $errors, array('required', 'placeholder="'.Helper\in_list($date_format, $date_formats).'"'), 'form-date') ?><br/>
<?= Helper\form_label(t('End Date'), 'to') ?>
<?= Helper\form_text('to', $values, $errors, array('required', 'placeholder="'.Helper\in_list($date_format, $date_formats).'"'), 'form-date') ?>
<div class="form-help"><?= t('Others formats accepted: %s and %s', date('Y-m-d'), date('Y_m_d')) ?></div>
<div class="form-actions">
<input type="submit" value="<?= t('Execute') ?>" class="btn btn-blue"/>
</div>
</form>

View File

@ -6,9 +6,6 @@
</li>
<?php if (Helper\is_admin() || $project['is_private']): ?>
<li>
<a href="?controller=project&amp;action=export&amp;project_id=<?= $project['id'] ?>"><?= t('Tasks Export') ?></a>
</li>
<li>
<a href="?controller=project&amp;action=share&amp;project_id=<?= $project['id'] ?>"><?= t('Public access') ?></a>
</li>
@ -44,4 +41,16 @@
</li>
<?php endif ?>
</ul>
<?php if (Helper\is_admin() || $project['is_private']): ?>
<h2><?= t('Exports') ?></h2>
<ul>
<li>
<?= Helper\a(t('Tasks'), 'project', 'exportTasks', array('project_id' => $project['id'])) ?>
</li>
<li>
<?= Helper\a(t('Daily project summary'), 'project', 'exportDailyProjectSummary', array('project_id' => $project['id'])) ?>
</li>
</li>
<?php endif ?>
</div>

View File

@ -1145,7 +1145,7 @@ tr td.task-orange,
padding: 10px;
padding-top: 0;
border: 1px solid #ddd;
background: #fefefe;
background: #fdfdfd;
border-radius: 5px;
}

View File

@ -16,7 +16,7 @@
padding: 10px;
padding-top: 0;
border: 1px solid #ddd;
background: #fefefe;
background: #fdfdfd;
border-radius: 5px;
}