internationalization of the date widget, see feature request tracker item 2967294
[openemr.git] / interface / patient_file / encounter / forms.php
blobeaece56519fbbbe266ca643df16ae757d34a789b
1 <?php
2 include_once("../../globals.php");
3 include_once("$srcdir/forms.inc");
4 include_once("$srcdir/calendar.inc");
5 include_once("$srcdir/acl.inc");
6 ?>
7 <html>
9 <head>
10 <?php html_header_show();?>
11 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
13 <!-- supporting javascript code -->
14 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/js/jquery.js"></script>
16 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/dialog.js"></script>
20 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
21 <link rel="stylesheet" type="text/css" href="../../../library/js/fancybox/jquery.fancybox-1.2.6.css" media="screen" />
22 <style type="text/css">@import url(../../../library/dynarch_calendar.css);</style>
23 <script type="text/javascript" src="../../../library/textformat.js"></script>
24 <script type="text/javascript" src="../../../library/dynarch_calendar.js"></script>
25 <?php include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?>
26 <script type="text/javascript" src="../../../library/dynarch_calendar_setup.js"></script>
27 <script type="text/javascript" src="../../../library/dialog.js"></script>
28 <script type="text/javascript" src="../../../library/js/jquery.1.3.2.js"></script>
29 <script type="text/javascript" src="../../../library/js/common.js"></script>
30 <script type="text/javascript" src="../../../library/js/fancybox/jquery.fancybox-1.2.6.js"></script>
32 <script language="JavaScript">
34 // Process click on Delete link.
35 function deleteme() {
36 dlgopen('../deleter.php?encounterid=<?php echo $encounter; ?>', '_blank', 500, 450);
37 return false;
40 // Called by the deleter.php window on a successful delete.
41 function imdeleted() {
42 <?php if ($GLOBALS['concurrent_layout']) { ?>
43 parent.parent.left_nav.clearEncounter();
44 <?php } else { ?>
45 top.restoreSession();
46 top.Title.location.href = '../patient_file/encounter/encounter_title.php';
47 top.Main.location.href = '../patient_file/encounter/patient_encounter.php?mode=new';
48 <?php } ?>
51 </script>
53 <script language="javascript">
54 function expandcollapse(atr){
55 if(atr == "expand") {
56 for(i=1;i<15;i++){
57 var mydivid="divid_"+i;var myspanid="spanid_"+i;
58 var ele = document.getElementById(mydivid); var text = document.getElementById(myspanid);
59 ele.style.display = "block";text.innerHTML = "Collapse";
62 else {
63 for(i=1;i<15;i++){
64 var mydivid="divid_"+i;var myspanid="spanid_"+i;
65 var ele = document.getElementById(mydivid); var text = document.getElementById(myspanid);
66 ele.style.display = "none"; text.innerHTML = "Expand";
72 function divtoggle(spanid, divid) {
73 var ele = document.getElementById(divid);
74 var text = document.getElementById(spanid);
75 if(ele.style.display == "block") {
76 ele.style.display = "none";
77 text.innerHTML = "Expand";
79 else {
80 ele.style.display = "block";
81 text.innerHTML = "Collapse";
84 </script>
86 <style type="text/css">
87 div.tab {
88 min-height: 50px;
89 padding:8px;
92 div.form_header_controls {
93 float:left;margin-bottom:2px;
96 div.form_header {
97 float:left;
98 margin-left:6px;
100 </style>
102 </head>
104 <body class="body_top">
106 <div id="encounter_forms">
109 <?php
110 $dateres = getEncounterDateByEncounter($encounter);
111 $encounter_date = date("Y-m-d",strtotime($dateres["date"]));
114 <div style='float:left'>
115 <span class="title"><?php xl($encounter_date . " Encounter ",'e'); ?></span>
116 <?php
117 $auth_notes_a = acl_check('encounters', 'notes_a');
118 $auth_notes = acl_check('encounters', 'notes');
119 $auth_relaxed = acl_check('encounters', 'relaxed');
121 if (is_numeric($pid)) {
122 // Check for no access to the patient's squad.
123 $result = getPatientData($pid, "fname,lname,squad");
124 echo xl('for','',' ',' ') . $result['fname'] . " " . $result['lname'];
125 if ($result['squad'] && ! acl_check('squads', $result['squad'])) {
126 $auth_notes_a = $auth_notes = $auth_relaxed = 0;
128 // Check for no access to the encounter's sensitivity level.
129 $result = sqlQuery("SELECT sensitivity FROM form_encounter WHERE " .
130 "pid = '$pid' AND encounter = '$encounter' LIMIT 1");
131 if ($result['sensitivity'] && !acl_check('sensitivities', $result['sensitivity'])) {
132 $auth_notes_a = $auth_notes = $auth_relaxed = 0;
136 </div>
137 <div style='float:left;margin-left:10px'>
138 <?php if (acl_check('admin', 'super')) { ?>
139 <a href='toggledivs(this.id,this.id);' class='css_button' onclick='return deleteme()'><span><?php echo xl('Delete') ?></span></a>
140 &nbsp;&nbsp;&nbsp;<a href="#" onClick='expandcollapse("expand");' style="font-size:80%;">Expand All</a>
141 &nbsp;&nbsp;&nbsp;<a style="font-size:80%;" href="#" onClick='expandcollapse("collapse");'>Collapse All</a>
142 <?php } ?>
143 </div>
144 <br/>
145 <br/>
147 <? if ($result = getFormByEncounter($pid, $encounter, "id, date, form_id, form_name, formdir, user, deleted")) {
148 echo "<table width='100%' id='partable'>";
149 $divnos=1;
150 foreach ($result as $iter) {
151 $formdir = $iter['formdir'];
153 // skip forms whose 'deleted' flag is set to 1
154 if ($iter['deleted'] == 1) continue;
156 // Skip forms that we are not authorized to see.
157 if (($auth_notes_a) ||
158 ($auth_notes && $iter['user'] == $_SESSION['authUser']) ||
159 ($auth_relaxed && ($formdir == 'sports_fitness' || $formdir == 'podiatry'))) ;
160 else continue;
162 // $form_info = getFormInfoById($iter['id']);
163 if (strtolower(substr($iter['form_name'],0,5)) == 'camos') {
164 //CAMOS generates links from report.php and these links should
165 //be clickable without causing view.php to come up unexpectedly.
166 //I feel that the JQuery code in this file leading to a click
167 //on the report.php content to bring up view.php steps on a
168 //form's autonomy to generate it's own html content in it's report
169 //but until any other form has a problem with this, I will just
170 //make an exception here for CAMOS and allow it to carry out this
171 //functionality for all other forms. --Mark
172 echo '<tr title="' . xl('Edit form') . '" '.
173 'id="'.$formdir.'~'.$iter['form_id'].'">';
174 } else {
175 echo '<tr title="' . xl('Edit form') . '" '.
176 'id="'.$formdir.'~'.$iter['form_id'].'" class="text onerow">';
178 $user = getNameFromUsername($iter['user']);
180 $form_name = ($formdir == 'newpatient') ? xl('Patient Encounter') : xl_form_title($iter['form_name']);
182 echo "<tr>";
183 echo "<td style='border-bottom:1px solid'>";
184 // a link to edit the form
185 echo "<div class='form_header_controls'>";
186 echo "<a target='".
187 ($GLOBALS['concurrent_layout'] ? "_parent" : "Main") .
188 "' href='$rootdir/patient_file/encounter/view_form.php?" .
189 "formname=" . $formdir . "&id=" . $iter['form_id'] .
190 "' onclick='top.restoreSession()' class='css_button_small'><span>Edit</span></a>";
192 if (acl_check('admin', 'super') ) {
193 if ( $formdir != 'newpatient') {
194 // a link to delete the form from the encounter
195 echo "<a target='".
196 ($GLOBALS['concurrent_layout'] ? "_parent" : "Main") .
197 "' href='$rootdir/patient_file/encounter/delete_form.php?" .
198 "formname=" . $formdir .
199 "&id=" . $iter['id'] .
200 "&encounter=". $encounter.
201 "&pid=".$pid.
202 "' class='css_button_small' title='" . xl('Delete this form') . "' onclick='top.restoreSession()'><span>" . xl('Delete') . "</span></a>";
203 } else {
204 ?><a href='javascript:;' class='css_button_small' style='color:gray'><span>Delete</span></a><?php
208 echo "<div class='form_header'>";
209 echo "<a href='#' onclick='divtoggle(\"spanid_$divnos\",\"divid_$divnos\");' class='small' id='aid_$divnos'><b>$form_name</b> <span class='text'>by " . $user['fname'] . " " . $user['lname'] . "</span> (<span id=spanid_$divnos class=\"indicator\">Collapse</span>)</a></div>";
210 echo "</td>\n";
211 echo "</tr>";
212 echo "<tr>";
213 echo "<td valign='top' class='formrow'><div class='tab' id='divid_$divnos' style='display:block'>";
215 // Use the form's report.php for display. Forms with names starting with LBF
216 // are list-based forms sharing a single collection of code.
218 if (substr($formdir,0,3) == 'LBF') {
219 include_once($GLOBALS['incdir'] . "/forms/LBF/report.php");
220 call_user_func("lbf_report", $pid, $iter['encounter'], 2, $iter['form_id'], $formdir);
222 else {
223 include_once($GLOBALS['incdir'] . "/forms/$formdir/report.php");
224 call_user_func($formdir . "_report", $pid, $iter['encounter'], 2, $iter['form_id']);
227 echo "</div></td></tr>";
228 $divnos=$divnos+1;
230 echo "</table>";
234 <?php if ($GLOBALS['athletic_team'] && $GLOBALS['concurrent_layout'] == 2) { ?>
235 <script language='JavaScript'>
236 // If this is the top frame then show the encounters list in the bottom frame.
237 var n = parent.parent.left_nav;
238 var nf = n.document.forms[0];
239 if (parent.window.name == 'RTop' && nf.cb_bot.checked) {
240 var othername = 'RBot';
241 n.setRadio(othername, 'ens');
242 n.loadFrame('ens1', othername, 'patient_file/history/encounters.php');
244 </script>
245 <?php } ?>
247 </div> <!-- end large encounter_forms DIV -->
248 </body>
250 <script language="javascript">
251 // jQuery stuff to make the page a little easier to use
253 $(document).ready(function(){
254 $(".save").click(function() { top.restoreSession(); document.my_form.submit(); });
255 $(".dontsave").click(function() { location.href='<?php echo "$rootdir/patient_file/encounter/$returnurl";?>'; });
257 $(".onerow").mouseover(function() { $(this).toggleClass("highlight"); });
258 $(".onerow").mouseout(function() { $(this).toggleClass("highlight"); });
259 $(".onerow").click(function() { GotoForm(this); });
261 // $(".deleteme").click(function(evt) { deleteme(); evt.stopPropogation(); });
263 var GotoForm = function(obj) {
264 var parts = $(obj).attr("id").split("~");
265 top.restoreSession();
266 <?php if ($GLOBALS['concurrent_layout']): ?>
267 parent.location.href = "<?php echo $rootdir; ?>/patient_file/encounter/view_form.php?formname="+parts[0]+"&id="+parts[1];
268 <?php else: ?>
269 top.Main.location.href = "<?php echo $rootdir; ?>/patient_file/encounter/view_form.php?formname="+parts[0]+"&id="+parts[1];
270 <?php endif; ?>
274 </script>
276 </html>