14 * to license@zend.com so we can send you a copy immediately. |
14 * to license@zend.com so we can send you a copy immediately. |
15 * |
15 * |
16 * @category Zend |
16 * @category Zend |
17 * @package Zend_Gdata |
17 * @package Zend_Gdata |
18 * @subpackage Health |
18 * @subpackage Health |
19 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
19 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) |
20 * @license http://framework.zend.com/license/new-bsd New BSD License |
20 * @license http://framework.zend.com/license/new-bsd New BSD License |
21 * @version $Id: ProfileEntry.php 20096 2010-01-06 02:05:09Z bkarwin $ |
21 * @version $Id: ProfileEntry.php 24779 2012-05-08 19:13:59Z adamlundrigan $ |
22 */ |
22 */ |
|
23 |
|
24 /** |
|
25 * @see Zend_Exception |
|
26 */ |
|
27 require_once 'Zend/Exception.php'; |
23 |
28 |
24 /** |
29 /** |
25 * @see Zend_Gdata_Entry |
30 * @see Zend_Gdata_Entry |
26 */ |
31 */ |
27 require_once 'Zend/Gdata/Entry.php'; |
32 require_once 'Zend/Gdata/Entry.php'; |
28 |
|
29 /** |
|
30 * @see Zend_Gdata_Health_Extension_Ccr |
|
31 */ |
|
32 require_once 'Zend/Gdata/Health/Extension/Ccr.php'; |
|
33 |
33 |
34 /** |
34 /** |
35 * Concrete class for working with Health profile entries. |
35 * Concrete class for working with Health profile entries. |
36 * |
36 * |
37 * @link http://code.google.com/apis/health/ |
37 * @link http://code.google.com/apis/health/ |
38 * |
38 * |
39 * @category Zend |
39 * @category Zend |
40 * @package Zend_Gdata |
40 * @package Zend_Gdata |
41 * @subpackage Health |
41 * @subpackage Health |
42 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) |
42 * @copyright Copyright (c) 2005-2012 Zend Technologies USA Inc. (http://www.zend.com) |
43 * @license http://framework.zend.com/license/new-bsd New BSD License |
43 * @license http://framework.zend.com/license/new-bsd New BSD License |
44 */ |
44 */ |
45 class Zend_Gdata_Health_ProfileEntry extends Zend_Gdata_Entry |
45 class Zend_Gdata_Health_ProfileEntry extends Zend_Gdata_Entry |
46 { |
46 { |
47 /** |
|
48 * The classname for individual profile entry elements. |
|
49 * |
|
50 * @var string |
|
51 */ |
|
52 protected $_entryClassName = 'Zend_Gdata_Health_ProfileEntry'; |
|
53 |
|
54 /** |
|
55 * Google Health CCR data |
|
56 * |
|
57 * @var Zend_Gdata_Health_Extension_Ccr |
|
58 */ |
|
59 protected $_ccrData = null; |
|
60 |
|
61 /** |
47 /** |
62 * Constructs a new Zend_Gdata_Health_ProfileEntry object. |
48 * Constructs a new Zend_Gdata_Health_ProfileEntry object. |
63 * @param DOMElement $element (optional) The DOMElement on which to base this object. |
49 * @param DOMElement $element (optional) The DOMElement on which to base this object. |
64 */ |
50 */ |
65 public function __construct($element = null) |
51 public function __construct($element = null) |
66 { |
52 { |
67 foreach (Zend_Gdata_Health::$namespaces as $nsPrefix => $nsUri) { |
53 throw new Zend_Exception( |
68 $this->registerNamespace($nsPrefix, $nsUri); |
54 'Google Health API has been discontinued by Google and was removed' |
69 } |
55 . ' from Zend Framework in 1.12.0. For more information see: ' |
70 parent::__construct($element); |
56 . 'http://googleblog.blogspot.ca/2011/06/update-on-google-health-and-google.html' |
71 } |
57 ); |
72 |
|
73 /** |
|
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. |
|
77 * |
|
78 * @param DOMDocument $doc The DOMDocument used to construct DOMElements |
|
79 * @return DOMElement The DOMElement representing this element and all |
|
80 * child properties. |
|
81 */ |
|
82 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) |
|
83 { |
|
84 $element = parent::getDOM($doc, $majorVersion, $minorVersion); |
|
85 if ($this->_ccrData !== null) { |
|
86 $element->appendChild($this->_ccrData->getDOM($element->ownerDocument)); |
|
87 } |
|
88 |
|
89 return $element; |
|
90 } |
|
91 |
|
92 /** |
|
93 * Creates individual Entry objects of the appropriate type and |
|
94 * stores them as members of this entry based upon DOM data. |
|
95 * |
|
96 * @param DOMNode $child The DOMNode to process |
|
97 */ |
|
98 protected function takeChildFromDOM($child) |
|
99 { |
|
100 $absoluteNodeName = $child->namespaceURI . ':' . $child->localName; |
|
101 |
|
102 if (strstr($absoluteNodeName, $this->lookupNamespace('ccr') . ':')) { |
|
103 $ccrElement = new Zend_Gdata_Health_Extension_Ccr(); |
|
104 $ccrElement->transferFromDOM($child); |
|
105 $this->_ccrData = $ccrElement; |
|
106 } else { |
|
107 parent::takeChildFromDOM($child); |
|
108 |
|
109 } |
|
110 } |
|
111 |
|
112 /** |
|
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 |
|
116 */ |
|
117 public function setCcr($ccrXMLStr) { |
|
118 $ccrElement = null; |
|
119 if ($ccrXMLStr != null) { |
|
120 $ccrElement = new Zend_Gdata_Health_Extension_Ccr(); |
|
121 $ccrElement->transferFromXML($ccrXMLStr); |
|
122 $this->_ccrData = $ccrElement; |
|
123 } |
|
124 return $ccrElement; |
|
125 } |
|
126 |
|
127 |
|
128 /** |
|
129 * Returns all the CCR data in a profile entry |
|
130 * @return Zend_Gdata_Health_Extension_Ccr |
|
131 */ |
|
132 public function getCcr() { |
|
133 return $this->_ccrData; |
|
134 } |
58 } |
135 } |
59 } |