-
Notifications
You must be signed in to change notification settings - Fork 25
/
Copy pathTrelloManagement.php
62 lines (53 loc) · 1.63 KB
/
TrelloManagement.php
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 declare(strict_types=1);
namespace XoopsModules\Publisher;
/**
* Class TrelloManagement
*/
class TrelloManagement
{
private $xoopsDb;
/**
* TrelloManagement constructor.
* @param $xoopsDb
*/
public function __construct($xoopsDb)
{
$this->xoopsDb = $xoopsDb;
}
/**
* @param $statusId
* @param $itemId
* @return mixed
*/
public function getProjectTaskByStatus($statusId, $itemId)
{
$helper = Helper::getInstance();
$dbHandle = new TrelloDBController($this->xoopsDb);
$query = 'SELECT * FROM ' . $GLOBALS['xoopsDB']->prefix($helper->getDirname() . '_items') . 'WHERE status= ? AND itemid = ?';
$result = $dbHandle->runQuery($query, 'ii', [$statusId, $itemId]);
return $result;
}
/**
* @return mixed
*/
public function getAllStatus()
{
$helper = Helper::getInstance();
$dbHandle = new TrelloDBController($this->xoopsDb);
$query = 'SELECT itemid, title, status FROM ' . $GLOBALS['xoopsDB']->prefix($helper->getDirname() . '_items');
$result = $dbHandle->runBaseQuery($query);
return $result;
}
/**
* @param $statusId
* @param $itemId
*/
public function editTaskStatus($statusId, $itemId)
{
$helper = Helper::getInstance();
$dbHandle = new TrelloDBController($this->xoopsDb);
$query = 'UPDATE ' . $GLOBALS['xoopsDB']->prefix($helper->getDirname() . '_items') . ' SET status = ? WHERE itemid = ?';
$result = $dbHandle->update($query, 'ii', [$statusId, $itemId]);
return $result;
}
}