styling adjustments (#822)
[openemr.git] / interface / eRxGlobals.php
blobc354e7831e73d02478b04876940c5899e7011fe1
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 {
26 private $configuration;
28 /**
29 * Construct eRxGlobals optionally providing an array of configurations to use
30 * @param array|null &$configuration [optional] Array of configurations to use
32 public function __construct(&$configuration = null) {
33 if(is_array($configuration)) {
34 $this->setGlobals($configuration);
38 /**
39 * Set the configuration array for use in eRxGlobals
40 * @param array &$configuration Array of configurations to use
42 public function setGlobals(&$configuration) {
43 $this->configuration =& $configuration;
45 return $this;
48 /**
49 * Return the value stored in configurations specified by the key
50 * @param string $key Configuration array key
51 * @return mixed Configuration specified by the key
53 public function getGlobalValue($key) {
54 if(array_key_exists($key, $this->configuration)) {
55 return $this->configuration[$key];
59 /**
60 * Return the version of OpenEMR
61 * @return string OpenEMR version
63 public function getOpenEMRVersion() {
64 return $this->getGlobalValue('openemr_version');
67 /**
68 * Return the OpenEMR site directory
69 * @return string OpenEMR site directory
71 public function getOpenEMRSiteDirectory() {
72 return $this->getGlobalValue('OE_SITE_DIR');
75 /**
76 * Return enable state for NewCrop eRx service
77 * @return boolean NewCrop eRx service enabled state
79 public function getEnabled() {
80 return $this->getGlobalValue('erx_enable');
83 /**
84 * Return the NewCrop eRx requests URL
85 * @return string URL for NewCrop eRx requests
87 public function getPath() {
88 return $this->getGlobalValue('erx_newcrop_path');
91 /**
92 * Return the NewCrop eRx service URLs
93 * @return array URLs for NewCrop eRx services: index [ 0 = Update, 1 = Patient ]
95 public function getSoapPaths() {
96 return explode(';', $this->getGlobalValue('erx_newcrop_path_soap'));
99 /**
100 * Return the NewCrop eRx allergies time-to-live
101 * @return integer Time-to-live in seconds for NewCrop eRx allergies
103 public function getTTLSoapAllergies() {
104 return $this->getGlobalValue('erx_soap_ttl_allergies');
108 * Return the NewCrop eRx medications time-to-live
109 * @return integer Time-to-live in seconds for NewCrop eRx medications
111 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() {
120 return $this->getGlobalValue('erx_account_partner_name');
124 * Return the NewCrop eRx account name for credentials
125 * @return string Account name for credentials
127 public function getAccountName() {
128 return $this->getGlobalValue('erx_account_name');
132 * Return the NewCrop eRx password for credentials
133 * @return string Password for credentials
135 public function getAccountPassword() {
136 return $this->getGlobalValue('erx_account_password');
140 * Return the NewCrop eRx account Id for credentials
141 * @return string Account Id for credentials
143 public function getAccountId() {
144 return $this->getGlobalValue('erx_account_id');
148 * Return enable state for NewCrop eRx only upload prescriptions
149 * @return boolean NewCrop eRx only upload prescriptions enabled state
151 public function getUploadActive() {
152 return $this->getGlobalValue('erx_upload_active');
156 * Return enable state for NewCrop eRx import status message
157 * @return boolean NewCrop eRx import status message enabled state
159 public function getImportStatusMessage() {
160 return $this->getGlobalValue('erx_import_status_message');
164 * Return enable state for NewCrop eRx display medications uploaded
165 * @return boolean NewCrop eRx display medications uploaded enabled state
167 public function getDisplayMedication() {
168 return $this->getGlobalValue('erx_medication_display');
172 * Return enable state for NewCrop eRx display allergies uploaded
173 * @return boolean NewCrop eRx display allergies uploaded enabled state
175 public function getDisplayAllergy() {
176 return $this->getGlobalValue('erx_allergy_display');
180 * Return NewCrop eRx default patient country code
181 * @return string NewCrop eRx default patient country code
183 public function getDefaultPatientCountry() {
184 return $this->getGlobalValue('erx_default_patient_country');
188 * Return array containing NewCrop eRx credentials
189 * @return array NewCrop eRx credentials: index [ 0 = Partner Name, 1 = Account Name, 2 = Password ]
191 public function getCredentials() {
192 return array(
193 $this->getPartnerName(),
194 $this->getAccountName(),
195 $this->getAccountPassword(),
200 * Return Debug NewCrop eRx settings
201 * @return integer Debug settings: flags [ 1 = XML, 2 = RESULT ]
203 public function getDebugSetting() {
204 return $this->getGlobalValue('erx_debug_setting');