File indexing completed on 2024-06-16 05:30:08

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 Photos
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_Entry
0026  */
0027 // require_once 'Zend/Gdata/Entry.php';
0028 
0029 /**
0030  * @see Zend_Gdata_Photos_Extension_Weight
0031  */
0032 // require_once 'Zend/Gdata/Photos/Extension/Weight.php';
0033 
0034 /**
0035  * @see Zend_Gdata_App_Extension_Category
0036  */
0037 // require_once 'Zend/Gdata/App/Extension/Category.php';
0038 
0039 /**
0040  * Data model class for a Tag Entry.
0041  *
0042  * To transfer user entries to and from the servers, including
0043  * creating new entries, refer to the service class,
0044  * Zend_Gdata_Photos.
0045  *
0046  * This class represents <atom:entry> in the Google Data protocol.
0047  *
0048  * @category   Zend
0049  * @package    Zend_Gdata
0050  * @subpackage Photos
0051  * @copyright  Copyright (c) 2005-2015 Zend Technologies USA Inc. (http://www.zend.com)
0052  * @license    http://framework.zend.com/license/new-bsd     New BSD License
0053  */
0054 class Zend_Gdata_Photos_TagEntry extends Zend_Gdata_Entry
0055 {
0056 
0057     protected $_entryClassName = 'Zend_Gdata_Photos_TagEntry';
0058 
0059     protected $_gphotoWeight = null;
0060 
0061     /**
0062      * Create a new instance.
0063      *
0064      * @param DOMElement $element (optional) DOMElement from which this
0065      *          object should be constructed.
0066      */
0067     public function __construct($element = null)
0068     {
0069         $this->registerAllNamespaces(Zend_Gdata_Photos::$namespaces);
0070         parent::__construct($element);
0071 
0072         $category = new Zend_Gdata_App_Extension_Category(
0073             'http://schemas.google.com/photos/2007#tag',
0074             'http://schemas.google.com/g/2005#kind');
0075         $this->setCategory(array($category));
0076     }
0077 
0078     /**
0079      * Retrieves a DOMElement which corresponds to this element and all
0080      * child properties.  This is used to build an entry back into a DOM
0081      * and eventually XML text for application storage/persistence.
0082      *
0083      * @param DOMDocument $doc The DOMDocument used to construct DOMElements
0084      * @return DOMElement The DOMElement representing this element and all
0085      *          child properties.
0086      */
0087     public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
0088     {
0089         $element = parent::getDOM($doc, $majorVersion, $minorVersion);
0090         if ($this->_gphotoWeight !== null) {
0091             $element->appendChild($this->_gphotoWeight->getDOM($element->ownerDocument));
0092         }
0093         return $element;
0094     }
0095 
0096     /**
0097      * Creates individual Entry objects of the appropriate type and
0098      * stores them as members of this entry based upon DOM data.
0099      *
0100      * @param DOMNode $child The DOMNode to process
0101      */
0102     protected function takeChildFromDOM($child)
0103     {
0104         $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
0105 
0106         switch ($absoluteNodeName) {
0107             case $this->lookupNamespace('gphoto') . ':' . 'weight';
0108                 $weight = new Zend_Gdata_Photos_Extension_Weight();
0109                 $weight->transferFromDOM($child);
0110                 $this->_gphotoWeight = $weight;
0111                 break;
0112             default:
0113                 parent::takeChildFromDOM($child);
0114                 break;
0115         }
0116     }
0117 
0118     /**
0119      * Get the value for this element's gphoto:weight attribute.
0120      *
0121      * @see setGphotoWeight
0122      * @return string The requested attribute.
0123      */
0124     public function getGphotoWeight()
0125     {
0126         return $this->_gphotoWeight;
0127     }
0128 
0129     /**
0130      * Set the value for this element's gphoto:weight attribute.
0131      *
0132      * @param string $value The desired value for this attribute.
0133      * @return Zend_Gdata_Photos_Extension_Weight The element being modified.
0134      */
0135     public function setGphotoWeight($value)
0136     {
0137         $this->_gphotoWeight = $value;
0138         return $this;
0139     }
0140 }