Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/lib/zend/Zend/Gdata/App/Entry.php
Go to the documentation of this file.
00001 <?php
00002 
00027 require_once 'Zend/Gdata/App/FeedEntryParent.php';
00028 
00032 require_once 'Zend/Gdata/App/Extension/Content.php';
00033 
00037 require_once 'Zend/Gdata/App/Extension/Edited.php';
00038 
00042 require_once 'Zend/Gdata/App/Extension/Published.php';
00043 
00047 require_once 'Zend/Gdata/App/Extension/Source.php';
00048 
00052 require_once 'Zend/Gdata/App/Extension/Summary.php';
00053 
00057 require_once 'Zend/Gdata/App/Extension/Control.php';
00058 
00068 class Zend_Gdata_App_Entry extends Zend_Gdata_App_FeedEntryParent
00069 {
00070 
00076     protected $_rootElement = 'entry';
00077 
00083     protected $_entryClassName = 'Zend_Gdata_App_Entry';
00084 
00090     protected $_content = null;
00091 
00097     protected $_published = null;
00098 
00104     protected $_source = null;
00105 
00111     protected $_summary = null;
00112 
00118     protected $_control = null;
00119 
00125     protected $_edited = null;
00126 
00127     public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
00128     {
00129         $element = parent::getDOM($doc, $majorVersion, $minorVersion);
00130         if ($this->_content != null) {
00131             $element->appendChild($this->_content->getDOM($element->ownerDocument));
00132         }
00133         if ($this->_published != null) {
00134             $element->appendChild($this->_published->getDOM($element->ownerDocument));
00135         }
00136         if ($this->_source != null) {
00137             $element->appendChild($this->_source->getDOM($element->ownerDocument));
00138         }
00139         if ($this->_summary != null) {
00140             $element->appendChild($this->_summary->getDOM($element->ownerDocument));
00141         }
00142         if ($this->_control != null) {
00143             $element->appendChild($this->_control->getDOM($element->ownerDocument));
00144         }
00145         if ($this->_edited != null) {
00146             $element->appendChild($this->_edited->getDOM($element->ownerDocument));
00147         }
00148         return $element;
00149     }
00150 
00151     protected function takeChildFromDOM($child)
00152     {
00153         $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
00154         switch ($absoluteNodeName) {
00155         case $this->lookupNamespace('atom') . ':' . 'content':
00156             $content = new Zend_Gdata_App_Extension_Content();
00157             $content->transferFromDOM($child);
00158             $this->_content = $content;
00159             break;
00160         case $this->lookupNamespace('atom') . ':' . 'published':
00161             $published = new Zend_Gdata_App_Extension_Published();
00162             $published->transferFromDOM($child);
00163             $this->_published = $published;
00164             break;
00165         case $this->lookupNamespace('atom') . ':' . 'source':
00166             $source = new Zend_Gdata_App_Extension_Source();
00167             $source->transferFromDOM($child);
00168             $this->_source = $source;
00169             break;
00170         case $this->lookupNamespace('atom') . ':' . 'summary':
00171             $summary = new Zend_Gdata_App_Extension_Summary();
00172             $summary->transferFromDOM($child);
00173             $this->_summary = $summary;
00174             break;
00175         case $this->lookupNamespace('app') . ':' . 'control':
00176             $control = new Zend_Gdata_App_Extension_Control();
00177             $control->transferFromDOM($child);
00178             $this->_control = $control;
00179             break;
00180         case $this->lookupNamespace('app') . ':' . 'edited':
00181             $edited = new Zend_Gdata_App_Extension_Edited();
00182             $edited->transferFromDOM($child);
00183             $this->_edited = $edited;
00184             break;
00185         default:
00186             parent::takeChildFromDOM($child);
00187             break;
00188         }
00189     }
00190 
00204     public function save($uri = null, $className = null, $extraHeaders = array())
00205     {
00206         return $this->getService()->updateEntry($this,
00207                                                 $uri,
00208                                                 $className,
00209                                                 $extraHeaders);
00210     }
00211 
00220     public function delete()
00221     {
00222         $this->getService()->delete($this);
00223     }
00224 
00241     public function reload($uri = null, $className = null, $extraHeaders = array())
00242     {
00243         // Get URI
00244         $editLink = $this->getEditLink();
00245         if (($uri === null) && $editLink != null) {
00246             $uri = $editLink->getHref();
00247         }
00248 
00249         // Set classname to current class, if not otherwise set
00250         if ($className === null) {
00251             $className = get_class($this);
00252         }
00253 
00254         // Append ETag, if present (Gdata v2 and above, only) and doesn't
00255         // conflict with existing headers
00256         if ($this->_etag != null
00257                 && !array_key_exists('If-Match', $extraHeaders)
00258                 && !array_key_exists('If-None-Match', $extraHeaders)) {
00259             $extraHeaders['If-None-Match'] = $this->_etag;
00260         }
00261 
00262         // If an HTTP 304 status (Not Modified)is returned, then we return
00263         // null.
00264         $result = null;
00265         try {
00266             $result = $this->service->importUrl($uri, $className, $extraHeaders);
00267         } catch (Zend_Gdata_App_HttpException $e) {
00268             if ($e->getResponse()->getStatus() != '304')
00269                 throw $e;
00270         }
00271 
00272         return $result;
00273     }
00274 
00280     public function getContent()
00281     {
00282         return $this->_content;
00283     }
00284 
00291     public function setContent($value)
00292     {
00293         $this->_content = $value;
00294         return $this;
00295     }
00296 
00303     public function getPublished()
00304     {
00305         return $this->_published;
00306     }
00307 
00315     public function setPublished($value)
00316     {
00317         $this->_published = $value;
00318         return $this;
00319     }
00320 
00326     public function getSource()
00327     {
00328         return $this->_source;
00329     }
00330 
00337     public function setSource($value)
00338     {
00339         $this->_source = $value;
00340         return $this;
00341     }
00342 
00349     public function getSummary()
00350     {
00351         return $this->_summary;
00352     }
00353 
00361     public function setSummary($value)
00362     {
00363         $this->_summary = $value;
00364         return $this;
00365     }
00366 
00372     public function getControl()
00373     {
00374         return $this->_control;
00375     }
00376 
00383     public function setControl($value)
00384     {
00385         $this->_control = $value;
00386         return $this;
00387     }
00388 
00389 }
 All Data Structures Namespaces Files Functions Variables Enumerations