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 App
|
---|
19 | * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
---|
20 | * @license http://framework.zend.com/license/new-bsd New BSD License
|
---|
21 | */
|
---|
22 |
|
---|
23 | /**
|
---|
24 | * @see Zend_Gdata_App_Extension
|
---|
25 | */
|
---|
26 | require_once 'Zend/Gdata/App/Extension.php';
|
---|
27 |
|
---|
28 | /**
|
---|
29 | * @see Zend_Gdata_App_Extension_Draft
|
---|
30 | */
|
---|
31 | require_once 'Zend/Gdata/App/Extension/Draft.php';
|
---|
32 |
|
---|
33 | /**
|
---|
34 | * Represents the app:control element
|
---|
35 | *
|
---|
36 | * @category Zend
|
---|
37 | * @package Zend_Gdata
|
---|
38 | * @subpackage App
|
---|
39 | * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
---|
40 | * @license http://framework.zend.com/license/new-bsd New BSD License
|
---|
41 | */
|
---|
42 | class Zend_Gdata_App_Extension_Control extends Zend_Gdata_App_Extension
|
---|
43 | {
|
---|
44 |
|
---|
45 | protected $_rootNamespace = 'app';
|
---|
46 | protected $_rootElement = 'control';
|
---|
47 | protected $_draft = null;
|
---|
48 |
|
---|
49 | public function __construct($draft = null)
|
---|
50 | {
|
---|
51 | parent::__construct();
|
---|
52 | $this->_draft = $draft;
|
---|
53 | }
|
---|
54 |
|
---|
55 | public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
|
---|
56 | {
|
---|
57 | $element = parent::getDOM($doc, $majorVersion, $minorVersion);
|
---|
58 | if ($this->_draft != null) {
|
---|
59 | $element->appendChild($this->_draft->getDOM($element->ownerDocument));
|
---|
60 | }
|
---|
61 | return $element;
|
---|
62 | }
|
---|
63 |
|
---|
64 | protected function takeChildFromDOM($child)
|
---|
65 | {
|
---|
66 | $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
|
---|
67 | switch ($absoluteNodeName) {
|
---|
68 | case $this->lookupNamespace('app') . ':' . 'draft':
|
---|
69 | $draft = new Zend_Gdata_App_Extension_Draft();
|
---|
70 | $draft->transferFromDOM($child);
|
---|
71 | $this->_draft = $draft;
|
---|
72 | break;
|
---|
73 | default:
|
---|
74 | parent::takeChildFromDOM($child);
|
---|
75 | break;
|
---|
76 | }
|
---|
77 | }
|
---|
78 |
|
---|
79 | /**
|
---|
80 | * @return Zend_Gdata_App_Extension_Draft
|
---|
81 | */
|
---|
82 | public function getDraft()
|
---|
83 | {
|
---|
84 | return $this->_draft;
|
---|
85 | }
|
---|
86 |
|
---|
87 | /**
|
---|
88 | * @param Zend_Gdata_App_Extension_Draft $value
|
---|
89 | * @return Zend_Gdata_App_Entry Provides a fluent interface
|
---|
90 | */
|
---|
91 | public function setDraft($value)
|
---|
92 | {
|
---|
93 | $this->_draft = $value;
|
---|
94 | return $this;
|
---|
95 | }
|
---|
96 |
|
---|
97 | }
|
---|