diff options
author | Frédéric Guillot <fred@kanboard.net> | 2014-11-16 20:51:59 -0500 |
---|---|---|
committer | Frédéric Guillot <fred@kanboard.net> | 2014-11-16 20:51:59 -0500 |
commit | 8bf50d6a7ff460820efe098413626307216f8c34 (patch) | |
tree | 6c2f7ea359a57fa2c3adf9ae6c5bbe3d1882d7fa /app/Controller | |
parent | 4494566fc7a536232cf564b940dfae6b46c20bcd (diff) |
Add cumulative flow diagram
Diffstat (limited to 'app/Controller')
-rw-r--r-- | app/Controller/Analytic.php | 44 | ||||
-rw-r--r-- | app/Controller/Base.php | 5 |
2 files changed, 48 insertions, 1 deletions
diff --git a/app/Controller/Analytic.php b/app/Controller/Analytic.php index 7d112e6a..6c49089b 100644 --- a/app/Controller/Analytic.php +++ b/app/Controller/Analytic.php @@ -81,4 +81,48 @@ class Analytic extends Base ))); } } + + /** + * Show cumulative flow diagram + * + * @access public + */ + public function cfd() + { + $project = $this->getProject(); + $values = $this->request->getValues(); + + $from = $this->request->getStringParam('from', date('Y-m-d', strtotime('-1week'))); + $to = $this->request->getStringParam('to', date('Y-m-d')); + + if (! empty($values)) { + $from = $values['from']; + $to = $values['to']; + } + + if ($this->request->isAjax()) { + $this->response->json(array( + 'columns' => array_values($this->board->getColumnsList($project['id'])), + 'metrics' => $this->projectDailySummary->getRawMetrics($project['id'], $from, $to), + 'labels' => array( + 'column' => t('Column'), + 'day' => t('Date'), + 'total' => t('Tasks'), + ) + )); + } + else { + $this->response->html($this->layout('analytic/cfd', array( + 'values' => array( + 'from' => $from, + 'to' => $to, + ), + 'display_graph' => $this->projectDailySummary->countDays($project['id'], $from, $to) >= 2, + 'project' => $project, + 'date_format' => $this->config->get('application_date_format'), + 'date_formats' => $this->dateParser->getAvailableFormats(), + 'title' => t('Cumulative flow diagram for "%s"', $project['name']), + ))); + } + } } diff --git a/app/Controller/Base.php b/app/Controller/Base.php index 5784605c..bd7bd2ee 100644 --- a/app/Controller/Base.php +++ b/app/Controller/Base.php @@ -108,7 +108,9 @@ abstract class Base */ public function __destruct() { - // $this->container['logger']->addDebug(var_export($this->container['db']->getLogMessages(), true)); + // foreach ($this->container['db']->getLogMessages() as $message) { + // $this->container['logger']->addDebug($message); + // } } /** @@ -173,6 +175,7 @@ abstract class Base { $models = array( 'projectActivity', // Order is important + 'projectDailySummary', 'action', 'project', 'webhook', |