[ Index ] |
PHP Cross Reference of moodle-2.8 |
[Summary view] [Print] [Text view]
1 <?php 2 /** 3 * Zend Framework 4 * 5 * LICENSE 6 * 7 * This source file is subject to the new BSD license that is bundled 8 * with this package in the file LICENSE.txt. 9 * It is also available through the world-wide-web at this URL: 10 * http://framework.zend.com/license/new-bsd 11 * If you did not receive a copy of the license and are unable to 12 * obtain it through the world-wide-web, please send an email 13 * to [email protected] so we can send you a copy immediately. 14 * 15 * @category Zend 16 * @package Zend_Gdata 17 * @subpackage Health 18 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) 19 * @license http://framework.zend.com/license/new-bsd New BSD License 20 * @version $Id$ 21 */ 22 23 /** 24 * @see Zend_Gdata_App_Extension_Element 25 */ 26 require_once 'Zend/Gdata/App/Extension/Element.php'; 27 28 /** 29 * Concrete class for working with CCR elements. 30 * 31 * @category Zend 32 * @package Zend_Gdata 33 * @subpackage Health 34 * @copyright Copyright (c) 2005-2010 Zend Technologies USA Inc. (http://www.zend.com) 35 * @license http://framework.zend.com/license/new-bsd New BSD License 36 */ 37 class Zend_Gdata_Health_Extension_Ccr extends Zend_Gdata_App_Extension_Element 38 { 39 protected $_rootNamespace = 'ccr'; 40 protected $_rootElement = 'ContinuityOfCareRecord'; 41 protected $_ccrDom = null; 42 43 /** 44 * Creates a Zend_Gdata_Health_Extension_Ccr entry, representing CCR data 45 * 46 * @param DOMElement $element (optional) DOMElement from which this 47 * object should be constructed. 48 */ 49 public function __construct($element = null) 50 { 51 foreach (Zend_Gdata_Health::$namespaces as $nsPrefix => $nsUri) { 52 $this->registerNamespace($nsPrefix, $nsUri); 53 } 54 } 55 56 /** 57 * Transfers each child and attribute into member variables. 58 * This is called when XML is received over the wire and the data 59 * model needs to be built to represent this XML. 60 * 61 * @param DOMNode $node The DOMNode that represents this object's data 62 */ 63 public function transferFromDOM($node) 64 { 65 $this->_ccrDom = $node; 66 } 67 68 /** 69 * Retrieves a DOMElement which corresponds to this element and all 70 * child properties. This is used to build an entry back into a DOM 71 * and eventually XML text for sending to the server upon updates, or 72 * for application storage/persistence. 73 * 74 * @param DOMDocument $doc The DOMDocument used to construct DOMElements 75 * @return DOMElement The DOMElement representing this element and all 76 * child properties. 77 */ 78 public function getDOM($doc = null, $majorVersion = 1, $minorVersion = null) 79 { 80 if ($doc === null) { 81 $doc = new DOMDocument('1.0', 'utf-8'); 82 } 83 $domElement = $doc->importNode($this->_ccrDom, true); 84 return $domElement; 85 } 86 87 /** 88 * Magic helper that allows drilling down and returning specific elements 89 * in the CCR. For example, to retrieve the users medications 90 * (/ContinuityOfCareRecord/Body/Medications) from the entry's CCR, call 91 * $entry->getCcr()->getMedications(). Similarly, getConditions() would 92 * return extract the user's conditions. 93 * 94 * @param string $name Name of the function to call 95 * @param unknown $args 96 * @return array.<DOMElement> A list of the appropriate CCR data 97 */ 98 public function __call($name, $args) 99 { 100 if (substr($name, 0, 3) === 'get') { 101 $category = substr($name, 3); 102 103 switch ($category) { 104 case 'Conditions': 105 $category = 'Problems'; 106 break; 107 case 'Allergies': 108 $category = 'Alerts'; 109 break; 110 case 'TestResults': 111 // TestResults is an alias for LabResults 112 case 'LabResults': 113 $category = 'Results'; 114 break; 115 default: 116 // $category is already well formatted 117 } 118 119 return $this->_ccrDom->getElementsByTagNameNS($this->lookupNamespace('ccr'), $category); 120 } else { 121 return null; 122 } 123 } 124 }
title
Description
Body
title
Description
Body
title
Description
Body
title
Body
Generated: Fri Nov 28 20:29:05 2014 | Cross-referenced by PHPXref 0.7.1 |