Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
Total | |
55.56% |
5 / 9 |
|
33.33% |
2 / 6 |
CRAP | |
0.00% |
0 / 1 |
SeedDMS_Core_Notification | |
55.56% |
5 / 9 |
|
33.33% |
2 / 6 |
9.16 | |
0.00% |
0 / 1 |
__construct | |
100.00% |
4 / 4 |
|
100.00% |
1 / 1 |
1 | |||
setDMS | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
getTarget | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getTargetType | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getUser | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 | |||
getGroup | |
0.00% |
0 / 1 |
|
0.00% |
0 / 1 |
2 |
1 | <?php |
2 | declare(strict_types=1); |
3 | |
4 | /** |
5 | * Implementation of a notification object |
6 | * |
7 | * @category DMS |
8 | * @package SeedDMS_Core |
9 | * @license GPL 2 |
10 | * @version @version@ |
11 | * @author Uwe Steinmann <uwe@steinmann.cx> |
12 | * @copyright Copyright (C) 2010-2024 Uwe Steinmann |
13 | * @version Release: @package_version@ |
14 | */ |
15 | |
16 | /** |
17 | * Class to represent a notification |
18 | * |
19 | * @category DMS |
20 | * @package SeedDMS_Core |
21 | * @author Uwe Steinmann <uwe@steinmann.cx> |
22 | * @copyright Copyright (C) 2010-2024 Uwe Steinmann |
23 | * @version Release: @package_version@ |
24 | */ |
25 | class SeedDMS_Core_Notification { /* {{{ */ |
26 | /** |
27 | * @var integer id of target (document or folder) |
28 | * |
29 | * @access protected |
30 | */ |
31 | protected $_target; |
32 | |
33 | /** |
34 | * @var integer document or folder |
35 | * |
36 | * @access protected |
37 | */ |
38 | protected $_targettype; |
39 | |
40 | /** |
41 | * @var integer id of user to notify |
42 | * |
43 | * @access protected |
44 | */ |
45 | protected $_userid; |
46 | |
47 | /** |
48 | * @var integer id of group to notify |
49 | * |
50 | * @access protected |
51 | */ |
52 | protected $_groupid; |
53 | |
54 | /** |
55 | * @var object reference to the dms instance this user belongs to |
56 | * |
57 | * @access protected |
58 | */ |
59 | protected $_dms; |
60 | |
61 | /** |
62 | * Constructor |
63 | * |
64 | * @param integer $target id of document/folder this notification is |
65 | * attached to. |
66 | * @param integer $targettype 1 = target is document, 2 = target is a folder |
67 | * @param integer $userid id of user. The id is -1 if the notification is |
68 | * for a group. |
69 | * @param integer $groupid id of group. The id is -1 if the notification is |
70 | * for a user. |
71 | */ |
72 | function __construct($target, $targettype, $userid, $groupid) { /* {{{ */ |
73 | $this->_target = $target; |
74 | $this->_targettype = $targettype; |
75 | $this->_userid = $userid; |
76 | $this->_groupid = $groupid; |
77 | } /* }}} */ |
78 | |
79 | /** |
80 | * Set instance of dms this object belongs to |
81 | * |
82 | * @param object $dms instance of dms |
83 | */ |
84 | function setDMS($dms) { /* {{{ */ |
85 | $this->_dms = $dms; |
86 | } /* }}} */ |
87 | |
88 | /** |
89 | * Get id of target (document/object) this notification is attachted to |
90 | * |
91 | * @return integer id of target |
92 | */ |
93 | function getTarget() { return $this->_target; } |
94 | |
95 | /** |
96 | * Get type of target |
97 | * |
98 | * @return integer type of target (1=document/2=object) |
99 | */ |
100 | function getTargetType() { return $this->_targettype; } |
101 | |
102 | /** |
103 | * Get user for this notification |
104 | * |
105 | * @return integer id of user or -1 if this notification does not belong |
106 | * to a user |
107 | */ |
108 | function getUser() { return $this->_dms->getUser($this->_userid); } |
109 | |
110 | /** |
111 | * Get group for this notification |
112 | * |
113 | * @return integer id of group or -1 if this notification does not belong |
114 | * to a group |
115 | */ |
116 | function getGroup() { return $this->_dms->getGroup($this->_groupid); } |
117 | } /* }}} */ |
118 | ?> |