File indexing completed on 2024-06-23 05:55:21

0001 <?php
0002 /**
0003  * Zend Framework
0004  *
0005  * LICENSE
0006  *
0007  * This source file is subject to the new BSD license that is bundled
0008  * with this package in the file LICENSE.txt.
0009  * It is also available through the world-wide-web at this URL:
0010  * http://framework.zend.com/license/new-bsd
0011  * If you did not receive a copy of the license and are unable to
0012  * obtain it through the world-wide-web, please send an email
0013  * to license@zend.com so we can send you a copy immediately.
0014  *
0015  * @category   Zend
0016  * @package    Zend_Gdata
0017  * @subpackage Calendar
0018  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0019  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0020  * @version    $Id$
0021  */
0022 
0023 /**
0024  * @see Zend_Gdata_Entry
0025  */
0026 // require_once 'Zend/Gdata/App/Extension/Link.php';
0027 
0028 /**
0029  * @see Zend_Gdata_Entry
0030  */
0031 // require_once 'Zend/Gdata/Calendar/Extension/WebContent.php';
0032 
0033 
0034 /**
0035  * Specialized Link class for use with Calendar. Enables use of gCal extension elements.
0036  *
0037  * @category   Zend
0038  * @package    Zend_Gdata
0039  * @subpackage Calendar
0040  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0041  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0042  */
0043 class Zend_Gdata_Calendar_Extension_Link extends Zend_Gdata_App_Extension_Link
0044 {
0045 
0046     protected $_webContent = null;
0047 
0048     /**
0049      * Constructs a new Zend_Gdata_Calendar_Extension_Link object.
0050      * @see Zend_Gdata_App_Extension_Link#__construct
0051      * @param Zend_Gdata_Calendar_Extension_Webcontent $webContent
0052      */
0053     public function __construct($href = null, $rel = null, $type = null,
0054             $hrefLang = null, $title = null, $length = null, $webContent = null)
0055     {
0056         $this->registerAllNamespaces(Zend_Gdata_Calendar::$namespaces);
0057         parent::__construct($href, $rel, $type, $hrefLang, $title, $length);
0058         $this->_webContent = $webContent;
0059     }
0060 
0061     /**
0062      * Retrieves a DOMElement which corresponds to this element and all
0063      * child properties.  This is used to build an entry back into a DOM
0064      * and eventually XML text for sending to the server upon updates, or
0065      * for application storage/persistence.
0066      *
0067      * @param DOMDocument $doc The DOMDocument used to construct DOMElements
0068      * @return DOMElement The DOMElement representing this element and all
0069      * child properties.
0070      */
0071     public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
0072     {
0073         $element = parent::getDOM($doc, $majorVersion, $minorVersion);
0074         if ($this->_webContent != null) {
0075             $element->appendChild($this->_webContent->getDOM($element->ownerDocument));
0076         }
0077         return $element;
0078     }
0079 
0080     /**
0081      * Creates individual Entry objects of the appropriate type and
0082      * stores them as members of this entry based upon DOM data.
0083      *
0084      * @param DOMNode $child The DOMNode to process
0085      */
0086     protected function takeChildFromDOM($child)
0087     {
0088         $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
0089         switch ($absoluteNodeName) {
0090         case $this->lookupNamespace('gCal') . ':' . 'webContent':
0091             $webContent = new Zend_Gdata_Calendar_Extension_WebContent();
0092             $webContent->transferFromDOM($child);
0093             $this->_webContent = $webContent;
0094             break;
0095         default:
0096             parent::takeChildFromDOM($child);
0097             break;
0098         }
0099     }
0100 
0101     /**
0102      * Get the value for this element's WebContent attribute.
0103      *
0104      * @return Zend_Gdata_Calendar_Extension_Webcontent The WebContent value
0105      */
0106     public function getWebContent()
0107     {
0108         return $this->_webContent;
0109     }
0110 
0111     /**
0112      * Set the value for this element's WebContent attribute.
0113      *
0114      * @param Zend_Gdata_Calendar_Extension_WebContent $value The desired value for this attribute.
0115      * @return Zend_Calendar_Extension_Link The element being modified.  Provides a fluent interface.
0116      */
0117     public function setWebContent($value)
0118     {
0119         $this->_webContent = $value;
0120         return $this;
0121     }
0122 
0123 
0124 }
0125