1<?php
2
3namespace Kanboard\Controller;
4
5/**
6 * Dashboard Controller
7 *
8 * @package  Kanboard\Controller
9 * @author   Frederic Guillot
10 */
11class DashboardController extends BaseController
12{
13    /**
14     * Dashboard overview
15     *
16     * @access public
17     */
18    public function show()
19    {
20        $user = $this->getUser();
21
22        $this->response->html($this->helper->layout->dashboard('dashboard/overview', array(
23            'title'              => t('Dashboard for %s', $this->helper->user->getFullname($user)),
24            'user'               => $user,
25            'overview_paginator' => $this->dashboardPagination->getOverview($user['id']),
26            'project_paginator'  => $this->projectPagination->getDashboardPaginator($user['id'], 'show', 10),
27        )));
28    }
29
30    /**
31     * My tasks
32     *
33     * @access public
34     */
35    public function tasks()
36    {
37        $user = $this->getUser();
38
39        $this->response->html($this->helper->layout->dashboard('dashboard/tasks', array(
40            'title' => t('Tasks overview for %s', $this->helper->user->getFullname($user)),
41            'paginator' => $this->taskPagination->getDashboardPaginator($user['id'], 'tasks', 50),
42            'user' => $user,
43        )));
44    }
45
46    /**
47     * My subtasks
48     *
49     * @access public
50     */
51    public function subtasks()
52    {
53        $user = $this->getUser();
54
55        $this->response->html($this->helper->layout->dashboard('dashboard/subtasks', array(
56            'title' => t('Subtasks overview for %s', $this->helper->user->getFullname($user)),
57            'paginator' => $this->subtaskPagination->getDashboardPaginator($user['id']),
58            'user' => $user,
59            'nb_subtasks' => $this->subtaskModel->countByAssigneeAndTaskStatus($user['id']),
60        )));
61    }
62
63    /**
64     * My projects
65     *
66     * @access public
67     */
68    public function projects()
69    {
70        $user = $this->getUser();
71
72        $this->response->html($this->helper->layout->dashboard('dashboard/projects', array(
73            'title' => t('Projects overview for %s', $this->helper->user->getFullname($user)),
74            'paginator' => $this->projectPagination->getDashboardPaginator($user['id'], 'projects', 25),
75            'user' => $user,
76        )));
77    }
78}
79