File indexing completed on 2025-05-04 05:32:34
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 Books 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_Extension 0026 */ 0027 // require_once 'Zend/Gdata/Extension.php'; 0028 0029 /** 0030 * Describes a viewability 0031 * 0032 * @category Zend 0033 * @package Zend_Gdata 0034 * @subpackage Books 0035 * @copyright Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com) 0036 * @license http://framework.zend.com/license/new-bsd New BSD License 0037 */ 0038 class Zend_Gdata_Books_Extension_Viewability extends Zend_Gdata_Extension 0039 { 0040 0041 protected $_rootNamespace = 'gbs'; 0042 protected $_rootElement = 'viewability'; 0043 protected $_value = null; 0044 0045 /** 0046 * Constructor for Zend_Gdata_Books_Extension_Viewability which 0047 * Describes a viewability 0048 * 0049 * @param string|null $value A programmatic value representing the book's 0050 * viewability mode. 0051 */ 0052 public function __construct($value = null) 0053 { 0054 $this->registerAllNamespaces(Zend_Gdata_Books::$namespaces); 0055 parent::__construct(); 0056 $this->_value = $value; 0057 } 0058 0059 /** 0060 * Retrieves DOMElement which corresponds to this element and all 0061 * child properties. This is used to build this object back into a DOM 0062 * and eventually XML text for sending to the server upon updates, or 0063 * for application storage/persistance. 0064 * 0065 * @param DOMDocument $doc The DOMDocument used to construct DOMElements 0066 * @return DOMElement The DOMElement representing this element and all 0067 * child properties. 0068 */ 0069 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) 0070 { 0071 $element = parent::getDOM($doc); 0072 if ($this->_value !== null) { 0073 $element->setAttribute('value', $this->_value); 0074 } 0075 return $element; 0076 } 0077 0078 /** 0079 * Extracts XML attributes from the DOM and converts them to the 0080 * appropriate object members. 0081 * 0082 * @param DOMNode $attribute The DOMNode attribute to be handled. 0083 */ 0084 protected function takeAttributeFromDOM($attribute) 0085 { 0086 switch ($attribute->localName) { 0087 case 'value': 0088 $this->_value = $attribute->nodeValue; 0089 break; 0090 default: 0091 parent::takeAttributeFromDOM($attribute); 0092 } 0093 } 0094 0095 /** 0096 * Returns the programmatic value that describes the viewability of a volume 0097 * in Google Book Search 0098 * 0099 * @return string The value 0100 */ 0101 public function getValue() 0102 { 0103 return $this->_value; 0104 } 0105 0106 /** 0107 * Sets the programmatic value that describes the viewability of a volume in 0108 * Google Book Search 0109 * 0110 * @param string $value programmatic value that describes the viewability 0111 * of a volume in Googl eBook Search 0112 * @return Zend_Gdata_Books_Extension_Viewability Provides a fluent 0113 * interface 0114 */ 0115 public function setValue($value) 0116 { 0117 $this->_value = $value; 0118 return $this; 0119 } 0120 0121 0122 } 0123