PSR2 fixes to prior commit
[openemr.git] / interface / de_identification_forms / re_identification_input_screen.php
blob22d23c0577a1a812206bd0566b1f4f521a686525
1 <?php
2 /********************************************************************************\
3 * Copyright (C) ViCarePlus, Visolve (vicareplus_engg@visolve.com) *
4 * *
5 * This program is free software; you can redistribute it and/or *
6 * modify it under the terms of the GNU General Public License *
7 * as published by the Free Software Foundation; either version 2 *
8 * of the License, or (at your option) any later version. *
9 * *
10 * This program is distributed in the hope that it will be useful, *
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of *
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the *
13 * GNU General Public License for more details. *
14 * *
15 * You should have received a copy of the GNU General Public License *
16 * along with this program; if not, write to the Free Software *
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. *
18 \********************************************************************************/
19 require_once("../globals.php");
20 require_once("$srcdir/lists.inc");
21 require_once("$srcdir/patient.inc");
22 require_once("$srcdir/acl.inc");
23 require_once("$srcdir/options.inc.php");
25 <html>
26 <head>
27 <title><?php xl('Re Identification', 'e'); ?></title>
28 <link rel="stylesheet" href='<?php echo $css_header ?>' type='text/css'>
30 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/dialog.js?v=<?php echo $v_js_includes; ?>"></script>
32 <style type="text/css">
33 .style1 {
34 text-align: center;
36 </style>
37 <script language="JavaScript">
38 function form_validate()
41 if(document.forms[0].re_id_code.value == "undefined" || document.forms[0].re_id_code.value == "")
43 alert("<?php echo xl('Enter the Re Identification code');?>");
44 return false;
46 top.restoreSession();
47 return true;
50 function download_file()
52 alert("<?php echo xl('Re-identification files will be saved in');
53 echo ' `'.$GLOBALS['temporary_files_dir'].'` ';
54 echo xl('location of the openemr machine and may contain sensitive data, so it is recommended to manually delete the files after its use');?>");
55 document.re_identification.submit();
58 </script>
59 </head>
60 <body class="body_top">
61 <strong><?php xl('Re Identification', 'e'); ?></strong>
62 <div id="overDiv"
63 style="position: absolute; visibility: hidden; z-index: 1000;"></div>
64 <form name="re_identification" enctype="Re_identification_ip_single_code"
65 action="re_identification_op_single_patient.php" method="POST" onsubmit="return form_validate();"><?php
66 $row = sqlQuery("SHOW TABLES LIKE 'de_identification_status'");
67 if (empty($row)) {
69 <table> <tr> <td>&nbsp;</td> <td>&nbsp;</td> </tr>
70 <tr> <td>&nbsp;</td> <td>&nbsp;</td> </tr>
71 </table>
72 <table class="de_identification_status_message" align="center" >
73 <tr valign="top">
74 <td>&nbsp;</td>
75 <td rowspan="3">
76 <br>
77 <?php echo xl('Please upgrade OpenEMR Database to include De Identification procedures, function, tables'); ?>
78 </br></br><a target="Blank" href="../../contrib/util/de_identification_upgrade.php"><?php echo xl('Click here');?></a>
79 <?php echo xl('to run');
80 echo " de_identification_upgrade.php</br>";?><br>
81 </td>
82 <td>&nbsp;</td>
83 </tr>
84 <tr>
85 <td>&nbsp;</td>
86 <td>&nbsp;</td>
87 </tr>
88 <tr>
89 <td>&nbsp;</td>
90 <td>&nbsp;</td>
91 </tr>
92 </table>
93 <?php
94 } else {
95 $query = "select status from re_identification_status";
96 $res = sqlStatement($query);
97 if ($row = sqlFetchArray($res)) {
98 $reIdentificationStatus = addslashes($row['status']);
99 /* $reIdentificationStatus:
100 * 0 - There is no Re Identification in progress. (start new Re Identification process)
101 * 1 - A Re Identification process is currently in progress.
102 * 2 - The Re Identification process completed and xls file is ready to download
106 if ($reIdentificationStatus == 1) {
107 //1 - A Re Identification process is currently in progress
109 <table>
110 <tr>
111 <td>&nbsp;</td>
112 <td>&nbsp;</td>
113 </tr>
114 <tr>
115 <td>&nbsp;</td>
116 <td>&nbsp;</td>
117 </tr>
118 </table>
119 <table class="de_identification_status_message" align="center">
120 <tr valign="top">
121 <td>&nbsp;</td>
122 <td rowspan="3"><br>
123 <?php echo xl('Re Identification Process is ongoing');
124 echo "</br></br>";
125 echo xl('Please visit Re Identification screen after some time');
126 echo "</br>"; ?> <br>
127 </td>
128 <td>&nbsp;</td>
129 </tr>
130 <tr>
131 <td>&nbsp;</td>
132 <td>&nbsp;</td>
133 </tr>
134 <tr>
135 <td>&nbsp;</td>
136 <td>&nbsp;</td>
137 </tr>
138 </table>
139 <?php
140 } else if ($reIdentificationStatus == 0) {
141 //0 - There is no Re Identification in progress. (start new Re Identification process)
143 <center></br>
144 </br>
145 <?php xl('Enter the Re Identification code', 'e'); ?> <input
146 type='text' size='50' name='re_id_code' id='re_id_code'
147 title='<?php xl('Enter the Re Identification code', 'e'); ?>' /> </br>
148 </br>
149 <Input type="Submit" Name="Submit" Value=<?php echo xl("submit");?>></center>
150 <?php
151 } else if ($reIdentificationStatus == 2) {
152 //2 - The Re Identification process completed and xls file is ready to download
153 $query = "SELECT count(*) as count FROM re_identified_data ";
154 $res = sqlStatement($query);
155 if ($row = sqlFetchArray($res)) {
156 $no_of_items = addslashes($row['count']);
159 if ($no_of_items <= 1) {
160 //start new search - no patient record fount
161 $query = "update re_identification_status set status = 0";
162 $res = sqlStatement($query);
164 <table>
165 <tr>
166 <td>&nbsp;</td>
167 <td>&nbsp;</td>
168 </tr>
169 <tr>
170 <td>&nbsp;</td>
171 <td>&nbsp;</td>
172 </tr>
173 </table>
174 <table class="de_identification_status_message" align="center">
175 <tr valign="top">
176 <td>&nbsp;</td>
177 <td rowspan="3"><br>
178 <?php echo xl('No Patient record found for the given Re Identification code');
179 echo "</br></br>";
180 echo xl('Please enter the correct Re Identification code');
181 echo "</br>"; ?> </br>
182 </td>
183 <td>&nbsp;</td>
184 </tr>
185 <tr>
186 <td>&nbsp;</td>
187 <td>&nbsp;</td>
188 </tr>
189 <tr>
190 <td>&nbsp;</td>
191 <td>&nbsp;</td>
192 </tr>
193 </table>
194 <table align="center">
195 <tr>
196 <td>&nbsp;</td>
197 <td>&nbsp;</td>
198 </tr>
199 </table>
201 <?php
202 } else {
204 <table>
205 <tr>
206 <td>&nbsp;</td>
207 <td>&nbsp;</td>
208 </tr>
209 <tr>
210 <td>&nbsp;</td>
211 <td>&nbsp;</td>
212 </tr>
213 </table>
214 <table class="de_identification_status_message"" align="center">
215 <tr valign="top">
216 <td>&nbsp;</td>
217 <td rowspan="3"><br>
218 <?php echo xl('Re Identification Process is completed');
219 echo "</br></br>";
220 echo xl('Please Click download button to download the Re Identified data');
221 echo "</br>"; ?> <br>
222 </td>
223 <td>&nbsp;</td>
224 </tr>
225 <tr>
226 <td>&nbsp;</td>
227 <td>&nbsp;</td>
228 </tr>
229 <tr>
230 <td>&nbsp;</td>
231 <td>&nbsp;</td>
232 </tr>
233 </table>
234 <table align="center">
235 <tr>
236 <td>&nbsp;</td>
237 <td>&nbsp;</td>
238 </tr>
239 <tr>
240 <td colspan="2" class="style1"><input type="button" name="Download"
241 value=<?php echo xl("Download"); ?> onclick="download_file()" ></td>
242 </tr>
243 </table>
244 <?php
250 </form>
251 </body>
252 </html>