import v1.1.0_beta1 | 2009-08-21

This commit is contained in:
2019-07-17 22:16:19 +02:00
parent 2c1152f0d3
commit 8dee6b1a10
2306 changed files with 251360 additions and 23428 deletions

View File

@ -0,0 +1,125 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Health
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
* @version $Id: Ccr.php 13522 2009-01-06 16:35:55Z thomas $
*/
/**
* @see Zend_Gdata_App_Extension_Element
*/
require_once 'Zend/Gdata/App/Extension/Element.php';
/**
* Concrete class for working with CCR elements.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Health
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_Health_Extension_Ccr extends Zend_Gdata_App_Extension_Element
{
protected $_rootNamespace = 'ccr';
protected $_rootElement = 'ContinuityOfCareRecord';
protected $_ccrDom = null;
/**
* Creates a Zend_Gdata_Health_Extension_Ccr entry, representing CCR data
*
* @param DOMElement $element (optional) DOMElement from which this
* object should be constructed.
*/
public function __construct($element = null)
{
foreach (Zend_Gdata_Health::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
}
/**
* Transfers each child and attribute into member variables.
* This is called when XML is received over the wire and the data
* model needs to be built to represent this XML.
*
* @param DOMNode $node The DOMNode that represents this object's data
*/
public function transferFromDOM($node)
{
$this->_ccrDom = $node;
}
/**
* Retrieves a DOMElement which corresponds to this element and all
* child properties. This is used to build an entry back into a DOM
* and eventually XML text for sending to the server upon updates, or
* for application storage/persistence.
*
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
* @return DOMElement The DOMElement representing this element and all
* child properties.
*/
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
{
if ($doc === null) {
$doc = new DOMDocument('1.0', 'utf-8');
}
$domElement = $doc->importNode($this->_ccrDom, true);
return $domElement;
}
/**
* Magic helper that allows drilling down and returning specific elements
* in the CCR. For example, to retrieve the users medications
* (/ContinuityOfCareRecord/Body/Medications) from the entry's CCR, call
* $entry->getCcr()->getMedications(). Similarly, getConditions() would
* return extract the user's conditions.
*
* @param string $name Name of the function to call
* @return array.<DOMElement> A list of the appropriate CCR data
*/
public function __call($name, $args)
{
$matches = array();
if (substr($name, 0, 3) === 'get') {
$category = substr($name, 3);
switch ($category) {
case 'Conditions':
$category = 'Problems';
break;
case 'Allergies':
$category = 'Alerts';
break;
case 'TestResults':
// TestResults is an alias for LabResults
case 'LabResults':
$category = 'Results';
break;
default:
// $category is already well formatted
}
return $this->_ccrDom->getElementsByTagNameNS($this->lookupNamespace('ccr'), $category);
} else {
return null;
}
}
}

View File

@ -0,0 +1,134 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Health
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* @see Zend_Gdata_Entry
*/
require_once 'Zend/Gdata/Entry.php';
/**
* @see Zend_Gdata_Health_Extension_Ccr
*/
require_once 'Zend/Gdata/Health/Extension/Ccr.php';
/**
* Concrete class for working with Health profile entries.
*
* @link http://code.google.com/apis/health/
*
* @category Zend
* @package Zend_Gdata
* @subpackage Health
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_Health_ProfileEntry extends Zend_Gdata_Entry
{
/**
* The classname for individual profile entry elements.
*
* @var string
*/
protected $_entryClassName = 'Zend_Gdata_Health_ProfileEntry';
/**
* Google Health CCR data
*
* @var Zend_Gdata_Health_Extension_Ccr
*/
protected $_ccrData = null;
/**
* Constructs a new Zend_Gdata_Health_ProfileEntry object.
* @param DOMElement $element (optional) The DOMElement on which to base this object.
*/
public function __construct($element = null)
{
foreach (Zend_Gdata_Health::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
parent::__construct($element);
}
/**
* Retrieves a DOMElement which corresponds to this element and all
* child properties. This is used to build an entry back into a DOM
* and eventually XML text for application storage/persistence.
*
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
* @return DOMElement The DOMElement representing this element and all
* child properties.
*/
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
{
$element = parent::getDOM($doc, $majorVersion, $minorVersion);
if ($this->_ccrData !== null) {
$element->appendChild($this->_ccrData->getDOM($element->ownerDocument));
}
return $element;
}
/**
* Creates individual Entry objects of the appropriate type and
* stores them as members of this entry based upon DOM data.
*
* @param DOMNode $child The DOMNode to process
*/
protected function takeChildFromDOM($child)
{
$absoluteNodeName = $child->namespaceURI . ':' . $child->localName;
if (strstr($absoluteNodeName, $this->lookupNamespace('ccr') . ':')) {
$ccrElement = new Zend_Gdata_Health_Extension_Ccr();
$ccrElement->transferFromDOM($child);
$this->_ccrData = $ccrElement;
} else {
parent::takeChildFromDOM($child);
}
}
/**
* Sets the profile entry's CCR data
* @param string $ccrXMLStr The CCR as an xml string
* @return Zend_Gdata_Health_Extension_Ccr
*/
public function setCcr($ccrXMLStr) {
$ccrElement = null;
if ($ccrXMLStr != null) {
$ccrElement = new Zend_Gdata_Health_Extension_Ccr();
$ccrElement->transferFromXML($ccrXMLStr);
$this->_ccrData = $ccrElement;
}
return $ccrElement;
}
/**
* Returns all the CCR data in a profile entry
* @return Zend_Gdata_Health_Extension_Ccr
*/
public function getCcr() {
return $this->_ccrData;
}
}

View File

@ -0,0 +1,66 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Health
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* @see Zend_Gdata_Feed
*/
require_once 'Zend/Gdata/Feed.php';
/**
* Represents a Google Health user's Profile Feed
*
* @link http://code.google.com/apis/health/
*
* @category Zend
* @package Zend_Gdata
* @subpackage Health
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_Health_ProfileFeed extends Zend_Gdata_Feed
{
/**
* The class name for individual profile feed elements.
*
* @var string
*/
protected $_entryClassName = 'Zend_Gdata_Health_ProfileEntry';
/**
* Creates a Health Profile feed, representing a user's Health profile
*
* @param DOMElement $element (optional) DOMElement from which this
* object should be constructed.
*/
public function __construct($element = null)
{
foreach (Zend_Gdata_Health::$namespaces as $nsPrefix => $nsUri) {
$this->registerNamespace($nsPrefix, $nsUri);
}
parent::__construct($element);
}
public function getEntries()
{
return $this->entry;
}
}

View File

@ -0,0 +1,99 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Health
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* @see Zend_Gdata_Entry
*/
require_once 'Zend/Gdata/Entry.php';
/**
* Concrete class for working with Health profile list entries.
*
* @link http://code.google.com/apis/health/
*
* @category Zend
* @package Zend_Gdata
* @subpackage Health
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_Health_ProfileListEntry extends Zend_Gdata_Entry
{
/**
* The classname for individual profile list entry elements.
*
* @var string
*/
protected $_entryClassName = 'Zend_Gdata_Health_ProfileListEntry';
/**
* Constructs a new Zend_Gdata_Health_ProfileListEntry object.
* @param DOMElement $element (optional) The DOMElement on which to base this object.
*/
public function __construct($element = null)
{
parent::__construct($element);
}
/**
* Retrieves a DOMElement which corresponds to this element and all
* child properties. This is used to build an entry back into a DOM
* and eventually XML text for application storage/persistence.
*
* @param DOMDocument $doc The DOMDocument used to construct DOMElements
* @return DOMElement The DOMElement representing this element and all
* child properties.
*/
public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null)
{
$element = parent::getDOM($doc, $majorVersion, $minorVersion);
return $element;
}
/**
* Creates individual Entry objects of the appropriate type and
* stores them as members of this entry based upon DOM data.
*
* @param DOMNode $child The DOMNode to process
*/
protected function takeChildFromDOM($child)
{
parent::takeChildFromDOM($child);
}
/**
* Retrieves the profile ID for the entry, which is contained in <atom:content>
* @return string The profile id
*/
public function getProfileID() {
return $this->getContent()->text;
}
/**
* Retrieves the profile's title, which is contained in <atom:title>
* @return string The profile name
*/
public function getProfileName() {
return $this->getTitle()->text;
}
}

View File

@ -0,0 +1,52 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Health
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* @see Zend_Gdata_Feed
*/
require_once 'Zend/Gdata/Feed.php';
/**
* Represents a Google Health user's Profile List Feed
*
* @link http://code.google.com/apis/health/
*
* @category Zend
* @package Zend_Gdata
* @subpackage Health
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_Health_ProfileListFeed extends Zend_Gdata_Feed
{
/**
* The class name for individual profile feed elements.
*
* @var string
*/
protected $_entryClassName = 'Zend_Gdata_Health_ProfileListEntry';
public function getEntries()
{
return $this->entry;
}
}

284
libs/Zend/Gdata/Health/Query.php Executable file
View File

@ -0,0 +1,284 @@
<?php
/**
* Zend Framework
*
* LICENSE
*
* This source file is subject to the new BSD license that is bundled
* with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://framework.zend.com/license/new-bsd
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@zend.com so we can send you a copy immediately.
*
* @category Zend
* @package Zend_Gdata
* @subpackage Health
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
/**
* @see Zend_Gdata_Query
*/
require_once('Zend/Gdata/Query.php');
/**
* Assists in constructing queries for Google Health
*
* @link http://code.google.com/apis/health
*
* @category Zend
* @package Zend_Gdata
* @subpackage Health
* @copyright Copyright (c) 2005-2008 Zend Technologies USA Inc. (http://www.zend.com)
* @license http://framework.zend.com/license/new-bsd New BSD License
*/
class Zend_Gdata_Health_Query extends Zend_Gdata_Query
{
/**
* URI of a user's profile feed.
*/
const HEALTH_PROFILE_FEED_URI =
'https://www.google.com/health/feeds/profile/default';
/**
* URI of register (notices) feed.
*/
const HEALTH_REGISTER_FEED_URI =
'https://www.google.com/health/feeds/register/default';
/**
* Namespace for an item category
*/
const ITEM_CATEGORY_NS = 'http://schemas.google.com/health/item';
/**
* The default URI for POST methods
*
* @var string
*/
protected $_defaultFeedUri = self::HEALTH_PROFILE_FEED_URI;
/**
* Sets the digest parameter's value.
*
* @param string $value
* @return Zend_Gdata_Health_Query Provides a fluent interface
*/
public function setDigest($value)
{
if ($value !== null) {
$this->_params['digest'] = $value;
}
return $this;
}
/**
* Returns the digest parameter's value.
*
* @return string The value set for the digest parameter.
*/
public function getDigest()
{
if (array_key_exists('digest', $this->_params)) {
return $this->_params['digest'];
} else {
return null;
}
}
/**
* Setter for category queries.
*
* @param string $item A category to query.
* @param string $name (optional) A specific item to search a category for.
* An example would be 'Lipitor' if $item is set to 'medication'.
* @return Zend_Gdata_Health_Query Provides a fluent interface
*/
public function setCategory($item, $name = null)
{
$this->_category = $item .
($name ? '/' . urlencode('{' . self::ITEM_CATEGORY_NS . '}' . $name) : null);
return $this;
}
/**
* Returns the query object's category.
*
* @return string id
*/
public function getCategory()
{
return $this->_category;
}
/**
* Setter for the grouped parameter.
*
* @param string $value setting a count of results per group.
* @return Zend_Gdata_Health_Query Provides a fluent interface
*/
public function setGrouped($value)
{
if ($value !== null) {
$this->_params['grouped'] = $value;
}
return $this;
}
/**
* Returns the value set for the grouped parameter.
*
* @return string grouped parameter.
*/
public function getGrouped()
{
if (array_key_exists('grouped', $this->_params)) {
return $this->_params['grouped'];
} else {
return null;
}
}
/**
* Setter for the max-results-group parameter.
*
* @param int $value Specifies the maximum number of groups to be
* retrieved. Must be an integer value greater than zero. This parameter
* is only valid if grouped=true.
* @return Zend_Gdata_Health_Query Provides a fluent interface
*/
public function setMaxResultsGroup($value)
{
if ($value !== null) {
if ($value <= 0 || $this->getGrouped() !== 'true') {
require_once 'Zend/Gdata/App/InvalidArgumentException.php';
throw new Zend_Gdata_App_InvalidArgumentException(
'The max-results-group parameter must be set to a value
greater than 0 and can only be used if grouped=true');
} else {
$this->_params['max-results-group'] = $value;
}
}
return $this;
}
/**
* Returns the value set for max-results-group.
*
* @return int Returns max-results-group parameter.
*/
public function getMaxResultsGroup()
{
if (array_key_exists('max-results-group', $this->_params)) {
return $this->_params['max-results-group'];
} else {
return null;
}
}
/**
* Setter for the max-results-group parameter.
*
* @param int $value Specifies the maximum number of records to be
* retrieved from each group. The limits that you specify with this
* parameter apply to all groups. Must be an integer value greater than
* zero. This parameter is only valid if grouped=true.
* @return Zend_Gdata_Health_Query Provides a fluent interface
*/
public function setMaxResultsInGroup($value)
{
if ($value !== null) {
if ($value <= 0 || $this->getGrouped() !== 'true') {
throw new Zend_Gdata_App_InvalidArgumentException(
'The max-results-in-group parameter must be set to a value
greater than 0 and can only be used if grouped=true');
} else {
$this->_params['max-results-in-group'] = $value;
}
}
return $this;
}
/**
* Returns the value set for max-results-in-group.
*
* @return int Returns max-results-in-group parameter.
*/
public function getMaxResultsInGroup()
{
if (array_key_exists('max-results-in-group', $this->_params)) {
return $this->_params['max-results-in-group'];
} else {
return null;
}
}
/**
* Setter for the start-index-group parameter.
*
* @param int $value Retrieves only items whose group ranking is at
* least start-index-group. This should be set to a 1-based index of the
* first group to be retrieved. The range is applied per category.
* This parameter is only valid if grouped=true.
* @return Zend_Gdata_Health_Query Provides a fluent interface
*/
public function setStartIndexGroup($value)
{
if ($value !== null && $this->getGrouped() !== 'true') {
throw new Zend_Gdata_App_InvalidArgumentException(
'The start-index-group can only be used if grouped=true');
} else {
$this->_params['start-index-group'] = $value;
}
return $this;
}
/**
* Returns the value set for start-index-group.
*
* @return int Returns start-index-group parameter.
*/
public function getStartIndexGroup()
{
if (array_key_exists('start-index-group', $this->_params)) {
return $this->_params['start-index-group'];
} else {
return null;
}
}
/**
* Setter for the start-index-in-group parameter.
*
* @param int $value A 1-based index of the records to be retrieved from
* each group. This parameter is only valid if grouped=true.
* @return Zend_Gdata_Health_Query Provides a fluent interface
*/
public function setStartIndexInGroup($value)
{
if ($value !== null && $this->getGrouped() !== 'true') {
throw new Zend_Gdata_App_InvalidArgumentException('start-index-in-group');
} else {
$this->_params['start-index-in-group'] = $value;
}
return $this;
}
/**
* Returns the value set for start-index-in-group.
*
* @return int Returns start-index-in-group parameter.
*/
public function getStartIndexInGroup()
{
if (array_key_exists('start-index-in-group', $this->_params)) {
return $this->_params['start-index-in-group'];
} else {
return null;
}
}
}