Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/lib/zend/Zend/Gdata/Feed.php
Go to the documentation of this file.
00001 <?php
00002 
00027 require_once 'Zend/Gdata.php';
00028 
00032 require_once 'Zend/Gdata/App/Feed.php';
00033 
00037 require_once 'Zend/Gdata/Entry.php';
00038 
00042 require_once 'Zend/Gdata/Extension/OpenSearchTotalResults.php';
00043 
00047 require_once 'Zend/Gdata/Extension/OpenSearchStartIndex.php';
00048 
00052 require_once 'Zend/Gdata/Extension/OpenSearchItemsPerPage.php';
00053 
00063 class Zend_Gdata_Feed extends Zend_Gdata_App_Feed
00064 {
00065 
00071     protected $_entryClassName = 'Zend_Gdata_Entry';
00072 
00078     protected $_totalResults = null;
00079 
00085     protected $_startIndex = null;
00086 
00092     protected $_itemsPerPage = null;
00093 
00094     public function __construct($element = null)
00095     {
00096         $this->registerAllNamespaces(Zend_Gdata::$namespaces);
00097         parent::__construct($element);
00098     }
00099 
00100     public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
00101     {
00102         $element = parent::getDOM($doc, $majorVersion, $minorVersion);
00103         if ($this->_totalResults != null) {
00104             $element->appendChild($this->_totalResults->getDOM($element->ownerDocument));
00105         }
00106         if ($this->_startIndex != null) {
00107             $element->appendChild($this->_startIndex->getDOM($element->ownerDocument));
00108         }
00109         if ($this->_itemsPerPage != null) {
00110             $element->appendChild($this->_itemsPerPage->getDOM($element->ownerDocument));
00111         }
00112 
00113         // ETags are special. We only support them in protocol >= 2.X.
00114         // This will be duplicated by the HTTP ETag header.
00115         if ($majorVersion >= 2) {
00116             if ($this->_etag != null) {
00117                 $element->setAttributeNS($this->lookupNamespace('gd'),
00118                                          'gd:etag',
00119                                          $this->_etag);
00120             }
00121         }
00122 
00123         return $element;
00124     }
00125 
00132     protected function takeChildFromDOM($child)
00133     {
00134         $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
00135         switch ($absoluteNodeName) {
00136         case $this->lookupNamespace('openSearch') . ':' . 'totalResults':
00137             $totalResults = new Zend_Gdata_Extension_OpenSearchTotalResults();
00138             $totalResults->transferFromDOM($child);
00139             $this->_totalResults = $totalResults;
00140             break;
00141         case $this->lookupNamespace('openSearch') . ':' . 'startIndex':
00142             $startIndex = new Zend_Gdata_Extension_OpenSearchStartIndex();
00143             $startIndex->transferFromDOM($child);
00144             $this->_startIndex = $startIndex;
00145             break;
00146         case $this->lookupNamespace('openSearch') . ':' . 'itemsPerPage':
00147             $itemsPerPage = new Zend_Gdata_Extension_OpenSearchItemsPerPage();
00148             $itemsPerPage->transferFromDOM($child);
00149             $this->_itemsPerPage = $itemsPerPage;
00150             break;
00151         default:
00152             parent::takeChildFromDOM($child);
00153             break;
00154         }
00155     }
00156 
00164     protected function takeAttributeFromDOM($attribute)
00165     {
00166         switch ($attribute->localName) {
00167         case 'etag':
00168             // ETags are special, since they can be conveyed by either the
00169             // HTTP ETag header or as an XML attribute.
00170             $etag = $attribute->nodeValue;
00171             if ($this->_etag === null) {
00172                 $this->_etag = $etag;
00173             }
00174             elseif ($this->_etag != $etag) {
00175                 require_once('Zend/Gdata/App/IOException.php');
00176                 throw new Zend_Gdata_App_IOException("ETag mismatch");
00177             }
00178             break;
00179         default:
00180             parent::takeAttributeFromDOM($attribute);
00181             break;
00182         }
00183     }
00184 
00192     function setTotalResults($value) {
00193         $this->_totalResults = $value;
00194         return $this;
00195     }
00196 
00203     function getTotalResults() {
00204         return $this->_totalResults;
00205     }
00206 
00214     function setStartIndex($value) {
00215         $this->_startIndex = $value;
00216         return $this;
00217     }
00218 
00225     function getStartIndex() {
00226         return $this->_startIndex;
00227     }
00228 
00236     function setItemsPerPage($value) {
00237         $this->_itemsPerPage = $value;
00238         return $this;
00239     }
00240 
00247     function getItemsPerPage() {
00248         return $this->_itemsPerPage;
00249     }
00250 
00251 }
 All Data Structures Namespaces Files Functions Variables Enumerations