diff options
Diffstat (limited to 'controllers')
-rw-r--r-- | controllers/project.php | 23 | ||||
-rw-r--r-- | controllers/task.php | 2 |
2 files changed, 24 insertions, 1 deletions
diff --git a/controllers/project.php b/controllers/project.php index a384be67..c44dd38d 100644 --- a/controllers/project.php +++ b/controllers/project.php @@ -4,6 +4,29 @@ namespace Controller; class Project extends Base { + // List of completed tasks for a given project + public function tasks() + { + $project_id = $this->request->getIntegerParam('project_id'); + $project = $this->project->get($project_id); + + if (! $project) { + $this->session->flashError(t('Project not found.')); + $this->response->redirect('?controller=project'); + } + + $tasks = $this->task->getAllByProjectId($project_id, array(0)); + $nb_tasks = count($tasks); + + $this->response->html($this->template->layout('project_tasks', array( + 'menu' => 'projects', + 'project' => $project, + 'tasks' => $tasks, + 'nb_tasks' => $nb_tasks, + 'title' => $project['name'].' ('.$nb_tasks.')' + ))); + } + // List of projects public function index() { diff --git a/controllers/task.php b/controllers/task.php index b30758b6..79f2c7d0 100644 --- a/controllers/task.php +++ b/controllers/task.php @@ -188,7 +188,7 @@ class Task extends Base { $task = $this->task->getById($this->request->getIntegerParam('task_id')); - if ($task && $this->task->close($task['id'])) { + if ($task && $this->task->open($task['id'])) { $this->session->flash(t('Task opened successfully.')); } else { $this->session->flashError(t('Unable to open this task.')); |