Highway to PSR2
[openemr.git] / interface / modules / zend_modules / module / Carecoordination / src / Carecoordination / Form / ModuleconfigForm.php
blob03c73ce020c841f56a93db46c50ba8c2ececc912
1 <?php
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;
24 use Zend\Form\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
39 $this->add(array(
40 'name' => 'hie_auto_sign_off_id',
41 'attributes' => array(
42 'type' => 'text',
43 'id' => 'hie_auto_sign_off_id'
45 'options' => array(
46 'label' => \Application\Listener\Listener::z_xlt('Auto Sign-Off [days]'),
48 ));
51 * Automatic Tranfer settings
53 $this->add(array(
54 'type' => 'Zend\Form\Element\Checkbox',
55 'name' => 'hie_auto_send_id',
56 'attributes' => array(
57 'id' => 'hie_auto_send_id'
59 'options' => array(
60 'label' => \Application\Listener\Listener::z_xlt('Auto Send'),
61 'checked_value' => 'yes',
62 'unchecked_value' => 'no'
64 ));
67 * Author settings
69 $this->add(array(
70 'name' => 'hie_author_id',
71 'type' => 'Zend\Form\Element\Select',
72 'attributes'=> array(
73 'class' => '',
74 'data-options' => 'required:true',
75 'editable' => 'false',
76 'required' => 'required',
77 'id' => 'hie_author_fname'
79 'options' => array(
80 'label' => \Application\Listener\Listener::z_xlt('Author'),
81 'value_options' => $this->getProviders(),
83 ));
86 * Data Enterer settings
88 $this->add(array(
89 'name' => 'hie_data_enterer_id',
90 'type' => 'Zend\Form\Element\Select',
91 'attributes'=> array(
92 'class' => '',
93 'data-options' => 'required:true',
94 'editable' => 'false',
95 'required' => 'required',
96 'id' => 'hie_data_enterer_id'
98 'options' => array(
99 'label' => \Application\Listener\Listener::z_xlt('Data Enterer'),
100 'value_options' => $this->getUsersList(),
105 * Informant settings
107 $this->add(array(
108 'name' => 'hie_informant_id',
109 'type' => 'Zend\Form\Element\Select',
110 'attributes'=> array(
111 'class' => '',
112 'data-options' => 'required:true',
113 'editable' => 'false',
114 'required' => 'required',
115 'id' => 'hie_informant_id'
117 'options' => array(
118 'label' => \Application\Listener\Listener::z_xlt('Informant'),
119 'value_options' => $this->getProviders(),
124 * Personal Informant settings
126 $this->add(array(
127 'name' => 'hie_personal_informant_id',
128 'attributes'=> array(
129 'type' => 'text',
130 'id' => 'hie_personal_informant_id'
132 'options' => array(
133 'label' => \Application\Listener\Listener::z_xlt('Informant'),
138 * Custodian settings
140 $this->add(array(
141 'name' => 'hie_custodian_id',
142 'type' => 'Zend\Form\Element\Select',
143 'attributes'=> array(
144 'class' => '',
145 'data-options' => 'required:true',
146 'editable' => 'false',
147 'required' => 'required',
148 'id' => 'hie_custodian_id'
150 'options' => array(
151 'label' => \Application\Listener\Listener::z_xlt('Custodian'),
152 'value_options' => $this->getFacilities(),
157 * Legal Authenticator settings
159 $this->add(array(
160 'name' => 'hie_legal_authenticator_id',
161 'type' => 'Zend\Form\Element\Select',
162 'attributes'=> array(
163 'class' => '',
164 'data-options' => 'required:true',
165 'editable' => 'false',
166 'required' => 'required',
167 'id' => 'hie_legal_authenticator_id'
169 'options' => array(
170 'label' => \Application\Listener\Listener::z_xlt('Legal Authenticator'),
171 'value_options' => $this->getUsers(),
176 * Authenticator settings
178 $this->add(array(
179 'name' => 'hie_authenticator_id',
180 'type' => 'Zend\Form\Element\Select',
181 'attributes'=> array(
182 'class' => '',
183 'data-options' => 'required:true',
184 'editable' => 'false',
185 'required' => 'required',
186 'id' => 'hie_authenticator_id'
188 'options' => array(
189 'label' => \Application\Listener\Listener::z_xlt('Authenticator'),
190 'value_options' => $this->getUsers(),
195 * Primary Care Provider settings
197 $this->add(array(
198 'name' => 'hie_primary_care_provider_id',
199 'type' => 'Zend\Form\Element\Select',
200 'attributes'=> array(
201 'class' => '',
202 'data-options' => 'required:true',
203 'editable' => 'false',
204 'required' => 'required',
205 'id' => 'hie_primary_care_provider_id'
207 'options' => array(
208 'label' => \Application\Listener\Listener::z_xlt('Primary Care Provider'),
209 'value_options' => $this->getProviders(),
214 * MIRTH IP settings
216 $this->add(array(
217 'name' => 'hie_mirth_ip',
218 'attributes'=> array(
219 'type' => 'text',
220 'id' => 'hie_mirth_ip'
222 'options' => array(
223 'label' => \Application\Listener\Listener::z_xlt('Mirth IP'),
228 * MIRTH Client ID
230 $this->add(array(
231 'name' => 'hie_mirth_clientid',
232 'attributes'=> array(
233 'type' => 'text',
234 'id' => 'hie_mirth_clientid'
236 'options' => array(
237 'label' => \Application\Listener\Listener::z_xlt('Client ID'),
242 * MIRTH Username
244 $this->add(array(
245 'name' => 'hie_mirth_username',
246 'attributes'=> array(
247 'type' => 'text',
248 'id' => 'hie_mirth_username'
250 'options' => array(
251 'label' => \Application\Listener\Listener::z_xlt('Username'),
256 * MIRTH Password
258 $this->add(array(
259 'name' => 'hie_mirth_password',
260 'attributes'=> array(
261 'type' => 'password',
262 'id' => 'hie_mirth_password'
264 'options' => array(
265 'label' => \Application\Listener\Listener::z_xlt('Password'),
271 * Function getOptions
272 * Get Select Options
274 * @return array
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'];
284 return $users;
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'];
295 return $users;
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'];
306 return $users;
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'];
317 return $users;