diff options
Diffstat (limited to 'zend/library/Zend/Gdata/Calendar')
| -rw-r--r-- | zend/library/Zend/Gdata/Calendar/EventEntry.php | 164 | ||||
| -rw-r--r-- | zend/library/Zend/Gdata/Calendar/EventFeed.php | 106 | ||||
| -rw-r--r-- | zend/library/Zend/Gdata/Calendar/EventQuery.php | 491 | ||||
| -rw-r--r-- | zend/library/Zend/Gdata/Calendar/Extension/AccessLevel.php | 125 | ||||
| -rw-r--r-- | zend/library/Zend/Gdata/Calendar/Extension/Color.php | 125 | ||||
| -rw-r--r-- | zend/library/Zend/Gdata/Calendar/Extension/Hidden.php | 134 | ||||
| -rw-r--r-- | zend/library/Zend/Gdata/Calendar/Extension/Link.php | 125 | ||||
| -rw-r--r-- | zend/library/Zend/Gdata/Calendar/Extension/QuickAdd.php | 132 | ||||
| -rw-r--r-- | zend/library/Zend/Gdata/Calendar/Extension/Selected.php | 133 | ||||
| -rw-r--r-- | zend/library/Zend/Gdata/Calendar/Extension/SendEventNotifications.php | 132 | ||||
| -rw-r--r-- | zend/library/Zend/Gdata/Calendar/Extension/Timezone.php | 124 | ||||
| -rw-r--r-- | zend/library/Zend/Gdata/Calendar/Extension/WebContent.php | 177 | ||||
| -rw-r--r-- | zend/library/Zend/Gdata/Calendar/ListEntry.php | 246 | ||||
| -rw-r--r-- | zend/library/Zend/Gdata/Calendar/ListFeed.php | 106 |
14 files changed, 2320 insertions, 0 deletions
diff --git a/zend/library/Zend/Gdata/Calendar/EventEntry.php b/zend/library/Zend/Gdata/Calendar/EventEntry.php new file mode 100644 index 0000000..00544d6 --- /dev/null +++ b/zend/library/Zend/Gdata/Calendar/EventEntry.php @@ -0,0 +1,164 @@ +<?php + +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Calendar + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: EventEntry.php 24593 2012-01-05 20:35:02Z matthew $ + */ + +/** + * @see Zend_Gdata_Entry + */ +require_once 'Zend/Gdata/Entry.php'; + +/** + * @see Zend_Gdata_Kind_EventEntry + */ +require_once 'Zend/Gdata/Kind/EventEntry.php'; + +/** + * @see Zend_Gdata_Calendar_Extension_SendEventNotifications + */ +require_once 'Zend/Gdata/Calendar/Extension/SendEventNotifications.php'; + +/** + * @see Zend_Gdata_Calendar_Extension_Timezone + */ +require_once 'Zend/Gdata/Calendar/Extension/Timezone.php'; + +/** + * @see Zend_Gdata_Calendar_Extension_Link + */ +require_once 'Zend/Gdata/Calendar/Extension/Link.php'; + +/** + * @see Zend_Gdata_Calendar_Extension_QuickAdd + */ +require_once 'Zend/Gdata/Calendar/Extension/QuickAdd.php'; + +/** + * Data model class for a Google Calendar Event Entry + * + * @category Zend + * @package Zend_Gdata + * @subpackage Calendar + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Gdata_Calendar_EventEntry extends Zend_Gdata_Kind_EventEntry +{ + + protected $_entryClassName = 'Zend_Gdata_Calendar_EventEntry'; + protected $_sendEventNotifications = null; + protected $_timezone = null; + protected $_quickadd = null; + + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_Calendar::$namespaces); + parent::__construct($element); + } + + public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_sendEventNotifications != null) { + $element->appendChild($this->_sendEventNotifications->getDOM($element->ownerDocument)); + } + if ($this->_timezone != null) { + $element->appendChild($this->_timezone->getDOM($element->ownerDocument)); + } + if ($this->_quickadd != null) { + $element->appendChild($this->_quickadd->getDOM($element->ownerDocument)); + } + return $element; + } + + protected function takeChildFromDOM($child) + { + $absoluteNodeName = $child->namespaceURI . ':' . $child->localName; + + switch ($absoluteNodeName) { + case $this->lookupNamespace('gCal') . ':' . 'sendEventNotifications'; + $sendEventNotifications = new Zend_Gdata_Calendar_Extension_SendEventNotifications(); + $sendEventNotifications->transferFromDOM($child); + $this->_sendEventNotifications = $sendEventNotifications; + break; + case $this->lookupNamespace('gCal') . ':' . 'timezone'; + $timezone = new Zend_Gdata_Calendar_Extension_Timezone(); + $timezone->transferFromDOM($child); + $this->_timezone = $timezone; + break; + case $this->lookupNamespace('atom') . ':' . 'link'; + $link = new Zend_Gdata_Calendar_Extension_Link(); + $link->transferFromDOM($child); + $this->_link[] = $link; + break; + case $this->lookupNamespace('gCal') . ':' . 'quickadd'; + $quickadd = new Zend_Gdata_Calendar_Extension_QuickAdd(); + $quickadd->transferFromDOM($child); + $this->_quickadd = $quickadd; + break; + default: + parent::takeChildFromDOM($child); + break; + } + } + + public function getSendEventNotifications() + { + return $this->_sendEventNotifications; + } + + public function setSendEventNotifications($value) + { + $this->_sendEventNotifications = $value; + return $this; + } + + public function getTimezone() + { + return $this->_timezone; + } + + /** + * @param Zend_Gdata_Calendar_Extension_Timezone $value + * @return Zend_Gdata_Extension_EventEntry Provides a fluent interface + */ + public function setTimezone($value) + { + $this->_timezone = $value; + return $this; + } + + public function getQuickAdd() + { + return $this->_quickadd; + } + + /** + * @param Zend_Gdata_Calendar_Extension_QuickAdd $value + * @return Zend_Gdata_Extension_ListEntry Provides a fluent interface + */ + public function setQuickAdd($value) + { + $this->_quickadd = $value; + return $this; + } + +} diff --git a/zend/library/Zend/Gdata/Calendar/EventFeed.php b/zend/library/Zend/Gdata/Calendar/EventFeed.php new file mode 100644 index 0000000..8aad167 --- /dev/null +++ b/zend/library/Zend/Gdata/Calendar/EventFeed.php @@ -0,0 +1,106 @@ +<?php + +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Calendar + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: EventFeed.php 24593 2012-01-05 20:35:02Z matthew $ + */ + +/** + * @see Zend_Gdata_Feed + */ +require_once 'Zend/Gdata/Feed.php'; + +/** + * @see Zend_Gdata_Extension_Timezone + */ +require_once 'Zend/Gdata/Calendar/Extension/Timezone.php'; + +/** + * Data model for a Google Calendar feed of events + * + * @category Zend + * @package Zend_Gdata + * @subpackage Calendar + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Gdata_Calendar_EventFeed extends Zend_Gdata_Feed +{ + + protected $_timezone = null; + + /** + * The classname for individual feed elements. + * + * @var string + */ + protected $_entryClassName = 'Zend_Gdata_Calendar_EventEntry'; + + /** + * The classname for the feed. + * + * @var string + */ + protected $_feedClassName = 'Zend_Gdata_Calendar_EventFeed'; + + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_Calendar::$namespaces); + parent::__construct($element); + } + + public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_timezone != null) { + $element->appendChild($this->_timezone->getDOM($element->ownerDocument)); + } + + return $element; + } + + protected function takeChildFromDOM($child) + { + $absoluteNodeName = $child->namespaceURI . ':' . $child->localName; + + switch ($absoluteNodeName) { + case $this->lookupNamespace('gCal') . ':' . 'timezone'; + $timezone = new Zend_Gdata_Calendar_Extension_Timezone(); + $timezone->transferFromDOM($child); + $this->_timezone = $timezone; + break; + + default: + parent::takeChildFromDOM($child); + break; + } + } + + public function getTimezone() + { + return $this->_timezone; + } + + public function setTimezone($value) + { + $this->_timezone = $value; + return $this; + } + +} diff --git a/zend/library/Zend/Gdata/Calendar/EventQuery.php b/zend/library/Zend/Gdata/Calendar/EventQuery.php new file mode 100644 index 0000000..c965e0c --- /dev/null +++ b/zend/library/Zend/Gdata/Calendar/EventQuery.php @@ -0,0 +1,491 @@ +<?php + +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Calendar + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: EventQuery.php 24593 2012-01-05 20:35:02Z matthew $ + */ + +/** + * Zend_Gdata_App_util + */ +require_once('Zend/Gdata/App/Util.php'); + +/** + * Zend_Gdata_Query + */ +require_once('Zend/Gdata/Query.php'); + +/** + * Assists in constructing queries for Google Calendar events + * + * @link http://code.google.com/apis/gdata/calendar/ + * + * @category Zend + * @package Zend_Gdata + * @subpackage Calendar + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Gdata_Calendar_EventQuery extends Zend_Gdata_Query +{ + + const CALENDAR_FEED_URI = 'https://www.google.com/calendar/feeds'; + + /** + * The default URI used for feeds. + */ + protected $_defaultFeedUri = self::CALENDAR_FEED_URI; + + /** + * The comment ID to retrieve. If null, no specific comment will be + * retrieved unless already included in the query URI. The event ID + * ($_event) must be set, otherwise this property is ignored. + */ + protected $_comments = null; + + /** + * The calendar address to be requested by queries. This may be an email + * address if requesting the primary calendar for a user. Defaults to + * "default" (the currently authenticated user). A null value should be + * used when the calendar address has already been set as part of the + * query URI. + */ + protected $_user = 'default'; + + /* + * The visibility to be requested by queries. Defaults to "public". A + * null value should be used when the calendar address has already been + * set as part of the query URI. + */ + protected $_visibility = 'public'; + + /** + * Projection to be requested by queries. Defaults to "full". A null value + * should be used when the calendar address has already been set as part + * of the query URI. + */ + protected $_projection = 'full'; + + /** + * The event ID to retrieve. If null, no specific event will be retrieved + * unless already included in the query URI. + */ + protected $_event = null; + + /** + * Create Gdata_Calendar_EventQuery object. If a URL is provided, + * it becomes the base URL, and additional URL components may be + * appended. For instance, if $url is 'https://www.google.com/calendar', + * the default URL constructed will be + * 'https://www.google.com/calendar/default/public/full'. + * + * If the URL already contains a calendar ID, projection, visibility, + * event ID, or comment ID, you will need to set these fields to null + * to prevent them from being inserted. See this class's properties for + * more information. + * + * @param string $url The URL to use as the base path for requests + */ + public function __construct($url = null) + { + parent::__construct($url); + } + + /** + * @see $_comments + * @param string $value + * @return Zend_Gdata_Calendar_EventQuery Provides a fluent interface + */ + public function setComments($value) + { + $this->_comments = $value; + return $this; + } + + /** + * @see $_event + * @param string $value + * @return Zend_Gdata_Calendar_EventQuery Provides a fluent interface + */ + public function setEvent($value) + { + $this->_event = $value; + return $this; + } + + /** + * @see $_projection + * @param string $value + * @return Zend_Gdata_Calendar_EventQuery Provides a fluent interface + */ + public function setProjection($value) + { + $this->_projection = $value; + return $this; + } + + /** + * @see $_user + * @param string $value + * @return Zend_Gdata_Calendar_EventQuery Provides a fluent interface + */ + public function setUser($value) + { + $this->_user = $value; + return $this; + } + + /** + * @see $_visibility + * @param bool $value + * @return Zend_Gdata_Calendar_EventQuery Provides a fluent interface + */ + public function setVisibility($value) + { + $this->_visibility = $value; + return $this; + } + + /** + * @see $_comments; + * @return string comments + */ + public function getComments() + { + return $this->_comments; + } + + /** + * @see $_event; + * @return string event + */ + public function getEvent() + { + return $this->_event; + } + + /** + * @see $_projection + * @return string projection + */ + public function getProjection() + { + return $this->_projection; + } + + /** + * @see $_user + * @return string user + */ + public function getUser() + { + return $this->_user; + } + + /** + * @see $_visibility + * @return string visibility + */ + public function getVisibility() + { + return $this->_visibility; + } + + /** + * @param int $value + * @return Zend_Gdata_Calendar_EventQuery Provides a fluent interface + */ + public function setStartMax($value) + { + if ($value != null) { + $this->_params['start-max'] = Zend_Gdata_App_Util::formatTimestamp($value); + } else { + unset($this->_params['start-max']); + } + return $this; + } + + /** + * @param int $value + * @return Zend_Gdata_Calendar_EventQuery Provides a fluent interface + */ + public function setStartMin($value) + { + if ($value != null) { + $this->_params['start-min'] = Zend_Gdata_App_Util::formatTimestamp($value); + } else { + unset($this->_params['start-min']); + } + return $this; + } + + /** + * @param string $value + * @return Zend_Gdata_Calendar_EventQuery Provides a fluent interface + */ + public function setOrderBy($value) + { + if ($value != null) { + $this->_params['orderby'] = $value; + } else { + unset($this->_params['orderby']); + } + return $this; + } + + /** + * @return int start-max + */ + public function getStartMax() + { + if (array_key_exists('start-max', $this->_params)) { + return $this->_params['start-max']; + } else { + return null; + } + } + + /** + * @return int start-min + */ + public function getStartMin() + { + if (array_key_exists('start-min', $this->_params)) { + return $this->_params['start-min']; + } else { + return null; + } + } + + /** + * @return string orderby + */ + public function getOrderBy() + { + if (array_key_exists('orderby', $this->_params)) { + return $this->_params['orderby']; + } else { + return null; + } + } + + /** + * @return string sortorder + */ + public function getSortOrder() + { + if (array_key_exists('sortorder', $this->_params)) { + return $this->_params['sortorder']; + } else { + return null; + } + } + + /** + * @return string sortorder + */ + public function setSortOrder($value) + { + if ($value != null) { + $this->_params['sortorder'] = $value; + } else { + unset($this->_params['sortorder']); + } + return $this; + } + + /** + * @return string recurrence-expansion-start + */ + public function getRecurrenceExpansionStart() + { + if (array_key_exists('recurrence-expansion-start', $this->_params)) { + return $this->_params['recurrence-expansion-start']; + } else { + return null; + } + } + + /** + * @return string recurrence-expansion-start + */ + public function setRecurrenceExpansionStart($value) + { + if ($value != null) { + $this->_params['recurrence-expansion-start'] = Zend_Gdata_App_Util::formatTimestamp($value); + } else { + unset($this->_params['recurrence-expansion-start']); + } + return $this; + } + + + /** + * @return string recurrence-expansion-end + */ + public function getRecurrenceExpansionEnd() + { + if (array_key_exists('recurrence-expansion-end', $this->_params)) { + return $this->_params['recurrence-expansion-end']; + } else { + return null; + } + } + + /** + * @return string recurrence-expansion-end + */ + public function setRecurrenceExpansionEnd($value) + { + if ($value != null) { + $this->_params['recurrence-expansion-end'] = Zend_Gdata_App_Util::formatTimestamp($value); + } else { + unset($this->_params['recurrence-expansion-end']); + } + return $this; + } + + /** + * @param string $value Also accepts bools. + * @return Zend_Gdata_Calendar_EventQuery Provides a fluent interface + */ + public function getSingleEvents() + { + if (array_key_exists('singleevents', $this->_params)) { + $value = $this->_params['singleevents']; + switch ($value) { + case 'true': + return true; + break; + case 'false': + return false; + break; + default: + require_once 'Zend/Gdata/App/Exception.php'; + throw new Zend_Gdata_App_Exception( + 'Invalid query param value for futureevents: ' . + $value . ' It must be a boolean.'); + } + } else { + return null; + } + } + + /** + * @param string $value Also accepts bools. If using a string, must be either "true" or "false". + * @return Zend_Gdata_Calendar_EventQuery Provides a fluent interface + */ + public function setSingleEvents($value) + { + if ($value !== null) { + if (is_bool($value)) { + $this->_params['singleevents'] = ($value?'true':'false'); + } elseif ($value == 'true' | $value == 'false') { + $this->_params['singleevents'] = $value; + } else { + require_once 'Zend/Gdata/App/Exception.php'; + throw new Zend_Gdata_App_Exception( + 'Invalid query param value for futureevents: ' . + $value . ' It must be a boolean.'); + } + } else { + unset($this->_params['singleevents']); + } + return $this; + } + + /** + * @return string futureevents + */ + public function getFutureEvents() + { + if (array_key_exists('futureevents', $this->_params)) { + $value = $this->_params['futureevents']; + switch ($value) { + case 'true': + return true; + break; + case 'false': + return false; + break; + default: + require_once 'Zend/Gdata/App/Exception.php'; + throw new Zend_Gdata_App_Exception( + 'Invalid query param value for futureevents: ' . + $value . ' It must be a boolean.'); + } + } else { + return null; + } + } + + /** + * @param string $value Also accepts bools. If using a string, must be either "true" or "false" or + * an exception will be thrown on retrieval. + * @return Zend_Gdata_Calendar_EventQuery Provides a fluent interface + */ + public function setFutureEvents($value) + { + if ($value !== null) { + if (is_bool($value)) { + $this->_params['futureevents'] = ($value?'true':'false'); + } elseif ($value == 'true' | $value == 'false') { + $this->_params['futureevents'] = $value; + } else { + require_once 'Zend/Gdata/App/Exception.php'; + throw new Zend_Gdata_App_Exception( + 'Invalid query param value for futureevents: ' . + $value . ' It must be a boolean.'); + } + } else { + unset($this->_params['futureevents']); + } + return $this; + } + + /** + * @return string url + */ + public function getQueryUrl() + { + if (isset($this->_url)) { + $uri = $this->_url; + } else { + $uri = $this->_defaultFeedUri; + } + if ($this->getUser() != null) { + $uri .= '/' . $this->getUser(); + } + if ($this->getVisibility() != null) { + $uri .= '/' . $this->getVisibility(); + } + if ($this->getProjection() != null) { + $uri .= '/' . $this->getProjection(); + } + if ($this->getEvent() != null) { + $uri .= '/' . $this->getEvent(); + if ($this->getComments() != null) { + $uri .= '/comments/' . $this->getComments(); + } + } + $uri .= $this->getQueryString(); + return $uri; + } + +} diff --git a/zend/library/Zend/Gdata/Calendar/Extension/AccessLevel.php b/zend/library/Zend/Gdata/Calendar/Extension/AccessLevel.php new file mode 100644 index 0000000..1c734de --- /dev/null +++ b/zend/library/Zend/Gdata/Calendar/Extension/AccessLevel.php @@ -0,0 +1,125 @@ +<?php + +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Calendar + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: AccessLevel.php 24593 2012-01-05 20:35:02Z matthew $ + */ + +/** + * @see Zend_Gdata_Extension + */ +require_once 'Zend/Gdata/Extension.php'; + +/** + * Represents the gCal:accessLevel element used by the Calendar data API + * + * @category Zend + * @package Zend_Gdata + * @subpackage Calendar + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Gdata_Calendar_Extension_AccessLevel extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'gCal'; + protected $_rootElement = 'accesslevel'; + protected $_value = null; + + /** + * Constructs a new Zend_Gdata_Calendar_Extension_AccessLevel object. + * @param string $value (optional) The text content of the element. + */ + public function __construct($value = null) + { + $this->registerAllNamespaces(Zend_Gdata_Calendar::$namespaces); + parent::__construct(); + $this->_value = $value; + } + + /** + * Retrieves a DOMElement which corresponds to this element and all + * child properties. This is used to build an entry back into a DOM + * and eventually XML text for sending to the server upon updates, or + * for application storage/persistence. + * + * @param DOMDocument $doc The DOMDocument used to construct DOMElements + * @return DOMElement The DOMElement representing this element and all + * child properties. + */ + public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_value != null) { + $element->setAttribute('value', $this->_value); + } + return $element; + } + + /** + * Given a DOMNode representing an attribute, tries to map the data into + * instance members. If no mapping is defined, the name and value are + * stored in an array. + * + * @param DOMNode $attribute The DOMNode attribute needed to be handled + */ + protected function takeAttributeFromDOM($attribute) + { + switch ($attribute->localName) { + case 'value': + $this->_value = $attribute->nodeValue; + break; + default: + parent::takeAttributeFromDOM($attribute); + } + } + + /** + * Get the value for this element's value attribute. + * + * @return string The attribute being modified. + */ + public function getValue() + { + return $this->_value; + } + + + /** + * Set the value for this element's value attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Calendar_Extension_Selected The element being modified. + */ + public function setValue($value) + { + $this->_value = $value; + return $this; + } + + /** + * Magic toString method allows using this directly via echo + * Works best in PHP >= 4.2.0 + */ + public function __toString() + { + return $this->getValue(); + } + +} diff --git a/zend/library/Zend/Gdata/Calendar/Extension/Color.php b/zend/library/Zend/Gdata/Calendar/Extension/Color.php new file mode 100644 index 0000000..601667e --- /dev/null +++ b/zend/library/Zend/Gdata/Calendar/Extension/Color.php @@ -0,0 +1,125 @@ +<?php + +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Calendar + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: Color.php 24593 2012-01-05 20:35:02Z matthew $ + */ + +/** + * @see Zend_Gdata_Extension + */ +require_once 'Zend/Gdata/Extension.php'; + +/** + * Represents the gCal:color element used by the Calendar data API + * to define the color of a calendar in the UI. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Calendar + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Gdata_Calendar_Extension_Color extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'gCal'; + protected $_rootElement = 'color'; + protected $_value = null; + + /** + * Constructs a new Zend_Gdata_Calendar_Extension_Color object. + * @param string $value (optional) The text content of the element. + */ + public function __construct($value = null) + { + $this->registerAllNamespaces(Zend_Gdata_Calendar::$namespaces); + parent::__construct(); + $this->_value = $value; + } + + /** + * Retrieves a DOMElement which corresponds to this element and all + * child properties. This is used to build an entry back into a DOM + * and eventually XML text for sending to the server upon updates, or + * for application storage/persistence. + * + * @param DOMDocument $doc The DOMDocument used to construct DOMElements + * @return DOMElement The DOMElement representing this element and all + * child properties. + */ + public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_value != null) { + $element->setAttribute('value', $this->_value); + } + return $element; + } + + /** + * Given a DOMNode representing an attribute, tries to map the data into + * instance members. If no mapping is defined, the name and value are + * stored in an array. + * + * @param DOMNode $attribute The DOMNode attribute needed to be handled + */ + protected function takeAttributeFromDOM($attribute) + { + switch ($attribute->localName) { + case 'value': + $this->_value = $attribute->nodeValue; + break; + default: + parent::takeAttributeFromDOM($attribute); + } + } + + /** + * Get the value for this element's value attribute. + * + * @return string The value associated with this attribute. + */ + public function getValue() + { + return $this->_value; + } + + /** + * Set the value for this element's value attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Calendar_Extension_Color The element being modified. + */ + public function setValue($value) + { + $this->_value = $value; + return $this; + } + + /** + * Magic toString method allows using this directly via echo + * Works best in PHP >= 4.2.0 + */ + public function __toString() + { + return $this->_value; + } + +} diff --git a/zend/library/Zend/Gdata/Calendar/Extension/Hidden.php b/zend/library/Zend/Gdata/Calendar/Extension/Hidden.php new file mode 100644 index 0000000..0973008 --- /dev/null +++ b/zend/library/Zend/Gdata/Calendar/Extension/Hidden.php @@ -0,0 +1,134 @@ +<?php + +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Calendar + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: Hidden.php 24593 2012-01-05 20:35:02Z matthew $ + */ + +/** + * @see Zend_Gdata_Extension + */ +require_once 'Zend/Gdata/Extension.php'; + +/** + * Represents the gCal:hidden element used by the Calendar data API + * + * @category Zend + * @package Zend_Gdata + * @subpackage Calendar + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Gdata_Calendar_Extension_Hidden extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'gCal'; + protected $_rootElement = 'hidden'; + protected $_value = null; + + /** + * Constructs a new Zend_Gdata_Calendar_Extension_Hidden object. + * @param bool $value (optional) The value of the element. + */ + public function __construct($value = null) + { + $this->registerAllNamespaces(Zend_Gdata_Calendar::$namespaces); + parent::__construct(); + $this->_value = $value; + } + + /** + * Retrieves a DOMElement which corresponds to this element and all + * child properties. This is used to build an entry back into a DOM + * and eventually XML text for sending to the server upon updates, or + * for application storage/persistence. + * + * @param DOMDocument $doc The DOMDocument used to construct DOMElements + * @return DOMElement The DOMElement representing this element and all + * child properties. + */ + public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_value !== null) { + $element->setAttribute('value', ($this->_value ? "true" : "false")); + } + return $element; + } + + /** + * Given a DOMNode representing an attribute, tries to map the data into + * instance members. If no mapping is defined, the name and value are + * stored in an array. + * + * @param DOMNode $attribute The DOMNode attribute needed to be handled + */ + protected function takeAttributeFromDOM($attribute) + { + switch ($attribute->localName) { + case 'value': + if ($attribute->nodeValue == "true") { + $this->_value = true; + } + else if ($attribute->nodeValue == "false") { + $this->_value = false; + } + else { + require_once 'Zend/Gdata/App/InvalidArgumentException.php'; + throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for gCal:selected#value."); + } + break; + default: + parent::takeAttributeFromDOM($attribute); + } + } + + /** + * Get the value for this element's value attribute. + * + * @return string The requested attribute. + */ + public function getValue() + { + return $this->_value; + } + + /** + * Set the value for this element's value attribute. + * + * @param bool $value The desired value for this attribute. + * @return Zend_Gdata_Calendar_Extension_Hidden The element being modified. + */ + public function setValue($value) + { + $this->_value = $value; + return $this; + } + + /** + * Magic toString method allows using this directly via echo + * Works best in PHP >= 4.2.0 + */ + public function __toString() + { + return $this->_value; + } + +} + diff --git a/zend/library/Zend/Gdata/Calendar/Extension/Link.php b/zend/library/Zend/Gdata/Calendar/Extension/Link.php new file mode 100644 index 0000000..f297323 --- /dev/null +++ b/zend/library/Zend/Gdata/Calendar/Extension/Link.php @@ -0,0 +1,125 @@ +<?php +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Calendar + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: Link.php 24593 2012-01-05 20:35:02Z matthew $ + */ + +/** + * @see Zend_Gdata_Entry + */ +require_once 'Zend/Gdata/App/Extension/Link.php'; + +/** + * @see Zend_Gdata_Entry + */ +require_once 'Zend/Gdata/Calendar/Extension/WebContent.php'; + + +/** + * Specialized Link class for use with Calendar. Enables use of gCal extension elements. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Calendar + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Gdata_Calendar_Extension_Link extends Zend_Gdata_App_Extension_Link +{ + + protected $_webContent = null; + + /** + * Constructs a new Zend_Gdata_Calendar_Extension_Link object. + * @see Zend_Gdata_App_Extension_Link#__construct + * @param Zend_Gdata_Calendar_Extension_Webcontent $webContent + */ + public function __construct($href = null, $rel = null, $type = null, + $hrefLang = null, $title = null, $length = null, $webContent = null) + { + $this->registerAllNamespaces(Zend_Gdata_Calendar::$namespaces); + parent::__construct($href, $rel, $type, $hrefLang, $title, $length); + $this->_webContent = $webContent; + } + + /** + * Retrieves a DOMElement which corresponds to this element and all + * child properties. This is used to build an entry back into a DOM + * and eventually XML text for sending to the server upon updates, or + * for application storage/persistence. + * + * @param DOMDocument $doc The DOMDocument used to construct DOMElements + * @return DOMElement The DOMElement representing this element and all + * child properties. + */ + public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_webContent != null) { + $element->appendChild($this->_webContent->getDOM($element->ownerDocument)); + } + return $element; + } + + /** + * Creates individual Entry objects of the appropriate type and + * stores them as members of this entry based upon DOM data. + * + * @param DOMNode $child The DOMNode to process + */ + protected function takeChildFromDOM($child) + { + $absoluteNodeName = $child->namespaceURI . ':' . $child->localName; + switch ($absoluteNodeName) { + case $this->lookupNamespace('gCal') . ':' . 'webContent': + $webContent = new Zend_Gdata_Calendar_Extension_WebContent(); + $webContent->transferFromDOM($child); + $this->_webContent = $webContent; + break; + default: + parent::takeChildFromDOM($child); + break; + } + } + + /** + * Get the value for this element's WebContent attribute. + * + * @return Zend_Gdata_Calendar_Extension_Webcontent The WebContent value + */ + public function getWebContent() + { + return $this->_webContent; + } + + /** + * Set the value for this element's WebContent attribute. + * + * @param Zend_Gdata_Calendar_Extension_WebContent $value The desired value for this attribute. + * @return Zend_Calendar_Extension_Link The element being modified. Provides a fluent interface. + */ + public function setWebContent($value) + { + $this->_webContent = $value; + return $this; + } + + +} + diff --git a/zend/library/Zend/Gdata/Calendar/Extension/QuickAdd.php b/zend/library/Zend/Gdata/Calendar/Extension/QuickAdd.php new file mode 100644 index 0000000..ce095f3 --- /dev/null +++ b/zend/library/Zend/Gdata/Calendar/Extension/QuickAdd.php @@ -0,0 +1,132 @@ +<?php + +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Calendar + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: QuickAdd.php 24593 2012-01-05 20:35:02Z matthew $ + */ + +/** + * @see Zend_Gdata_Extension + */ +require_once 'Zend/Gdata/Extension.php'; + +/** + * Represents the gCal:quickAdd element used by the Calendar data API + * + * @category Zend + * @package Zend_Gdata + * @subpackage Calendar + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Gdata_Calendar_Extension_QuickAdd extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'gCal'; + protected $_rootElement = 'quickadd'; + protected $_value = null; + + /** + * Constructs a new Zend_Gdata_Calendar_Extension_QuickAdd object. + * @param string $value (optional) The text content of the element. + */ + public function __construct($value = null) + { + $this->registerAllNamespaces(Zend_Gdata_Calendar::$namespaces); + parent::__construct(); + $this->_value = $value; + } + + /** + * Retrieves a DOMElement which corresponds to this element and all + * child properties. This is used to build an entry back into a DOM + * and eventually XML text for sending to the server upon updates, or + * for application storage/persistence. + * + * @param DOMDocument $doc The DOMDocument used to construct DOMElements + * @return DOMElement The DOMElement representing this element and all + * child properties. + */ + public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_value !== null) { + $element->setAttribute('value', ($this->_value ? "true" : "false")); + } + return $element; + } + + /** + * Given a DOMNode representing an attribute, tries to map the data into + * instance members. If no mapping is defined, the name and value are + * stored in an array. + * + * @param DOMNode $attribute The DOMNode attribute needed to be handled + */ + protected function takeAttributeFromDOM($attribute) + { + switch ($attribute->localName) { + case 'value': + if ($attribute->nodeValue == "true") { + $this->_value = true; + } + else if ($attribute->nodeValue == "false") { + $this->_value = false; + } + else { + throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for gCal:selected#value."); + } + break; + default: + parent::takeAttributeFromDOM($attribute); + } + } + + /** + * Get the value for this element's value attribute. + * + * @return string The value associated with this attribute. + */ + public function getValue() + { + return $this->_value; + } + + /** + * Set the value for this element's value attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Calendar_Extension_QuickAdd The element being modified. + */ + public function setValue($value) + { + $this->_value = $value; + return $this; + } + + /** + * Magic toString method allows using this directly via echo + * Works best in PHP >= 4.2.0 + */ + public function __toString() + { + return $this->getValue(); + } + +} diff --git a/zend/library/Zend/Gdata/Calendar/Extension/Selected.php b/zend/library/Zend/Gdata/Calendar/Extension/Selected.php new file mode 100644 index 0000000..44e66ac --- /dev/null +++ b/zend/library/Zend/Gdata/Calendar/Extension/Selected.php @@ -0,0 +1,133 @@ +<?php + +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Calendar + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: Selected.php 24593 2012-01-05 20:35:02Z matthew $ + */ + +/** + * @see Zend_Gdata_Extension + */ +require_once 'Zend/Gdata/Extension.php'; + +/** + * Represents the gCal:selected element used by the Calendar data API + * + * @category Zend + * @package Zend_Gdata + * @subpackage Calendar + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Gdata_Calendar_Extension_Selected extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'gCal'; + protected $_rootElement = 'selected'; + protected $_value = null; + + /** + * Constructs a new Zend_Gdata_Calendar_Extension_Selected object. + * @param bool $value (optional) The value of the element. + */ + public function __construct($value = null) + { + $this->registerAllNamespaces(Zend_Gdata_Calendar::$namespaces); + parent::__construct(); + $this->_value = $value; + } + + /** + * Retrieves a DOMElement which corresponds to this element and all + * child properties. This is used to build an entry back into a DOM + * and eventually XML text for sending to the server upon updates, or + * for application storage/persistence. + * + * @param DOMDocument $doc The DOMDocument used to construct DOMElements + * @return DOMElement The DOMElement representing this element and all + * child properties. + */ + public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_value !== null) { + $element->setAttribute('value', ($this->_value ? "true" : "false")); + } + return $element; + } + + /** + * Given a DOMNode representing an attribute, tries to map the data into + * instance members. If no mapping is defined, the name and value are + * stored in an array. + * + * @param DOMNode $attribute The DOMNode attribute needed to be handled + */ + protected function takeAttributeFromDOM($attribute) + { + switch ($attribute->localName) { + case 'value': + if ($attribute->nodeValue == "true") { + $this->_value = true; + } + else if ($attribute->nodeValue == "false") { + $this->_value = false; + } + else { + require_once 'Zend/Gdata/App/InvalidArgumentException.php'; + throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for gCal:selected#value."); + } + break; + default: + parent::takeAttributeFromDOM($attribute); + } + } + + /** + * Get the value for this element's value attribute. + * + * @return bool The value associated with this attribute. + */ + public function getValue() + { + return $this->_value; + } + + /** + * Set the value for this element's value attribute. + * + * @param bool $value The desired value for this attribute. + * @return Zend_Gdata_Calendar_Extension_Selected The element being modified. + */ + public function setValue($value) + { + $this->_value = $value; + return $this; + } + + /** + * Magic toString method allows using this directly via echo + * Works best in PHP >= 4.2.0 + */ + public function __toString() + { + return $this->_value; + } + +} diff --git a/zend/library/Zend/Gdata/Calendar/Extension/SendEventNotifications.php b/zend/library/Zend/Gdata/Calendar/Extension/SendEventNotifications.php new file mode 100644 index 0000000..453559d --- /dev/null +++ b/zend/library/Zend/Gdata/Calendar/Extension/SendEventNotifications.php @@ -0,0 +1,132 @@ +<?php + +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Calendar + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: SendEventNotifications.php 24593 2012-01-05 20:35:02Z matthew $ + */ + +/** + * @see Zend_Gdata_Extension + */ +require_once 'Zend/Gdata/Extension.php'; + +/** + * Data model class to represent an entry's sendEventNotifications + * + * @category Zend + * @package Zend_Gdata + * @subpackage Calendar + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Gdata_Calendar_Extension_SendEventNotifications extends Zend_Gdata_Extension +{ + protected $_rootNamespace = 'gCal'; + protected $_rootElement = 'sendEventNotifications'; + protected $_value = null; + + /** + * Constructs a new Zend_Gdata_Extension_SendEventNotifications object. + * @param bool $value (optional) SendEventNotifications value as URI. + */ + public function __construct($value = null) + { + $this->registerAllNamespaces(Zend_Gdata_Calendar::$namespaces); + parent::__construct(); + $this->_value = $value; + } + + /** + * Retrieves a DOMElement which corresponds to this element and all + * child properties. This is used to build an entry back into a DOM + * and eventually XML text for sending to the server upon updates, or + * for application storage/persistence. + * + * @param DOMDocument $doc The DOMDocument used to construct DOMElements + * @return DOMElement The DOMElement representing this element and all + * child properties. + */ + public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_value !== null) { + $element->setAttribute('value', ($this->_value ? "true" : "false")); + } + return $element; + } + + /** + * Given a DOMNode representing an attribute, tries to map the data into + * instance members. If no mapping is defined, the name and value are + * stored in an array. + * + * @param DOMNode $attribute The DOMNode attribute needed to be handled + */ + protected function takeAttributeFromDOM($attribute) + { + switch ($attribute->localName) { + case 'value': + if ($attribute->nodeValue == "true") { + $this->_value = true; + } + else if ($attribute->nodeValue == "false") { + $this->_value = false; + } + else { + throw new Zend_Gdata_App_InvalidArgumentException("Expected 'true' or 'false' for gCal:selected#value."); + } + break; + default: + parent::takeAttributeFromDOM($attribute); + } + } + + /** + * Get the value for this element's Value attribute. + * + * @return string The requested attribute. + */ + public function getValue() + { + return $this->_value; + } + + /** + * Set the value for this element's Value attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Extension_SendEventNotifications The element being modified. + */ + public function setValue($value) + { + $this->_value = $value; + return $this; + } + + /** + * Magic toString method allows using this directly via echo + * Works best in PHP >= 4.2.0 + */ + public function __toString() + { + return $this->getValue(); + } + +} + diff --git a/zend/library/Zend/Gdata/Calendar/Extension/Timezone.php b/zend/library/Zend/Gdata/Calendar/Extension/Timezone.php new file mode 100644 index 0000000..7cc2fad --- /dev/null +++ b/zend/library/Zend/Gdata/Calendar/Extension/Timezone.php @@ -0,0 +1,124 @@ +<?php + +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Calendar + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: Timezone.php 24593 2012-01-05 20:35:02Z matthew $ + */ + +/** + * @see Zend_Gdata_Extension + */ +require_once 'Zend/Gdata/Extension.php'; + +/** + * Represents the gCal:timezone element used by the Calendar data API + * + * @category Zend + * @package Zend_Gdata + * @subpackage Calendar + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Gdata_Calendar_Extension_Timezone extends Zend_Gdata_Extension +{ + + protected $_rootNamespace = 'gCal'; + protected $_rootElement = 'timezone'; + protected $_value = null; + + /** + * Constructs a new Zend_Gdata_Calendar_Extension_Timezone object. + * @param string $value (optional) The text content of the element. + */ + public function __construct($value = null) + { + $this->registerAllNamespaces(Zend_Gdata_Calendar::$namespaces); + parent::__construct(); + $this->_value = $value; + } + + /** + * Retrieves a DOMElement which corresponds to this element and all + * child properties. This is used to build an entry back into a DOM + * and eventually XML text for sending to the server upon updates, or + * for application storage/persistence. + * + * @param DOMDocument $doc The DOMDocument used to construct DOMElements + * @return DOMElement The DOMElement representing this element and all + * child properties. + */ + public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_value != null) { + $element->setAttribute('value', $this->_value); + } + return $element; + } + + /** + * Given a DOMNode representing an attribute, tries to map the data into + * instance members. If no mapping is defined, the name and value are + * stored in an array. + * + * @param DOMNode $attribute The DOMNode attribute needed to be handled + */ + protected function takeAttributeFromDOM($attribute) + { + switch ($attribute->localName) { + case 'value': + $this->_value = $attribute->nodeValue; + break; + default: + parent::takeAttributeFromDOM($attribute); + } + } + + /** + * Get the value for this element's value attribute. + * + * @return string The value associated with this attribute. + */ + public function getValue() + { + return $this->_value; + } + + /** + * Set the value for this element's value attribute. + * + * @param string $value The desired value for this attribute. + * @return Zend_Gdata_Calendar_Extension_Timezone The element being modified. + */ + public function setValue($value) + { + $this->_value = $value; + return $this; + } + + /** + * Magic toString method allows using this directly via echo + * Works best in PHP >= 4.2.0 + */ + public function __toString() + { + return $this->getValue(); + } + +} diff --git a/zend/library/Zend/Gdata/Calendar/Extension/WebContent.php b/zend/library/Zend/Gdata/Calendar/Extension/WebContent.php new file mode 100644 index 0000000..cb33999 --- /dev/null +++ b/zend/library/Zend/Gdata/Calendar/Extension/WebContent.php @@ -0,0 +1,177 @@ +<?php + +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Calendar + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: WebContent.php 24593 2012-01-05 20:35:02Z matthew $ + */ + +/** + * @see Zend_Gdata_Extension + */ +require_once 'Zend/Gdata/Extension.php'; + +/** + * Represents the gCal:webContent element used by the Calendar data API + * + * @category Zend + * @package Zend_Gdata + * @subpackage Calendar + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Gdata_Calendar_Extension_WebContent extends Zend_Gdata_App_Extension +{ + + protected $_rootNamespace = 'gCal'; + protected $_rootElement = 'webContent'; + protected $_url = null; + protected $_height = null; + protected $_width = null; + + /** + * Constructs a new Zend_Gdata_Calendar_Extension_WebContent object. + * @param string $url (optional) The value for this element's URL attribute. + * @param string $height (optional) The value for this element's height attribute. + * @param string $width (optional) The value for this element's width attribute. + */ + public function __construct($url = null, $height = null, $width = null) + { + $this->registerAllNamespaces(Zend_Gdata_Calendar::$namespaces); + parent::__construct(); + $this->_url = $url; + $this->_height = $height; + $this->_width = $width; + } + + /** + * Retrieves a DOMElement which corresponds to this element and all + * child properties. This is used to build an entry back into a DOM + * and eventually XML text for sending to the server upon updates, or + * for application storage/persistence. + * + * @param DOMDocument $doc The DOMDocument used to construct DOMElements + * @return DOMElement The DOMElement representing this element and all + * child properties. + */ + public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->url != null) { + $element->setAttribute('url', $this->_url); + } + if ($this->height != null) { + $element->setAttribute('height', $this->_height); + } + if ($this->width != null) { + $element->setAttribute('width', $this->_width); + } + return $element; + } + + /** + * Given a DOMNode representing an attribute, tries to map the data into + * instance members. If no mapping is defined, the name and value are + * stored in an array. + * + * @param DOMNode $attribute The DOMNode attribute needed to be handled + */ + protected function takeAttributeFromDOM($attribute) + { + switch ($attribute->localName) { + case 'url': + $this->_url = $attribute->nodeValue; + break; + case 'height': + $this->_height = $attribute->nodeValue; + break; + case 'width': + $this->_width = $attribute->nodeValue; + break; + default: + parent::takeAttributeFromDOM($attribute); + } + } + + /** + * Get the value for this element's URL attribute. + * + * @return string The desired value for this attribute. + */ + public function getURL() + { + return $this->_url; + } + + /** + * Set the value for this element's URL attribute. + * + * @param bool $value The desired value for this attribute. + * @return Zend_Gdata_Calendar_Extension_WebContent The element being modified. + */ + public function setURL($value) + { + $this->_url = $value; + return $this; + } + + /** + * Get the value for this element's height attribute. + * + * @return int The desired value for this attribute. + */ + public function getHeight() + { + return $this->_height; + } + + /** + * Set the value for this element's height attribute. + * + * @param int $value The desired value for this attribute. + * @return Zend_Gdata_Calendar_Extension_WebContent The element being modified. + */ + public function setHeight($value) + { + $this->_height = $value; + return $this; + } + + /** + * Get the value for this element's height attribute. + * + * @return int The desired value for this attribute. + */ + public function getWidth() + { + return $this->_width; + } + + /** + * Set the value for this element's height attribute. + * + * @param int $value The desired value for this attribute. + * @return Zend_Gdata_Calendar_Extension_WebContent The element being modified. + */ + public function setWidth($value) + { + $this->_width = $value; + return $this; + } + +} diff --git a/zend/library/Zend/Gdata/Calendar/ListEntry.php b/zend/library/Zend/Gdata/Calendar/ListEntry.php new file mode 100644 index 0000000..eb7ecab --- /dev/null +++ b/zend/library/Zend/Gdata/Calendar/ListEntry.php @@ -0,0 +1,246 @@ +<?php + +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Calendar + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: ListEntry.php 24593 2012-01-05 20:35:02Z matthew $ + */ + +/** + * @see Zend_Gdata_Entry + */ +require_once 'Zend/Gdata/Entry.php'; + +/** + * @see Zend_Calendar_Extension_AccessLevel + */ +require_once 'Zend/Gdata/Calendar/Extension/AccessLevel.php'; + +/** + * @see Zend_Calendar_Extension_Color + */ +require_once 'Zend/Gdata/Calendar/Extension/Color.php'; + +/** + * @see Zend_Calendar_Extension_Hidden + */ +require_once 'Zend/Gdata/Calendar/Extension/Hidden.php'; + +/** + * @see Zend_Calendar_Extension_Selected + */ +require_once 'Zend/Gdata/Calendar/Extension/Selected.php'; + +/** + * @see Zend_Gdata_Extension_EventStatus + */ +require_once 'Zend/Gdata/Extension/EventStatus.php'; + +/** + * @see Zend_Gdata_Extension_Visibility + */ +require_once 'Zend/Gdata/Extension/Visibility.php'; + + +/** + * @see Zend_Extension_Where + */ +require_once 'Zend/Gdata/Extension/Where.php'; + +/** + * Represents a Calendar entry in the Calendar data API meta feed of a user's + * calendars. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Calendar + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Gdata_Calendar_ListEntry extends Zend_Gdata_Entry +{ + + protected $_color = null; + protected $_accessLevel = null; + protected $_hidden = null; + protected $_selected = null; + protected $_timezone = null; + protected $_where = array(); + + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_Calendar::$namespaces); + parent::__construct($element); + } + + public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_accessLevel != null) { + $element->appendChild($this->_accessLevel->getDOM($element->ownerDocument)); + } + if ($this->_color != null) { + $element->appendChild($this->_color->getDOM($element->ownerDocument)); + } + if ($this->_hidden != null) { + $element->appendChild($this->_hidden->getDOM($element->ownerDocument)); + } + if ($this->_selected != null) { + $element->appendChild($this->_selected->getDOM($element->ownerDocument)); + } + if ($this->_timezone != null) { + $element->appendChild($this->_timezone->getDOM($element->ownerDocument)); + } + if ($this->_where != null) { + foreach ($this->_where as $where) { + $element->appendChild($where->getDOM($element->ownerDocument)); + } + } + return $element; + } + + protected function takeChildFromDOM($child) + { + $absoluteNodeName = $child->namespaceURI . ':' . $child->localName; + switch ($absoluteNodeName) { + case $this->lookupNamespace('gCal') . ':' . 'accesslevel'; + $accessLevel = new Zend_Gdata_Calendar_Extension_AccessLevel(); + $accessLevel->transferFromDOM($child); + $this->_accessLevel = $accessLevel; + break; + case $this->lookupNamespace('gCal') . ':' . 'color'; + $color = new Zend_Gdata_Calendar_Extension_Color(); + $color->transferFromDOM($child); + $this->_color = $color; + break; + case $this->lookupNamespace('gCal') . ':' . 'hidden'; + $hidden = new Zend_Gdata_Calendar_Extension_Hidden(); + $hidden->transferFromDOM($child); + $this->_hidden = $hidden; + break; + case $this->lookupNamespace('gCal') . ':' . 'selected'; + $selected = new Zend_Gdata_Calendar_Extension_Selected(); + $selected->transferFromDOM($child); + $this->_selected = $selected; + break; + case $this->lookupNamespace('gCal') . ':' . 'timezone'; + $timezone = new Zend_Gdata_Calendar_Extension_Timezone(); + $timezone->transferFromDOM($child); + $this->_timezone = $timezone; + break; + case $this->lookupNamespace('gd') . ':' . 'where'; + $where = new Zend_Gdata_Extension_Where(); + $where->transferFromDOM($child); + $this->_where[] = $where; + break; + default: + parent::takeChildFromDOM($child); + break; + } + } + + public function getAccessLevel() + { + return $this->_accessLevel; + } + + /** + * @param Zend_Gdata_Calendar_Extension_AccessLevel $value + * @return Zend_Gdata_Extension_ListEntry Provides a fluent interface + */ + public function setAccessLevel($value) + { + $this->_accessLevel = $value; + return $this; + } + public function getColor() + { + return $this->_color; + } + + /** + * @param Zend_Gdata_Calendar_Extension_Color $value + * @return Zend_Gdata_Extension_ListEntry Provides a fluent interface + */ + public function setColor($value) + { + $this->_color = $value; + return $this; + } + + public function getHidden() + { + return $this->_hidden; + } + + /** + * @param Zend_Gdata_Calendar_Extension_Hidden $value + * @return Zend_Gdata_Extension_ListEntry Provides a fluent interface + */ + public function setHidden($value) + { + $this->_hidden = $value; + return $this; + } + + public function getSelected() + { + return $this->_selected; + } + + /** + * @param Zend_Gdata_Calendar_Extension_Selected $value + * @return Zend_Gdata_Extension_ListEntry Provides a fluent interface + */ + public function setSelected($value) + { + $this->_selected = $value; + return $this; + } + + public function getTimezone() + { + return $this->_timezone; + } + + /** + * @param Zend_Gdata_Calendar_Extension_Timezone $value + * @return Zend_Gdata_Extension_ListEntry Provides a fluent interface + */ + public function setTimezone($value) + { + $this->_timezone = $value; + return $this; + } + + public function getWhere() + { + return $this->_where; + } + + /** + * @param Zend_Gdata_Extension_Where $value + * @return Zend_Gdata_Extension_ListEntry Provides a fluent interface + */ + public function setWhere($value) + { + $this->_where = $value; + return $this; + } + +} diff --git a/zend/library/Zend/Gdata/Calendar/ListFeed.php b/zend/library/Zend/Gdata/Calendar/ListFeed.php new file mode 100644 index 0000000..a9aa0f0 --- /dev/null +++ b/zend/library/Zend/Gdata/Calendar/ListFeed.php @@ -0,0 +1,106 @@ +<?php + +/** + * Zend Framework + * + * LICENSE + * + * This source file is subject to the new BSD license that is bundled + * with this package in the file LICENSE.txt. + * It is also available through the world-wide-web at this URL: + * http://framework.zend.com/license/new-bsd + * If you did not receive a copy of the license and are unable to + * obtain it through the world-wide-web, please send an email + * to license@zend.com so we can send you a copy immediately. + * + * @category Zend + * @package Zend_Gdata + * @subpackage Calendar + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + * @version $Id: ListFeed.php 24593 2012-01-05 20:35:02Z matthew $ + */ + +/** + * @see Zend_Gdata_Feed + */ +require_once 'Zend/Gdata/Feed.php'; + +/** + * @see Zend_Gdata_Extension_Timezone + */ +require_once 'Zend/Gdata/Calendar/Extension/Timezone.php'; + +/** + * Represents the meta-feed list of calendars + * + * @category Zend + * @package Zend_Gdata + * @subpackage Calendar + * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) + * @license http://framework.zend.com/license/new-bsd New BSD License + */ +class Zend_Gdata_Calendar_ListFeed extends Zend_Gdata_Feed +{ + protected $_timezone = null; + + /** + * The classname for individual feed elements. + * + * @var string + */ + protected $_entryClassName = 'Zend_Gdata_Calendar_ListEntry'; + + /** + * The classname for the feed. + * + * @var string + */ + protected $_feedClassName = 'Zend_Gdata_Calendar_ListFeed'; + + public function __construct($element = null) + { + $this->registerAllNamespaces(Zend_Gdata_Calendar::$namespaces); + parent::__construct($element); + } + + public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) + { + $element = parent::getDOM($doc, $majorVersion, $minorVersion); + if ($this->_timezone != null) { + $element->appendChild($this->_timezone->getDOM($element->ownerDocument)); + } + return $element; + } + + protected function takeChildFromDOM($child) + { + $absoluteNodeName = $child->namespaceURI . ':' . $child->localName; + switch ($absoluteNodeName) { + case $this->lookupNamespace('gCal') . ':' . 'timezone'; + $timezone = new Zend_Gdata_Calendar_Extension_Timezone(); + $timezone->transferFromDOM($child); + $this->_timezone = $timezone; + break; + default: + parent::takeChildFromDOM($child); + break; + } + } + + public function getTimezone() + { + return $this->_timezone; + } + + /** + * @param Zend_Gdata_Calendar_Extension_Timezone $value + * @return Zend_Gdata_Extension_ListEntry Provides a fluent interface + */ + public function setTimezone($value) + { + $this->_timezone = $value; + return $this; + } + +} |
