added cache clearing support for dialog.js (#411)
[openemr.git] / interface / patient_file / summary / disclosure_full.php
bloba735774784061897ace14fa35bf5e13492551d68
1 <?php
2 /**
4 * Patient disclosures main screen.
6 * Copyright (C) Visolve <vicareplus_engg@visolve.com>
8 * LICENSE: This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 2
11 * of the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
19 * @package OpenEMR
20 * @author Visolve <vicareplus_engg@visolve.com>
21 * @author Brady Miller <brady@sparmy.com>
22 * @link http://www.open-emr.org
25 //SANITIZE ALL ESCAPES
26 $sanitize_all_escapes=true;
29 //STOP FAKE REGISTER GLOBALS
30 $fake_register_globals=false;
33 require_once("../../globals.php");
34 require_once("$srcdir/sql.inc");
35 require_once("$srcdir/log.inc");
37 //retrieve the user name
38 $res = sqlQuery("select username from users where username=?", array($_SESSION{"authUser"}) );
39 $uname=$res{"username"};
40 //if the mode variable is set to disclosure, retrieve the values from 'disclosure_form ' in record_disclosure.php to store it in database.
41 if (isset($_POST["mode"]) and $_POST["mode"] == "disclosure"){
42 $dates=trim($_POST['dates']);
43 $event=trim($_POST['form_disclosure_type']);
44 $recipient_name=trim($_POST['recipient_name']);
45 $disclosure_desc=trim($_POST['desc_disc']);
46 $disclosure_id=trim($_POST['disclosure_id']);
47 if (isset($_POST["updatemode"]) AND $_POST["updatemode"] == "disclosure_update")
49 //update the recorded disclosure in the extended_log table.
50 updateRecordedDisclosure($dates,$event,$recipient_name,$disclosure_desc,$disclosure_id);
52 else
54 //insert the disclosure records in the extended_log table.
55 recordDisclosure($dates,$event,$pid,$recipient_name,$disclosure_desc,$uname);
58 if (isset($_GET['deletelid']))
60 $deletelid=$_GET['deletelid'];
61 //function to delete the recorded disclosures
62 deleteDisclosure($deletelid);
65 <html>
66 <head>
67 <link rel='stylesheet' href="<?php echo $css_header;?>" type="text/css">
68 <!-- supporting javascript code -->
69 <script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-2-1/index.js"></script>
70 <link rel="stylesheet" type="text/css" href="../../../library/js/fancybox/jquery.fancybox-1.2.6.css" media="screen" />
71 <script type="text/javascript" src="../../../library/dialog.js?v=<?php echo $v_js_includes; ?>"></script>
72 <script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-3-2/index.js"></script>
73 <script type="text/javascript" src="../../../library/js/common.js"></script>
74 <script type="text/javascript" src="../../../library/js/fancybox/jquery.fancybox-1.2.6.js"></script>
75 </head>
76 <body class="body_top">
77 <div>
78 <span class="title"><?php echo xlt('Disclosures'); ?></span>
79 </div>
80 <div class="disclosure_wrap">
81 <div style='float: left; margin-right: 10px'><?php echo xlt('for'); ?>&nbsp;
82 <span class="title"><a href="../summary/demographics.php" onclick="top.restoreSession()"><?php $pname = getPatientName($pid); echo text($pname); ?></a></span>
83 </div>
84 <div>
85 <a href="record_disclosure.php" class="css_button iframe" onclick="top.restoreSession()"><span><?php echo xlt('Record'); ?></span></a>
86 </div>
87 <div>
88 <a href="demographics.php"
89 class="css_button" onclick="top.restoreSession()"> <span><?php echo xlt('View Patient') ?></span></a>
90 </div>
91 </div>
92 <br>
93 <br>
94 <?php
95 $N=15;
96 $offset = $_REQUEST['offset'];
97 if (!isset($offset)) $offset = 0;
99 $disclQry = " SELECT el.id, el.event, el.recipient, el.description, el.date, CONCAT(u.fname, ' ', u.lname) as user_fullname FROM extended_log el" .
100 " LEFT JOIN users u ON u.username = el.user " .
101 " WHERE el.patient_id = ? AND el.event IN (SELECT option_id FROM list_options WHERE list_id='disclosure_type' AND activity = 1)" .
102 " ORDER BY el.date DESC ";
103 $r2= sqlStatement($disclQry, array($pid) );
104 $totalRecords=sqlNumRows($r2);
106 //echo "select id,event,recipient,description,date from extended_log where patient_id=$pid AND event in (select option_id from list_options where list_id='disclosure_type') order by date desc limit $offset ,$N";
107 //display all of the disclosures for the day, as well as others that are active from previous dates, up to a certain number, $N
108 $disclInnerQry = " SELECT el.id, el.event, el.recipient, el.description, el.date, CONCAT(u.fname, ' ', u.lname) as user_fullname FROM extended_log el" .
109 " LEFT JOIN users u ON u.username = el.user" .
110 " WHERE patient_id = ? AND event IN (SELECT option_id FROM list_options WHERE list_id = 'disclosure_type' AND activity = 1)" .
111 " ORDER BY date DESC LIMIT $offset, $N";
113 $r1= sqlStatement($disclInnerQry, array($pid) );
114 $n=sqlNumRows($r1);
115 $noOfRecordsLeft=($totalRecords - $offset);
116 if ($n>0){?>
117 <table border='0' class="text">
118 <tr>
119 <td colspan='5' style="padding: 5px;"><a href="disclosure_full.php" class="" id='Submit' onclick="top.restoreSession()"><span><?php echo xlt('Refresh'); ?></span></a></td>
120 </tr>
121 </table>
122 <div id='pnotes'>
123 <table border='0' cellpadding="1" width='80%'>
124 <tr class="showborder_head" align='left' height="22">
125 <th style='width: 120px';>&nbsp;</th>
126 <th style="border-style: 1px solid #000" width="140px"><?php echo xlt('Recipient Name'); ?></th>
127 <th style="border-style: 1px solid #000" width="140px"><?php echo xlt('Disclosure Type'); ?></th>
128 <th style="border-style: 1px solid #000"><?php echo xlt('Description'); ?></th>
129 <th style="border-style: 1px solid #000"><?php echo xlt('Provider'); ?></th>
130 </tr>
131 <?php
132 $result2 = array();
133 for ($iter = 0;$frow = sqlFetchArray($r1);$iter++)
134 $result2[$iter] = $frow;
135 foreach($result2 as $iter)
137 $app_event=$iter{event};
138 $event=explode("-",$app_event);
139 $description =nl2br(text($iter{description})); //for line break if there is any new lines in the input text area field.
141 <!-- List the recipient name, description, date and edit and delete options-->
142 <tr class="noterow" height='25'>
143 <!--buttons for edit and delete.-->
144 <td valign='top'><a href='record_disclosure.php?editlid=<?php echo text($iter{id}); ?>'
145 class='css_button_small iframe' onclick='top.restoreSession()'><span><?php echo xlt('Edit');?></span></a>
146 <a href='#' class='deletenote css_button_small'
147 id='<?php echo text($iter{id}); ?>' onclick='top.restoreSession()'><span><?php echo xlt('Delete');?></span></a></td>
148 <td class="text" valign='top'><?php echo text($iter{recipient});?>&nbsp;</td>
149 <td class='text' valign='top'><?php if($event[1]=='healthcareoperations'){ echo xlt('health care operations'); } else echo text($event[1]); ?>&nbsp;</td>
150 <td class='text'><?php echo text($iter{date})." ".$description;?>&nbsp;</td>
151 <td class='text'><?php echo text($iter{user_fullname});?></td>
152 </tr>
153 <?php
156 else
158 <br>
159 <!-- Display None, if there is no disclosure -->
160 <span class='text' colspan='3'><?php echo xlt('None');?></span>
161 <?php
164 </table>
165 <table width='400' border='0' cellpadding='0' cellspacing='0'>
166 <tr>
167 <td>
168 <?php
169 if ($offset > ($N-1) && $n!=0) {
170 echo " <a class='link' href='disclosure_full.php?active=" . $active .
171 "&offset=" . ($offset-$N) . "' onclick='top.restoreSession()'>[" .
172 xlt('Previous') . "]</a>\n";
176 <?php
178 if ($n >= $N && $noOfRecordsLeft!=$N) {
179 echo "&nbsp;&nbsp; <a class='link' href='disclosure_full.php?active=" . $active.
180 "&offset=" . ($offset+$N) ."&leftrecords=".$noOfRecordsLeft."' onclick='top.restoreSession()'>[" .
181 xlt('Next') . "]</a>\n";
184 </td>
185 </tr>
186 </table>
187 </div>
188 </body>
190 <script type="text/javascript">
191 $(document).ready(function()
193 /// todo, move this to a common library
194 //for row highlight.
195 $(".noterow").mouseover(function() { $(this).toggleClass("highlight"); });
196 $(".noterow").mouseout(function() { $(this).toggleClass("highlight"); });
197 //fancy box
198 enable_modals();
199 //for deleting the disclosures
200 $(".deletenote").click(function() { DeleteNote(this); });
202 var DeleteNote = function(logevent)
204 if (confirm("<?php echo htmlspecialchars(xl('Are you sure you want to delete this disclosure?','','','\n ') . xl('This action CANNOT be undone.'),ENT_QUOTES); ?>"))
206 top.restoreSession();
207 window.location.replace("disclosure_full.php?deletelid="+logevent.id)
211 </script>
212 </html>