File indexing completed on 2025-03-02 05:29:25

0001 <?php
0002 
0003 /**
0004  * Zend Framework
0005  *
0006  * LICENSE
0007  *
0008  * This source file is subject to the new BSD license that is bundled
0009  * with this package in the file LICENSE.txt.
0010  * It is also available through the world-wide-web at this URL:
0011  * http://framework.zend.com/license/new-bsd
0012  * If you did not receive a copy of the license and are unable to
0013  * obtain it through the world-wide-web, please send an email
0014  * to license@zend.com so we can send you a copy immediately.
0015  *
0016  * @category   Zend
0017  * @package    Zend_Gdata
0018  * @subpackage App
0019  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0020  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0021  * @version    $Id$
0022  */
0023 
0024 /**
0025  * @see Zend_Gdata_App_Extension
0026  */
0027 // require_once 'Zend/Gdata/App/Extension.php';
0028 
0029 /**
0030  * @see Zend_Gdata_App_Extension_Draft
0031  */
0032 // require_once 'Zend/Gdata/App/Extension/Draft.php';
0033 
0034 /**
0035  * Represents the app:control element
0036  *
0037  * @category   Zend
0038  * @package    Zend_Gdata
0039  * @subpackage App
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_App_Extension_Control extends Zend_Gdata_App_Extension
0044 {
0045 
0046     protected $_rootNamespace = 'app';
0047     protected $_rootElement = 'control';
0048     protected $_draft = null;
0049 
0050     public function __construct($draft = null)
0051     {
0052         parent::__construct();
0053         $this->_draft = $draft;
0054     }
0055 
0056     public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
0057     {
0058         $element = parent::getDOM($doc, $majorVersion, $minorVersion);
0059         if ($this->_draft != null) {
0060             $element->appendChild($this->_draft->getDOM($element->ownerDocument));
0061         }
0062         return $element;
0063     }
0064 
0065     protected function takeChildFromDOM($child)
0066     {
0067         $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
0068         switch ($absoluteNodeName) {
0069         case $this->lookupNamespace('app') . ':' . 'draft':
0070             $draft = new Zend_Gdata_App_Extension_Draft();
0071             $draft->transferFromDOM($child);
0072             $this->_draft = $draft;
0073             break;
0074         default:
0075             parent::takeChildFromDOM($child);
0076             break;
0077         }
0078     }
0079 
0080     /**
0081      * @return Zend_Gdata_App_Extension_Draft
0082      */
0083     public function getDraft()
0084     {
0085         return $this->_draft;
0086     }
0087 
0088     /**
0089      * @param Zend_Gdata_App_Extension_Draft $value
0090      * @return Zend_Gdata_App_Entry Provides a fluent interface
0091      */
0092     public function setDraft($value)
0093     {
0094         $this->_draft = $value;
0095         return $this;
0096     }
0097 
0098 }