From c0ee8b409223ee38a24a7bbd896efe9386e785b2 Mon Sep 17 00:00:00 2001 From: Frederic Guillot Date: Sun, 7 Aug 2016 10:31:48 -0400 Subject: Show project name in task forms --- app/Controller/TaskModificationController.php | 24 +++++++++++++++++++----- 1 file changed, 19 insertions(+), 5 deletions(-) (limited to 'app/Controller/TaskModificationController.php') diff --git a/app/Controller/TaskModificationController.php b/app/Controller/TaskModificationController.php index b064123a..d37f4bb4 100644 --- a/app/Controller/TaskModificationController.php +++ b/app/Controller/TaskModificationController.php @@ -37,11 +37,7 @@ class TaskModificationController extends BaseController $project = $this->projectModel->getById($task['project_id']); if (empty($values)) { - $values = $task; - $values = $this->hook->merge('controller:task:form:default', $values, array('default_values' => $values)); - $values = $this->hook->merge('controller:task-modification:form:default', $values, array('default_values' => $values)); - $values = $this->dateParser->format($values, array('date_due'), $this->dateParser->getUserDateFormat()); - $values = $this->dateParser->format($values, array('date_started'), $this->dateParser->getUserDateTimeFormat()); + $values = $this->prepareValues($task); } $this->response->html($this->template->render('task_modification/show', array( @@ -75,4 +71,22 @@ class TaskModificationController extends BaseController $this->edit($values, $errors); } } + + /** + * Prepare form values + * + * @access protected + * @param array $task + * @return array + */ + protected function prepareValues(array $task) + { + $values = $task; + $values = $this->hook->merge('controller:task:form:default', $values, array('default_values' => $values)); + $values = $this->hook->merge('controller:task-modification:form:default', $values, array('default_values' => $values)); + $values = $this->dateParser->format($values, array('date_due'), $this->dateParser->getUserDateFormat()); + $values = $this->dateParser->format($values, array('date_started'), $this->dateParser->getUserDateTimeFormat()); + + return $values; + } } -- cgit v1.2.3