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.g.miller@gmail.com>
27 * @link http://www.open-emr.org
32 require_once("../../globals.php");
33 require_once("$srcdir/pnotes.inc");
34 require_once("$srcdir/patient.inc");
35 require_once("$srcdir/acl.inc");
36 require_once("$srcdir/log.inc");
37 require_once("$srcdir/options.inc.php");
38 require_once("$srcdir/gprelations.inc.php");
43 <?php
html_header_show();?
>
44 <link rel
="stylesheet" href
="<?php echo $css_header;?>" type
="text/css">
45 <script type
="text/javascript" src
="../../../library/dialog.js?v=<?php echo $v_js_includes; ?>"></script
>
46 <script type
="text/javascript" src
="../../../library/textformat.js"></script
>
47 <script type
="text/javascript" src
="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-1-2-2/index.js"></script
>
50 <body
class="body_top">
52 <span
class="title"><?php
echo xlt('Message and Reminder Center'); ?
></span
>
54 <span
class="title"><?php
echo xlt('Reminders'); ?
></span
>
58 // TajEmo Work by CB 2012/01/11 02:51:25 PM adding dated reminders
59 // I am asuming that at this point security checks have been performed
60 require_once '../dated_reminders/dated_reminders.php';
62 // Check to see if the user has Admin rights, and if so, allow access to See All.
63 $showall = isset($_GET['show_all']) ?
$_GET['show_all'] : "" ;
64 if ($showall == "yes") {
70 // Collect active variable and applicable html code for links
71 $form_active = (isset($_REQUEST['form_active']) ?
$_REQUEST['form_active'] : false);
72 $form_inactive = (isset($_REQUEST['form_inactive']) ?
$_REQUEST['form_inactive'] : false);
75 $activity_string_html = 'form_active=1';
76 } else if ($form_inactive) {
78 $activity_string_html = 'form_inactive=1';
81 $activity_string_html = '';
84 //collect the task setting
85 $task= isset($_REQUEST['task']) ?
$_REQUEST['task'] : "";
87 if (acl_check('admin', 'super')) {
88 if ($show_all=='yes') {
90 $lnkvar="\"messages.php?show_all=no&$activity_string_html\" name='Just Mine' onclick=\"top.restoreSession()\"> (".htmlspecialchars(xl('Just Mine'), ENT_NOQUOTES
).")";
93 $lnkvar="\"messages.php?show_all=yes&$activity_string_html\" name='See All' onclick=\"top.restoreSession()\">(".htmlspecialchars(xl('See All'), ENT_NOQUOTES
).")";
98 <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
>
100 //show the activity links
101 if (empty($task) ||
$task=="add" ||
$task=="delete") { ?
>
102 <?php
if ($active == "all") { ?
>
103 <span
><?php
echo xlt('Show All'); ?
></span
>
105 <a href
="messages.php" class="link" onclick
="top.restoreSession()"><span
><?php
echo xlt('Show All'); ?
></span
></a
>
108 <?php
if ($active == '1') { ?
>
109 <span
><?php
echo xlt('Show Active'); ?
></span
>
111 <a href
="messages.php?form_active=1" class="link" onclick
="top.restoreSession()"><span
><?php
echo xlt('Show Active'); ?
></span
></a
>
114 <?php
if ($active == '0') { ?
>
115 <span
><?php
echo xlt('Show Inactive'); ?
></span
>
117 <a href
="messages.php?form_inactive=1" class="link" onclick
="top.restoreSession()"><span
><?php
echo xlt('Show Inactive'); ?
></span
></a
>
124 // Add a new message for a specific patient; the message is documented in Patient Notes.
125 // Add a new message; it's treated as a new note in Patient Notes.
126 $note = $_POST['note'];
127 $noteid = $_POST['noteid'];
128 $form_note_type = $_POST['form_note_type'];
129 $form_message_status = $_POST['form_message_status'];
130 $reply_to = $_POST['reply_to'];
131 $assigned_to_list = explode(';', $_POST['assigned_to']);
132 foreach ($assigned_to_list as $assigned_to) {
133 if ($noteid && $assigned_to != '-patient-') {
134 updatePnote($noteid, $note, $form_note_type, $assigned_to, $form_message_status);
137 if ($noteid && $assigned_to == '-patient-') {
138 // When $assigned_to == '-patient-' we don't update the current note, but
139 // instead create a new one with the current note's body prepended and
140 // attributed to the patient. This seems to be all for the patient portal.
141 $row = getPnoteById($noteid);
143 die("getPnoteById() did not find id '".text($noteid)."'");
146 $pres = sqlQuery("SELECT lname, fname " .
147 "FROM patient_data WHERE pid = ?", array($reply_to));
148 $patientname = $pres['lname'] . ", " . $pres['fname'];
149 $note .= "\n\n$patientname on ".$row['date']." wrote:\n\n";
150 $note .= $row['body'];
153 // There's no note ID, and/or it's assigned to the patient.
154 // In these cases a new note is created.
155 addPnote($reply_to, $note, $userauthorized, '1', $form_note_type, $assigned_to, '', $form_message_status);
162 $noteid = $_POST['noteid'];
163 $form_message_status = $_POST['form_message_status'];
164 $reply_to = $_POST['reply_to'];
166 updatePnoteMessageStatus($noteid, $form_message_status);
168 updatePnotePatient($noteid, $reply_to);
172 $note = $_POST['note'];
173 $title = $_POST['form_note_type'];
174 $reply_to = $_POST['reply_to'];
175 break;//missing break was here, assumed bug
178 $noteid = $_GET['noteid'];
181 // Update the message if it already exists; it's appended to an existing note in Patient Notes.
182 $result = getPnoteById($noteid);
185 $title = $result['title'];
188 $body = $result['body'];
189 if ($reply_to == "") {
190 $reply_to = $result['pid'];
193 $form_message_status = $result['message_status'];
197 // Delete selected message(s) from the Messages box (only).
198 $delete_id = $_POST['delete_id'];
199 for ($i = 0; $i < count($delete_id); $i++
) {
200 deletePnote($delete_id[$i]);
201 newEvent("delete", $_SESSION['authUser'], $_SESSION['authProvider'], 1, "pnotes: id ".$delete_id[$i]);
206 if ($task == "addnew" or $task == "edit") {
207 // Display the Messages page layout.
209 <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>
210 <input type=hidden name=noteid id=noteid value='".attr($noteid)."'>
211 <input type=hidden name=task id=task value=add>";
213 <div id
="pnotes"><center
>
214 <table border
='0' cellspacing
='8'>
217 <b
><?php
echo htmlspecialchars(xl('Type'), ENT_NOQUOTES
); ?
>:</b
>
220 $title = "Unassigned";
223 // Added 6/2009 by BM to incorporate the patient notes into the list_options listings.
224 generate_form_field(array('data_type'=>1,'field_id'=>'note_type','list_id'=>'note_type','empty_title'=>'SKIP','order_by'=>'title'), $title);
227 <?php
if ($task != "addnew" && $result['pid'] != 0) { ?
>
228 <a
class="patLink" onclick
="goPid('<?php echo attr($result['pid']);?>')"><?php
echo htmlspecialchars(xl('Patient'), ENT_NOQUOTES
); ?
>:</a
>
230 <b
class='<?php echo ($task=="addnew"?"required":"") ?>'><?php
echo htmlspecialchars(xl('Patient'), ENT_NOQUOTES
); ?
>:</b
>
235 $prow = sqlQuery("SELECT lname, fname,pid, pubpid, DOB " .
236 "FROM patient_data WHERE pid = ?", array($reply_to));
237 $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';
256 generate_form_field(array('data_type'=>1,'field_id'=>'message_status','list_id'=>'message_status','empty_title'=>'SKIP','order_by'=>'title'), $form_message_status); ?
>
261 <b
><?php
echo htmlspecialchars(xl('To'), ENT_QUOTES
); ?
>:</b
>
262 <input type
='textbox' name
='assigned_to_text' id
='assigned_to_text' size
='40' readonly
='readonly'
263 value
='<?php echo htmlspecialchars(xl("Select Users From The Dropdown List"), ENT_QUOTES)?>' >
264 <input type
='hidden' name
='assigned_to' id
='assigned_to' >
265 <select name
='users' id
='users' onchange
='addtolist(this);' >
267 echo "<option value='" . htmlspecialchars('--', ENT_QUOTES
) . "'";
268 echo ">" . htmlspecialchars(xl('Select User'), ENT_NOQUOTES
);
270 $ures = sqlStatement("SELECT username, fname, lname FROM users " .
271 "WHERE username != '' AND active = 1 AND " .
272 "( info IS NULL OR info NOT LIKE '%Inactive%' ) " .
273 "ORDER BY lname, fname");
274 while ($urow = sqlFetchArray($ures)) {
275 echo " <option value='" . htmlspecialchars($urow['username'], ENT_QUOTES
) . "'";
276 echo ">" . htmlspecialchars($urow['lname'], ENT_NOQUOTES
);
277 if ($urow['fname']) {
278 echo ", " . htmlspecialchars($urow['fname'], ENT_NOQUOTES
);
284 if ($GLOBALS['portal_offsite_enable']) {
285 echo "<option value='" . htmlspecialchars('-patient-', ENT_QUOTES
) . "'";
286 echo ">" . htmlspecialchars('-Patient-', ENT_NOQUOTES
);
296 // Get the related document IDs if any.
298 "SELECT id1 FROM gprelations WHERE " .
299 "type1 = ? AND type2 = ? AND id2 = ?",
300 array('1', '6', $noteid)
302 if (sqlNumRows($tmp)) {
304 echo " <td class='text'><b>";
305 echo xlt('Linked document') . ":</b>\n";
306 while ($gprow = sqlFetchArray($tmp)) {
307 $d = new Document($gprow['id1']);
308 $enc_list = sqlStatement("SELECT fe.encounter,fe.date,openemr_postcalendar_categories.pc_catname FROM form_encounter AS fe ".
309 " 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']));
310 $str_dob = htmlspecialchars(xl("DOB") . ":" . $prow['DOB'] . " " . xl("Age") . ":" . getPatientAge($prow['DOB']));
311 $pname = $prow['fname']." ".$prow['lname'];
312 echo "<a href='javascript:void(0);' ";
313 echo "onClick=\"gotoReport(".addslashes(attr($d->get_id())).",'".addslashes(attr($pname))."',".addslashes(attr($prow['pid'])).",".addslashes(attr($prow['pubpid'])).",'".addslashes(attr($str_dob))."');\">";
314 echo text($d->get_url_file());
322 // Get the related procedure order IDs if any.
324 "SELECT id1 FROM gprelations WHERE " .
325 "type1 = ? AND type2 = ? AND id2 = ?",
326 array('2', '6', $noteid)
328 if (sqlNumRows($tmp)) {
330 echo " <td class='text'><b>";
331 echo xlt('Linked procedure order') . ":</b>\n";
332 while ($gprow = sqlFetchArray($tmp)) {
334 echo $GLOBALS['webroot'] . "/interface/orders/single_order_results.php?orderid=";
336 echo "' target='_blank' onclick='top.restoreSession()'>";
353 $body = preg_replace('/(:\d{2}\s\()'.$result['pid'].'(\sto\s)/', '${1}'.$patientname.'${2}', $body);
354 $body = preg_replace('/(\d{4}-\d{2}-\d{2} \d{2}:\d{2}\s\([^)(]+\s)(to)(\s[^)(]+\))/', '${1}'.xl('to').'${3}', $body);
355 $body = nl2br(htmlspecialchars($body, ENT_NOQUOTES
));
356 echo "<div class='text' style='background-color:white; color: gray; border:1px solid #999; padding: 5px; width: 640px;'>".$body."</div>";
360 <textarea name
='note' id
='note' rows
='8' style
="width: 660px; "><?php
echo htmlspecialchars($note, ENT_NOQUOTES
) ?
></textarea
>
365 <?php
if ($noteid) { ?
>
366 <!-- This is
for displaying an existing note
. -->
367 <input type
="button" id
="newnote" value
="<?php echo htmlspecialchars(xl('Send message'), ENT_QUOTES); ?>">
368 <input type
="button" id
="printnote" value
="<?php echo htmlspecialchars(xl('Print message'), ENT_QUOTES); ?>">
369 <input type
="button" id
="cancel" value
="<?php echo htmlspecialchars(xl('Cancel'), ENT_QUOTES); ?>">
371 <!-- This is
for displaying a
new note
. -->
372 <input type
="button" id
="newnote" value
="<?php echo htmlspecialchars(xl('Send message'), ENT_QUOTES); ?>">
373 <input type
="button" id
="cancel" value
="<?php echo htmlspecialchars(xl('Cancel'), ENT_QUOTES); ?>">
378 </form
></center
></div
>
379 <script language
="javascript">
381 // jQuery stuff to make the page a little easier to use
383 $
(document
).ready(function(){
384 $
("#newnote").click(function() { NewNote(); });
385 $
("#printnote").click(function() { PrintNote(); });
386 obj
= document
.getElementById("form_message_status");
387 obj
.onchange
= function(){SaveNote();};
388 $
("#cancel").click(function() { CancelNote(); });
391 var NewNote
= function () {
392 top
.restoreSession();
393 if (document
.forms
[0].reply_to
.value
.length
== 0 || document
.forms
[0].reply_to
.value
== '0') {
394 alert('<?php echo htmlspecialchars(xl('Please choose a patient
'), ENT_QUOTES); ?>');
396 else if (document
.forms
[0].assigned_to
.value
.length
== 0 &&
397 document
.getElementById("form_message_status").value
!= 'Done')
399 alert('<?php echo addslashes(xl('Recipient required unless status is Done
')); ?>');
403 $
("#new_note").submit();
407 var PrintNote
= function () {
408 top
.restoreSession();
409 window
.open('../../patient_file/summary/pnotes_print.php?noteid=<?php echo htmlspecialchars($noteid, ENT_QUOTES); ?>', '_blank', 'resizable=1,scrollbars=1,width=600,height=500');
412 var SaveNote
= function () {
413 <?php
if ($noteid) { ?
>
414 top
.restoreSession();
415 $
("#task").val("save");
416 $
("#new_note").submit();
420 var CancelNote
= function () {
421 top
.restoreSession();
423 $
("#new_note").submit();
426 function gotoReport(doc_id
,pname
,pid
,pubpid
,str_dob
){
427 EncounterDateArray
=new Array;
428 CalendarCategoryArray
=new Array;
429 EncounterIdArray
=new Array;
432 if (isset($enc_list) && sqlNumRows($enc_list) >0) {
433 while ($row = sqlFetchArray($enc_list)) {
435 EncounterIdArray
[Count
]='<?php echo attr($row['encounter
']); ?>';
436 EncounterDateArray
[Count
]='<?php echo attr(oeFormatShortDate(date("Y-m-d", strtotime($row['date
'])))); ?>';
437 CalendarCategoryArray
[Count
]='<?php echo attr(xl_appt_category($row['pc_catname
'])); ?>';
443 top
.restoreSession();
446 url
:'<?php echo $GLOBALS['webroot
']."/library/ajax/set_pt.php";?>',
450 parent
.left_nav
.setPatient(pname
,pid
,pubpid
,'',str_dob
);
451 parent
.left_nav
.setPatientEncounter(EncounterIdArray
,EncounterDateArray
,CalendarCategoryArray
);
452 <?php
if ($GLOBALS['new_tabs_layout']) { ?
>
453 var docurl
= '../controller.php?document&view' +
"&patient_id=" + pid +
"&document_id=" + doc_id +
"&";
454 var paturl
= 'patient_file/summary/demographics.php?pid=' + pid
;
455 parent
.left_nav
.loadFrame('dem1', 'pat', paturl
);
456 parent
.left_nav
.loadFrame('doc0', 'enc', docurl
);
457 top
.activateTabByName('enc',true);
459 var docurl
= '<?php echo $GLOBALS['webroot
'] . "/controller.php?document&view"; ?>' +
"&patient_id=" + pid +
"&document_id=" + doc_id +
"&";
460 var paturl
= '<?php echo $GLOBALS['webroot
'] . "/interface/patient_file/summary/demographics.php?pid="; ?>' + pid
;
461 var othername
= (window
.name
== 'RTop') ?
'RBot' : 'RTop';
462 parent
.frames
[othername
].location
.href
= paturl
;
463 location
.href
= docurl
;
466 // This is for callback by the find-patient popup.
467 function setpatient(pid
, lname
, fname
, dob
) {
468 var f
= document
.forms
[0];
469 f
.form_patient
.value
= lname +
', ' + fname
;
470 f
.reply_to
.value
= pid
;
471 <?php
if ($noteid) { ?
>
472 //used when direct messaging service inserts a pnote with indeterminate patient
473 //to allow the user to assign the message to a patient.
474 top
.restoreSession();
475 $
("#task").val("savePatient");
476 $
("#new_note").submit();
480 // This invokes the find-patient popup.
481 function sel_patient() {
482 dlgopen('../../main/calendar/find_patient_popup.php', '_blank', 500, 400);
485 function addtolist(sel
){
486 var itemtext
= document
.getElementById('assigned_to_text');
487 var item
= document
.getElementById('assigned_to');
488 if(sel
.value
!= '--'){
490 if(item
.value
.indexOf(sel
.value
) == -1){
491 itemtext
.value
= itemtext
.value +
' ; '+ sel
.options
[sel
.selectedIndex
].text
;
492 item
.value
= item
.value +
';'+ sel
.value
;
495 itemtext
.value
= sel
.options
[sel
.selectedIndex
].text
;
496 item
.value
= sel
.value
;
503 // This is for sorting the records.
504 $sort = array("users.lname", "patient_data.lname", "pnotes.title", "pnotes.date", "pnotes.message_status");
505 $sortby = (isset($_REQUEST['sortby']) && ($_REQUEST['sortby']!="")) ?
$_REQUEST['sortby'] : $sort[0];
506 $sortorder = (isset($_REQUEST['sortorder']) && ($_REQUEST['sortorder']!="")) ?
$_REQUEST['sortorder'] : "asc";
507 $begin = isset($_REQUEST['begin']) ?
$_REQUEST['begin'] : 0;
509 for ($i = 0; $i < count($sort); $i++
) {
510 $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>";
513 for ($i = 0; $i < count($sort); $i++
) {
514 if ($sortby == $sort[$i]) {
515 switch ($sortorder) {
517 $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>";
520 $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>";
526 // Manage page numbering and display beneath the Messages table.
528 $total = getPnotesByUser($active, $show_all, $_SESSION['authUser'], true);
529 if ($begin == "" or $begin == 0) {
533 $prev = $begin - $listnumber;
534 $next = $begin +
$listnumber;
536 $end = $listnumber +
$start - 1;
537 if ($end >= $total) {
546 $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>";
551 if ($next < $total) {
552 $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>";
557 // Display the Messages table header.
559 <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;\">
560 <form name=MessageList action=\"messages.php?showall=".attr($showall)."&sortby=".attr($sortby)."&sortorder=".attr($sortorder)."&begin=".attr($begin)."&$activity_string_html\" method=post>
561 <input type=hidden name=task value=delete>
562 <tr height=\"24\" style=\"background:lightgrey\">
563 <td align=\"center\" width=\"25\" style=\"border-bottom: 1px #000000 solid; border-right: 1px #000000 solid;\"><input type=checkbox id=\"checkAll\" onclick=\"selectAll()\"></td>
564 <td width=\"20%\" style=\"border-bottom: 1px #000000 solid; border-right: 1px #000000 solid;\" class=bold> <b>" .
565 htmlspecialchars(xl('From'), ENT_NOQUOTES
) . "</b> $sortlink[0]</td>
566 <td width=\"20%\" style=\"border-bottom: 1px #000000 solid; border-right: 1px #000000 solid;\" class=bold> <b>" .
567 htmlspecialchars(xl('Patient'), ENT_NOQUOTES
) . "</b> $sortlink[1]</td>
568 <td style=\"border-bottom: 1px #000000 solid; border-right: 1px #000000 solid;\" class=bold> <b>" .
569 htmlspecialchars(xl('Type'), ENT_NOQUOTES
) . "</b> $sortlink[2]</td>
570 <td width=\"15%\" style=\"border-bottom: 1px #000000 solid; border-right: 1px #000000 solid;\" class=bold> <b>" .
571 htmlspecialchars(xl('Date'), ENT_NOQUOTES
) . "</b> $sortlink[3]</td>
572 <td width=\"15%\" style=\"border-bottom: 1px #000000 solid; \" class=bold> <b>" .
573 htmlspecialchars(xl('Status'), ENT_NOQUOTES
) . "</b> $sortlink[4]</td>
575 // Display the Messages table body.
577 $result = getPnotesByUser($active, $show_all, $_SESSION['authUser'], false, $sortby, $sortorder, $begin, $listnumber);
578 while ($myrow = sqlFetchArray($result)) {
579 $name = $myrow['user'];
580 $name = $myrow['users_lname'];
581 if ($myrow['users_fname']) {
582 $name .= ", " . $myrow['users_fname'];
585 $patient = $myrow['pid'];
587 $patient = $myrow['patient_data_lname'];
588 if ($myrow['patient_data_fname']) {
589 $patient .= ", " . $myrow['patient_data_fname'];
592 $patient = "* Patient must be set manually *";
597 <tr id=\"row$count\" style=\"background:white\" height=\"24\">
598 <td align=\"center\" style=\"border-bottom: 1px #000000 solid; border-right: 1px #000000 solid;\"><input type=checkbox id=\"check$count\" name=\"delete_id[]\" value=\"" .
599 attr($myrow['id']) . "\" onclick=\"if(this.checked==true){ selectRow('row$count'); }else{ deselectRow('row$count'); }\"></td>
600 <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\">" .
601 text($name) . "</td><td width=5></td></tr></table></td>
602 <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=" .
603 attr($myrow['id']) . "&$activity_string_html\" onclick=\"top.restoreSession()\">" .
604 text($patient) . "</a></td><td width=5></td></tr></table></td>
605 <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\">" .
606 xlt($myrow['title']) . "</td><td width=5></td></tr></table></td>
607 <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\">" .
608 text(oeFormatShortDate(substr($myrow['date'], 0, strpos($myrow['date'], " ")))) . "</td><td width=5></td></tr></table></td>
609 <td style=\"border-bottom: 1px #000000 solid;\"><table cellspacing=0 cellpadding=0 width=100%><tr><td width=5></td><td class=\"text\">" .
610 xlt($myrow['message_status']) . "</td><td width=5></td></tr></table></td>
614 // Display the Messages table footer.
617 <table border=0 cellpadding=5 cellspacing=0 width=90%>
619 <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()\">" .
620 htmlspecialchars(xl('Add New'), ENT_NOQUOTES
) . "</a> <a href=\"javascript:confirmDeleteSelected()\" onclick=\"top.restoreSession()\">" .
621 htmlspecialchars(xl('Delete'), ENT_NOQUOTES
) . "</a></td>
622 <td align=right class=\"text amount-msg\">$prevlink $end of $total $nextlink</td>
624 </table></td></tr></table><br>";
626 <script language
="javascript">
627 // This is to confirm delete action.
628 function confirmDeleteSelected() {
629 if(confirm("<?php echo htmlspecialchars(xl('Do you really want to delete the selection?'), ENT_QUOTES); ?>")) {
630 document
.MessageList
.submit();
633 // This is to allow selection of all items in Messages table for deletion.
634 function selectAll() {
635 if(document
.getElementById("checkAll").checked
==true) {
636 document
.getElementById("checkAll").checked
=true;<?php
637 for ($i = 1; $i <= $count; $i++
) {
638 echo "document.getElementById(\"check$i\").checked=true; document.getElementById(\"row$i\").style.background='#E7E7E7'; ";
642 document
.getElementById("checkAll").checked
=false;<?php
643 for ($i = 1; $i <= $count; $i++
) {
644 echo "document.getElementById(\"check$i\").checked=false; document.getElementById(\"row$i\").style.background='#F7F7F7'; ";
648 // The two functions below are for managing row styles in Messages table.
649 function selectRow(row
) {
650 document
.getElementById(row
).style
.background
= "#E7E7E7";
652 function deselectRow(row
) {
653 document
.getElementById(row
).style
.background
= "#F7F7F7";