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