|
Moodle
2.2.1
http://www.collinsharper.com
|
00001 <?php 00002 00027 require_once 'Zend/Gdata/Extension.php'; 00028 00038 class Zend_Gdata_App_Extension_Link extends Zend_Gdata_App_Extension 00039 { 00040 00041 protected $_rootElement = 'link'; 00042 protected $_href = null; 00043 protected $_rel = null; 00044 protected $_type = null; 00045 protected $_hrefLang = null; 00046 protected $_title = null; 00047 protected $_length = null; 00048 00049 public function __construct($href = null, $rel = null, $type = null, 00050 $hrefLang = null, $title = null, $length = null) 00051 { 00052 parent::__construct(); 00053 $this->_href = $href; 00054 $this->_rel = $rel; 00055 $this->_type = $type; 00056 $this->_hrefLang = $hrefLang; 00057 $this->_title = $title; 00058 $this->_length = $length; 00059 } 00060 00061 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) 00062 { 00063 $element = parent::getDOM($doc, $majorVersion, $minorVersion); 00064 if ($this->_href !== null) { 00065 $element->setAttribute('href', $this->_href); 00066 } 00067 if ($this->_rel !== null) { 00068 $element->setAttribute('rel', $this->_rel); 00069 } 00070 if ($this->_type !== null) { 00071 $element->setAttribute('type', $this->_type); 00072 } 00073 if ($this->_hrefLang !== null) { 00074 $element->setAttribute('hreflang', $this->_hrefLang); 00075 } 00076 if ($this->_title !== null) { 00077 $element->setAttribute('title', $this->_title); 00078 } 00079 if ($this->_length !== null) { 00080 $element->setAttribute('length', $this->_length); 00081 } 00082 return $element; 00083 } 00084 00085 protected function takeAttributeFromDOM($attribute) 00086 { 00087 switch ($attribute->localName) { 00088 case 'href': 00089 $this->_href = $attribute->nodeValue; 00090 break; 00091 case 'rel': 00092 $this->_rel = $attribute->nodeValue; 00093 break; 00094 case 'type': 00095 $this->_type = $attribute->nodeValue; 00096 break; 00097 case 'hreflang': 00098 $this->_hrefLang = $attribute->nodeValue; 00099 break; 00100 case 'title': 00101 $this->_title = $attribute->nodeValue; 00102 break; 00103 case 'length': 00104 $this->_length = $attribute->nodeValue; 00105 break; 00106 default: 00107 parent::takeAttributeFromDOM($attribute); 00108 } 00109 } 00110 00114 public function getHref() 00115 { 00116 return $this->_href; 00117 } 00118 00123 public function setHref($value) 00124 { 00125 $this->_href = $value; 00126 return $this; 00127 } 00128 00132 public function getRel() 00133 { 00134 return $this->_rel; 00135 } 00136 00141 public function setRel($value) 00142 { 00143 $this->_rel = $value; 00144 return $this; 00145 } 00146 00150 public function getType() 00151 { 00152 return $this->_type; 00153 } 00154 00159 public function setType($value) 00160 { 00161 $this->_type = $value; 00162 return $this; 00163 } 00164 00168 public function getHrefLang() 00169 { 00170 return $this->_hrefLang; 00171 } 00172 00177 public function setHrefLang($value) 00178 { 00179 $this->_hrefLang = $value; 00180 return $this; 00181 } 00182 00186 public function getTitle() 00187 { 00188 return $this->_title; 00189 } 00190 00195 public function setTitle($value) 00196 { 00197 $this->_title = $value; 00198 return $this; 00199 } 00200 00204 public function getLength() 00205 { 00206 return $this->_length; 00207 } 00208 00213 public function setLength($value) 00214 { 00215 $this->_length = $value; 00216 return $this; 00217 } 00218 00219 }