[ 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 Gbase 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_Entry 26 */ 27 require_once 'Zend/Gdata/Entry.php'; 28 29 /** 30 * @see Zend_Gdata_Gbase_Extension_BaseAttribute 31 */ 32 require_once 'Zend/Gdata/Gbase/Extension/BaseAttribute.php'; 33 34 /** 35 * Base class for working with Google Base entries. 36 * 37 * @link http://code.google.com/apis/base/ 38 * 39 * @category Zend 40 * @package Zend_Gdata 41 * @subpackage Gbase 42 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) 43 * @license http://framework.zend.com/license/new-bsd New BSD License 44 */ 45 class Zend_Gdata_Gbase_Entry extends Zend_Gdata_Entry 46 { 47 48 /** 49 * Name of the base class for Google Base entries 50 * 51 * var @string 52 */ 53 protected $_entryClassName = 'Zend_Gdata_Gbase_Entry'; 54 55 /** 56 * Google Base attribute elements in the 'g' namespace 57 * 58 * @var array 59 */ 60 protected $_baseAttributes = array(); 61 62 /** 63 * Constructs a new Zend_Gdata_Gbase_ItemEntry object. 64 * @param DOMElement $element (optional) The DOMElement on which to base this object. 65 */ 66 public function __construct($element = null) 67 { 68 $this->registerAllNamespaces(Zend_Gdata_Gbase::$namespaces); 69 parent::__construct($element); 70 } 71 72 /** 73 * Retrieves a DOMElement which corresponds to this element and all 74 * child properties. This is used to build an entry back into a DOM 75 * and eventually XML text 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 foreach ($this->_baseAttributes as $baseAttribute) { 85 $element->appendChild($baseAttribute->getDOM($element->ownerDocument)); 86 } 87 return $element; 88 } 89 90 /** 91 * Creates individual Entry objects of the appropriate type and 92 * stores them as members of this entry based upon DOM data. 93 * 94 * @param DOMNode $child The DOMNode to process 95 */ 96 protected function takeChildFromDOM($child) 97 { 98 $absoluteNodeName = $child->namespaceURI . ':' . $child->localName; 99 100 if (strstr($absoluteNodeName, $this->lookupNamespace('g') . ':')) { 101 $baseAttribute = new Zend_Gdata_Gbase_Extension_BaseAttribute(); 102 $baseAttribute->transferFromDOM($child); 103 $this->_baseAttributes[] = $baseAttribute; 104 } else { 105 parent::takeChildFromDOM($child); 106 } 107 } 108 109 /** 110 * Get the value of the itme_type 111 * 112 * @return Zend_Gdata_Gbase_Extension_ItemType The requested object. 113 */ 114 public function getItemType() 115 { 116 $itemType = $this->getGbaseAttribute('item_type'); 117 if (is_object($itemType[0])) { 118 return $itemType[0]; 119 } else { 120 return null; 121 } 122 } 123 124 /** 125 * Return all the Base attributes 126 * @return Zend_Gdata_Gbase_Extension_BaseAttribute 127 */ 128 public function getGbaseAttributes() { 129 return $this->_baseAttributes; 130 } 131 132 /** 133 * Return an array of Base attributes that match the given attribute name 134 * 135 * @param string $name The name of the Base attribute to look for 136 * @return array $matches Array that contains the matching list of Base attributes 137 */ 138 public function getGbaseAttribute($name) 139 { 140 $matches = array(); 141 for ($i = 0; $i < count($this->_baseAttributes); $i++) { 142 $baseAttribute = $this->_baseAttributes[$i]; 143 if ($baseAttribute->rootElement == $name && 144 $baseAttribute->rootNamespaceURI == $this->lookupNamespace('g')) { 145 $matches[] = &$this->_baseAttributes[$i]; 146 } 147 } 148 return $matches; 149 } 150 151 }
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 |