[ 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 * Data model class to represent a location (gd:where element) 36 * 37 * @category Zend 38 * @package Zend_Gdata 39 * @subpackage Gdata 40 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) 41 * @license http://framework.zend.com/license/new-bsd New BSD License 42 */ 43 class Zend_Gdata_Extension_Where extends Zend_Gdata_Extension 44 { 45 46 protected $_rootElement = 'where'; 47 protected $_label = null; 48 protected $_rel = null; 49 protected $_valueString = null; 50 protected $_entryLink = null; 51 52 public function __construct($valueString = null, $label = null, $rel = null, $entryLink = null) 53 { 54 parent::__construct(); 55 $this->_valueString = $valueString; 56 $this->_label = $label; 57 $this->_rel = $rel; 58 $this->_entryLink = $entryLink; 59 } 60 61 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) 62 { 63 $element = parent::getDOM($doc, $majorVersion, $minorVersion); 64 if ($this->_label !== null) { 65 $element->setAttribute('label', $this->_label); 66 } 67 if ($this->_rel !== null) { 68 $element->setAttribute('rel', $this->_rel); 69 } 70 if ($this->_valueString !== null) { 71 $element->setAttribute('valueString', $this->_valueString); 72 } 73 if ($this->entryLink !== null) { 74 $element->appendChild($this->_entryLink->getDOM($element->ownerDocument)); 75 } 76 return $element; 77 } 78 79 protected function takeAttributeFromDOM($attribute) 80 { 81 switch ($attribute->localName) { 82 case 'label': 83 $this->_label = $attribute->nodeValue; 84 break; 85 case 'rel': 86 $this->_rel = $attribute->nodeValue; 87 break; 88 case 'valueString': 89 $this->_valueString = $attribute->nodeValue; 90 break; 91 default: 92 parent::takeAttributeFromDOM($attribute); 93 } 94 } 95 96 /** 97 * Creates individual Entry objects of the appropriate type and 98 * stores them in the $_entry array based upon DOM data. 99 * 100 * @param DOMNode $child The DOMNode to process 101 */ 102 protected function takeChildFromDOM($child) 103 { 104 $absoluteNodeName = $child->namespaceURI . ':' . $child->localName; 105 switch ($absoluteNodeName) { 106 case $this->lookupNamespace('gd') . ':' . 'entryLink': 107 $entryLink = new Zend_Gdata_Extension_EntryLink(); 108 $entryLink->transferFromDOM($child); 109 $this->_entryLink = $entryLink; 110 break; 111 default: 112 parent::takeChildFromDOM($child); 113 break; 114 } 115 } 116 117 public function __toString() 118 { 119 if ($this->_valueString != null) { 120 return $this->_valueString; 121 } 122 else { 123 return parent::__toString(); 124 } 125 } 126 127 public function getLabel() 128 { 129 return $this->_label; 130 } 131 132 public function setLabel($value) 133 { 134 $this->_label = $value; 135 return $this; 136 } 137 138 public function getRel() 139 { 140 return $this->_rel; 141 } 142 143 public function setRel($value) 144 { 145 $this->_rel = $value; 146 return $this; 147 } 148 149 public function getValueString() 150 { 151 return $this->_valueString; 152 } 153 154 public function setValueString($value) 155 { 156 $this->_valueString = $value; 157 return $this; 158 } 159 160 public function getEntryLink() 161 { 162 return $this->_entryLink; 163 } 164 165 public function setEntryLink($value) 166 { 167 $this->_entryLink = $value; 168 return $this; 169 } 170 171 }
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 |