2 // This program is free software; you can redistribute it and/or
3 // modify it under the terms of the GNU General Public License
4 // as published by the Free Software Foundation; either version 2
5 // of the License, or (at your option) any later version.
8 $sanitize_all_escapes=true;
11 //STOP FAKE REGISTER GLOBALS
12 $fake_register_globals=false;
15 require_once("../../globals.php");
16 require_once("$srcdir/pnotes.inc");
17 require_once("$srcdir/acl.inc");
18 require_once("$srcdir/patient.inc");
19 require_once("$srcdir/options.inc.php");
20 require_once("$srcdir/classes/Document.class.php");
21 require_once("$srcdir/formatting.inc.php");
23 // form parameter docid can be passed to restrict the display to a document.
24 $docid = empty($_REQUEST['docid']) ?
0 : 0 +
$_REQUEST['docid'];
27 <li
class="current" ><a href
="#"><?php
echo htmlspecialchars(xl('Inbox'),ENT_NOQUOTES
); ?
></a
></li
>
28 <li
><a href
="#"><?php
echo htmlspecialchars(xl('Sent Items'),ENT_NOQUOTES
); ?
></a
></li
>
30 <div
class='tabContainer' >
31 <div
class='tab current' >
33 //display all of the notes for the day, as well as others that are active from previous dates, up to a certain number, $N
41 $thisauth = acl_check('patients', 'notes');
43 $tmp = getPatientData($pid, "squad");
44 if ($tmp['squad'] && ! acl_check('squads', $tmp['squad']))
48 echo "<p>(" . htmlspecialchars(xl('Notes not authorized'),ENT_NOQUOTES
) . ")</p>\n";
50 <table width
='100%' border
='0' cellspacing
='1' cellpadding
='1' style
='border-collapse:collapse;' >
53 $pres = sqlQuery("SELECT lname, fname " .
54 "FROM patient_data WHERE pid = ?", array($pid) );
55 $patientname = $pres['lname'] . ", " . $pres['fname'];
56 //retrieve all active notes
57 $result = getPnotesByDate("", 1, "id,date,body,user,title,assigned_to,message_status",
58 $pid, "$N", 0, '', $docid);
60 if ($result != null) {
61 $notes_count = 0;//number of notes so far displayed
62 echo "<tr class='text' style='border-bottom:2px solid #000;' >\n";
63 echo "<td valign='top' class='text' ><b>". htmlspecialchars(xl('From'),ENT_NOQUOTES
) ."</b></td>\n";
64 echo "<td valign='top' class='text' ><b>". htmlspecialchars(xl('Date'),ENT_NOQUOTES
) ."</b></td>\n";
65 echo "<td valign='top' class='text' ><b>". htmlspecialchars(xl('Subject'),ENT_NOQUOTES
) ."</b></td>\n";
66 echo "<td valign='top' class='text' ><b>". htmlspecialchars(xl('Content'),ENT_NOQUOTES
) ."</b></td>\n";
67 echo "<td valign='top' class='text' ><b>". htmlspecialchars(xl('Status'),ENT_NOQUOTES
) ."</b></td>\n";
69 foreach ($result as $iter) {
72 $body = $iter['body'];
73 if (preg_match('/^\d\d\d\d-\d\d-\d\d \d\d\:\d\d /', $body)) {
74 $body = nl2br(htmlspecialchars(oeFormatPatientNote($body),ENT_NOQUOTES
));
76 $body = htmlspecialchars(oeFormatSDFT(strtotime($iter['date'])) . date(' H:i', strtotime($iter['date'])) .
77 ' (' . $iter['user'] . ') ',ENT_NOQUOTES
) .
78 nl2br(htmlspecialchars(oeFormatPatientNote($body),ENT_NOQUOTES
));
80 $body = preg_replace('/(\sto\s)-patient-(\))/','${1}'.$patientname.'${2}',$body);
81 $body = strlen($body) > 120 ?
substr($body,0,120)."<b>.......</b>" : $body;
82 echo " <tr class='text' id='".htmlspecialchars($iter['id'],ENT_QUOTES
)."' style='border-bottom:1px dashed;height:30px;' >\n";
84 // Modified 6/2009 by BM to incorporate the patient notes into the list_options listings
85 echo "<td valign='top' class='text'>".htmlspecialchars($iter['user'],ENT_NOQUOTES
)."</td>\n";
86 echo "<td valign='top' class='text'>".htmlspecialchars($iter['date'],ENT_NOQUOTES
)."</td>\n";
87 echo " <td valign='top' class='text'><b>";
88 echo generate_display_field(array('data_type'=>'1','list_id'=>'note_type'), $iter['title']);
91 echo " <td valign='top' class='text'>$body</td>\n";
92 echo " <td valign='top' class='text'>";
93 echo generate_display_field(array('data_type'=>'1','list_id'=>'message_status'), $iter['message_status']);
104 if ( isset($has_note) && ($has_note < 1 )) { ?
>
106 <?php
echo htmlspecialchars(xl( "There are no notes on file for this patient."),ENT_NOQUOTES
);
108 echo "<a href='pnotes_full.php'>";
109 echo htmlspecialchars(xl("To add notes, please click here"),ENT_NOQUOTES
);
116 <?php
echo htmlspecialchars(xl('Displaying the following number of most recent notes:'),ENT_NOQUOTES
); ?
>
117 <b
><?php
echo $N;?
></b
><br
>
118 <a href
='pnotes_full.php?s=0'><?php
echo htmlspecialchars(xl('Click here to view them all.'),ENT_NOQUOTES
); ?
></a
>
130 //display all of the notes for the day, as well as others that are active from previous dates, up to a certain number, $N
136 echo "<p>(" . htmlspecialchars(xl('Notes not authorized'),ENT_NOQUOTES
) . ")</p>\n";
138 <table width
='100%' border
='0' cellspacing
='1' cellpadding
='1' style
='border-collapse:collapse;' >
140 //retrieve all active notes
141 $result_sent = getSentPnotesByDate("", 1, "id,date,body,user,title,assigned_to,pid",
142 $pid, "$M", 0, '', $docid);
143 if ($result_sent != null) {
144 $notes_sent_count = 0;//number of notes so far displayed
145 echo "<tr class='text' style='border-bottom:2px solid #000;' >\n";
146 echo "<td valign='top' class='text' ><b>". htmlspecialchars(xl('To'),ENT_NOQUOTES
) ."</b></td>\n";
147 echo "<td valign='top' class='text' ><b>". htmlspecialchars(xl('Date'),ENT_NOQUOTES
) ."</b></td>\n";
148 echo "<td valign='top' class='text' ><b>". htmlspecialchars(xl('Subject'),ENT_NOQUOTES
) ."</b></td>\n";
149 echo "<td valign='top' class='text' ><b>". htmlspecialchars(xl('Content'),ENT_NOQUOTES
) ."</b></td>\n";
151 foreach ($result_sent as $iter) {
153 $body = $iter['body'];
154 if (preg_match('/^\d\d\d\d-\d\d-\d\d \d\d\:\d\d /', $body)) {
155 $body = nl2br(htmlspecialchars(oeFormatPatientNote($body),ENT_NOQUOTES
));
157 $body = htmlspecialchars(oeFormatSDFT(strtotime($iter['date'])) . date(' H:i', strtotime($iter['date'])) .
158 ' (' . $iter['user'] . ') ',ENT_NOQUOTES
) .
159 nl2br(htmlspecialchars(oeFormatPatientNote($body),ENT_NOQUOTES
));
161 $body = preg_replace('/(:\d{2}\s\()'.$iter['pid'].'(\sto\s)/','${1}'.$patientname.'${2}',$body);
162 $body = strlen($body) > 120 ?
substr($body,0,120)."<b>.......</b>" : $body;
163 echo " <tr class='text' id='".htmlspecialchars($iter['id'],ENT_QUOTES
)."' style='border-bottom:1px dashed;height:30px;' >\n";
164 // Modified 6/2009 by BM to incorporate the patient notes into the list_options listings
165 echo "<td valign='top' class='text'>".htmlspecialchars($iter['assigned_to'],ENT_NOQUOTES
)."</td>\n";
166 echo "<td valign='top' class='text'>".htmlspecialchars($iter['date'],ENT_NOQUOTES
)."</td>\n";
167 echo " <td valign='top' class='text'><b>";
168 echo generate_display_field(array('data_type'=>'1','list_id'=>'note_type'), $iter['title']);
170 echo " <td valign='top' class='text'>$body</td>\n";
177 if ( !isset($has_set_note) ||
($has_sent_note < 1) ) { ?
>
179 <?php
echo htmlspecialchars(xl( "There are no notes on file for this patient."),ENT_NOQUOTES
);
181 echo "<a href='pnotes_full.php'>";
182 echo htmlspecialchars(xl("To add notes, please click here"),ENT_NOQUOTES
);
189 <?php
echo htmlspecialchars(xl('Displaying the following number of most recent notes'),ENT_NOQUOTES
).":"; ?
>
190 <b
><?php
echo $M;?
></b
><br
>
191 <a href
='pnotes_full.php?s=1'><?php
echo htmlspecialchars(xl('Click here to view them all.'),ENT_NOQUOTES
); ?
></a
>
201 <script language
="javascript">
202 // jQuery stuff to make the page a little easier to use
206 $
(document
).ready(function(){
207 $
(".noterow").mouseover(function() { $
(this
).toggleClass("highlight"); });
208 $
(".noterow").mouseout(function() { $
(this
).toggleClass("highlight"); });