3
* Copyright Netvibes 2006-2009.
4
* This file is part of Exposition PHP Lib.
6
* Exposition PHP Lib is free software: you can redistribute it and/or modify
7
* it under the terms of the GNU Lesser General Public License as published by
8
* the Free Software Foundation, either version 3 of the License, or
9
* (at your option) any later version.
11
* Exposition PHP Lib is distributed in the hope that it will be useful,
12
* but WITHOUT ANY WARRANTY; without even the implied warranty of
13
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
* GNU Lesser General Public License for more details.
16
* You should have received a copy of the GNU Lesser General Public License
17
* along with Exposition PHP Lib. If not, see <http://www.gnu.org/licenses/>.
22
* Netvibes Widget descriptor.
87
protected $_skeletonId;
90
* Widget skeleton origin.
94
protected $_skeletonOrigin;
104
* Constructor from a XML element.
106
* @param SimpleXMLElement $xml
108
public function __construct($xml)
110
$this->_id = (int) $xml['id'];
111
$this->_col = (int) $xml['col'];
112
$this->_row = (int) $xml['row'];
113
$this->_name = (string) $xml['name'];
114
$this->_title = (string) $xml->title;
115
$this->_url = (string) $xml->url;
116
$this->_height = (int) $xml->height;
117
$this->_color = (string) $xml->color;
119
if (isset($xml->skeleton)) {
120
$this->_skeletonId = (string) $xml->skeleton['id'];
121
$this->_skeletonOrigin = (string) $xml->skeleton['origin'];
122
$this->_links = array();
123
foreach ($xml->skeleton->link as $link) {
124
$this->_links[(string) $link['rel']] = (string) $link['href'];
128
$this->_data = array();
129
foreach ($xml->data as $data) {
130
$this->_data[(string) $data['name']] = (string) $data;
135
* Sets the widget identifier.
139
public function setId($id)
141
$this->_id = (int) $id;
145
* Returns the widget identifier.
149
public function getId()
155
* Sets the widget column number.
159
public function setCol($col)
161
$this->_col = (int) $col;
165
* Returns the widget column number.
169
public function getCol()
175
* Sets the widget row number.
179
public function setRow($row)
181
$this->_row = (int) $row;
185
* Returns the widget row number.
189
public function getRow()
195
* Sets the widget name.
197
* @param string $name
199
public function setName($name)
201
$this->_name = (string) $name;
205
* Returns the widget name.
209
public function getName()
215
* Returns the widget links.
219
public function getLinks()
221
return $this->_links;
225
* Returns the widget uwa url.
229
public function getUrl()
231
return (isset($this->_links['uwa']) ? $this->_links['uwa'] : '');
235
* Returns the widget iframe url.
239
public function getIframeUrl()
241
return (isset($this->_links['iframe']) ? $this->_links['iframe'] : '');
245
* Returns the widget script url.
249
public function getScriptUrl()
251
return (isset($this->_links['script']) ? $this->_links['script'] : '');
255
* Returns the widget stylesheet url.
259
public function getStylesheetUrl()
261
return (isset($this->_links['stylesheet']) ? $this->_links['stylesheet'] : '');
265
* Retrieves the widget skeleton identifier.
269
public function getSkeletonId()
271
return $this->_skeletonId;
275
* Retrieves the widget skeleton origin.
279
public function getSkeletonOrigin()
281
return $this->_skeletonOrigin;
285
* Sets the widget height.
287
* @param string $height
289
public function setHeight($height)
291
$this->_height = (string) $height;
295
* Returns the widget height.
299
public function getHeight()
301
return $this->_height;
305
* Returns the widget color.
309
public function getColor()
311
return $this->_color;
315
* Sets the tab title.
317
* @param string $title
319
public function setTitle($title)
321
$this->_title = $title;
325
* Returns the tab title.
329
public function getTitle()
331
return $this->_title;
335
* Sets the widget data.
339
public function setData(array $data)
341
$this->_data = $data;
345
* Returns the widget data.
349
public function getData()