3 * Used for displaying log of dated reminders.
5 * Copyright (C) 2012 tajemo.co.za <http://www.tajemo.co.za/>
7 * LICENSE: This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License
9 * as published by the Free Software Foundation; either version 3
10 * of the License, or (at your option) any later version.
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
19 * @author Craig Bezuidenhout <http://www.tajemo.co.za/>
20 * @link http://www.open-emr.org
23 $fake_register_globals=false;
24 $sanitize_all_escapes=true;
26 require_once("../../globals.php");
27 require_once("$srcdir/htmlspecialchars.inc.php");
28 require_once("$srcdir/acl.inc");
29 require_once("$srcdir/dated_reminder_functions.php");
32 $isAdmin =acl_check('admin', 'users');
36 ------------------- HANDLE POST ---------------------
40 if(empty($_GET['sentBy']) and empty($_GET['sentTo']))
41 $_GET['sentTo'] = array(intval($_SESSION['authId']));
43 echo '<table border="1" width="100%" cellpadding="5px" id="logTable">
46 <th>'.xlt('ID').'</th>
47 <th>'.xlt('Sent Date').'</th>
48 <th>'.xlt('From').'</th>
49 <th>'.xlt('To').'</th>
50 <th>'.xlt('Patient').'</th>
51 <th>'.xlt('Message').'</th>
52 <th>'.xlt('Due Date').'</th>
53 <th>'.xlt('Processed Date').'</th>
54 <th>'.xlt('Processed By').'</th>
58 $remindersArray = array();
59 $TempRemindersArray = logRemindersArray();
60 foreach($TempRemindersArray as $RA){
61 $remindersArray[$RA['messageID']]['messageID'] = $RA['messageID'];
62 $remindersArray[$RA['messageID']]['ToName'] = ($remindersArray[$RA['messageID']]['ToName'] ?
$remindersArray[$RA['messageID']]['ToName'].', '.$RA['ToName'] : $RA['ToName']);
63 $remindersArray[$RA['messageID']]['PatientName'] = $RA['PatientName'];
64 $remindersArray[$RA['messageID']]['message'] = $RA['message'];
65 $remindersArray[$RA['messageID']]['dDate'] = $RA['dDate'];
66 $remindersArray[$RA['messageID']]['sDate'] = $RA['sDate'];
67 $remindersArray[$RA['messageID']]['pDate'] = $RA['pDate'];
68 $remindersArray[$RA['messageID']]['processedByName'] = $RA['processedByName'];
69 $remindersArray[$RA['messageID']]['fromName'] = $RA['fromName'];
71 foreach($remindersArray as $RA){
72 echo '<tr class="heading">
73 <td>',text($RA['messageID']),'</td>
74 <td>',text($RA['sDate']),'</td>
75 <td>',text($RA['fromName']),'</td>
76 <td>',text($RA['ToName']),'</td>
77 <td>',text($RA['PatientName']),'</td>
78 <td>',text($RA['message']),'</td>
79 <td>',text($RA['dDate']),'</td>
80 <td>',text($RA['pDate']),'</td>
81 <td>',text($RA['processedByName']),'</td>
84 echo '</tbody></table>';
91 <link rel
="stylesheet" href
="<?php echo $css_header;?>" type
="text/css">
92 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/js/jquery.js"></script
>
93 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/js/jquery-calendar.js"></script
>
94 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/js/jquery.grouprows.js"></script
>
95 <script src
="<?php echo $GLOBALS['webroot'] ?>/library/js/grouprows.js"></script
>
96 <script language
="JavaScript">
97 $
(document
).ready(function (){
98 $
("#submitForm").click(function(){
99 // top.restoreSession(); --> can't use this as it negates this ajax refresh
100 $
.get("dated_reminders_log.php?"+$
("#logForm").serialize(),
102 $
("#resultsDiv").html(data
);
105 echo '$("select option").removeAttr("selected");';
116 <body
class="body_top">
117 <!-- Required
for the popup date selectors
-->
118 <div id
="overDiv" style
="position:absolute; visibility:hidden; z-index:1000;"></div
>
123 $uSQL = sqlStatement('SELECT id, fname, mname, lname FROM `users` WHERE `active` = 1 AND `facility_id` > 0 AND id != ?',array(intval($_SESSION['authId'])));
124 for($i=0; $uRow=sqlFetchArray($uSQL); $i++
){ $allUsers[] = $uRow; }
126 <form method
="get" id
="logForm" onsubmit
="return top.restoreSession()">
127 <h1
><?php
echo xlt('Dated Message Log') ?
></h1
>
128 <h2
><?php
echo xlt('filters') ?
> :</h2
>
129 <blockquote
><?php
echo xlt('Date The Message Was Sent') ?
><br
/>
130 <!----------------------------------------------------------------------------------------------------------------------------------------------------->
131 <?php
echo xlt('Start Date') ?
> : <input id
="sd" type
="text" name
="sd" value
="" onkeyup
='datekeyup(this,mypcc)' onblur
='dateblur(this,mypcc)' title
='<?php echo xla('yyyy
-mm
-dd
'); ?>' />  
; 
; 
;
132 <!----------------------------------------------------------------------------------------------------------------------------------------------------->
133 <?php
echo xlt('End Date') ?
> : <input id
="ed" type
="text" name
="ed" value
="" onkeyup
='datekeyup(this,mypcc)' onblur
='dateblur(this,mypcc)' title
='<?php echo xla('yyyy
-mm
-dd
'); ?>' /> <br
/><br
/>
134 <!----------------------------------------------------------------------------------------------------------------------------------------------------->
136 <table style
="width:100%">
138 <td style
="width:50%">
139 <?php
echo xlt('Sent By, Leave Blank For All') ?
> : <br
/>
140 <select style
="width:100%;" id
="sentBy" name
="sentBy[]" multiple
="multiple">
141 <option value
="<?php echo attr(intval($_SESSION['authId'])); ?>"><?php
echo xlt('Myself') ?
></option
>
144 foreach($allUsers as $user)
145 echo '<option value="',attr($user['id']),'">',text($user['fname'].' '.$user['mname'].' '.$user['lname']),'</option>';
149 <td style
="width:50%">
150 <?php
echo xlt('Sent To, Leave Blank For All') ?
> : <br
/>
151 <select style
="width:100%" id
="sentTo" name
="sentTo[]" multiple
="multiple">
152 <option value
="<?php echo attr(intval($_SESSION['authId'])); ?>"><?php
echo xlt('Myself') ?
></option
>
155 foreach($allUsers as $user)
156 echo '<option value="',attr($user['id']),'">',text($user['fname'].' '.$user['mname'].' '.$user['lname']),'</option>';
162 <!----------------------------------------------------------------------------------------------------------------------------------------------------->
163 <input type
="checkbox" name
="processed" id
="processed"><label
for="processed"><?php
echo xlt('Processed') ?
></label
>
164 <!----------------------------------------------------------------------------------------------------------------------------------------------------->
165 <input type
="checkbox" name
="pending" id
="pending"><label
for="pending"><?php
echo xlt('Pending') ?
></label
>
166 <!----------------------------------------------------------------------------------------------------------------------------------------------------->
168 <button value
="Refresh" id
="submitForm"><?php
echo xlt('Refresh') ?
></button
>
171 <div id
="resultsDiv"></div
>
174 <!-- stuff
for the popup calendar
-->
175 <style type
="text/css">@import
url(<?php
echo $GLOBALS['webroot'] ?
>/library
/dynarch_calendar
.css
);</style
>
176 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/dynarch_calendar.js"></script
>
177 <?php
include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?
>
178 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/dynarch_calendar_setup.js"></script
>
179 <script language
="Javascript">
180 Calendar
.setup({inputField
:"sd", ifFormat
:"%Y-%m-%d", button
:"img_begin_date", showsTime
:'false'});
181 Calendar
.setup({inputField
:"ed", ifFormat
:"%Y-%m-%d", button
:"img_begin_date", showsTime
:'false'});