File indexing completed on 2025-03-02 05:29:26
0001 <?php 0002 0003 /** 0004 * Zend Framework 0005 * 0006 * LICENSE 0007 * 0008 * This source file is subject to the new BSD license that is bundled 0009 * with this package in the file LICENSE.txt. 0010 * It is also available through the world-wide-web at this URL: 0011 * http://framework.zend.com/license/new-bsd 0012 * If you did not receive a copy of the license and are unable to 0013 * obtain it through the world-wide-web, please send an email 0014 * to license@zend.com so we can send you a copy immediately. 0015 * 0016 * @category Zend 0017 * @package Zend_Gdata 0018 * @subpackage Calendar 0019 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0020 * @license http://framework.zend.com/license/new-bsd New BSD License 0021 * @version $Id$ 0022 */ 0023 0024 /** 0025 * @see Zend_Gdata_Extension 0026 */ 0027 // require_once 'Zend/Gdata/Extension.php'; 0028 0029 /** 0030 * Represents the gCal:webContent element used by the Calendar data API 0031 * 0032 * @category Zend 0033 * @package Zend_Gdata 0034 * @subpackage Calendar 0035 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0036 * @license http://framework.zend.com/license/new-bsd New BSD License 0037 */ 0038 class Zend_Gdata_Calendar_Extension_WebContent extends Zend_Gdata_App_Extension 0039 { 0040 0041 protected $_rootNamespace = 'gCal'; 0042 protected $_rootElement = 'webContent'; 0043 protected $_url = null; 0044 protected $_height = null; 0045 protected $_width = null; 0046 0047 /** 0048 * Constructs a new Zend_Gdata_Calendar_Extension_WebContent object. 0049 * @param string $url (optional) The value for this element's URL attribute. 0050 * @param string $height (optional) The value for this element's height attribute. 0051 * @param string $width (optional) The value for this element's width attribute. 0052 */ 0053 public function __construct($url = null, $height = null, $width = null) 0054 { 0055 $this->registerAllNamespaces(Zend_Gdata_Calendar::$namespaces); 0056 parent::__construct(); 0057 $this->_url = $url; 0058 $this->_height = $height; 0059 $this->_width = $width; 0060 } 0061 0062 /** 0063 * Retrieves a DOMElement which corresponds to this element and all 0064 * child properties. This is used to build an entry back into a DOM 0065 * and eventually XML text for sending to the server upon updates, or 0066 * for application storage/persistence. 0067 * 0068 * @param DOMDocument $doc The DOMDocument used to construct DOMElements 0069 * @return DOMElement The DOMElement representing this element and all 0070 * child properties. 0071 */ 0072 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) 0073 { 0074 $element = parent::getDOM($doc, $majorVersion, $minorVersion); 0075 if ($this->url != null) { 0076 $element->setAttribute('url', $this->_url); 0077 } 0078 if ($this->height != null) { 0079 $element->setAttribute('height', $this->_height); 0080 } 0081 if ($this->width != null) { 0082 $element->setAttribute('width', $this->_width); 0083 } 0084 return $element; 0085 } 0086 0087 /** 0088 * Given a DOMNode representing an attribute, tries to map the data into 0089 * instance members. If no mapping is defined, the name and value are 0090 * stored in an array. 0091 * 0092 * @param DOMNode $attribute The DOMNode attribute needed to be handled 0093 */ 0094 protected function takeAttributeFromDOM($attribute) 0095 { 0096 switch ($attribute->localName) { 0097 case 'url': 0098 $this->_url = $attribute->nodeValue; 0099 break; 0100 case 'height': 0101 $this->_height = $attribute->nodeValue; 0102 break; 0103 case 'width': 0104 $this->_width = $attribute->nodeValue; 0105 break; 0106 default: 0107 parent::takeAttributeFromDOM($attribute); 0108 } 0109 } 0110 0111 /** 0112 * Get the value for this element's URL attribute. 0113 * 0114 * @return string The desired value for this attribute. 0115 */ 0116 public function getURL() 0117 { 0118 return $this->_url; 0119 } 0120 0121 /** 0122 * Set the value for this element's URL attribute. 0123 * 0124 * @param bool $value The desired value for this attribute. 0125 * @return Zend_Gdata_Calendar_Extension_WebContent The element being modified. 0126 */ 0127 public function setURL($value) 0128 { 0129 $this->_url = $value; 0130 return $this; 0131 } 0132 0133 /** 0134 * Get the value for this element's height attribute. 0135 * 0136 * @return int The desired value for this attribute. 0137 */ 0138 public function getHeight() 0139 { 0140 return $this->_height; 0141 } 0142 0143 /** 0144 * Set the value for this element's height attribute. 0145 * 0146 * @param int $value The desired value for this attribute. 0147 * @return Zend_Gdata_Calendar_Extension_WebContent The element being modified. 0148 */ 0149 public function setHeight($value) 0150 { 0151 $this->_height = $value; 0152 return $this; 0153 } 0154 0155 /** 0156 * Get the value for this element's height attribute. 0157 * 0158 * @return int The desired value for this attribute. 0159 */ 0160 public function getWidth() 0161 { 0162 return $this->_width; 0163 } 0164 0165 /** 0166 * Set the value for this element's height attribute. 0167 * 0168 * @param int $value The desired value for this attribute. 0169 * @return Zend_Gdata_Calendar_Extension_WebContent The element being modified. 0170 */ 0171 public function setWidth($value) 0172 { 0173 $this->_width = $value; 0174 return $this; 0175 } 0176 0177 }