[44] | 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 | * Abstract class for data models that require only text and type-- such as:
|
---|
| 30 | * title, summary, etc.
|
---|
| 31 | *
|
---|
| 32 | * @category Zend
|
---|
| 33 | * @package Zend_Gdata
|
---|
| 34 | * @subpackage App
|
---|
| 35 | * @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
|
---|
| 36 | * @license http://framework.zend.com/license/new-bsd New BSD License
|
---|
| 37 | */
|
---|
| 38 | abstract class Zend_Gdata_App_Extension_Text extends Zend_Gdata_App_Extension
|
---|
| 39 | {
|
---|
| 40 |
|
---|
| 41 | protected $_rootElement = null;
|
---|
| 42 | protected $_type = 'text';
|
---|
| 43 |
|
---|
| 44 | public function __construct($text = null, $type = 'text')
|
---|
| 45 | {
|
---|
| 46 | parent::__construct();
|
---|
| 47 | $this->_text = $text;
|
---|
| 48 | $this->_type = $type;
|
---|
| 49 | }
|
---|
| 50 |
|
---|
| 51 | public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
|
---|
| 52 | {
|
---|
| 53 | $element = parent::getDOM($doc, $majorVersion, $minorVersion);
|
---|
| 54 | if ($this->_type !== null) {
|
---|
| 55 | $element->setAttribute('type', $this->_type);
|
---|
| 56 | }
|
---|
| 57 | return $element;
|
---|
| 58 | }
|
---|
| 59 |
|
---|
| 60 | protected function takeAttributeFromDOM($attribute)
|
---|
| 61 | {
|
---|
| 62 | switch ($attribute->localName) {
|
---|
| 63 | case 'type':
|
---|
| 64 | $this->_type = $attribute->nodeValue;
|
---|
| 65 | break;
|
---|
| 66 | default:
|
---|
| 67 | parent::takeAttributeFromDOM($attribute);
|
---|
| 68 | }
|
---|
| 69 | }
|
---|
| 70 |
|
---|
| 71 | /*
|
---|
| 72 | * @return Zend_Gdata_App_Extension_Type
|
---|
| 73 | */
|
---|
| 74 | public function getType()
|
---|
| 75 | {
|
---|
| 76 | return $this->_type;
|
---|
| 77 | }
|
---|
| 78 |
|
---|
| 79 | /*
|
---|
| 80 | * @param string $value
|
---|
| 81 | * @return Zend_Gdata_App_Extension_Text Provides a fluent interface
|
---|
| 82 | */
|
---|
| 83 | public function setType($value)
|
---|
| 84 | {
|
---|
| 85 | $this->_type = $value;
|
---|
| 86 | return $this;
|
---|
| 87 | }
|
---|
| 88 |
|
---|
| 89 | }
|
---|