The Third Reminders email bug fix - contributed by arnabnaha
[openemr.git] / interface / patient_file / summary / disclosure_full.php
blob015801e9e32450171e4a54c6526e9fd65b6e25b9
1 <?php
2 /*******************************************************************************\
3 * Copyright (C) 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 ********************************************************************************/
20 //SANITIZE ALL ESCAPES
21 $sanitize_all_escapes=true;
24 //STOP FAKE REGISTER GLOBALS
25 $fake_register_globals=false;
28 require_once("../../globals.php");
29 require_once("$srcdir/sql.inc");
30 require_once("$srcdir/log.inc");
32 //retrieve the user name
33 $res = sqlQuery("select username from users where username=?", array($_SESSION{"authUser"}) );
34 $uname=$res{"username"};
35 //if the mode variable is set to disclosure, retrieve the values from 'disclosure_form ' in record_disclosure.php to store it in database.
36 if (isset($_POST["mode"]) and $_POST["mode"] == "disclosure"){
37 $dates=trim($_POST['dates']);
38 $event=trim($_POST['form_disclosure_type']);
39 $recipient_name=trim($_POST['recipient_name']);
40 $disclosure_desc=trim($_POST['desc_disc']);
41 $disclosure_id=trim($_POST['disclosure_id']);
42 if (isset($_POST["updatemode"]) AND $_POST["updatemode"] == "disclosure_update")
44 //update the recorded disclosure in the extended_log table.
45 updateRecordedDisclosure($dates,$event,$recipient_name,$disclosure_desc,$disclosure_id);
47 else
49 //insert the disclosure records in the extended_log table.
50 recordDisclosure($dates,$event,$pid,$recipient_name,$disclosure_desc,$uname);
53 if (isset($_GET['deletelid']))
55 $deletelid=$_GET['deletelid'];
56 //function to delete the recorded disclosures
57 deleteDisclosure($deletelid);
60 <html>
61 <head>
62 <link rel='stylesheet' href="<?php echo $css_header;?>" type="text/css">
63 <!-- supporting javascript code -->
64 <script type="text/javascript" src="<?php echo $GLOBALS['webroot'] ?>/library/js/jquery.js"></script>
65 <link rel="stylesheet" type="text/css" href="../../../library/js/fancybox/jquery.fancybox-1.2.6.css" media="screen" />
66 <script type="text/javascript" src="../../../library/dialog.js"></script>
67 <script type="text/javascript" src="../../../library/js/jquery.1.3.2.js"></script>
68 <script type="text/javascript" src="../../../library/js/common.js"></script>
69 <script type="text/javascript" src="../../../library/js/fancybox/jquery.fancybox-1.2.6.js"></script>
70 </head>
71 <body class="body_top">
72 <div>
73 <span class="title"><?php echo htmlspecialchars(xl('Disclosures'),ENT_NOQUOTES); ?></span>
74 </div>
75 <div style='float: left; margin-right: 10px'><?php echo htmlspecialchars(xl('for'),ENT_NOQUOTES); ?>&nbsp;
76 <span class="title"><a href="../summary/demographics.php" onclick="top.restoreSession()"><?php echo htmlspecialchars(getPatientName($pid),ENT_NOQUOTES); ?></a></span>
77 </div>
78 <div>
79 <a href="record_disclosure.php" class="css_button iframe"><span><?php echo htmlspecialchars(xl('Record'),ENT_NOQUOTES); ?></span></a>
80 </div>
81 <div>
82 <a href="demographics.php" <?php if (!$GLOBALS['concurrent_layout']) echo "target='Main'"; ?>
83 class="css_button" onclick="top.restoreSession()"> <span><?php echo htmlspecialchars(xl('View Patient'),ENT_NOQUOTES); ?></span></a>
84 </div>
85 <br>
86 <br>
87 <?php
88 $N=15;
89 $offset = $_REQUEST['offset'];
90 if (!isset($offset)) $offset = 0;
93 $r2= sqlStatement("select id,event,recipient,description,date from extended_log where patient_id=? AND event in (select option_id from list_options where list_id='disclosure_type') order by date desc ", array($pid) );
94 $totalRecords=sqlNumRows($r2);
96 //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";
97 //display all of the disclosures for the day, as well as others that are active from previous dates, up to a certain number, $N
98 $r1= sqlStatement("select id,event,recipient,description,date from extended_log where patient_id=? AND event in (select option_id from list_options where list_id='disclosure_type') order by date desc limit $offset,$N", array($pid) );
99 $n=sqlNumRows($r1);
100 $noOfRecordsLeft=($totalRecords - $offset);
101 if ($n>0){?>
102 <table border='0' class="text">
103 <tr>
104 <td colspan='5' style="padding: 5px;"><a href="disclosure_full.php" class="" id='Submit'><span><?php echo htmlspecialchars(xl('Refresh'),ENT_NOQUOTES); ?></span></a></td>
105 </tr>
106 </table>
107 <div id='pnotes'>
108 <table border='0' cellpadding="1" width='80%'>
109 <tr class="showborder_head" align='left' height="22">
110 <th style='width: 120px';>&nbsp;</th>
111 <th style="border-style: 1px solid #000" width="140px"><?php echo htmlspecialchars(xl('Recipient Name'),ENT_NOQUOTES); ?></th>
112 <th style="border-style: 1px solid #000" width="140px"><?php echo htmlspecialchars(xl('Disclosure Type'),ENT_NOQUOTES); ?></th>
113 <th style="border-style: 1px solid #000"><?php echo htmlspecialchars(xl('Description'),ENT_NOQUOTES); ?></th>
114 </tr>
115 <?php
116 $result2 = array();
117 for ($iter = 0;$frow = sqlFetchArray($r1);$iter++)
118 $result2[$iter] = $frow;
119 foreach($result2 as $iter)
121 $app_event=$iter{event};
122 $event=split("-",$app_event);
123 $description =nl2br(htmlspecialchars($iter{description},ENT_NOQUOTES)); //for line break if there is any new lines in the input text area field.
125 <!-- List the recipient name, description, date and edit and delete options-->
126 <tr class="noterow" height='25'>
127 <!--buttons for edit and delete.-->
128 <td valign='top'><a href='record_disclosure.php?editlid=<?php echo htmlspecialchars($iter{id},ENT_QUOTES); ?>'
129 class='css_button_small iframe'><span><?php echo htmlspecialchars(xl('Edit'),ENT_NOQUOTES);?></span></a>
130 <a href='#' class='deletenote css_button_small'
131 id='<?php echo htmlspecialchars($iter{id},ENT_QUOTES); ?>'><span><?php echo htmlspecialchars(xl('Delete'),ENT_NOQUOTES);?></span></a></td>
132 <td class="text" valign='top'><?php echo htmlspecialchars($iter{recipient},ENT_NOQUOTES);?>&nbsp;</td>
133 <td class='text' valign='top'><?php if($event[1]=='healthcareoperations'){ echo htmlspecialchars(xl('health care operations'),ENT_NOQUOTES); } else echo htmlspecialchars($event[1],ENT_NOQUOTES); ?>&nbsp;</td>
134 <td class='text'><?php echo htmlspecialchars($iter{date},ENT_NOQUOTES)." ".$description;?>&nbsp;</td>
135 </tr>
136 <?php
139 else
141 <br>
142 <!-- Display None, if there is no disclosure -->
143 <span class='text' colspan='3'><?php echo htmlspecialchars(xl('None'),ENT_NOQUOTES) ;?></span>
144 <?php
147 </table>
148 <table width='400' border='0' cellpadding='0' cellspacing='0'>
149 <tr>
150 <td>
151 <?php
152 if ($offset > ($N-1) && $n!=0) {
153 echo " <a class='link' href='disclosure_full.php?active=" . $active .
154 "&offset=" . ($offset-$N) . "' onclick='top.restoreSession()'>[" .
155 xl('Previous') . "]</a>\n";
159 <?php
161 if ($n >= $N && $noOfRecordsLeft!=$N) {
162 echo "&nbsp;&nbsp; <a class='link' href='disclosure_full.php?active=" . $active.
163 "&offset=" . ($offset+$N) ."&leftrecords=".$noOfRecordsLeft."' onclick='top.restoreSession()'>[" .
164 xl('Next') . "]</a>\n";
167 </td>
168 </tr>
169 </table>
170 </div>
171 </body>
173 <script type="text/javascript">
174 $(document).ready(function()
176 /// todo, move this to a common library
177 //for row highlight.
178 $(".noterow").mouseover(function() { $(this).toggleClass("highlight"); });
179 $(".noterow").mouseout(function() { $(this).toggleClass("highlight"); });
180 //fancy box
181 enable_modals();
182 //for deleting the disclosures
183 $(".deletenote").click(function() { DeleteNote(this); });
185 var DeleteNote = function(logevent)
187 if (confirm("<?php echo htmlspecialchars(xl('Are you sure you want to delete this disclosure?','','','\n ') . xl('This action CANNOT be undone.'),ENT_QUOTES); ?>"))
189 top.restoreSession();
190 window.location.replace("disclosure_full.php?deletelid="+logevent.id)
194 </script>
195 </html>