2 /* +-----------------------------------------------------------------------------+
3 * OpenEMR - Open Source Electronic Medical Record
4 * Copyright (C) 2014 Z&H Consultancy Services Private Limited <sam@zhservices.com>
6 * This program is free software: you can redistribute it and/or modify
7 * it under the terms of the GNU Affero General Public License as
8 * published by the Free Software Foundation, either version 3 of the
9 * License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU Affero General Public License for more details.
16 * You should have received a copy of the GNU Affero General Public License
17 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 * @author Vinish K <vinish@zhservices.com>
19 * +------------------------------------------------------------------------------+
22 namespace Carecoordination\Form
;
25 use Zend\Db\Adapter\AdapterInterface
;
26 use \Application\Model\ApplicationTable
;
28 class ModuleconfigForm
extends Form
30 public function __construct(AdapterInterface
$dbAdapter)
32 $this->application
= new ApplicationTable
;
33 parent
::__construct('configuration');
34 $this->setAttribute('method', 'post');
37 * Automatic SignOff settings
40 'name' => 'hie_auto_sign_off_id',
41 'attributes' => array(
43 'id' => 'hie_auto_sign_off_id'
46 'label' => \Application\Listener\Listener
::z_xlt('Auto Sign-Off [days]'),
51 * Automatic Tranfer settings
54 'type' => 'Zend\Form\Element\Checkbox',
55 'name' => 'hie_auto_send_id',
56 'attributes' => array(
57 'id' => 'hie_auto_send_id'
60 'label' => \Application\Listener\Listener
::z_xlt('Auto Send'),
61 'checked_value' => 'yes',
62 'unchecked_value' => 'no'
70 'name' => 'hie_author_id',
71 'type' => 'Zend\Form\Element\Select',
74 'data-options' => 'required:true',
75 'editable' => 'false',
76 'required' => 'required',
77 'id' => 'hie_author_fname'
80 'label' => \Application\Listener\Listener
::z_xlt('Author'),
81 'value_options' => $this->getProviders(),
86 * Data Enterer settings
89 'name' => 'hie_data_enterer_id',
90 'type' => 'Zend\Form\Element\Select',
93 'data-options' => 'required:true',
94 'editable' => 'false',
95 'required' => 'required',
96 'id' => 'hie_data_enterer_id'
99 'label' => \Application\Listener\Listener
::z_xlt('Data Enterer'),
100 'value_options' => $this->getUsersList(),
108 'name' => 'hie_informant_id',
109 'type' => 'Zend\Form\Element\Select',
110 'attributes'=> array(
112 'data-options' => 'required:true',
113 'editable' => 'false',
114 'required' => 'required',
115 'id' => 'hie_informant_id'
118 'label' => \Application\Listener\Listener
::z_xlt('Informant'),
119 'value_options' => $this->getProviders(),
124 * Personal Informant settings
127 'name' => 'hie_personal_informant_id',
128 'attributes'=> array(
130 'id' => 'hie_personal_informant_id'
133 'label' => \Application\Listener\Listener
::z_xlt('Informant'),
141 'name' => 'hie_custodian_id',
142 'type' => 'Zend\Form\Element\Select',
143 'attributes'=> array(
145 'data-options' => 'required:true',
146 'editable' => 'false',
147 'required' => 'required',
148 'id' => 'hie_custodian_id'
151 'label' => \Application\Listener\Listener
::z_xlt('Custodian'),
152 'value_options' => $this->getFacilities(),
157 * Legal Authenticator settings
160 'name' => 'hie_legal_authenticator_id',
161 'type' => 'Zend\Form\Element\Select',
162 'attributes'=> array(
164 'data-options' => 'required:true',
165 'editable' => 'false',
166 'required' => 'required',
167 'id' => 'hie_legal_authenticator_id'
170 'label' => \Application\Listener\Listener
::z_xlt('Legal Authenticator'),
171 'value_options' => $this->getUsers(),
176 * Authenticator settings
179 'name' => 'hie_authenticator_id',
180 'type' => 'Zend\Form\Element\Select',
181 'attributes'=> array(
183 'data-options' => 'required:true',
184 'editable' => 'false',
185 'required' => 'required',
186 'id' => 'hie_authenticator_id'
189 'label' => \Application\Listener\Listener
::z_xlt('Authenticator'),
190 'value_options' => $this->getUsers(),
195 * Primary Care Provider settings
198 'name' => 'hie_primary_care_provider_id',
199 'type' => 'Zend\Form\Element\Select',
200 'attributes'=> array(
202 'data-options' => 'required:true',
203 'editable' => 'false',
204 'required' => 'required',
205 'id' => 'hie_primary_care_provider_id'
208 'label' => \Application\Listener\Listener
::z_xlt('Primary Care Provider'),
209 'value_options' => $this->getProviders(),
217 'name' => 'hie_mirth_ip',
218 'attributes'=> array(
220 'id' => 'hie_mirth_ip'
223 'label' => \Application\Listener\Listener
::z_xlt('Mirth IP'),
231 'name' => 'hie_mirth_clientid',
232 'attributes'=> array(
234 'id' => 'hie_mirth_clientid'
237 'label' => \Application\Listener\Listener
::z_xlt('Client ID'),
245 'name' => 'hie_mirth_username',
246 'attributes'=> array(
248 'id' => 'hie_mirth_username'
251 'label' => \Application\Listener\Listener
::z_xlt('Username'),
259 'name' => 'hie_mirth_password',
260 'attributes'=> array(
261 'type' => 'password',
262 'id' => 'hie_mirth_password'
265 'label' => \Application\Listener\Listener
::z_xlt('Password'),
271 * Function getOptions
276 public function getUsers()
278 $users = array('0' => '');
279 $res = $this->application
->zQuery(("SELECT id, fname, lname, street, city, state, zip FROM users WHERE abook_type='ccda'"));
280 foreach ($res as $row) {
281 $users[$row['id']] = $row['fname']." ".$row['lname'];
287 public function getFacilities()
289 $users = array('0' => '');
290 $res = $this->application
->zQuery(("SELECT `id`,`name` FROM `facility`"));
291 foreach ($res as $row) {
292 $users[$row['id']] = $row['name'];
298 public function getProviders()
300 $users = array('0' => '');
301 $res = $this->application
->zQuery(("SELECT id, fname, lname FROM users WHERE authorized=1 AND active ='1'"));
302 foreach ($res as $row) {
303 $users[$row['id']] = $row['fname']." ".$row['lname'];
309 public function getUsersList()
311 $users = array('0' => '');
312 $res = $this->application
->zQuery(("SELECT id, fname, lname FROM users WHERE active ='1' AND `username` IS NOT NULL AND `password` IS NOT NULL"));
313 foreach ($res as $row) {
314 $users[$row['id']] = $row['fname']." ".$row['lname'];