summaryrefslogtreecommitdiff
path: root/app/Controller/Analytic.php
diff options
context:
space:
mode:
authorFrédéric Guillot <fred@kanboard.net>2014-11-13 20:37:37 -0500
committerFrédéric Guillot <fred@kanboard.net>2014-11-13 20:37:37 -0500
commit1487cb27634161ef558c367150213bc7077e4198 (patch)
tree5a5684152412abc3bc336cdb63dfe05b7bbb0c4a /app/Controller/Analytic.php
parente4efc73a90b0ef62b5d828db53a365184be40137 (diff)
Add graph for user repartition
Diffstat (limited to 'app/Controller/Analytic.php')
-rw-r--r--app/Controller/Analytic.php34
1 files changed, 31 insertions, 3 deletions
diff --git a/app/Controller/Analytic.php b/app/Controller/Analytic.php
index 68177c83..7d112e6a 100644
--- a/app/Controller/Analytic.php
+++ b/app/Controller/Analytic.php
@@ -27,11 +27,11 @@ class Analytic extends Base
}
/**
- * Show task distribution graph
+ * Show tasks distribution graph
*
* @access public
*/
- public function repartition()
+ public function tasks()
{
$project = $this->getProject();
$metrics = $this->projectAnalytic->getTaskRepartition($project['id']);
@@ -46,11 +46,39 @@ class Analytic extends Base
));
}
else {
- $this->response->html($this->layout('analytic/repartition', array(
+ $this->response->html($this->layout('analytic/tasks', array(
'project' => $project,
'metrics' => $metrics,
'title' => t('Task repartition for "%s"', $project['name']),
)));
}
}
+
+ /**
+ * Show users repartition
+ *
+ * @access public
+ */
+ public function users()
+ {
+ $project = $this->getProject();
+ $metrics = $this->projectAnalytic->getUserRepartition($project['id']);
+
+ if ($this->request->isAjax()) {
+ $this->response->json(array(
+ 'metrics' => $metrics,
+ 'labels' => array(
+ 'user' => t('User'),
+ 'nb_tasks' => t('Number of tasks'),
+ )
+ ));
+ }
+ else {
+ $this->response->html($this->layout('analytic/users', array(
+ 'project' => $project,
+ 'metrics' => $metrics,
+ 'title' => t('User repartition for "%s"', $project['name']),
+ )));
+ }
+ }
}