summaryrefslogtreecommitdiff
path: root/app/Api/Procedure/SubtaskTimeTrackingProcedure.php
blob: 5ceaa08df6d0fc85ce2e045a5e6ab981f312a4da (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
<?php

namespace Kanboard\Api\Procedure;

use Kanboard\Api\Authorization\SubtaskAuthorization;

/**
 * Subtask Time Tracking API controller
 *
 * @package  Kanboard\Api\Procedure
 * @author   Frederic Guillot
 * @author   Nikolaos Georgakis
 */
class SubtaskTimeTrackingProcedure extends BaseProcedure
{
    public function hasSubtaskTimer($subtask_id, $user_id)
    {
        SubtaskAuthorization::getInstance($this->container)->check($this->getClassName(), 'hasSubtaskTimer', $subtask_id);
        return $this->subtaskTimeTrackingModel->hasTimer($subtask_id, $user_id);
    }

    public function setSubtaskStartTime($subtask_id, $user_id)
    {
        SubtaskAuthorization::getInstance($this->container)->check($this->getClassName(), 'setSubtaskStartTime', $subtask_id);
        return $this->subtaskTimeTrackingModel->logStartTime($subtask_id, $user_id);
    }

    public function setSubtaskEndTime($subtask_id, $user_id)
    {
        SubtaskAuthorization::getInstance($this->container)->check($this->getClassName(), 'setSubtaskEndTime', $subtask_id);
        return $this->subtaskTimeTrackingModel->logEndTime($subtask_id, $user_id);
    }

    public function getSubtaskTimeSpent($subtask_id, $user_id)
    {
        SubtaskAuthorization::getInstance($this->container)->check($this->getClassName(), 'getSubtaskTimeSpent', $subtask_id);
        return $this->subtaskTimeTrackingModel->getTimeSpent($subtask_id, $user_id);
    }
}