|
1 <?php |
|
2 |
|
3 /** |
|
4 * Zend Framework |
|
5 * |
|
6 * LICENSE |
|
7 * |
|
8 * This source file is subject to the new BSD license that is bundled |
|
9 * with this package in the file LICENSE.txt. |
|
10 * It is also available through the world-wide-web at this URL: |
|
11 * http://framework.zend.com/license/new-bsd |
|
12 * If you did not receive a copy of the license and are unable to |
|
13 * obtain it through the world-wide-web, please send an email |
|
14 * to license@zend.com so we can send you a copy immediately. |
|
15 * |
|
16 * @category Zend |
|
17 * @package Zend_Service |
|
18 * @subpackage Simpy |
|
19 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
|
20 * @license http://framework.zend.com/license/new-bsd New BSD License |
|
21 * @version $Id: Watchlist.php 20096 2010-01-06 02:05:09Z bkarwin $ |
|
22 */ |
|
23 |
|
24 |
|
25 /** |
|
26 * @see Zend_Service_Simpy_WatchlistFilterSet |
|
27 */ |
|
28 require_once 'Zend/Service/Simpy/WatchlistFilterSet.php'; |
|
29 |
|
30 |
|
31 /** |
|
32 * @category Zend |
|
33 * @package Zend_Service |
|
34 * @subpackage Simpy |
|
35 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
|
36 * @license http://framework.zend.com/license/new-bsd New BSD License |
|
37 */ |
|
38 class Zend_Service_Simpy_Watchlist |
|
39 { |
|
40 /** |
|
41 * Identifier for the watchlist |
|
42 * |
|
43 * @var int |
|
44 */ |
|
45 protected $_id; |
|
46 |
|
47 /** |
|
48 * Name of the watchlist |
|
49 * |
|
50 * @var string |
|
51 */ |
|
52 protected $_name; |
|
53 |
|
54 /** |
|
55 * Description of the watchlist |
|
56 * |
|
57 * @var string |
|
58 */ |
|
59 protected $_description; |
|
60 |
|
61 /** |
|
62 * Timestamp for when the watchlist was added |
|
63 * |
|
64 * @var string |
|
65 */ |
|
66 protected $_addDate; |
|
67 |
|
68 /** |
|
69 * Number of new links in the watchlist |
|
70 * |
|
71 * @var int |
|
72 */ |
|
73 protected $_newLinks; |
|
74 |
|
75 /** |
|
76 * List of usernames for users included in the watchlist |
|
77 * |
|
78 * @var array |
|
79 */ |
|
80 protected $_users; |
|
81 |
|
82 /** |
|
83 * List of filters included in the watchlist |
|
84 * |
|
85 * @var Zend_Service_Simpy_WatchlistFilterSet |
|
86 */ |
|
87 protected $_filters; |
|
88 |
|
89 /** |
|
90 * Constructor to initialize the object with data |
|
91 * |
|
92 * @param DOMNode $node Individual <watchlist> node from a parsed |
|
93 * response from a GetWatchlists or GetWatchlist |
|
94 * operation |
|
95 * @return void |
|
96 */ |
|
97 public function __construct($node) |
|
98 { |
|
99 $map =& $node->attributes; |
|
100 |
|
101 $this->_id = $map->getNamedItem('id')->nodeValue; |
|
102 $this->_name = $map->getNamedItem('name')->nodeValue; |
|
103 $this->_description = $map->getNamedItem('description')->nodeValue; |
|
104 $this->_addDate = $map->getNamedItem('addDate')->nodeValue; |
|
105 $this->_newLinks = $map->getNamedItem('newLinks')->nodeValue; |
|
106 |
|
107 $this->_users = array(); |
|
108 $this->_filters = new Zend_Service_Simpy_WatchlistFilterSet(); |
|
109 |
|
110 $childNode = $node->firstChild; |
|
111 while ($childNode !== null) { |
|
112 if ($childNode->nodeName == 'user') { |
|
113 $this->_users[] = $childNode->attributes->getNamedItem('username')->nodeValue; |
|
114 } elseif ($childNode->nodeName == 'filter') { |
|
115 $filter = new Zend_Service_Simpy_WatchlistFilter($childNode); |
|
116 $this->_filters->add($filter); |
|
117 } |
|
118 $childNode = $childNode->nextSibling; |
|
119 } |
|
120 } |
|
121 |
|
122 /** |
|
123 * Returns the identifier for the watchlist |
|
124 * |
|
125 * @return int |
|
126 */ |
|
127 public function getId() |
|
128 { |
|
129 return $this->_id; |
|
130 } |
|
131 |
|
132 /** |
|
133 * Returns the name of the watchlist |
|
134 * |
|
135 * @return string |
|
136 */ |
|
137 public function getName() |
|
138 { |
|
139 return $this->_name; |
|
140 } |
|
141 |
|
142 /** |
|
143 * Returns the description of the watchlist |
|
144 * |
|
145 * @return string |
|
146 */ |
|
147 public function getDescription() |
|
148 { |
|
149 return $this->_description; |
|
150 } |
|
151 |
|
152 /** |
|
153 * Returns a timestamp for when the watchlist was added |
|
154 * |
|
155 * @return string |
|
156 */ |
|
157 public function getAddDate() |
|
158 { |
|
159 return $this->_addDate; |
|
160 } |
|
161 |
|
162 /** |
|
163 * Returns the number of new links in the watchlist |
|
164 * |
|
165 * @return int |
|
166 */ |
|
167 public function getNewLinks() |
|
168 { |
|
169 return $this->_newLinks; |
|
170 } |
|
171 |
|
172 /** |
|
173 * Returns a list of usernames for users included in the watchlist |
|
174 * |
|
175 * @return array |
|
176 */ |
|
177 public function getUsers() |
|
178 { |
|
179 return $this->_users; |
|
180 } |
|
181 |
|
182 /** |
|
183 * Returns a list of filters included in the watchlist |
|
184 * |
|
185 * @return Zend_Service_Simpy_WatchlistFilterSet |
|
186 */ |
|
187 public function getFilters() |
|
188 { |
|
189 return $this->_filters; |
|
190 } |
|
191 } |