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.
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
25 * @see Zend_Gdata_Extension
27 require_once 'Zend/Gdata/Extension.php';
30 * Represents the gCal:webContent element used by the Calendar data API
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
38 class Zend_Gdata_Calendar_Extension_WebContent extends Zend_Gdata_App_Extension
41 protected $_rootNamespace = 'gCal';
42 protected $_rootElement = 'webContent';
43 protected $_url = null;
44 protected $_height = null;
45 protected $_width = null;
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.
53 public function __construct($url = null, $height = null, $width = null)
55 $this->registerAllNamespaces(Zend_Gdata_Calendar::$namespaces);
56 parent::__construct();
58 $this->_height = $height;
59 $this->_width = $width;
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.
68 * @param DOMDocument $doc The DOMDocument used to construct DOMElements
69 * @return DOMElement The DOMElement representing this element and all
72 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
74 $element = parent::getDOM($doc, $majorVersion, $minorVersion);
75 if ($this->url != null) {
76 $element->setAttribute('url', $this->_url);
78 if ($this->height != null) {
79 $element->setAttribute('height', $this->_height);
81 if ($this->width != null) {
82 $element->setAttribute('width', $this->_width);
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
92 * @param DOMNode $attribute The DOMNode attribute needed to be handled
94 protected function takeAttributeFromDOM($attribute)
96 switch ($attribute->localName) {
98 $this->_url = $attribute->nodeValue;
101 $this->_height = $attribute->nodeValue;
104 $this->_width = $attribute->nodeValue;
107 parent::takeAttributeFromDOM($attribute);
112 * Get the value for this element's URL attribute.
114 * @return string The desired value for this attribute.
116 public function getURL()
122 * Set the value for this element's URL attribute.
124 * @param bool $value The desired value for this attribute.
125 * @return Zend_Gdata_Calendar_Extension_WebContent The element being modified.
127 public function setURL($value)
129 $this->_url = $value;
134 * Get the value for this element's height attribute.
136 * @return int The desired value for this attribute.
138 public function getHeight()
140 return $this->_height;
144 * Set the value for this element's height attribute.
146 * @param int $value The desired value for this attribute.
147 * @return Zend_Gdata_Calendar_Extension_WebContent The element being modified.
149 public function setHeight($value)
151 $this->_height = $value;
156 * Get the value for this element's height attribute.
158 * @return int The desired value for this attribute.
160 public function getWidth()
162 return $this->_width;
166 * Set the value for this element's height attribute.
168 * @param int $value The desired value for this attribute.
169 * @return Zend_Gdata_Calendar_Extension_WebContent The element being modified.
171 public function setWidth($value)
173 $this->_width = $value;