1 | <?php
|
---|
2 | /**
|
---|
3 | * Zend Framework
|
---|
4 | *
|
---|
5 | * LICENSE
|
---|
6 | *
|
---|
7 | * This source file is subject to the new BSD license that is bundled
|
---|
8 | * with this package in the file LICENSE.txt.
|
---|
9 | * It is also available through the world-wide-web at this URL:
|
---|
10 | * http://framework.zend.com/license/new-bsd
|
---|
11 | * If you did not receive a copy of the license and are unable to
|
---|
12 | * obtain it through the world-wide-web, please send an email
|
---|
13 | * to license@zend.com so we can send you a copy immediately.
|
---|
14 | *
|
---|
15 | * @category Zend
|
---|
16 | * @package Zend_Gdata
|
---|
17 | * @subpackage Calendar
|
---|
18 | * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
---|
19 | * @license http://framework.zend.com/license/new-bsd New BSD License
|
---|
20 | * @version $Id: Entry.php 3941 2007-03-14 21:36:13Z darby $
|
---|
21 | */
|
---|
22 |
|
---|
23 | /**
|
---|
24 | * @see Zend_Gdata_Entry
|
---|
25 | */
|
---|
26 | require_once 'Zend/Gdata/App/Extension/Link.php';
|
---|
27 |
|
---|
28 | /**
|
---|
29 | * @see Zend_Gdata_Entry
|
---|
30 | */
|
---|
31 | require_once 'Zend/Gdata/Calendar/Extension/WebContent.php';
|
---|
32 |
|
---|
33 |
|
---|
34 | /**
|
---|
35 | * Specialized Link class for use with Calendar. Enables use of gCal extension elements.
|
---|
36 | *
|
---|
37 | * @category Zend
|
---|
38 | * @package Zend_Gdata
|
---|
39 | * @subpackage Calendar
|
---|
40 | * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
---|
41 | * @license http://framework.zend.com/license/new-bsd New BSD License
|
---|
42 | */
|
---|
43 | class Zend_Gdata_Calendar_Extension_Link extends Zend_Gdata_App_Extension_Link
|
---|
44 | {
|
---|
45 |
|
---|
46 | protected $_webContent = null;
|
---|
47 |
|
---|
48 | /**
|
---|
49 | * Constructs a new Zend_Gdata_Calendar_Extension_Link object.
|
---|
50 | * @see Zend_Gdata_App_Extension_Link#__construct
|
---|
51 | * @param Zend_Gdata_Calendar_Extension_Webcontent $webContent
|
---|
52 | */
|
---|
53 | public function __construct($href = null, $rel = null, $type = null,
|
---|
54 | $hrefLang = null, $title = null, $length = null, $webContent = null)
|
---|
55 | {
|
---|
56 | $this->registerAllNamespaces(Zend_Gdata_Calendar::$namespaces);
|
---|
57 | parent::__construct($href, $rel, $type, $hrefLang, $title, $length);
|
---|
58 | $this->_webContent = $webContent;
|
---|
59 | }
|
---|
60 |
|
---|
61 | /**
|
---|
62 | * Retrieves a DOMElement which corresponds to this element and all
|
---|
63 | * child properties. This is used to build an entry back into a DOM
|
---|
64 | * and eventually XML text for sending to the server upon updates, or
|
---|
65 | * for application storage/persistence.
|
---|
66 | *
|
---|
67 | * @param DOMDocument $doc The DOMDocument used to construct DOMElements
|
---|
68 | * @return DOMElement The DOMElement representing this element and all
|
---|
69 | * child properties.
|
---|
70 | */
|
---|
71 | public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
|
---|
72 | {
|
---|
73 | $element = parent::getDOM($doc, $majorVersion, $minorVersion);
|
---|
74 | if ($this->_webContent != null) {
|
---|
75 | $element->appendChild($this->_webContent->getDOM($element->ownerDocument));
|
---|
76 | }
|
---|
77 | return $element;
|
---|
78 | }
|
---|
79 |
|
---|
80 | /**
|
---|
81 | * Creates individual Entry objects of the appropriate type and
|
---|
82 | * stores them as members of this entry based upon DOM data.
|
---|
83 | *
|
---|
84 | * @param DOMNode $child The DOMNode to process
|
---|
85 | */
|
---|
86 | protected function takeChildFromDOM($child)
|
---|
87 | {
|
---|
88 | $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
|
---|
89 | switch ($absoluteNodeName) {
|
---|
90 | case $this->lookupNamespace('gCal') . ':' . 'webContent':
|
---|
91 | $webContent = new Zend_Gdata_Calendar_Extension_WebContent();
|
---|
92 | $webContent->transferFromDOM($child);
|
---|
93 | $this->_webContent = $webContent;
|
---|
94 | break;
|
---|
95 | default:
|
---|
96 | parent::takeChildFromDOM($child);
|
---|
97 | break;
|
---|
98 | }
|
---|
99 | }
|
---|
100 |
|
---|
101 | /**
|
---|
102 | * Get the value for this element's WebContent attribute.
|
---|
103 | *
|
---|
104 | * @return Zend_Gdata_Calendar_Extension_Webcontent The WebContent value
|
---|
105 | */
|
---|
106 | public function getWebContent()
|
---|
107 | {
|
---|
108 | return $this->_webContent;
|
---|
109 | }
|
---|
110 |
|
---|
111 | /**
|
---|
112 | * Set the value for this element's WebContent attribute.
|
---|
113 | *
|
---|
114 | * @param Zend_Gdata_Calendar_Extension_WebContent $value The desired value for this attribute.
|
---|
115 | * @return Zend_Calendar_Extension_Link The element being modified. Provides a fluent interface.
|
---|
116 | */
|
---|
117 | public function setWebContent($value)
|
---|
118 | {
|
---|
119 | $this->_webContent = $value;
|
---|
120 | return $this;
|
---|
121 | }
|
---|
122 |
|
---|
123 |
|
---|
124 | }
|
---|
125 |
|
---|