8 * This source file is subject to the new BSD license that is bundled
9 * with this package in the file LICENSE.txt.
10 * It is also available through the world-wide-web at this URL:
11 * http://framework.zend.com/license/new-bsd
12 * If you did not receive a copy of the license and are unable to
13 * obtain it through the world-wide-web, please send an email
14 * to license@zend.com so we can send you a copy immediately.
19 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
20 * @license http://framework.zend.com/license/new-bsd New BSD License
25 * @see Zend_Gdata_Extension
27 require_once 'Zend/Gdata/Extension.php';
30 * @see Zend_Gdata_Entry
32 require_once 'Zend/Gdata/Entry.php';
35 * Represents the gd:entryLink element
40 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
41 * @license http://framework.zend.com/license/new-bsd New BSD License
43 class Zend_Gdata_Extension_EntryLink extends Zend_Gdata_Extension
46 protected $_rootElement = 'entryLink';
47 protected $_href = null;
48 protected $_readOnly = null;
49 protected $_rel = null;
50 protected $_entry = null;
52 public function __construct($href = null, $rel = null,
53 $readOnly = null, $entry = null)
55 parent::__construct();
57 $this->_readOnly = $readOnly;
59 $this->_entry = $entry;
62 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
64 $element = parent::getDOM($doc, $majorVersion, $minorVersion);
65 if ($this->_href !== null) {
66 $element->setAttribute('href', $this->_href);
68 if ($this->_readOnly !== null) {
69 $element->setAttribute('readOnly', ($this->_readOnly ? "true" : "false"));
71 if ($this->_rel !== null) {
72 $element->setAttribute('rel', $this->_rel);
74 if ($this->_entry !== null) {
75 $element->appendChild($this->_entry->getDOM($element->ownerDocument));
80 protected function takeChildFromDOM($child)
82 $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
83 switch ($absoluteNodeName) {
84 case $this->lookupNamespace('atom') . ':' . 'entry';
85 $entry = new Zend_Gdata_Entry();
86 $entry->transferFromDOM($child);
87 $this->_entry = $entry;
90 parent::takeChildFromDOM($child);
95 protected function takeAttributeFromDOM($attribute)
97 switch ($attribute->localName) {
99 $this->_href = $attribute->nodeValue;
102 if ($attribute->nodeValue == "true") {
103 $this->_readOnly = true;
105 else if ($attribute->nodeValue == "false") {
106 $this->_readOnly = false;
109 throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for gCal:selected#value.");
113 $this->_rel = $attribute->nodeValue;
116 parent::takeAttributeFromDOM($attribute);
123 public function getHref()
128 public function setHref($value)
130 $this->_href = $value;
134 public function getReadOnly()
136 return $this->_readOnly;
139 public function setReadOnly($value)
141 $this->_readOnly = $value;
145 public function getRel()
150 public function setRel($value)
152 $this->_rel = $value;
156 public function getEntry()
158 return $this->_entry;
161 public function setEntry($value)
163 $this->_entry = $value;