]> CyberLeo.Net >> Repos - Github/sugarcrm.git/blob - Zend/Gdata/Spreadsheets/Extension/Custom.php
Release 6.5.0
[Github/sugarcrm.git] / Zend / Gdata / Spreadsheets / Extension / Custom.php
1 <?php
2 /**
3  * Zend Framework
4  *
5  * LICENSE
6  *
7  * This source file is subject to the new BSD license that is bundled
8  * with this package in the file LICENSE.txt.
9  * It is also available through the world-wide-web at this URL:
10  * http://framework.zend.com/license/new-bsd
11  * If you did not receive a copy of the license and are unable to
12  * obtain it through the world-wide-web, please send an email
13  * to license@zend.com so we can send you a copy immediately.
14  *
15  * @category   Zend
16  * @package    Zend_Gdata
17  * @subpackage Spreadsheets
18  * @copyright  Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
19  * @license    http://framework.zend.com/license/new-bsd     New BSD License
20
21  */
22
23 /**
24  * @see Zend_Gdata_Entry
25  */
26 require_once 'Zend/Gdata/Entry.php';
27
28 /**
29  * @see Zend_Gdata_Extension
30  */
31 require_once 'Zend/Gdata/Extension.php';
32
33
34 /**
35  * Concrete class for working with custom gsx elements.
36  *
37  * @category   Zend
38  * @package    Zend_Gdata
39  * @subpackage Spreadsheets
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_Spreadsheets_Extension_Custom extends Zend_Gdata_Extension
44 {
45     // custom elements have custom names.
46     protected $_rootElement = null; // The name of the column
47     protected $_rootNamespace = 'gsx';
48
49     /**
50      * Constructs a new Zend_Gdata_Spreadsheets_Extension_Custom object.
51      * @param string $column (optional) The column/tag name of the element.
52      * @param string $value (optional) The text content of the element.
53      */
54     public function __construct($column = null, $value = null)
55     {
56         $this->registerAllNamespaces(Zend_Gdata_Spreadsheets::$namespaces);
57         parent::__construct();
58         $this->_text = $value;
59         $this->_rootElement = $column;
60     }
61
62     public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
63     {
64         $element = parent::getDOM($doc, $majorVersion, $minorVersion);
65         return $element;
66     }
67
68     /**
69      * Transfers each child and attribute into member variables.
70      * This is called when XML is received over the wire and the data
71      * model needs to be built to represent this XML.
72      *
73      * @param DOMNode $node The DOMNode that represents this object's data
74      */
75     public function transferFromDOM($node)
76     {
77         parent::transferFromDOM($node);
78         $this->_rootElement = $node->localName;
79     }
80
81     /**
82      * Sets the column/tag name of the element.
83      * @param string $column The new column name.
84      */
85     public function setColumnName($column)
86     {
87         $this->_rootElement = $column;
88         return $this;
89     }
90
91     /**
92      * Gets the column name of the element
93      * @return string The column name.
94      */
95     public function getColumnName()
96     {
97         return $this->_rootElement;
98     }
99
100 }