3 * interface/eRxGlobals.php Functions for retrieving NewCrop global configurations.
6 * @link http://www.open-emr.org
7 * @author Sam Likins <sam.likins@wsi-services.com>
8 * @copyright Copyright (c) 2015 Sam Likins <sam.likins@wsi-services.com>
9 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
16 private $configuration;
19 * Construct eRxGlobals optionally providing an array of configurations to use
20 * @param array|null &$configuration [optional] Array of configurations to use
22 public function __construct(&$configuration = null)
24 if (is_array($configuration)) {
25 $this->setGlobals($configuration);
30 * Set the configuration array for use in eRxGlobals
31 * @param array &$configuration Array of configurations to use
33 public function setGlobals(&$configuration)
35 $this->configuration
=& $configuration;
41 * Return the value stored in configurations specified by the key
42 * @param string $key Configuration array key
43 * @return mixed Configuration specified by the key
45 public function getGlobalValue($key)
47 if (array_key_exists($key, $this->configuration
)) {
48 return $this->configuration
[$key];
53 * Return the version of OpenEMR
54 * @return string OpenEMR version
56 public function getOpenEMRVersion()
58 return $this->getGlobalValue('openemr_version');
62 * Return the OpenEMR site directory
63 * @return string OpenEMR site directory
65 public function getOpenEMRSiteDirectory()
67 return $this->getGlobalValue('OE_SITE_DIR');
71 * Return enable state for NewCrop eRx service
72 * @return boolean NewCrop eRx service enabled state
74 public function getEnabled()
76 return $this->getGlobalValue('erx_enable');
80 * Return the NewCrop eRx requests URL
81 * @return string URL for NewCrop eRx requests
83 public function getPath()
85 return $this->getGlobalValue('erx_newcrop_path');
89 * Return the NewCrop eRx service URLs
90 * @return array URLs for NewCrop eRx services: index [ 0 = Update, 1 = Patient ]
92 public function getSoapPaths()
94 return explode(';', $this->getGlobalValue('erx_newcrop_path_soap'));
98 * Return the NewCrop eRx allergies time-to-live
99 * @return integer Time-to-live in seconds for NewCrop eRx allergies
101 public function getTTLSoapAllergies()
103 return $this->getGlobalValue('erx_soap_ttl_allergies');
107 * Return the NewCrop eRx medications time-to-live
108 * @return integer Time-to-live in seconds for NewCrop eRx medications
110 public function getTTLSoapMedications()
112 return $this->getGlobalValue('erx_soap_ttl_medications');
116 * Return the NewCrop eRx partner name for credentials
117 * @return string Partner name for credentials
119 public function getPartnerName()
121 return $this->getGlobalValue('erx_account_partner_name');
125 * Return the NewCrop eRx account name for credentials
126 * @return string Account name for credentials
128 public function getAccountName()
130 return $this->getGlobalValue('erx_account_name');
134 * Return the NewCrop eRx password for credentials
135 * @return string Password for credentials
137 public function getAccountPassword()
139 return $this->getGlobalValue('erx_account_password');
143 * Return the NewCrop eRx account Id for credentials
144 * @return string Account Id for credentials
146 public function getAccountId()
148 return $this->getGlobalValue('erx_account_id');
152 * Return enable state for NewCrop eRx only upload prescriptions
153 * @return boolean NewCrop eRx only upload prescriptions enabled state
155 public function getUploadActive()
157 return $this->getGlobalValue('erx_upload_active');
161 * Return enable state for NewCrop eRx import status message
162 * @return boolean NewCrop eRx import status message enabled state
164 public function getImportStatusMessage()
166 return $this->getGlobalValue('erx_import_status_message');
170 * Return enable state for NewCrop eRx display medications uploaded
171 * @return boolean NewCrop eRx display medications uploaded enabled state
173 public function getDisplayMedication()
175 return $this->getGlobalValue('erx_medication_display');
179 * Return enable state for NewCrop eRx display allergies uploaded
180 * @return boolean NewCrop eRx display allergies uploaded enabled state
182 public function getDisplayAllergy()
184 return $this->getGlobalValue('erx_allergy_display');
188 * Return NewCrop eRx default patient country code
189 * @return string NewCrop eRx default patient country code
191 public function getDefaultPatientCountry()
193 return $this->getGlobalValue('erx_default_patient_country');
197 * Return array containing NewCrop eRx credentials
198 * @return array NewCrop eRx credentials: index [ 0 = Partner Name, 1 = Account Name, 2 = Password ]
200 public function getCredentials()
203 $this->getPartnerName(),
204 $this->getAccountName(),
205 $this->getAccountPassword(),
210 * Return Debug NewCrop eRx settings
211 * @return integer Debug settings: flags [ 1 = XML, 2 = RESULT ]
213 public function getDebugSetting()
215 return $this->getGlobalValue('erx_debug_setting');