summaryrefslogtreecommitdiff
path: root/app/Api/Procedure/SubtaskTimeTrackingProcedure.php
blob: 5d1988d61cb8167fdd21a931f313de1761b1c30a (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 logSubtaskStartTime($subtask_id, $user_id)
    {
        SubtaskAuthorization::getInstance($this->container)->check($this->getClassName(), 'logSubtaskStartTime', $subtask_id);
        return $this->subtaskTimeTrackingModel->logStartTime($subtask_id, $user_id);
    }

    public function logSubtaskEndTime($subtask_id,$user_id)
    {
        SubtaskAuthorization::getInstance($this->container)->check($this->getClassName(), 'logSubtaskEndTime', $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);
    }
}