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_Entry
27 require_once 'Zend/Gdata/Entry.php';
30 * @see Zend_Gdata_Health_Extension_Ccr
32 require_once 'Zend/Gdata/Health/Extension/Ccr.php';
35 * Concrete class for working with Health profile entries.
37 * @link http://code.google.com/apis/health/
42 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com)
43 * @license http://framework.zend.com/license/new-bsd New BSD License
45 class Zend_Gdata_Health_ProfileEntry extends Zend_Gdata_Entry
48 * The classname for individual profile entry elements.
52 protected $_entryClassName = 'Zend_Gdata_Health_ProfileEntry';
55 * Google Health CCR data
57 * @var Zend_Gdata_Health_Extension_Ccr
59 protected $_ccrData = null;
62 * Constructs a new Zend_Gdata_Health_ProfileEntry object.
63 * @param DOMElement $element (optional) The DOMElement on which to base this object.
65 public function __construct($element = null)
67 foreach (Zend_Gdata_Health::$namespaces as $nsPrefix => $nsUri) {
68 $this->registerNamespace($nsPrefix, $nsUri);
70 parent::__construct($element);
74 * Retrieves a DOMElement which corresponds to this element and all
75 * child properties. This is used to build an entry back into a DOM
76 * and eventually XML text for application storage/persistence.
78 * @param DOMDocument $doc The DOMDocument used to construct DOMElements
79 * @return DOMElement The DOMElement representing this element and all
82 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
84 $element = parent::getDOM($doc, $majorVersion, $minorVersion);
85 if ($this->_ccrData !== null) {
86 $element->appendChild($this->_ccrData->getDOM($element->ownerDocument));
93 * Creates individual Entry objects of the appropriate type and
94 * stores them as members of this entry based upon DOM data.
96 * @param DOMNode $child The DOMNode to process
98 protected function takeChildFromDOM($child)
100 $absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
102 if (strstr($absoluteNodeName, $this->lookupNamespace('ccr') . ':')) {
103 $ccrElement = new Zend_Gdata_Health_Extension_Ccr();
104 $ccrElement->transferFromDOM($child);
105 $this->_ccrData = $ccrElement;
107 parent::takeChildFromDOM($child);
113 * Sets the profile entry's CCR data
114 * @param string $ccrXMLStr The CCR as an xml string
115 * @return Zend_Gdata_Health_Extension_Ccr
117 public function setCcr($ccrXMLStr) {
119 if ($ccrXMLStr != null) {
120 $ccrElement = new Zend_Gdata_Health_Extension_Ccr();
121 $ccrElement->transferFromXML($ccrXMLStr);
122 $this->_ccrData = $ccrElement;
129 * Returns all the CCR data in a profile entry
130 * @return Zend_Gdata_Health_Extension_Ccr
132 public function getCcr() {
133 return $this->_ccrData;