]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - Zend/Gdata/Calendar/EventFeed.php
Release 6.5.0
[Github/sugarcrm.git] / Zend / Gdata / Calendar / EventFeed.php
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 Calendar
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
21
22  */
23
24 /**
25  * @see Zend_Gdata_Feed
26  */
27 require_once 'Zend/Gdata/Feed.php';
28
29 /**
30  * @see Zend_Gdata_Extension_Timezone
31  */
32 require_once 'Zend/Gdata/Calendar/Extension/Timezone.php';
33
34 /**
35  * Data model for a Google Calendar feed of events
36  *
37  * @category   Zend
38  * @package    Zend_Gdata
39  * @subpackage Calendar
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
42  */
43 class Zend_Gdata_Calendar_EventFeed extends Zend_Gdata_Feed
44 {
45
46     protected $_timezone = null;
47
48     /**
49      * The classname for individual feed elements.
50      *
51      * @var string
52      */
53     protected $_entryClassName = 'Zend_Gdata_Calendar_EventEntry';
54
55     /**
56      * The classname for the feed.
57      *
58      * @var string
59      */
60     protected $_feedClassName = 'Zend_Gdata_Calendar_EventFeed';
61
62     public function __construct($element = null)
63     {
64         $this->registerAllNamespaces(Zend_Gdata_Calendar::$namespaces);
65         parent::__construct($element);
66     }
67
68     public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
69     {
70         $element = parent::getDOM($doc, $majorVersion, $minorVersion);
71         if ($this->_timezone != null) {
72             $element->appendChild($this->_timezone->getDOM($element->ownerDocument));
73         }
74
75         return $element;
76     }
77
78     protected function takeChildFromDOM($child)
79     {
80         $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
81
82         switch ($absoluteNodeName) {
83             case $this->lookupNamespace('gCal') . ':' . 'timezone';
84                 $timezone = new Zend_Gdata_Calendar_Extension_Timezone();
85                 $timezone->transferFromDOM($child);
86                 $this->_timezone = $timezone;
87                 break;
88
89             default:
90                 parent::takeChildFromDOM($child);
91                 break;
92         }
93     }
94
95     public function getTimezone()
96     {
97         return $this->_timezone;
98     }
99
100     public function setTimezone($value)
101     {
102         $this->_timezone = $value;
103         return $this;
104     }
105
106 }