|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00027 require_once 'Zend/Gdata/Gbase/Entry.php'; 00028 00040 class Zend_Gdata_Gbase_ItemEntry extends Zend_Gdata_Gbase_Entry 00041 { 00047 protected $_entryClassName = 'Zend_Gdata_Gbase_ItemEntry'; 00048 00055 public function setItemType($value) 00056 { 00057 $this->addGbaseAttribute('item_type', $value, 'text'); 00058 return $this; 00059 } 00060 00071 public function addGbaseAttribute($name, $text, $type = null) { 00072 $newBaseAttribute = new Zend_Gdata_Gbase_Extension_BaseAttribute($name, $text, $type); 00073 $this->_baseAttributes[] = $newBaseAttribute; 00074 return $this; 00075 } 00076 00083 public function removeGbaseAttribute($baseAttribute) { 00084 $baseAttributes = $this->_baseAttributes; 00085 for ($i = 0; $i < count($this->_baseAttributes); $i++) { 00086 if ($this->_baseAttributes[$i] == $baseAttribute) { 00087 array_splice($baseAttributes, $i, 1); 00088 break; 00089 } 00090 } 00091 $this->_baseAttributes = $baseAttributes; 00092 return $this; 00093 } 00094 00109 public function save($dryRun = false, 00110 $uri = null, 00111 $className = null, 00112 $extraHeaders = array()) 00113 { 00114 if ($dryRun == true) { 00115 $editLink = $this->getEditLink(); 00116 if ($uri == null && $editLink !== null) { 00117 $uri = $editLink->getHref() . '?dry-run=true'; 00118 } 00119 if ($uri === null) { 00120 require_once 'Zend/Gdata/App/InvalidArgumentException.php'; 00121 throw new Zend_Gdata_App_InvalidArgumentException('You must specify an URI which needs deleted.'); 00122 } 00123 $service = new Zend_Gdata_App($this->getHttpClient()); 00124 return $service->updateEntry($this, 00125 $uri, 00126 $className, 00127 $extraHeaders); 00128 } else { 00129 parent::save($uri, $className, $extraHeaders); 00130 } 00131 } 00132 00142 public function delete($dryRun = false) 00143 { 00144 $uri = null; 00145 00146 if ($dryRun == true) { 00147 $editLink = $this->getEditLink(); 00148 if ($editLink !== null) { 00149 $uri = $editLink->getHref() . '?dry-run=true'; 00150 } 00151 if ($uri === null) { 00152 require_once 'Zend/Gdata/App/InvalidArgumentException.php'; 00153 throw new Zend_Gdata_App_InvalidArgumentException('You must specify an URI which needs deleted.'); 00154 } 00155 parent::delete($uri); 00156 } else { 00157 parent::delete(); 00158 } 00159 } 00160 00161 }