3 * Message and Reminder Center UI
5 * 2013/02/08 Minor tweaks by EMR Direct to allow integration with Direct messaging
6 * 2013-03-27 by sunsetsystems: Fixed some weirdness with assigning a message recipient,
7 * and allowing a message to be closed with a new note appended and no recipient.
9 * Copyright (c) 2010 OpenEMR Support LLC
11 * LICENSE: This program is free software; you can redistribute it and/or
12 * modify it under the terms of the GNU General Public License
13 * as published by the Free Software Foundation; either version 3
14 * of the License, or (at your option) any later version.
15 * This program is distributed in the hope that it will be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
19 * You should have received a copy of the GNU General Public License
20 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
23 * @author OpenEMR Support LLC
24 * @author Roberto Vasquez <robertogagliotta@gmail.com>
25 * @author Rod Roark <rod@sunsetsystems.com>
26 * @author Brady Miller <brady@sparmy.com>
27 * @link http://www.open-emr.org
30 //SANITIZE ALL ESCAPES
31 $sanitize_all_escapes=true;
33 //STOP FAKE REGISTER GLOBALS
34 $fake_register_globals=false;
36 require_once("../../globals.php");
37 require_once("$srcdir/pnotes.inc");
38 require_once("$srcdir/patient.inc");
39 require_once("$srcdir/acl.inc");
40 require_once("$srcdir/log.inc");
41 require_once("$srcdir/options.inc.php");
42 require_once("$srcdir/gprelations.inc.php");
43 require_once("$srcdir/formatting.inc.php");
48 <?php
html_header_show();?
>
49 <link rel
="stylesheet" href
="<?php echo $css_header;?>" type
="text/css">
50 <script type
="text/javascript" src
="../../../library/dialog.js?v=<?php echo $v_js_includes; ?>"></script
>
51 <script type
="text/javascript" src
="../../../library/textformat.js"></script
>
52 <script type
="text/javascript" src
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-2-1/index.js"></script
>
55 <body
class="body_top">
57 <span
class="title"><?php
echo xlt('Message and Reminder Center'); ?
></span
>
59 <span
class="title"><?php
echo xlt('Reminders'); ?
></span
>
63 // TajEmo Work by CB 2012/01/11 02:51:25 PM adding dated reminders
64 // I am asuming that at this point security checks have been performed
65 require_once '../dated_reminders/dated_reminders.php';
67 // Check to see if the user has Admin rights, and if so, allow access to See All.
68 $showall = isset($_GET['show_all']) ?
$_GET['show_all'] : "" ;
69 if ($showall == "yes") {
77 // Collect active variable and applicable html code for links
78 $form_active = (isset($_REQUEST['form_active']) ?
$_REQUEST['form_active'] : FALSE);
79 $form_inactive = (isset($_REQUEST['form_inactive']) ?
$_REQUEST['form_inactive'] : FALSE);
82 $activity_string_html = 'form_active=1';
84 else if ($form_inactive) {
86 $activity_string_html = 'form_inactive=1';
90 $activity_string_html = '';
93 //collect the task setting
94 $task= isset($_REQUEST['task']) ?
$_REQUEST['task'] : "";
96 if (acl_check('admin', 'super' )) {
97 if ($show_all=='yes') {
99 $lnkvar="'messages.php?show_all=no&$activity_string_html' name='Just Mine' onclick=\"top.restoreSession()\"> (".htmlspecialchars( xl('Just Mine'), ENT_NOQUOTES
).")";
103 $lnkvar="'messages.php?show_all=yes&$activity_string_html' name='See All' onclick=\"top.restoreSession()\"> (".htmlspecialchars( xl('See All'), ENT_NOQUOTES
).")";
108 <table
><tr
><td
><span
class="title"><?php
echo htmlspecialchars( xl('Messages'), ENT_NOQUOTES
); ?
></span
> <a
class='more' href
=<?php
echo $lnkvar; ?
></a
></td
></tr
></table
>
110 //show the activity links
111 if (empty($task) ||
$task=="add" ||
$task=="delete") { ?
>
112 <?php
if ($active == "all") { ?
>
113 <span
><?php
echo xlt('Show All'); ?
></span
>
115 <a href
="messages.php" class="link" onclick
="top.restoreSession()"><span
><?php
echo xlt('Show All'); ?
></span
></a
>
118 <?php
if ($active == '1') { ?
>
119 <span
><?php
echo xlt('Show Active'); ?
></span
>
121 <a href
="messages.php?form_active=1" class="link" onclick
="top.restoreSession()"><span
><?php
echo xlt('Show Active'); ?
></span
></a
>
124 <?php
if ($active == '0') { ?
>
125 <span
><?php
echo xlt('Show Inactive'); ?
></span
>
127 <a href
="messages.php?form_inactive=1" class="link" onclick
="top.restoreSession()"><span
><?php
echo xlt('Show Inactive'); ?
></span
></a
>
135 // Add a new message for a specific patient; the message is documented in Patient Notes.
136 // Add a new message; it's treated as a new note in Patient Notes.
137 $note = $_POST['note'];
138 $noteid = $_POST['noteid'];
139 $form_note_type = $_POST['form_note_type'];
140 $form_message_status = $_POST['form_message_status'];
141 $reply_to = $_POST['reply_to'];
142 $assigned_to_list = explode(';', $_POST['assigned_to']);
143 foreach($assigned_to_list as $assigned_to){
144 if ($noteid && $assigned_to != '-patient-') {
145 updatePnote($noteid, $note, $form_note_type, $assigned_to, $form_message_status);
149 if($noteid && $assigned_to == '-patient-'){
150 // When $assigned_to == '-patient-' we don't update the current note, but
151 // instead create a new one with the current note's body prepended and
152 // attributed to the patient. This seems to be all for the patient portal.
153 $row = getPnoteById($noteid);
154 if (! $row) die("getPnoteById() did not find id '".text($noteid)."'");
155 $pres = sqlQuery("SELECT lname, fname " .
156 "FROM patient_data WHERE pid = ?", array($reply_to) );
157 $patientname = $pres['lname'] . ", " . $pres['fname'];
158 $note .= "\n\n$patientname on ".$row['date']." wrote:\n\n";
159 $note .= $row['body'];
161 // There's no note ID, and/or it's assigned to the patient.
162 // In these cases a new note is created.
163 addPnote($reply_to, $note, $userauthorized, '1', $form_note_type, $assigned_to, '', $form_message_status);
170 $noteid = $_POST['noteid'];
171 $form_message_status = $_POST['form_message_status'];
172 $reply_to = $_POST['reply_to'];
174 updatePnoteMessageStatus($noteid,$form_message_status);
176 updatePnotePatient($noteid,$reply_to);
178 $note = $_POST['note'];
179 $title = $_POST['form_note_type'];
180 $reply_to = $_POST['reply_to'];
184 $noteid = $_GET['noteid'];
186 // Update the message if it already exists; it's appended to an existing note in Patient Notes.
187 $result = getPnoteById($noteid);
190 $title = $result['title'];
192 $body = $result['body'];
193 if ($reply_to == ""){
194 $reply_to = $result['pid'];
196 $form_message_status = $result['message_status'];
200 // Delete selected message(s) from the Messages box (only).
201 $delete_id = $_POST['delete_id'];
202 for($i = 0; $i < count($delete_id); $i++
) {
203 deletePnote($delete_id[$i]);
204 newEvent("delete", $_SESSION['authUser'], $_SESSION['authProvider'], 1, "pnotes: id ".$delete_id[$i]);
209 if($task == "addnew" or $task == "edit") {
210 // Display the Messages page layout.
212 <form name=new_note id=new_note action=\"messages.php?showall=".attr($showall)."&sortby=".attr($sortby)."&sortorder=".attr($sortorder)."&begin=".attr($begin)."&$activity_string_html\" method=post>
213 <input type=hidden name=noteid id=noteid value='".attr($noteid)."'>
214 <input type=hidden name=task id=task value=add>";
216 <div id
="pnotes"><center
>
217 <table border
='0' cellspacing
='8'>
220 <b
><?php
echo htmlspecialchars( xl('Type'), ENT_NOQUOTES
); ?
>:</b
>
223 $title = "Unassigned";
225 // Added 6/2009 by BM to incorporate the patient notes into the list_options listings.
226 generate_form_field(array('data_type'=>1,'field_id'=>'note_type','list_id'=>'note_type','empty_title'=>'SKIP','order_by'=>'title'), $title);
229 <?php
if ($task != "addnew" && $result['pid'] != 0) { ?
>
230 <a
class="patLink" onclick
="goPid('<?php echo attr($result['pid']);?>')"><?php
echo htmlspecialchars( xl('Patient'), ENT_NOQUOTES
); ?
>:</a
>
232 <b
class='<?php echo ($task=="addnew"?"required":"") ?>'><?php
echo htmlspecialchars( xl('Patient'), ENT_NOQUOTES
); ?
>:</b
>
236 $prow = sqlQuery("SELECT lname, fname,pid, pubpid, DOB " .
237 "FROM patient_data WHERE pid = ?", array($reply_to) );
238 $patientname = $prow['lname'] . ", " . $prow['fname'];
240 if ($patientname == '') {
241 $patientname = xl('Click to select');
243 <input type
='text' size
='10' name
='form_patient' style
='width:150px;<?php
244 echo ($task=="addnew"?"cursor:pointer;cursor:hand;":"") ?>' value
='<?php
245 echo htmlspecialchars($patientname, ENT_QUOTES); ?>' <?php
246 echo (($task=="addnew" ||
$result['pid']==0) ?
"onclick='sel_patient()' readonly":"disabled") ?
> title
='<?php
247 echo ($task=="addnew"?(htmlspecialchars( xl('Click to select patient
'), ENT_QUOTES)):"") ?>' />
248 <input type
='hidden' name
='reply_to' id
='reply_to' value
='<?php echo htmlspecialchars( $reply_to, ENT_QUOTES) ?>' />
250 <b
><?php
echo htmlspecialchars( xl('Status'), ENT_NOQUOTES
); ?
>:</b
>
252 if ($form_message_status == "") {
253 $form_message_status = 'New';
255 generate_form_field(array('data_type'=>1,'field_id'=>'message_status','list_id'=>'message_status','empty_title'=>'SKIP','order_by'=>'title'), $form_message_status); ?
>
260 <b
><?php
echo htmlspecialchars( xl('To'), ENT_QUOTES
); ?
>:</b
>
261 <input type
='textbox' name
='assigned_to_text' id
='assigned_to_text' size
='40' readonly
='readonly'
262 value
='<?php echo htmlspecialchars(xl("Select Users From The Dropdown List"), ENT_QUOTES)?>' >
263 <input type
='hidden' name
='assigned_to' id
='assigned_to' >
264 <select name
='users' id
='users' onchange
='addtolist(this);' >
266 echo "<option value='" . htmlspecialchars( '--', ENT_QUOTES
) . "'";
267 echo ">" . htmlspecialchars( xl('Select User'), ENT_NOQUOTES
);
269 $ures = sqlStatement("SELECT username, fname, lname FROM users " .
270 "WHERE username != '' AND active = 1 AND " .
271 "( info IS NULL OR info NOT LIKE '%Inactive%' ) " .
272 "ORDER BY lname, fname");
273 while ($urow = sqlFetchArray($ures)) {
274 echo " <option value='" . htmlspecialchars( $urow['username'], ENT_QUOTES
) . "'";
275 echo ">" . htmlspecialchars( $urow['lname'], ENT_NOQUOTES
);
276 if ($urow['fname']) echo ", " . htmlspecialchars( $urow['fname'], ENT_NOQUOTES
);
279 echo "<option value='" . htmlspecialchars( '-patient-', ENT_QUOTES
) . "'";
280 echo ">" . htmlspecialchars( '-Patient-', ENT_NOQUOTES
);
289 // Get the related document IDs if any.
290 $tmp = sqlStatement("SELECT id1 FROM gprelations WHERE " .
291 "type1 = ? AND type2 = ? AND id2 = ?",
292 array('1', '6', $noteid));
293 if (sqlNumRows($tmp)) {
295 echo " <td class='text'><b>";
296 echo xlt('Linked document') . ":</b>\n";
297 while ($gprow = sqlFetchArray($tmp)) {
298 $d = new Document($gprow['id1']);
299 $enc_list = sqlStatement("SELECT fe.encounter,fe.date,openemr_postcalendar_categories.pc_catname FROM form_encounter AS fe ".
300 " left join openemr_postcalendar_categories on fe.pc_catid=openemr_postcalendar_categories.pc_catid WHERE fe.pid = ? order by fe.date desc", array($prow['pid']));
301 $str_dob = htmlspecialchars(xl("DOB") . ":" . $prow['DOB'] . " " . xl("Age") . ":" . getPatientAge($prow['DOB']));
302 $pname = $prow['fname']." ".$prow['lname'];
303 echo "<a href='javascript:void(0);' ";
304 echo "onClick=\"gotoReport(".addslashes(attr($d->get_id())).",'".addslashes(attr($pname))."',".addslashes(attr($prow['pid'])).",".addslashes(attr($prow['pubpid'])).",'".addslashes(attr($str_dob))."');\">";
305 echo text($d->get_url_file());
311 // Get the related procedure order IDs if any.
312 $tmp = sqlStatement("SELECT id1 FROM gprelations WHERE " .
313 "type1 = ? AND type2 = ? AND id2 = ?",
314 array('2', '6', $noteid));
315 if (sqlNumRows($tmp)) {
317 echo " <td class='text'><b>";
318 echo xlt('Linked procedure order') . ":</b>\n";
319 while ($gprow = sqlFetchArray($tmp)) {
321 echo $GLOBALS['webroot'] . "/interface/orders/single_order_results.php?orderid=";
323 echo "' target='_blank' onclick='top.restoreSession()'>";
339 $body = preg_replace('/(:\d{2}\s\()'.$result['pid'].'(\sto\s)/','${1}'.$patientname.'${2}',$body);
340 $body = nl2br(htmlspecialchars( $body, ENT_NOQUOTES
));
341 echo "<div class='text' style='background-color:white; color: gray; border:1px solid #999; padding: 5px; width: 640px;'>".$body."</div>";
345 <textarea name
='note' id
='note' rows
='8' style
="width: 660px; "><?php
echo htmlspecialchars( $note, ENT_NOQUOTES
) ?
></textarea
>
350 <?php
if ($noteid) { ?
>
351 <!-- This is
for displaying an existing note
. -->
352 <input type
="button" id
="newnote" value
="<?php echo htmlspecialchars( xl('Send message'), ENT_QUOTES); ?>">
353 <input type
="button" id
="printnote" value
="<?php echo htmlspecialchars( xl('Print message'), ENT_QUOTES); ?>">
354 <input type
="button" id
="cancel" value
="<?php echo htmlspecialchars( xl('Cancel'), ENT_QUOTES); ?>">
356 <!-- This is
for displaying a
new note
. -->
357 <input type
="button" id
="newnote" value
="<?php echo htmlspecialchars( xl('Send message'), ENT_QUOTES); ?>">
358 <input type
="button" id
="cancel" value
="<?php echo htmlspecialchars( xl('Cancel'), ENT_QUOTES); ?>">
363 </form
></center
></div
>
364 <script language
="javascript">
366 // jQuery stuff to make the page a little easier to use
368 $
(document
).ready(function(){
369 $
("#newnote").click(function() { NewNote(); });
370 $
("#printnote").click(function() { PrintNote(); });
371 obj
= document
.getElementById("form_message_status");
372 obj
.onchange
= function(){SaveNote();};
373 $
("#cancel").click(function() { CancelNote(); });
376 var NewNote
= function () {
377 top
.restoreSession();
378 if (document
.forms
[0].reply_to
.value
.length
== 0 || document
.forms
[0].reply_to
.value
== '0') {
379 alert('<?php echo htmlspecialchars( xl('Please choose a patient
'), ENT_QUOTES); ?>');
381 else if (document
.forms
[0].assigned_to
.value
.length
== 0 &&
382 document
.getElementById("form_message_status").value
!= 'Done')
384 alert('<?php echo addslashes(xl('Recipient required unless status is Done
')); ?>');
388 $
("#new_note").submit();
392 var PrintNote
= function () {
393 top
.restoreSession();
394 window
.open('../../patient_file/summary/pnotes_print.php?noteid=<?php echo htmlspecialchars( $noteid, ENT_QUOTES); ?>', '_blank', 'resizable=1,scrollbars=1,width=600,height=500');
397 var SaveNote
= function () {
398 <?php
if ($noteid) { ?
>
399 top
.restoreSession();
400 $
("#task").val("save");
401 $
("#new_note").submit();
405 var CancelNote
= function () {
406 top
.restoreSession();
408 $
("#new_note").submit();
411 function gotoReport(doc_id
,pname
,pid
,pubpid
,str_dob
){
412 EncounterDateArray
=new Array;
413 CalendarCategoryArray
=new Array;
414 EncounterIdArray
=new Array;
417 if(isset($enc_list) && sqlNumRows($enc_list) >0 ){
418 while($row = sqlFetchArray($enc_list)){
420 EncounterIdArray
[Count
]='<?php echo attr($row['encounter
']); ?>';
421 EncounterDateArray
[Count
]='<?php echo attr(oeFormatShortDate(date("Y-m-d", strtotime($row['date
'])))); ?>';
422 CalendarCategoryArray
[Count
]='<?php echo attr(xl_appt_category($row['pc_catname
'])); ?>';
428 top
.restoreSession();
431 url
:'<?php echo $GLOBALS['webroot
']."/interface/patient_file/encounter/patient_encounter.php";?>',
435 parent
.left_nav
.setPatient(pname
,pid
,pubpid
,'',str_dob
);
436 parent
.left_nav
.setPatientEncounter(EncounterIdArray
,EncounterDateArray
,CalendarCategoryArray
);
437 <?php
if ($GLOBALS['new_tabs_layout']) { ?
>
438 var docurl
= '../controller.php?document&view' +
"&patient_id=" + pid +
"&document_id=" + doc_id +
"&";
439 var paturl
= 'patient_file/summary/demographics.php?pid=' + pid
;
440 parent
.left_nav
.loadFrame('dem1', 'pat', paturl
);
441 parent
.left_nav
.loadFrame('doc0', 'enc', docurl
);
442 top
.activateTabByName('enc',true);
444 var docurl
= '<?php echo $GLOBALS['webroot
'] . "/controller.php?document&view"; ?>' +
"&patient_id=" + pid +
"&document_id=" + doc_id +
"&";
445 var paturl
= '<?php echo $GLOBALS['webroot
'] . "/interface/patient_file/summary/demographics.php?pid="; ?>' + pid
;
446 var othername
= (window
.name
== 'RTop') ?
'RBot' : 'RTop';
447 parent
.frames
[othername
].location
.href
= paturl
;
448 location
.href
= docurl
;
451 // This is for callback by the find-patient popup.
452 function setpatient(pid
, lname
, fname
, dob
) {
453 var f
= document
.forms
[0];
454 f
.form_patient
.value
= lname +
', ' + fname
;
455 f
.reply_to
.value
= pid
;
456 <?php
if ($noteid) { ?
>
457 //used when direct messaging service inserts a pnote with indeterminate patient
458 //to allow the user to assign the message to a patient.
459 top
.restoreSession();
460 $
("#task").val("savePatient");
461 $
("#new_note").submit();
465 // This invokes the find-patient popup.
466 function sel_patient() {
467 dlgopen('../../main/calendar/find_patient_popup.php', '_blank', 500, 400);
470 function addtolist(sel
){
471 var itemtext
= document
.getElementById('assigned_to_text');
472 var item
= document
.getElementById('assigned_to');
473 if(sel
.value
!= '--'){
475 if(item
.value
.indexOf(sel
.value
) == -1){
476 itemtext
.value
= itemtext
.value +
' ; '+ sel
.options
[sel
.selectedIndex
].text
;
477 item
.value
= item
.value +
';'+ sel
.value
;
480 itemtext
.value
= sel
.options
[sel
.selectedIndex
].text
;
481 item
.value
= sel
.value
;
490 // This is for sorting the records.
491 $sort = array("users.lname", "patient_data.lname", "pnotes.title", "pnotes.date", "pnotes.message_status");
492 $sortby = (isset($_REQUEST['sortby']) && ($_REQUEST['sortby']!="")) ?
$_REQUEST['sortby'] : $sort[0];
493 $sortorder = (isset($_REQUEST['sortorder']) && ($_REQUEST['sortorder']!="")) ?
$_REQUEST['sortorder'] : "asc";
494 $begin = isset($_REQUEST['begin']) ?
$_REQUEST['begin'] : 0;
496 for($i = 0; $i < count($sort); $i++
) {
497 $sortlink[$i] = "<a href=\"messages.php?show_all=".attr($showall)."&sortby=".attr($sort[$i])."&sortorder=asc&$activity_string_html\" onclick=\"top.restoreSession()\"><img src=\"../../../images/sortdown.gif\" border=0 alt=\"".htmlspecialchars( xl('Sort Up'), ENT_QUOTES
)."\"></a>";
499 for($i = 0; $i < count($sort); $i++
) {
500 if($sortby == $sort[$i]) {
502 case "asc" : $sortlink[$i] = "<a href=\"messages.php?show_all=".attr($showall)."&sortby=".attr($sortby)."&sortorder=desc&$activity_string_html\" onclick=\"top.restoreSession()\"><img src=\"../../../images/sortup.gif\" border=0 alt=\"".htmlspecialchars( xl('Sort Up'), ENT_QUOTES
)."\"></a>"; break;
503 case "desc" : $sortlink[$i] = "<a href=\"messages.php?show_all=".attr($showall)."&sortby=".attr($sortby)."&sortorder=asc&$activity_string_html\" onclick=\"top.restoreSession()\"><img src=\"../../../images/sortdown.gif\" border=0 alt=\"".htmlspecialchars( xl('Sort Down'), ENT_QUOTES
)."\"></a>"; break;
507 // Manage page numbering and display beneath the Messages table.
509 $total = getPnotesByUser($active,$show_all,$_SESSION['authUser'],true);
510 if($begin == "" or $begin == 0) {
513 $prev = $begin - $listnumber;
514 $next = $begin +
$listnumber;
516 $end = $listnumber +
$start - 1;
524 $prevlink = "<a href=\"messages.php?show_all=".attr($showall)."&sortby=".attr($sortby)."&sortorder=".attr($sortorder)."&begin=".attr($prev)."&$activity_string_html\" onclick=\"top.restoreSession()\"><<</a>";
531 $nextlink = "<a href=\"messages.php?show_all=".attr($showall)."&sortby=".attr($sortby)."&sortorder=".attr($sortorder)."&begin=".attr($next)."&$activity_string_html\" onclick=\"top.restoreSession()\">>></a>";
536 // Display the Messages table header.
538 <table width=100%><tr><td><table border=0 cellpadding=1 cellspacing=0 width=90% style=\"border-left: 1px #000000 solid; border-right: 1px #000000 solid; border-top: 1px #000000 solid;\">
539 <form name=MessageList action=\"messages.php?showall=".attr($showall)."&sortby=".attr($sortby)."&sortorder=".attr($sortorder)."&begin=".attr($begin)."&$activity_string_html\" method=post>
540 <input type=hidden name=task value=delete>
541 <tr height=\"24\" style=\"background:lightgrey\">
542 <td align=\"center\" width=\"25\" style=\"border-bottom: 1px #000000 solid; border-right: 1px #000000 solid;\"><input type=checkbox id=\"checkAll\" onclick=\"selectAll()\"></td>
543 <td width=\"20%\" style=\"border-bottom: 1px #000000 solid; border-right: 1px #000000 solid;\" class=bold> <b>" .
544 htmlspecialchars( xl('From'), ENT_NOQUOTES
) . "</b> $sortlink[0]</td>
545 <td width=\"20%\" style=\"border-bottom: 1px #000000 solid; border-right: 1px #000000 solid;\" class=bold> <b>" .
546 htmlspecialchars( xl('Patient'), ENT_NOQUOTES
) . "</b> $sortlink[1]</td>
547 <td style=\"border-bottom: 1px #000000 solid; border-right: 1px #000000 solid;\" class=bold> <b>" .
548 htmlspecialchars( xl('Type'), ENT_NOQUOTES
) . "</b> $sortlink[2]</td>
549 <td width=\"15%\" style=\"border-bottom: 1px #000000 solid; border-right: 1px #000000 solid;\" class=bold> <b>" .
550 htmlspecialchars( xl('Date'), ENT_NOQUOTES
) . "</b> $sortlink[3]</td>
551 <td width=\"15%\" style=\"border-bottom: 1px #000000 solid; \" class=bold> <b>" .
552 htmlspecialchars( xl('Status'), ENT_NOQUOTES
) . "</b> $sortlink[4]</td>
554 // Display the Messages table body.
556 $result = getPnotesByUser($active,$show_all,$_SESSION['authUser'],false,$sortby,$sortorder,$begin,$listnumber);
557 while ($myrow = sqlFetchArray($result)) {
558 $name = $myrow['user'];
559 $name = $myrow['users_lname'];
560 if ($myrow['users_fname']) {
561 $name .= ", " . $myrow['users_fname'];
563 $patient = $myrow['pid'];
565 $patient = $myrow['patient_data_lname'];
566 if ($myrow['patient_data_fname']) {
567 $patient .= ", " . $myrow['patient_data_fname'];
570 $patient = "* Patient must be set manually *";
574 <tr id=\"row$count\" style=\"background:white\" height=\"24\">
575 <td align=\"center\" style=\"border-bottom: 1px #000000 solid; border-right: 1px #000000 solid;\"><input type=checkbox id=\"check$count\" name=\"delete_id[]\" value=\"" .
576 attr( $myrow['id']) . "\" onclick=\"if(this.checked==true){ selectRow('row$count'); }else{ deselectRow('row$count'); }\"></td>
577 <td style=\"border-bottom: 1px #000000 solid; border-right: 1px #000000 solid;\"><table cellspacing=0 cellpadding=0 width=100%><tr><td width=5></td><td class=\"text\">" .
578 text( $name) . "</td><td width=5></td></tr></table></td>
579 <td style=\"border-bottom: 1px #000000 solid; border-right: 1px #000000 solid;\"><table cellspacing=0 cellpadding=0 width=100%><tr><td width=5></td><td class=\"text\"><a href=\"messages.php?showall=".attr($showall)."&sortby=".attr($sortby)."&sortorder=".attr($sortorder)."&begin=".attr($begin)."&task=edit¬eid=" .
580 attr( $myrow['id']) . "&$activity_string_html\" onclick=\"top.restoreSession()\">" .
581 text( $patient) . "</a></td><td width=5></td></tr></table></td>
582 <td style=\"border-bottom: 1px #000000 solid; border-right: 1px #000000 solid;\"><table cellspacing=0 cellpadding=0 width=100%><tr><td width=5></td><td class=\"text\">" .
583 xlt( $myrow['title']) . "</td><td width=5></td></tr></table></td>
584 <td style=\"border-bottom: 1px #000000 solid; border-right: 1px #000000 solid;\"><table cellspacing=0 cellpadding=0 width=100%><tr><td width=5></td><td class=\"text\">" .
585 text( oeFormatShortDate(substr($myrow['date'], 0, strpos($myrow['date'], " ")))) . "</td><td width=5></td></tr></table></td>
586 <td style=\"border-bottom: 1px #000000 solid;\"><table cellspacing=0 cellpadding=0 width=100%><tr><td width=5></td><td class=\"text\">" .
587 xlt( $myrow['message_status']) . "</td><td width=5></td></tr></table></td>
590 // Display the Messages table footer.
593 <table border=0 cellpadding=5 cellspacing=0 width=90%>
595 <td class=\"text\"><a href=\"messages.php?showall=".attr($showall)."&sortby=".attr($sortby)."&sortorder=".attr($sortorder)."&begin=".attr($begin)."&task=addnew&$activity_string_html\" onclick=\"top.restoreSession()\">" .
596 htmlspecialchars( xl('Add New'), ENT_NOQUOTES
) . "</a> <a href=\"javascript:confirmDeleteSelected()\" onclick=\"top.restoreSession()\">" .
597 htmlspecialchars( xl('Delete'), ENT_NOQUOTES
) . "</a></td>
598 <td align=right class=\"text amount-msg\">$prevlink $end of $total $nextlink</td>
600 </table></td></tr></table><br>";
602 <script language
="javascript">
603 // This is to confirm delete action.
604 function confirmDeleteSelected() {
605 if(confirm("<?php echo htmlspecialchars( xl('Do you really want to delete the selection?'), ENT_QUOTES); ?>")) {
606 document
.MessageList
.submit();
609 // This is to allow selection of all items in Messages table for deletion.
610 function selectAll() {
611 if(document
.getElementById("checkAll").checked
==true) {
612 document
.getElementById("checkAll").checked
=true;<?php
613 for($i = 1; $i <= $count; $i++
) {
614 echo "document.getElementById(\"check$i\").checked=true; document.getElementById(\"row$i\").style.background='#E7E7E7'; ";
618 document
.getElementById("checkAll").checked
=false;<?php
619 for($i = 1; $i <= $count; $i++
) {
620 echo "document.getElementById(\"check$i\").checked=false; document.getElementById(\"row$i\").style.background='#F7F7F7'; ";
624 // The two functions below are for managing row styles in Messages table.
625 function selectRow(row
) {
626 document
.getElementById(row
).style
.background
= "#E7E7E7";
628 function deselectRow(row
) {
629 document
.getElementById(row
).style
.background
= "#F7F7F7";