~cdparra/gelee/trunk

« back to all changes in this revision

Viewing changes to webui/ecosystem/workspace/ecosystem/uwa-server-original/server/lib/Exposition/Netvibes/Widget.php

  • Committer: parra
  • Date: 2010-03-15 02:39:02 UTC
  • Revision ID: svn-v4:ac5bba68-f036-4e09-846e-8f32731cc928:trunk/gelee:1433
merged gelee at svn

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<?php
 
2
/**
 
3
 * Copyright Netvibes 2006-2009.
 
4
 * This file is part of Exposition PHP Lib.
 
5
 * 
 
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.
 
10
 * 
 
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.
 
15
 * 
 
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/>.
 
18
 */
 
19
 
 
20
 
 
21
/**
 
22
 * Netvibes Widget descriptor.
 
23
 */
 
24
class Netvibes_Widget
 
25
{
 
26
    /**
 
27
     * Widget identifier.
 
28
     *
 
29
     * @var int
 
30
     */
 
31
    protected $_id;
 
32
 
 
33
    /**
 
34
     * Widget column.
 
35
     *
 
36
     * @var int
 
37
     */
 
38
    protected $_col;
 
39
 
 
40
    /**
 
41
     * Widget row.
 
42
     *
 
43
     * @var int
 
44
     */
 
45
    protected $_row;
 
46
 
 
47
    /**
 
48
     * Widget name.
 
49
     *
 
50
     * @var string
 
51
     */
 
52
    protected $_name;
 
53
 
 
54
    /**
 
55
     * Widget title.
 
56
     *
 
57
     * @var string
 
58
     */
 
59
    protected $_title;
 
60
 
 
61
    /**
 
62
     * Widget data.
 
63
     *
 
64
     * @var array
 
65
     */
 
66
    protected $_data;
 
67
 
 
68
    /**
 
69
     * Widget height.
 
70
     *
 
71
     * @var int
 
72
     */
 
73
    protected $_height;
 
74
    
 
75
    /**
 
76
     * Widget color.
 
77
     *
 
78
     * @var int
 
79
     */
 
80
    protected $_color;
 
81
 
 
82
    /**
 
83
     * Widget skeleton id.
 
84
     *
 
85
     * @var string
 
86
     */
 
87
    protected $_skeletonId;
 
88
 
 
89
    /**
 
90
     * Widget skeleton origin.
 
91
     *
 
92
     * @var string
 
93
     */
 
94
    protected $_skeletonOrigin;
 
95
 
 
96
    /**
 
97
     * Widget links.
 
98
     *
 
99
     * @var string
 
100
     */
 
101
    protected $_links;
 
102
 
 
103
    /**
 
104
     * Constructor from a XML element.
 
105
     *
 
106
     * @param SimpleXMLElement $xml
 
107
     */
 
108
    public function __construct($xml)
 
109
    {
 
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;
 
118
        
 
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'];
 
125
            }
 
126
        }
 
127
        
 
128
        $this->_data = array();
 
129
        foreach ($xml->data as $data) {
 
130
            $this->_data[(string) $data['name']] = (string) $data;
 
131
        }
 
132
    }
 
133
 
 
134
    /**
 
135
     * Sets the widget identifier.
 
136
     *
 
137
     * @param int $id
 
138
     */
 
139
    public function setId($id)
 
140
    {
 
141
        $this->_id = (int) $id;
 
142
    }
 
143
     
 
144
    /**
 
145
     * Returns the widget identifier.
 
146
     *
 
147
     * @return int
 
148
     */
 
149
    public function getId()
 
150
    {
 
151
        return $this->_id;
 
152
    }
 
153
 
 
154
    /**
 
155
     * Sets the widget column number.
 
156
     *
 
157
     * @param int $col
 
158
     */
 
159
    public function setCol($col)
 
160
    {
 
161
        $this->_col = (int) $col;
 
162
    }
 
163
     
 
164
    /**
 
165
     * Returns the widget column number.
 
166
     *
 
167
     * @return int
 
168
     */
 
169
    public function getCol()
 
170
    {
 
171
        return $this->_col;
 
172
    }
 
173
 
 
174
    /**
 
175
     * Sets the widget row number.
 
176
     *
 
177
     * @param int $row
 
178
     */
 
179
    public function setRow($row)
 
180
    {
 
181
        $this->_row = (int) $row;
 
182
    }
 
183
     
 
184
    /**
 
185
     * Returns the widget row number.
 
186
     *
 
187
     * @return int
 
188
     */
 
189
    public function getRow()
 
190
    {
 
191
        return $this->_row;
 
192
    }
 
193
 
 
194
    /**
 
195
     * Sets the widget name.
 
196
     *
 
197
     * @param string $name
 
198
     */
 
199
    public function setName($name)
 
200
    {
 
201
        $this->_name = (string) $name;
 
202
    }
 
203
     
 
204
    /**
 
205
     * Returns the widget name.
 
206
     *
 
207
     * @return string
 
208
     */
 
209
    public function getName()
 
210
    {
 
211
        return $this->_name;
 
212
    }
 
213
 
 
214
    /**
 
215
     * Returns the widget links.
 
216
     *
 
217
     * @return string
 
218
     */
 
219
    public function getLinks()
 
220
    {
 
221
        return $this->_links;
 
222
    }
 
223
 
 
224
    /**
 
225
     * Returns the widget uwa url.
 
226
     *
 
227
     * @return string
 
228
     */
 
229
    public function getUrl()
 
230
    {
 
231
        return (isset($this->_links['uwa']) ? $this->_links['uwa'] : '');
 
232
    }
 
233
 
 
234
    /**
 
235
     * Returns the widget iframe url.
 
236
     *
 
237
     * @return string
 
238
     */
 
239
    public function getIframeUrl()
 
240
    {
 
241
        return (isset($this->_links['iframe']) ? $this->_links['iframe'] : '');
 
242
    }
 
243
 
 
244
    /**
 
245
     * Returns the widget script url.
 
246
     *
 
247
     * @return string
 
248
     */
 
249
    public function getScriptUrl()
 
250
    {
 
251
        return (isset($this->_links['script']) ? $this->_links['script'] : '');
 
252
    }
 
253
 
 
254
    /**
 
255
     * Returns the widget stylesheet url.
 
256
     *
 
257
     * @return string
 
258
     */
 
259
    public function getStylesheetUrl()
 
260
    {
 
261
        return (isset($this->_links['stylesheet']) ? $this->_links['stylesheet'] : '');
 
262
    }
 
263
 
 
264
    /**
 
265
     * Retrieves the widget skeleton identifier.
 
266
     *
 
267
     * @return string
 
268
     */
 
269
    public function getSkeletonId()
 
270
    {
 
271
        return $this->_skeletonId;
 
272
    }
 
273
 
 
274
    /**
 
275
     * Retrieves the widget skeleton origin.
 
276
     *
 
277
     * @return string
 
278
     */
 
279
    public function getSkeletonOrigin()
 
280
    {
 
281
        return $this->_skeletonOrigin;
 
282
    }
 
283
 
 
284
    /**
 
285
     * Sets the widget height.
 
286
     *
 
287
     * @param string $height
 
288
     */
 
289
    public function setHeight($height)
 
290
    {
 
291
        $this->_height = (string) $height;
 
292
    }
 
293
     
 
294
    /**
 
295
     * Returns the widget height.
 
296
     *
 
297
     * @return string
 
298
     */
 
299
    public function getHeight()
 
300
    {
 
301
        return $this->_height;
 
302
    }
 
303
    
 
304
    /**
 
305
     * Returns the widget color.
 
306
     *
 
307
     * @return string
 
308
     */
 
309
    public function getColor()
 
310
    {
 
311
        return $this->_color;
 
312
    }
 
313
    
 
314
    /**
 
315
     * Sets the tab title.
 
316
     *
 
317
     * @param string $title
 
318
     */
 
319
    public function setTitle($title)
 
320
    {
 
321
        $this->_title = $title;
 
322
    }
 
323
 
 
324
    /**
 
325
     * Returns the tab title.
 
326
     *
 
327
     * @return string
 
328
     */
 
329
    public function getTitle()
 
330
    {
 
331
        return $this->_title;
 
332
    }
 
333
 
 
334
    /**
 
335
     * Sets the widget data.
 
336
     *
 
337
     * @param array $data
 
338
     */
 
339
    public function setData(array $data)
 
340
    {
 
341
        $this->_data = $data;
 
342
    }
 
343
 
 
344
    /**
 
345
     * Returns the widget data.
 
346
     *
 
347
     * @return array
 
348
     */
 
349
    public function getData()
 
350
    {
 
351
        return $this->_data;
 
352
    }
 
353
}