summaryrefslogtreecommitdiff
path: root/app/Controller/Analytic.php
diff options
context:
space:
mode:
authorFrederic Guillot <fred@kanboard.net>2016-01-31 21:44:49 -0500
committerFrederic Guillot <fred@kanboard.net>2016-01-31 21:44:49 -0500
commit26492aba7ee2bfb8c525ea0aaa580aff47a414ba (patch)
treede2ebb411685057a2a8723ca7f763966478a39f7 /app/Controller/Analytic.php
parent271543431e999032d6e91197633119309fa6c622 (diff)
Simplify layout and templates generation
Diffstat (limited to 'app/Controller/Analytic.php')
-rw-r--r--app/Controller/Analytic.php29
1 files changed, 7 insertions, 22 deletions
diff --git a/app/Controller/Analytic.php b/app/Controller/Analytic.php
index d203fb8e..e7ab9ebc 100644
--- a/app/Controller/Analytic.php
+++ b/app/Controller/Analytic.php
@@ -1,6 +1,7 @@
<?php
namespace Kanboard\Controller;
+
use Kanboard\Model\Task as TaskModel;
/**
@@ -12,22 +13,6 @@ use Kanboard\Model\Task as TaskModel;
class Analytic extends Base
{
/**
- * Common layout for analytic views
- *
- * @access private
- * @param string $template Template name
- * @param array $params Template parameters
- * @return string
- */
- private function layout($template, array $params)
- {
- $params['board_selector'] = $this->projectUserRole->getActiveProjectsByUser($this->userSession->getId());
- $params['content_for_sublayout'] = $this->template->render($template, $params);
-
- return $this->template->layout('analytic/layout', $params);
- }
-
- /**
* Show average Lead and Cycle time
*
* @access public
@@ -37,7 +22,7 @@ class Analytic extends Base
$project = $this->getProject();
list($from, $to) = $this->getDates();
- $this->response->html($this->layout('analytic/lead_cycle_time', array(
+ $this->response->html($this->helper->layout->analytic('analytic/lead_cycle_time', array(
'values' => array(
'from' => $from,
'to' => $to,
@@ -69,7 +54,7 @@ class Analytic extends Base
->setQuery($query)
->calculate();
- $this->response->html($this->layout('analytic/compare_hours', array(
+ $this->response->html($this->helper->layout->analytic('analytic/compare_hours', array(
'project' => $project,
'paginator' => $paginator,
'metrics' => $this->estimatedTimeComparisonAnalytic->build($project['id']),
@@ -86,7 +71,7 @@ class Analytic extends Base
{
$project = $this->getProject();
- $this->response->html($this->layout('analytic/avg_time_columns', array(
+ $this->response->html($this->helper->layout->analytic('analytic/avg_time_columns', array(
'project' => $project,
'metrics' => $this->averageTimeSpentColumnAnalytic->build($project['id']),
'title' => t('Average time spent into each column for "%s"', $project['name']),
@@ -102,7 +87,7 @@ class Analytic extends Base
{
$project = $this->getProject();
- $this->response->html($this->layout('analytic/tasks', array(
+ $this->response->html($this->helper->layout->analytic('analytic/tasks', array(
'project' => $project,
'metrics' => $this->taskDistributionAnalytic->build($project['id']),
'title' => t('Task repartition for "%s"', $project['name']),
@@ -118,7 +103,7 @@ class Analytic extends Base
{
$project = $this->getProject();
- $this->response->html($this->layout('analytic/users', array(
+ $this->response->html($this->helper->layout->analytic('analytic/users', array(
'project' => $project,
'metrics' => $this->userDistributionAnalytic->build($project['id']),
'title' => t('User repartition for "%s"', $project['name']),
@@ -160,7 +145,7 @@ class Analytic extends Base
$display_graph = $this->projectDailyColumnStats->countDays($project['id'], $from, $to) >= 2;
- $this->response->html($this->layout($template, array(
+ $this->response->html($this->helper->layout->analytic($template, array(
'values' => array(
'from' => $from,
'to' => $to,