summaryrefslogtreecommitdiff
path: root/app/Controller
diff options
context:
space:
mode:
Diffstat (limited to 'app/Controller')
-rw-r--r--app/Controller/Activity.php16
-rw-r--r--app/Controller/Analytic.php58
-rw-r--r--app/Controller/Board.php24
-rw-r--r--app/Controller/Export.php2
-rw-r--r--app/Controller/Ical.php4
-rw-r--r--app/Controller/Task.php26
6 files changed, 117 insertions, 13 deletions
diff --git a/app/Controller/Activity.php b/app/Controller/Activity.php
index 2276b3b8..234e4be4 100644
--- a/app/Controller/Activity.php
+++ b/app/Controller/Activity.php
@@ -26,4 +26,20 @@ class Activity extends Base
'title' => t('%s\'s activity', $project['name'])
)));
}
+
+ /**
+ * Display task activities
+ *
+ * @access public
+ */
+ public function task()
+ {
+ $task = $this->getTask();
+
+ $this->response->html($this->taskLayout('activity/task', array(
+ 'title' => $task['title'],
+ 'task' => $task,
+ 'events' => $this->projectActivity->getTask($task['id']),
+ )));
+ }
}
diff --git a/app/Controller/Analytic.php b/app/Controller/Analytic.php
index 2413ba92..ca2146ed 100644
--- a/app/Controller/Analytic.php
+++ b/app/Controller/Analytic.php
@@ -3,7 +3,7 @@
namespace Controller;
/**
- * Project Anaytic controller
+ * Project Analytic controller
*
* @package controller
* @author Frederic Guillot
@@ -27,6 +27,56 @@ class Analytic extends Base
}
/**
+ * Show average Lead and Cycle time
+ *
+ * @access public
+ */
+ public function leadAndCycleTime()
+ {
+ $project = $this->getProject();
+ $values = $this->request->getValues();
+
+ $this->projectDailyStats->updateTotals($project['id'], date('Y-m-d'));
+
+ $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'];
+ }
+
+ $this->response->html($this->layout('analytic/lead_cycle_time', array(
+ 'values' => array(
+ 'from' => $from,
+ 'to' => $to,
+ ),
+ 'project' => $project,
+ 'average' => $this->projectAnalytic->getAverageLeadAndCycleTime($project['id']),
+ 'metrics' => $this->projectDailyStats->getRawMetrics($project['id'], $from, $to),
+ 'date_format' => $this->config->get('application_date_format'),
+ 'date_formats' => $this->dateParser->getAvailableFormats(),
+ 'title' => t('Lead and Cycle time for "%s"', $project['name']),
+ )));
+ }
+
+ /**
+ * Show average time spent by column
+ *
+ * @access public
+ */
+ public function averageTimeByColumn()
+ {
+ $project = $this->getProject();
+
+ $this->response->html($this->layout('analytic/avg_time_columns', array(
+ 'project' => $project,
+ 'metrics' => $this->projectAnalytic->getAverageTimeSpentByColumn($project['id']),
+ 'title' => t('Average time spent into each column for "%s"', $project['name']),
+ )));
+ }
+
+ /**
* Show tasks distribution graph
*
* @access public
@@ -88,6 +138,8 @@ class Analytic extends Base
$project = $this->getProject();
$values = $this->request->getValues();
+ $this->projectDailyColumnStats->updateTotals($project['id'], date('Y-m-d'));
+
$from = $this->request->getStringParam('from', date('Y-m-d', strtotime('-1week')));
$to = $this->request->getStringParam('to', date('Y-m-d'));
@@ -96,7 +148,7 @@ class Analytic extends Base
$to = $values['to'];
}
- $display_graph = $this->projectDailySummary->countDays($project['id'], $from, $to) >= 2;
+ $display_graph = $this->projectDailyColumnStats->countDays($project['id'], $from, $to) >= 2;
$this->response->html($this->layout($template, array(
'values' => array(
@@ -104,7 +156,7 @@ class Analytic extends Base
'to' => $to,
),
'display_graph' => $display_graph,
- 'metrics' => $display_graph ? $this->projectDailySummary->getAggregatedMetrics($project['id'], $from, $to, $column) : array(),
+ 'metrics' => $display_graph ? $this->projectDailyColumnStats->getAggregatedMetrics($project['id'], $from, $to, $column) : array(),
'project' => $project,
'date_format' => $this->config->get('application_date_format'),
'date_formats' => $this->dateParser->getAvailableFormats(),
diff --git a/app/Controller/Board.php b/app/Controller/Board.php
index caaa38ef..ac80a192 100644
--- a/app/Controller/Board.php
+++ b/app/Controller/Board.php
@@ -310,4 +310,28 @@ class Board extends Base
'recurrence_basedate_list' => $this->task->getRecurrenceBasedateList(),
)));
}
+
+ /**
+ * Enable collapsed mode
+ *
+ * @access public
+ */
+ public function collapse()
+ {
+ $project_id = $this->request->getIntegerParam('project_id');
+ $this->userSession->setBoardDisplayMode($project_id, true);
+ $this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $project_id)));
+ }
+
+ /**
+ * Enable expanded mode
+ *
+ * @access public
+ */
+ public function expand()
+ {
+ $project_id = $this->request->getIntegerParam('project_id');
+ $this->userSession->setBoardDisplayMode($project_id, false);
+ $this->response->redirect($this->helper->url->to('board', 'show', array('project_id' => $project_id)));
+ }
}
diff --git a/app/Controller/Export.php b/app/Controller/Export.php
index 117fb5ee..8b558c0a 100644
--- a/app/Controller/Export.php
+++ b/app/Controller/Export.php
@@ -70,7 +70,7 @@ class Export extends Base
*/
public function summary()
{
- $this->common('projectDailySummary', 'getAggregatedMetrics', t('Summary'), 'summary', t('Daily project summary export'));
+ $this->common('ProjectDailyColumnStats', 'getAggregatedMetrics', t('Summary'), 'summary', t('Daily project summary export'));
}
/**
diff --git a/app/Controller/Ical.php b/app/Controller/Ical.php
index 8a7ed8b5..0129915e 100644
--- a/app/Controller/Ical.php
+++ b/app/Controller/Ical.php
@@ -78,8 +78,8 @@ class Ical extends Base
*/
private function renderCalendar(TaskFilter $filter, iCalendar $calendar)
{
- $start = $this->request->getStringParam('start', strtotime('-1 month'));
- $end = $this->request->getStringParam('end', strtotime('+2 months'));
+ $start = $this->request->getStringParam('start', strtotime('-2 month'));
+ $end = $this->request->getStringParam('end', strtotime('+6 months'));
// Tasks
if ($this->config->get('calendar_project_tasks', 'date_started') === 'date_creation') {
diff --git a/app/Controller/Task.php b/app/Controller/Task.php
index dc83f7b1..0d85f411 100644
--- a/app/Controller/Task.php
+++ b/app/Controller/Task.php
@@ -64,7 +64,7 @@ class Task extends Base
'time_spent' => $task['time_spent'] ?: '',
);
- $this->dateParser->format($values, array('date_started'));
+ $this->dateParser->format($values, array('date_started'), 'Y-m-d H:i');
$this->response->html($this->taskLayout('task/show', array(
'project' => $this->project->getById($task['project_id']),
@@ -88,19 +88,20 @@ class Task extends Base
}
/**
- * Display task activities
+ * Display task analytics
*
* @access public
*/
- public function activites()
+ public function analytics()
{
$task = $this->getTask();
- $this->response->html($this->taskLayout('task/activity', array(
+ $this->response->html($this->taskLayout('task/analytics', array(
'title' => $task['title'],
'task' => $task,
- 'ajax' => $this->request->isAjax(),
- 'events' => $this->projectActivity->getTask($task['id']),
+ 'lead_time' => $this->taskAnalytic->getLeadTime($task),
+ 'cycle_time' => $this->taskAnalytic->getCycleTime($task),
+ 'time_spent_columns' => $this->taskAnalytic->getTimeSpentByColumn($task),
)));
}
@@ -151,7 +152,6 @@ class Task extends Base
{
$project = $this->getProject();
$values = $this->request->getValues();
- $values['creator_id'] = $this->userSession->getId();
list($valid, $errors) = $this->taskValidator->validateCreation($values);
@@ -618,4 +618,16 @@ class Task extends Base
'transitions' => $this->transition->getAllByTask($task['id']),
)));
}
+
+ /**
+ * Set automatically the start date
+ *
+ * @access public
+ */
+ public function start()
+ {
+ $task = $this->getTask();
+ $this->taskModification->update(array('id' => $task['id'], 'date_started' => time()));
+ $this->response->redirect($this->helper->url->to('task', 'show', array('project_id' => $task['project_id'], 'task_id' => $task['id'])));
+ }
}