|
1
|
|
|
<?php |
|
2
|
|
|
/** |
|
3
|
|
|
* @copyright Copyright (c) 2016 Julius Härtl <[email protected]> |
|
4
|
|
|
* |
|
5
|
|
|
* @author Julius Härtl <[email protected]> |
|
6
|
|
|
* |
|
7
|
|
|
* @license GNU AGPL version 3 or any later version |
|
8
|
|
|
* |
|
9
|
|
|
* This program is free software: you can redistribute it and/or modify |
|
10
|
|
|
* it under the terms of the GNU Affero General Public License as |
|
11
|
|
|
* published by the Free Software Foundation, either version 3 of the |
|
12
|
|
|
* License, or (at your option) any later version. |
|
13
|
|
|
* |
|
14
|
|
|
* This program is distributed in the hope that it will be useful, |
|
15
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
16
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
17
|
|
|
* GNU Affero General Public License for more details. |
|
18
|
|
|
* |
|
19
|
|
|
* You should have received a copy of the GNU Affero General Public License |
|
20
|
|
|
* along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
21
|
|
|
* |
|
22
|
|
|
*/ |
|
23
|
|
|
|
|
24
|
|
|
namespace OCA\Deck\Db; |
|
25
|
|
|
|
|
26
|
|
|
class Board extends RelationalEntity { |
|
27
|
|
|
|
|
28
|
|
|
protected $title; |
|
29
|
|
|
protected $owner; |
|
30
|
|
|
protected $color; |
|
31
|
|
|
protected $archived = false; |
|
32
|
|
|
protected $labels = []; |
|
33
|
|
|
protected $acl = []; |
|
34
|
|
|
protected $permissions = []; |
|
35
|
|
|
protected $users = []; |
|
36
|
|
|
protected $shared; |
|
37
|
|
|
protected $stacks = []; |
|
38
|
|
|
protected $deletedAt = 0; |
|
39
|
|
|
protected $lastModified = 0; |
|
40
|
|
|
|
|
41
|
|
|
public function __construct() { |
|
42
|
|
|
$this->addType('id', 'integer'); |
|
43
|
|
|
$this->addType('shared', 'integer'); |
|
44
|
|
|
$this->addType('archived', 'boolean'); |
|
45
|
|
|
$this->addType('deletedAt', 'integer'); |
|
46
|
|
|
$this->addType('lastModified', 'integer'); |
|
47
|
|
|
$this->addRelation('labels'); |
|
48
|
|
|
$this->addRelation('acl'); |
|
49
|
|
|
$this->addRelation('shared'); |
|
50
|
|
|
$this->addRelation('users'); |
|
51
|
|
|
$this->addRelation('permissions'); |
|
52
|
|
|
$this->addRelation('stacks'); |
|
53
|
|
|
$this->addResolvable('owner'); |
|
54
|
|
|
$this->shared = -1; |
|
55
|
|
|
} |
|
56
|
|
|
|
|
57
|
|
|
public function jsonSerialize() { |
|
58
|
|
|
$json = parent::jsonSerialize(); |
|
59
|
|
|
if ($this->shared === -1) { |
|
60
|
|
|
unset($json['shared']); |
|
61
|
|
|
} |
|
62
|
|
|
return $json; |
|
63
|
|
|
} |
|
64
|
|
|
|
|
65
|
|
|
/** |
|
66
|
|
|
* @param Label[] $labels |
|
67
|
|
|
*/ |
|
68
|
|
|
public function setLabels($labels) { |
|
69
|
|
|
foreach ($labels as $l) { |
|
70
|
|
|
$this->labels[] = $l; |
|
71
|
|
|
} |
|
72
|
|
|
} |
|
73
|
|
|
|
|
74
|
|
|
/** |
|
75
|
|
|
* @param Acl[] $acl |
|
76
|
|
|
*/ |
|
77
|
|
|
public function setAcl($acl) { |
|
78
|
|
|
foreach ($acl as $a) { |
|
79
|
|
|
$this->acl[] = $a; |
|
80
|
|
|
} |
|
81
|
|
|
} |
|
82
|
|
|
} |
|
83
|
|
|
|