blob: 8358efee45bff75190275ef2df28c23d4cd6157d (
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
|
<?php
namespace Kanboard\Api;
use Kanboard\Core\Base;
/**
* Comment API controller
*
* @package Kanboard\Api
* @author Frederic Guillot
*/
class CommentApi extends Base
{
public function getComment($comment_id)
{
return $this->commentModel->getById($comment_id);
}
public function getAllComments($task_id)
{
return $this->commentModel->getAll($task_id);
}
public function removeComment($comment_id)
{
return $this->commentModel->remove($comment_id);
}
public function createComment($task_id, $user_id, $content, $reference = '')
{
$values = array(
'task_id' => $task_id,
'user_id' => $user_id,
'comment' => $content,
'reference' => $reference,
);
list($valid, ) = $this->commentValidator->validateCreation($values);
return $valid ? $this->commentModel->create($values) : false;
}
public function updateComment($id, $content)
{
$values = array(
'id' => $id,
'comment' => $content,
);
list($valid, ) = $this->commentValidator->validateModification($values);
return $valid && $this->commentModel->update($values);
}
}
|