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