*prechod na novsiu verziu ZF
[sport-group.git] / library / Zend / Service / Simpy / Watchlist.php
blobef34f91fe89eb6080195ee7d9dfab8fe5d217012
1 <?php
3 /**
4 * Zend Framework
6 * LICENSE
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.
16 * @category Zend
17 * @package Zend_Service
18 * @subpackage Simpy
19 * @copyright Copyright (c) 2005-2009 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 16211 2009-06-21 19:23:55Z thomas $
25 /**
26 * @see Zend_Service_Simpy_WatchlistFilterSet
28 require_once 'Zend/Service/Simpy/WatchlistFilterSet.php';
31 /**
32 * @category Zend
33 * @package Zend_Service
34 * @subpackage Simpy
35 * @copyright Copyright (c) 2005-2009 Zend Technologies USA Inc. (http://www.zend.com)
36 * @license http://framework.zend.com/license/new-bsd New BSD License
38 class Zend_Service_Simpy_Watchlist
40 /**
41 * Identifier for the watchlist
43 * @var int
45 protected $_id;
47 /**
48 * Name of the watchlist
50 * @var string
52 protected $_name;
54 /**
55 * Description of the watchlist
57 * @var string
59 protected $_description;
61 /**
62 * Timestamp for when the watchlist was added
64 * @var string
66 protected $_addDate;
68 /**
69 * Number of new links in the watchlist
71 * @var int
73 protected $_newLinks;
75 /**
76 * List of usernames for users included in the watchlist
78 * @var array
80 protected $_users;
82 /**
83 * List of filters included in the watchlist
85 * @var Zend_Service_Simpy_WatchlistFilterSet
87 protected $_filters;
89 /**
90 * Constructor to initialize the object with data
92 * @param DOMNode $node Individual <watchlist> node from a parsed
93 * response from a GetWatchlists or GetWatchlist
94 * operation
95 * @return void
97 public function __construct($node)
99 $map =& $node->attributes;
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;
107 $this->_users = array();
108 $this->_filters = new Zend_Service_Simpy_WatchlistFilterSet();
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);
118 $childNode = $childNode->nextSibling;
123 * Returns the identifier for the watchlist
125 * @return int
127 public function getId()
129 return $this->_id;
133 * Returns the name of the watchlist
135 * @return string
137 public function getName()
139 return $this->_name;
143 * Returns the description of the watchlist
145 * @return string
147 public function getDescription()
149 return $this->_description;
153 * Returns a timestamp for when the watchlist was added
155 * @return string
157 public function getAddDate()
159 return $this->_addDate;
163 * Returns the number of new links in the watchlist
165 * @return int
167 public function getNewLinks()
169 return $this->_newLinks;
173 * Returns a list of usernames for users included in the watchlist
175 * @return array
177 public function getUsers()
179 return $this->_users;
183 * Returns a list of filters included in the watchlist
185 * @return Zend_Service_Simpy_WatchlistFilterSet
187 public function getFilters()
189 return $this->_filters;