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.
19 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
20 * @license http://framework.zend.com/license/new-bsd New BSD License
25 * @see Zend_Gdata_Extension
27 require_once 'Zend/Gdata/Extension.php';
30 * Describes a viewability
35 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
36 * @license http://framework.zend.com/license/new-bsd New BSD License
38 class Zend_Gdata_Books_Extension_Viewability
extends Zend_Gdata_Extension
41 protected $_rootNamespace = 'gbs';
42 protected $_rootElement = 'viewability';
43 protected $_value = null;
46 * Constructor for Zend_Gdata_Books_Extension_Viewability which
47 * Describes a viewability
49 * @param string|null $value A programmatic value representing the book's
52 public function __construct($value = null)
54 $this->registerAllNamespaces(Zend_Gdata_Books
::$namespaces);
55 parent
::__construct();
56 $this->_value
= $value;
60 * Retrieves DOMElement which corresponds to this element and all
61 * child properties. This is used to build this object back into a DOM
62 * and eventually XML text for sending to the server upon updates, or
63 * for application storage/persistance.
65 * @param DOMDocument $doc The DOMDocument used to construct DOMElements
66 * @return DOMElement The DOMElement representing this element and all
69 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
71 $element = parent
::getDOM($doc);
72 if ($this->_value
!== null) {
73 $element->setAttribute('value', $this->_value
);
79 * Extracts XML attributes from the DOM and converts them to the
80 * appropriate object members.
82 * @param DOMNode $attribute The DOMNode attribute to be handled.
84 protected function takeAttributeFromDOM($attribute)
86 switch ($attribute->localName
) {
88 $this->_value
= $attribute->nodeValue
;
91 parent
::takeAttributeFromDOM($attribute);
96 * Returns the programmatic value that describes the viewability of a volume
97 * in Google Book Search
99 * @return string The value
101 public function getValue()
103 return $this->_value
;
107 * Sets the programmatic value that describes the viewability of a volume in
110 * @param string $value programmatic value that describes the viewability
111 * of a volume in Googl eBook Search
112 * @return Zend_Gdata_Books_Extension_Viewability Provides a fluent
115 public function setValue($value)
117 $this->_value
= $value;