changes for new flexible frame-based layout - not yet complete
[openemr.git] / interface / patient_file / encounter / forms.php
blob64d11318a7a918e8c0b7435b4a5afbd126d964b5
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 <link rel=stylesheet href="<?echo $css_header;?>" type="text/css">
11 <script type="text/javascript" src="../../../library/dialog.js"></script>
13 <script language="JavaScript">
15 // Process click on Delete link.
16 function deleteme() {
17 dlgopen('../deleter.php?encounterid=<?php echo $encounter; ?>', '_blank', 500, 450);
18 return false;
21 // Called by the deleter.php window on a successful delete.
22 function imdeleted() {
23 top.Title.location.href = '../patient_file/encounter/encounter_title.php';
24 top.Main.location.href = '../patient_file/encounter/patient_encounter.php?mode=new';
27 </script>
29 </head>
31 <body <?php echo $top_bg_line;?> topmargin=0 rightmargin=0 leftmargin=2 bottommargin=0 marginwidth=2 marginheight=0>
33 <span class="title"><?php xl('This Encounter','e'); ?></span>
34 <?php
35 $auth_notes_a = acl_check('encounters', 'notes_a');
36 $auth_notes = acl_check('encounters', 'notes');
37 $auth_relaxed = acl_check('encounters', 'relaxed');
39 if (is_numeric($pid)) {
40 // Check for no access to the patient's squad.
41 $result = getPatientData($pid, "fname,lname,squad");
42 echo " for " . $result['fname'] . " " . $result['lname'];
43 if ($result['squad'] && ! acl_check('squads', $result['squad'])) {
44 $auth_notes_a = $auth_notes = $auth_relaxed = 0;
46 // Check for no access to the encounter's sensitivity level.
47 $result = sqlQuery("SELECT sensitivity FROM form_encounter WHERE " .
48 "pid = '$pid' AND encounter = '$encounter' LIMIT 1");
49 if ($result['sensitivity'] && !acl_check('sensitivities', $result['sensitivity'])) {
50 $auth_notes_a = $auth_notes = $auth_relaxed = 0;
54 echo ":";
55 if (acl_check('admin', 'super')) {
56 echo "&nbsp;&nbsp;<a href='' onclick='return deleteme()'>" .
57 "<font class='more' style='color:red'>(Delete)</font></a>";
59 echo "<br>\n";
61 if ($result = getFormByEncounter($pid, $encounter, "id, date, form_id, form_name,formdir,user")) {
62 echo "<table>";
63 foreach ($result as $iter) {
64 $formdir = $iter['formdir'];
66 // Skip forms that we are not authorized to see.
67 if (($auth_notes_a) ||
68 ($auth_notes && $iter['user'] == $_SESSION['authUser']) ||
69 ($auth_relaxed && ($formdir == 'sports_fitness' || $formdir == 'podiatry'))) ;
70 else continue;
72 // $form_info = getFormInfoById($iter['id']);
73 echo '<tr valign="top">';
74 $user = getNameFromUsername($iter['user']);
76 $form_name = ($formdir == 'newpatient') ? "Patient Encounter" : $iter['form_name'];
78 echo '<td class="text"><span style="font-weight:bold;">' .
79 $user['fname'] . " " . $user['lname'] .'</span></td>';
80 echo "<td valign='top'><a target='";
81 echo $GLOBALS['concurrent_layout'] ? "_parent" : "Main";
82 echo "' href='$rootdir/patient_file/encounter/view_form.php?" .
83 "formname=" . $formdir . "&id=" . $iter['form_id'] .
84 "' class='text'>$form_name</a></td>\n" .
85 "<td width='25'></td>\n" .
86 "<td valign='top'>";
88 // Use the form's report.php for display.
90 include_once($GLOBALS['incdir'] . "/forms/$formdir/report.php");
91 call_user_func($formdir . "_report", $pid, $iter['encounter'], 2, $iter['form_id']);
93 echo "</td></tr>";
95 echo "</table>";
99 </body>
100 </html>