diff options
Diffstat (limited to 'app/Controller')
-rw-r--r-- | app/Controller/Analytic.php | 2 | ||||
-rw-r--r-- | app/Controller/Base.php | 3 | ||||
-rw-r--r-- | app/Controller/Budget.php | 10 | ||||
-rw-r--r-- | app/Controller/Export.php | 2 | ||||
-rw-r--r-- | app/Controller/Project.php | 87 | ||||
-rw-r--r-- | app/Controller/Projectinfo.php | 97 |
6 files changed, 107 insertions, 94 deletions
diff --git a/app/Controller/Analytic.php b/app/Controller/Analytic.php index e7578da9..f31870e0 100644 --- a/app/Controller/Analytic.php +++ b/app/Controller/Analytic.php @@ -21,7 +21,7 @@ class Analytic extends Base private function layout($template, array $params) { $params['board_selector'] = $this->projectPermission->getAllowedProjects($this->userSession->getId()); - $params['analytic_content_for_layout'] = $this->template->render($template, $params); + $params['content_for_sublayout'] = $this->template->render($template, $params); return $this->template->layout('analytic/layout', $params); } diff --git a/app/Controller/Base.php b/app/Controller/Base.php index 57a64a3a..fcd07b99 100644 --- a/app/Controller/Base.php +++ b/app/Controller/Base.php @@ -247,12 +247,13 @@ abstract class Base extends \Core\Base * @param array $params Template parameters * @return string */ - protected function projectLayout($template, array $params) + protected function projectLayout($template, array $params, $sidebar_template = 'project/sidebar') { $content = $this->template->render($template, $params); $params['project_content_for_layout'] = $content; $params['title'] = $params['project']['name'] === $params['title'] ? $params['title'] : $params['project']['name'].' > '.$params['title']; $params['board_selector'] = $this->projectPermission->getAllowedProjects($this->userSession->getId()); + $params['sidebar_template'] = $sidebar_template; return $this->template->layout('project/layout', $params); } diff --git a/app/Controller/Budget.php b/app/Controller/Budget.php index 45dad7fb..a2f7e0db 100644 --- a/app/Controller/Budget.php +++ b/app/Controller/Budget.php @@ -23,7 +23,7 @@ class Budget extends Base 'daily_budget' => $this->budget->getDailyBudgetBreakdown($project['id']), 'project' => $project, 'title' => t('Budget') - ))); + ), 'budget/sidebar')); } /** @@ -47,7 +47,7 @@ class Budget extends Base 'paginator' => $paginator, 'project' => $project, 'title' => t('Budget') - ))); + ), 'budget/sidebar')); } /** @@ -68,8 +68,8 @@ class Budget extends Base 'values' => $values + array('project_id' => $project['id']), 'errors' => $errors, 'project' => $project, - 'title' => t('Budget') - ))); + 'title' => t('Budget lines') + ), 'budget/sidebar')); } /** @@ -111,7 +111,7 @@ class Budget extends Base 'project' => $project, 'budget_id' => $this->request->getIntegerParam('budget_id'), 'title' => t('Remove a budget line'), - ))); + ), 'budget/sidebar')); } /** diff --git a/app/Controller/Export.php b/app/Controller/Export.php index b8f932c1..117fb5ee 100644 --- a/app/Controller/Export.php +++ b/app/Controller/Export.php @@ -40,7 +40,7 @@ class Export extends Base 'date_formats' => $this->dateParser->getAvailableFormats(), 'project' => $project, 'title' => $page_title, - ))); + ), 'export/sidebar')); } /** diff --git a/app/Controller/Project.php b/app/Controller/Project.php index 63c20cc4..ba039b7d 100644 --- a/app/Controller/Project.php +++ b/app/Controller/Project.php @@ -3,7 +3,7 @@ namespace Controller; /** - * Project controller + * Project controller (Settings + creation/edition) * * @package controller * @author Frederic Guillot @@ -416,91 +416,6 @@ class Project extends Base } /** - * Activity page for a project - * - * @access public - */ - public function activity() - { - $project = $this->getProject(); - - $this->response->html($this->template->layout('project/activity', array( - 'board_selector' => $this->projectPermission->getAllowedProjects($this->userSession->getId()), - 'events' => $this->projectActivity->getProject($project['id']), - 'project' => $project, - 'title' => t('%s\'s activity', $project['name']) - ))); - } - - /** - * Task search for a given project - * - * @access public - */ - public function search() - { - $project = $this->getProject(); - $search = $this->request->getStringParam('search'); - $nb_tasks = 0; - - $paginator = $this->paginator - ->setUrl('project', 'search', array('search' => $search, 'project_id' => $project['id'])) - ->setMax(30) - ->setOrder('tasks.id') - ->setDirection('DESC'); - - if ($search !== '') { - - $paginator - ->setQuery($this->taskFinder->getSearchQuery($project['id'], $search)) - ->calculate(); - - $nb_tasks = $paginator->getTotal(); - } - - $this->response->html($this->template->layout('project/search', array( - 'board_selector' => $this->projectPermission->getAllowedProjects($this->userSession->getId()), - 'values' => array( - 'search' => $search, - 'controller' => 'project', - 'action' => 'search', - 'project_id' => $project['id'], - ), - 'paginator' => $paginator, - 'project' => $project, - 'columns' => $this->board->getColumnsList($project['id']), - 'categories' => $this->category->getList($project['id'], false), - 'title' => t('Search in the project "%s"', $project['name']).($nb_tasks > 0 ? ' ('.$nb_tasks.')' : '') - ))); - } - - /** - * List of completed tasks for a given project - * - * @access public - */ - public function tasks() - { - $project = $this->getProject(); - $paginator = $this->paginator - ->setUrl('project', 'tasks', array('project_id' => $project['id'])) - ->setMax(30) - ->setOrder('tasks.id') - ->setDirection('DESC') - ->setQuery($this->taskFinder->getClosedTaskQuery($project['id'])) - ->calculate(); - - $this->response->html($this->template->layout('project/tasks', array( - 'board_selector' => $this->projectPermission->getAllowedProjects($this->userSession->getId()), - 'project' => $project, - 'columns' => $this->board->getColumnsList($project['id']), - 'categories' => $this->category->getList($project['id'], false), - 'paginator' => $paginator, - 'title' => t('Completed tasks for "%s"', $project['name']).' ('.$paginator->getTotal().')' - ))); - } - - /** * Display a form to create a new project * * @access public diff --git a/app/Controller/Projectinfo.php b/app/Controller/Projectinfo.php new file mode 100644 index 00000000..a9498f43 --- /dev/null +++ b/app/Controller/Projectinfo.php @@ -0,0 +1,97 @@ +<?php + +namespace Controller; + +/** + * Project Info controller (ActivityStream + completed tasks) + * + * @package controller + * @author Frederic Guillot + */ +class Projectinfo extends Base +{ + /** + * Activity page for a project + * + * @access public + */ + public function activity() + { + $project = $this->getProject(); + + $this->response->html($this->template->layout('projectinfo/activity', array( + 'board_selector' => $this->projectPermission->getAllowedProjects($this->userSession->getId()), + 'events' => $this->projectActivity->getProject($project['id']), + 'project' => $project, + 'title' => t('%s\'s activity', $project['name']) + ))); + } + + /** + * Task search for a given project + * + * @access public + */ + public function search() + { + $project = $this->getProject(); + $search = $this->request->getStringParam('search'); + $nb_tasks = 0; + + $paginator = $this->paginator + ->setUrl('projectinfo', 'search', array('search' => $search, 'project_id' => $project['id'])) + ->setMax(30) + ->setOrder('tasks.id') + ->setDirection('DESC'); + + if ($search !== '') { + + $paginator + ->setQuery($this->taskFinder->getSearchQuery($project['id'], $search)) + ->calculate(); + + $nb_tasks = $paginator->getTotal(); + } + + $this->response->html($this->template->layout('projectinfo/search', array( + 'board_selector' => $this->projectPermission->getAllowedProjects($this->userSession->getId()), + 'values' => array( + 'search' => $search, + 'controller' => 'projectinfo', + 'action' => 'search', + 'project_id' => $project['id'], + ), + 'paginator' => $paginator, + 'project' => $project, + 'columns' => $this->board->getColumnsList($project['id']), + 'categories' => $this->category->getList($project['id'], false), + 'title' => t('Search in the project "%s"', $project['name']).($nb_tasks > 0 ? ' ('.$nb_tasks.')' : '') + ))); + } + + /** + * List of completed tasks for a given project + * + * @access public + */ + public function tasks() + { + $project = $this->getProject(); + $paginator = $this->paginator + ->setUrl('projectinfo', 'tasks', array('project_id' => $project['id'])) + ->setMax(30) + ->setOrder('tasks.id') + ->setDirection('DESC') + ->setQuery($this->taskFinder->getClosedTaskQuery($project['id'])) + ->calculate(); + + $this->response->html($this->template->layout('projectinfo/tasks', array( + 'board_selector' => $this->projectPermission->getAllowedProjects($this->userSession->getId()), + 'project' => $project, + 'columns' => $this->board->getColumnsList($project['id']), + 'categories' => $this->category->getList($project['id'], false), + 'paginator' => $paginator, + 'title' => t('Completed tasks for "%s"', $project['name']).' ('.$paginator->getTotal().')' + ))); + } +} |