[ Index ] |
PHP Cross Reference of moodle-2.8 |
[Summary view] [Print] [Text view]
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 [email protected] so we can send you a copy immediately. 15 * 16 * @category Zend 17 * @package Zend_Gdata 18 * @subpackage Gdata 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 * @version $Id$ 22 */ 23 24 /** 25 * @see Zend_Gdata_Extension 26 */ 27 require_once 'Zend/Gdata/Extension.php'; 28 29 /** 30 * @see Zend_Gdata_Extension_EntryLink 31 */ 32 require_once 'Zend/Gdata/Extension/EntryLink.php'; 33 34 /** 35 * @see Zend_Gdata_Extension_OriginalEvent 36 */ 37 require_once 'Zend/Gdata/Extension/OriginalEvent.php'; 38 39 /** 40 * Data model class to represent an entry's recurrenceException 41 * 42 * @category Zend 43 * @package Zend_Gdata 44 * @subpackage Gdata 45 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) 46 * @license http://framework.zend.com/license/new-bsd New BSD License 47 */ 48 class Zend_Gdata_Extension_RecurrenceException extends Zend_Gdata_Extension 49 { 50 51 protected $_rootElement = 'recurrenceException'; 52 protected $_specialized = null; 53 protected $_entryLink = null; 54 protected $_originalEvent = null; 55 56 /** 57 * Constructs a new Zend_Gdata_Extension_RecurrenceException object. 58 * @param bool $specialized (optional) Whether this is a specialized exception or not. 59 * @param Zend_Gdata_EntryLink (optional) An Event entry with details about the exception. 60 * @param Zend_Gdata_OriginalEvent (optional) The origianl recurrent event this is an exeption to. 61 */ 62 public function __construct($specialized = null, $entryLink = null, 63 $originalEvent = null) 64 { 65 parent::__construct(); 66 $this->_specialized = $specialized; 67 $this->_entryLink = $entryLink; 68 $this->_originalEvent = $originalEvent; 69 } 70 71 /** 72 * Retrieves a DOMElement which corresponds to this element and all 73 * child properties. This is used to build an entry back into a DOM 74 * and eventually XML text for sending to the server upon updates, or 75 * for application storage/persistence. 76 * 77 * @param DOMDocument $doc The DOMDocument used to construct DOMElements 78 * @return DOMElement The DOMElement representing this element and all 79 * child properties. 80 */ 81 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) 82 { 83 $element = parent::getDOM($doc, $majorVersion, $minorVersion); 84 if ($this->_specialized !== null) { 85 $element->setAttribute('specialized', ($this->_specialized ? "true" : "false")); 86 } 87 if ($this->_entryLink !== null) { 88 $element->appendChild($this->_entryLink->getDOM($element->ownerDocument)); 89 } 90 if ($this->_originalEvent !== null) { 91 $element->appendChild($this->_originalEvent->getDOM($element->ownerDocument)); 92 } 93 return $element; 94 } 95 96 /** 97 * Given a DOMNode representing an attribute, tries to map the data into 98 * instance members. If no mapping is defined, the name and value are 99 * stored in an array. 100 * 101 * @param DOMNode $attribute The DOMNode attribute needed to be handled 102 */ 103 protected function takeAttributeFromDOM($attribute) 104 { 105 switch ($attribute->localName) { 106 case 'specialized': 107 if ($attribute->nodeValue == "true") { 108 $this->_specialized = true; 109 } 110 else if ($attribute->nodeValue == "false") { 111 $this->_specialized = false; 112 } 113 else { 114 throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for gCal:selected#value."); 115 } 116 break; 117 default: 118 parent::takeAttributeFromDOM($attribute); 119 } 120 } 121 122 /** 123 * Creates individual Entry objects of the appropriate type and 124 * stores them as members of this entry based upon DOM data. 125 * 126 * @param DOMNode $child The DOMNode to process 127 */ 128 protected function takeChildFromDOM($child) 129 { 130 $absoluteNodeName = $child->namespaceURI . ':' . $child->localName; 131 switch ($absoluteNodeName) { 132 case $this->lookupNamespace('gd') . ':' . 'entryLink': 133 $entryLink = new Zend_Gdata_Extension_EntryLink(); 134 $entryLink->transferFromDOM($child); 135 $this->_entryLink = $entryLink; 136 break; 137 case $this->lookupNamespace('gd') . ':' . 'originalEvent': 138 $originalEvent = new Zend_Gdata_Extension_OriginalEvent(); 139 $originalEvent->transferFromDOM($child); 140 $this->_originalEvent = $originalEvent; 141 break; 142 default: 143 parent::takeChildFromDOM($child); 144 break; 145 } 146 } 147 148 /** 149 * Get the value for this element's Specialized attribute. 150 * 151 * @return bool The requested attribute. 152 */ 153 public function getSpecialized() 154 { 155 return $this->_specialized; 156 } 157 158 /** 159 * Set the value for this element's Specialized attribute. 160 * 161 * @param bool $value The desired value for this attribute. 162 * @return Zend_Gdata_Extension_RecurrenceException The element being modified. 163 */ 164 public function setSpecialized($value) 165 { 166 $this->_specialized = $value; 167 return $this; 168 } 169 170 /** 171 * Get the value for this element's EntryLink attribute. 172 * 173 * @return Zend_Gdata_Extension_EntryLink The requested attribute. 174 */ 175 public function getEntryLink() 176 { 177 return $this->_entryLink; 178 } 179 180 /** 181 * Set the value for this element's EntryLink attribute. 182 * 183 * @param Zend_Gdata_Extension_EntryLink $value The desired value for this attribute. 184 * @return Zend_Gdata_Extension_RecurrenceException The element being modified. 185 */ 186 public function setEntryLink($value) 187 { 188 $this->_entryLink = $value; 189 return $this; 190 } 191 192 /** 193 * Get the value for this element's Specialized attribute. 194 * 195 * @return Zend_Gdata_Extension_OriginalEvent The requested attribute. 196 */ 197 public function getOriginalEvent() 198 { 199 return $this->_originalEvent; 200 } 201 202 /** 203 * Set the value for this element's Specialized attribute. 204 * 205 * @param Zend_Gdata_Extension_OriginalEvent $value The desired value for this attribute. 206 * @return Zend_Gdata_Extension_RecurrenceException The element being modified. 207 */ 208 public function setOriginalEvent($value) 209 { 210 $this->_originalEvent = $value; 211 return $this; 212 } 213 214 } 215
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:29:05 2014 | Cross-referenced by PHPXref 0.7.1 |