Moved recent v5.0.0 statement fix to current master.
[openemr.git] / interface / eRxGlobals.php
blobd7a0955c89c13500fc88f795f0d54d4a6f9bd802
1 <?php
3 /**
4 * interface/eRxGlobals.php Functions for retrieving NewCrop global configurations.
6 * Copyright (C) 2015 Sam Likins <sam.likins@wsi-services.com>
8 * LICENSE: This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by the Free
10 * Software Foundation; either version 3 of the License, or (at your option) any
11 * later version. This program is distributed in the hope that it will be
12 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
14 * Public License for more details. You should have received a copy of the GNU
15 * General Public License along with this program.
16 * If not, see <http://opensource.org/licenses/gpl-license.php>.
18 * @package OpenEMR
19 * @subpackage NewCrop
20 * @author Sam Likins <sam.likins@wsi-services.com>
21 * @link http://www.open-emr.org
24 class eRxGlobals
27 private $configuration;
29 /**
30 * Construct eRxGlobals optionally providing an array of configurations to use
31 * @param array|null &$configuration [optional] Array of configurations to use
33 public function __construct(&$configuration = null)
35 if (is_array($configuration)) {
36 $this->setGlobals($configuration);
40 /**
41 * Set the configuration array for use in eRxGlobals
42 * @param array &$configuration Array of configurations to use
44 public function setGlobals(&$configuration)
46 $this->configuration =& $configuration;
48 return $this;
51 /**
52 * Return the value stored in configurations specified by the key
53 * @param string $key Configuration array key
54 * @return mixed Configuration specified by the key
56 public function getGlobalValue($key)
58 if (array_key_exists($key, $this->configuration)) {
59 return $this->configuration[$key];
63 /**
64 * Return the version of OpenEMR
65 * @return string OpenEMR version
67 public function getOpenEMRVersion()
69 return $this->getGlobalValue('openemr_version');
72 /**
73 * Return the OpenEMR site directory
74 * @return string OpenEMR site directory
76 public function getOpenEMRSiteDirectory()
78 return $this->getGlobalValue('OE_SITE_DIR');
81 /**
82 * Return enable state for NewCrop eRx service
83 * @return boolean NewCrop eRx service enabled state
85 public function getEnabled()
87 return $this->getGlobalValue('erx_enable');
90 /**
91 * Return the NewCrop eRx requests URL
92 * @return string URL for NewCrop eRx requests
94 public function getPath()
96 return $this->getGlobalValue('erx_newcrop_path');
99 /**
100 * Return the NewCrop eRx service URLs
101 * @return array URLs for NewCrop eRx services: index [ 0 = Update, 1 = Patient ]
103 public function getSoapPaths()
105 return explode(';', $this->getGlobalValue('erx_newcrop_path_soap'));
109 * Return the NewCrop eRx allergies time-to-live
110 * @return integer Time-to-live in seconds for NewCrop eRx allergies
112 public function getTTLSoapAllergies()
114 return $this->getGlobalValue('erx_soap_ttl_allergies');
118 * Return the NewCrop eRx medications time-to-live
119 * @return integer Time-to-live in seconds for NewCrop eRx medications
121 public function getTTLSoapMedications()
123 return $this->getGlobalValue('erx_soap_ttl_medications');
127 * Return the NewCrop eRx partner name for credentials
128 * @return string Partner name for credentials
130 public function getPartnerName()
132 return $this->getGlobalValue('erx_account_partner_name');
136 * Return the NewCrop eRx account name for credentials
137 * @return string Account name for credentials
139 public function getAccountName()
141 return $this->getGlobalValue('erx_account_name');
145 * Return the NewCrop eRx password for credentials
146 * @return string Password for credentials
148 public function getAccountPassword()
150 return $this->getGlobalValue('erx_account_password');
154 * Return the NewCrop eRx account Id for credentials
155 * @return string Account Id for credentials
157 public function getAccountId()
159 return $this->getGlobalValue('erx_account_id');
163 * Return enable state for NewCrop eRx only upload prescriptions
164 * @return boolean NewCrop eRx only upload prescriptions enabled state
166 public function getUploadActive()
168 return $this->getGlobalValue('erx_upload_active');
172 * Return enable state for NewCrop eRx import status message
173 * @return boolean NewCrop eRx import status message enabled state
175 public function getImportStatusMessage()
177 return $this->getGlobalValue('erx_import_status_message');
181 * Return enable state for NewCrop eRx display medications uploaded
182 * @return boolean NewCrop eRx display medications uploaded enabled state
184 public function getDisplayMedication()
186 return $this->getGlobalValue('erx_medication_display');
190 * Return enable state for NewCrop eRx display allergies uploaded
191 * @return boolean NewCrop eRx display allergies uploaded enabled state
193 public function getDisplayAllergy()
195 return $this->getGlobalValue('erx_allergy_display');
199 * Return NewCrop eRx default patient country code
200 * @return string NewCrop eRx default patient country code
202 public function getDefaultPatientCountry()
204 return $this->getGlobalValue('erx_default_patient_country');
208 * Return array containing NewCrop eRx credentials
209 * @return array NewCrop eRx credentials: index [ 0 = Partner Name, 1 = Account Name, 2 = Password ]
211 public function getCredentials()
213 return array(
214 $this->getPartnerName(),
215 $this->getAccountName(),
216 $this->getAccountPassword(),
221 * Return Debug NewCrop eRx settings
222 * @return integer Debug settings: flags [ 1 = XML, 2 = RESULT ]
224 public function getDebugSetting()
226 return $this->getGlobalValue('erx_debug_setting');