[44] | 1 | <?php
|
---|
| 2 |
|
---|
| 3 | /**
|
---|
| 4 | * Zend Framework
|
---|
| 5 | *
|
---|
| 6 | * LICENSE
|
---|
| 7 | *
|
---|
| 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.
|
---|
| 15 | *
|
---|
| 16 | * @category Zend
|
---|
| 17 | * @package Zend_Gdata
|
---|
| 18 | * @subpackage Gdata
|
---|
| 19 | * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
---|
| 20 | * @license http://framework.zend.com/license/new-bsd New BSD License
|
---|
| 21 | */
|
---|
| 22 |
|
---|
| 23 | /**
|
---|
| 24 | * @see Zend_Gdata_Extension
|
---|
| 25 | */
|
---|
| 26 | require_once 'Zend/Gdata/Extension.php';
|
---|
| 27 |
|
---|
| 28 | /**
|
---|
| 29 | * @see Zend_Gdata_Entry
|
---|
| 30 | */
|
---|
| 31 | require_once 'Zend/Gdata/Entry.php';
|
---|
| 32 |
|
---|
| 33 | /**
|
---|
| 34 | * Represents the gd:entryLink element
|
---|
| 35 | *
|
---|
| 36 | * @category Zend
|
---|
| 37 | * @package Zend_Gdata
|
---|
| 38 | * @subpackage Gdata
|
---|
| 39 | * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
---|
| 40 | * @license http://framework.zend.com/license/new-bsd New BSD License
|
---|
| 41 | */
|
---|
| 42 | class Zend_Gdata_Extension_EntryLink extends Zend_Gdata_Extension
|
---|
| 43 | {
|
---|
| 44 |
|
---|
| 45 | protected $_rootElement = 'entryLink';
|
---|
| 46 | protected $_href = null;
|
---|
| 47 | protected $_readOnly = null;
|
---|
| 48 | protected $_rel = null;
|
---|
| 49 | protected $_entry = null;
|
---|
| 50 |
|
---|
| 51 | public function __construct($href = null, $rel = null,
|
---|
| 52 | $readOnly = null, $entry = null)
|
---|
| 53 | {
|
---|
| 54 | parent::__construct();
|
---|
| 55 | $this->_href = $href;
|
---|
| 56 | $this->_readOnly = $readOnly;
|
---|
| 57 | $this->_rel = $rel;
|
---|
| 58 | $this->_entry = $entry;
|
---|
| 59 | }
|
---|
| 60 |
|
---|
| 61 | public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
|
---|
| 62 | {
|
---|
| 63 | $element = parent::getDOM($doc, $majorVersion, $minorVersion);
|
---|
| 64 | if ($this->_href !== null) {
|
---|
| 65 | $element->setAttribute('href', $this->_href);
|
---|
| 66 | }
|
---|
| 67 | if ($this->_readOnly !== null) {
|
---|
| 68 | $element->setAttribute('readOnly', ($this->_readOnly ? "true" : "false"));
|
---|
| 69 | }
|
---|
| 70 | if ($this->_rel !== null) {
|
---|
| 71 | $element->setAttribute('rel', $this->_rel);
|
---|
| 72 | }
|
---|
| 73 | if ($this->_entry !== null) {
|
---|
| 74 | $element->appendChild($this->_entry->getDOM($element->ownerDocument));
|
---|
| 75 | }
|
---|
| 76 | return $element;
|
---|
| 77 | }
|
---|
| 78 |
|
---|
| 79 | protected function takeChildFromDOM($child)
|
---|
| 80 | {
|
---|
| 81 | $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
|
---|
| 82 | switch ($absoluteNodeName) {
|
---|
| 83 | case $this->lookupNamespace('atom') . ':' . 'entry';
|
---|
| 84 | $entry = new Zend_Gdata_Entry();
|
---|
| 85 | $entry->transferFromDOM($child);
|
---|
| 86 | $this->_entry = $entry;
|
---|
| 87 | break;
|
---|
| 88 | default:
|
---|
| 89 | parent::takeChildFromDOM($child);
|
---|
| 90 | break;
|
---|
| 91 | }
|
---|
| 92 | }
|
---|
| 93 |
|
---|
| 94 | protected function takeAttributeFromDOM($attribute)
|
---|
| 95 | {
|
---|
| 96 | switch ($attribute->localName) {
|
---|
| 97 | case 'href':
|
---|
| 98 | $this->_href = $attribute->nodeValue;
|
---|
| 99 | break;
|
---|
| 100 | case 'readOnly':
|
---|
| 101 | if ($attribute->nodeValue == "true") {
|
---|
| 102 | $this->_readOnly = true;
|
---|
| 103 | }
|
---|
| 104 | else if ($attribute->nodeValue == "false") {
|
---|
| 105 | $this->_readOnly = false;
|
---|
| 106 | }
|
---|
| 107 | else {
|
---|
| 108 | throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for gCal:selected#value.");
|
---|
| 109 | }
|
---|
| 110 | break;
|
---|
| 111 | case 'rel':
|
---|
| 112 | $this->_rel = $attribute->nodeValue;
|
---|
| 113 | break;
|
---|
| 114 | default:
|
---|
| 115 | parent::takeAttributeFromDOM($attribute);
|
---|
| 116 | }
|
---|
| 117 | }
|
---|
| 118 |
|
---|
| 119 | /**
|
---|
| 120 | * @return string
|
---|
| 121 | */
|
---|
| 122 | public function getHref()
|
---|
| 123 | {
|
---|
| 124 | return $this->_href;
|
---|
| 125 | }
|
---|
| 126 |
|
---|
| 127 | public function setHref($value)
|
---|
| 128 | {
|
---|
| 129 | $this->_href = $value;
|
---|
| 130 | return $this;
|
---|
| 131 | }
|
---|
| 132 |
|
---|
| 133 | public function getReadOnly()
|
---|
| 134 | {
|
---|
| 135 | return $this->_readOnly;
|
---|
| 136 | }
|
---|
| 137 |
|
---|
| 138 | public function setReadOnly($value)
|
---|
| 139 | {
|
---|
| 140 | $this->_readOnly = $value;
|
---|
| 141 | return $this;
|
---|
| 142 | }
|
---|
| 143 |
|
---|
| 144 | public function getRel()
|
---|
| 145 | {
|
---|
| 146 | return $this->_rel;
|
---|
| 147 | }
|
---|
| 148 |
|
---|
| 149 | public function setRel($value)
|
---|
| 150 | {
|
---|
| 151 | $this->_rel = $value;
|
---|
| 152 | return $this;
|
---|
| 153 | }
|
---|
| 154 |
|
---|
| 155 | public function getEntry()
|
---|
| 156 | {
|
---|
| 157 | return $this->_entry;
|
---|
| 158 | }
|
---|
| 159 |
|
---|
| 160 | public function setEntry($value)
|
---|
| 161 | {
|
---|
| 162 | $this->_entry = $value;
|
---|
| 163 | return $this;
|
---|
| 164 | }
|
---|
| 165 |
|
---|
| 166 | }
|
---|