summaryrefslogtreecommitdiff
path: root/app/Controller/ActivityController.php
blob: a1734af14db9bd60e40c7f21dcf872569ab53c3c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
<?php

namespace Kanboard\Controller;

/**
 * Activity Controller
 *
 * @package Kanboard\Controller
 * @author  Frederic Guillot
 */
class ActivityController extends BaseController
{
    /**
     * Activity page for a user
     *
     * @access public
     */
    public function user()
    {
        $user = $this->getUser();

        $this->response->html($this->helper->layout->dashboard('activity/user', array(
            'title'  => t('Activity stream for %s', $this->helper->user->getFullname($user)),
            'events' => $this->helper->projectActivity->getProjectsEvents($this->projectPermissionModel->getActiveProjectIds($user['id']), 100),
            'user'   => $user,
        )));
    }

    /**
     * Activity page for a project
     *
     * @access public
     */
    public function project()
    {
        $project = $this->getProject();

        $this->response->html($this->helper->layout->app('activity/project', array(
            'title'   => t('%s\'s activity', $project['name']),
            'events'  => $this->helper->projectActivity->getProjectEvents($project['id']),
            'project' => $project,
        )));
    }

    /**
     * Display task activities
     *
     * @access public
     */
    public function task()
    {
        $task = $this->getTask();

        $this->response->html($this->helper->layout->task('activity/task', array(
            'title'   => $task['title'],
            'task'    => $task,
            'project' => $this->projectModel->getById($task['project_id']),
            'events'  => $this->helper->projectActivity->getTaskEvents($task['id']),
            'tags'    => $this->taskTagModel->getList($task['id']),
        )));
    }
}