|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00027 require_once 'Zend/Gdata/Entry.php'; 00028 00032 require_once 'Zend/Gdata/Gbase/Extension/BaseAttribute.php'; 00033 00045 class Zend_Gdata_Gbase_Entry extends Zend_Gdata_Entry 00046 { 00047 00053 protected $_entryClassName = 'Zend_Gdata_Gbase_Entry'; 00054 00060 protected $_baseAttributes = array(); 00061 00066 public function __construct($element = null) 00067 { 00068 $this->registerAllNamespaces(Zend_Gdata_Gbase::$namespaces); 00069 parent::__construct($element); 00070 } 00071 00081 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) 00082 { 00083 $element = parent::getDOM($doc, $majorVersion, $minorVersion); 00084 foreach ($this->_baseAttributes as $baseAttribute) { 00085 $element->appendChild($baseAttribute->getDOM($element->ownerDocument)); 00086 } 00087 return $element; 00088 } 00089 00096 protected function takeChildFromDOM($child) 00097 { 00098 $absoluteNodeName = $child->namespaceURI . ':' . $child->localName; 00099 00100 if (strstr($absoluteNodeName, $this->lookupNamespace('g') . ':')) { 00101 $baseAttribute = new Zend_Gdata_Gbase_Extension_BaseAttribute(); 00102 $baseAttribute->transferFromDOM($child); 00103 $this->_baseAttributes[] = $baseAttribute; 00104 } else { 00105 parent::takeChildFromDOM($child); 00106 } 00107 } 00108 00114 public function getItemType() 00115 { 00116 $itemType = $this->getGbaseAttribute('item_type'); 00117 if (is_object($itemType[0])) { 00118 return $itemType[0]; 00119 } else { 00120 return null; 00121 } 00122 } 00123 00128 public function getGbaseAttributes() { 00129 return $this->_baseAttributes; 00130 } 00131 00138 public function getGbaseAttribute($name) 00139 { 00140 $matches = array(); 00141 for ($i = 0; $i < count($this->_baseAttributes); $i++) { 00142 $baseAttribute = $this->_baseAttributes[$i]; 00143 if ($baseAttribute->rootElement == $name && 00144 $baseAttribute->rootNamespaceURI == $this->lookupNamespace('g')) { 00145 $matches[] = &$this->_baseAttributes[$i]; 00146 } 00147 } 00148 return $matches; 00149 } 00150 00151 }