]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - Zend/Gdata/Calendar/Extension/WebContent.php
Release 6.5.0
[Github/sugarcrm.git] / Zend / Gdata / Calendar / Extension / WebContent.php
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_Gdata
18  * @subpackage Calendar
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
22  */
23
24 /**
25  * @see Zend_Gdata_Extension
26  */
27 require_once 'Zend/Gdata/Extension.php';
28
29 /**
30  * Represents the gCal:webContent element used by the Calendar data API
31  *
32  * @category   Zend
33  * @package    Zend_Gdata
34  * @subpackage Calendar
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_Gdata_Calendar_Extension_WebContent extends Zend_Gdata_App_Extension
39 {
40
41     protected $_rootNamespace = 'gCal';
42     protected $_rootElement = 'webContent';
43     protected $_url = null;
44     protected $_height = null;
45     protected $_width = null;
46
47     /**
48      * Constructs a new Zend_Gdata_Calendar_Extension_WebContent object.
49      * @param string $url (optional) The value for this element's URL attribute.
50      * @param string $height (optional) The value for this element's height attribute.
51      * @param string $width (optional) The value for this element's width attribute.
52      */
53     public function __construct($url = null, $height = null, $width = null)
54     {
55         $this->registerAllNamespaces(Zend_Gdata_Calendar::$namespaces);
56         parent::__construct();
57         $this->_url = $url;
58         $this->_height = $height;
59         $this->_width = $width;
60     }
61
62     /**
63      * Retrieves a DOMElement which corresponds to this element and all
64      * child properties.  This is used to build an entry back into a DOM
65      * and eventually XML text for sending to the server upon updates, or
66      * for application storage/persistence.
67      *
68      * @param DOMDocument $doc The DOMDocument used to construct DOMElements
69      * @return DOMElement The DOMElement representing this element and all
70      * child properties.
71      */
72     public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
73     {
74         $element = parent::getDOM($doc, $majorVersion, $minorVersion);
75         if ($this->url != null) {
76             $element->setAttribute('url', $this->_url);
77         }
78         if ($this->height != null) {
79             $element->setAttribute('height', $this->_height);
80         }
81         if ($this->width != null) {
82             $element->setAttribute('width', $this->_width);
83         }
84         return $element;
85     }
86
87     /**
88      * Given a DOMNode representing an attribute, tries to map the data into
89      * instance members.  If no mapping is defined, the name and value are
90      * stored in an array.
91      *
92      * @param DOMNode $attribute The DOMNode attribute needed to be handled
93      */
94     protected function takeAttributeFromDOM($attribute)
95     {
96         switch ($attribute->localName) {
97                 case 'url':
98                         $this->_url = $attribute->nodeValue;
99                         break;
100                 case 'height':
101                         $this->_height = $attribute->nodeValue;
102                         break;
103                 case 'width':
104                         $this->_width = $attribute->nodeValue;
105                         break;
106         default:
107             parent::takeAttributeFromDOM($attribute);
108         }
109     }
110
111     /**
112      * Get the value for this element's URL attribute.
113      *
114      * @return string The desired value for this attribute.
115      */
116     public function getURL()
117     {
118         return $this->_url;
119     }
120
121     /**
122      * Set the value for this element's URL attribute.
123      *
124      * @param bool $value The desired value for this attribute.
125      * @return Zend_Gdata_Calendar_Extension_WebContent The element being modified.
126      */
127     public function setURL($value)
128     {
129         $this->_url = $value;
130         return $this;
131     }
132
133     /**
134      * Get the value for this element's height attribute.
135      *
136      * @return int The desired value for this attribute.
137      */
138     public function getHeight()
139     {
140         return $this->_height;
141     }
142
143     /**
144      * Set the value for this element's height attribute.
145      *
146      * @param int $value The desired value for this attribute.
147      * @return Zend_Gdata_Calendar_Extension_WebContent The element being modified.
148      */
149     public function setHeight($value)
150     {
151         $this->_height = $value;
152         return $this;
153     }
154
155     /**
156      * Get the value for this element's height attribute.
157      *
158      * @return int The desired value for this attribute.
159      */
160     public function getWidth()
161     {
162         return $this->_width;
163     }
164
165     /**
166      * Set the value for this element's height attribute.
167      *
168      * @param int $value The desired value for this attribute.
169      * @return Zend_Gdata_Calendar_Extension_WebContent The element being modified.
170      */
171     public function setWidth($value)
172     {
173         $this->_width = $value;
174         return $this;
175     }
176
177 }