2 // ------------------------------------------------------------------------ //
3 // OpenEMR Electronic Medical Records System //
4 // Copyright (c) 2012 tajemo.co.za //
5 // <http://www.tajemo.co.za/> //
6 // ------------------------------------------------------------------------ //
7 // This program is free software; you can redistribute it and/or modify //
8 // it under the terms of the GNU General Public License as published by //
9 // the Free Software Foundation; either version 2 of the License, or //
10 // (at your option) any later version. //
12 // You may not change or alter any portion of this comment or credits //
13 // of supporting developers from this source code or any supporting //
14 // source code which is considered copyrighted (c) material of the //
15 // original comment or credit authors. //
17 // This program is distributed in the hope that it will be useful, //
18 // but WITHOUT ANY WARRANTY; without even the implied warranty of //
19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the //
20 // GNU General Public License for more details. //
22 // You should have received a copy of the GNU General Public License //
23 // along with this program; if not, write to the Free Software //
24 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA //
25 // --------------------------------------------------------------------------//
26 // Original Author of this file: Craig Bezuidenhout (Tajemo Enterprises) //
27 // Purpose of this file: Used for displaying log of dated reminders //
28 // --------------------------------------------------------------------------//
30 $fake_register_globals=false;
31 $sanitize_all_escapes=true;
33 require_once("../../globals.php");
34 require_once("$srcdir/htmlspecialchars.inc.php");
35 require_once("$srcdir/acl.inc");
36 require_once("$srcdir/dated_reminders.php");
39 $isAdmin =acl_check('admin', 'users');
43 ------------------- HANDLE POST ---------------------
47 if(empty($_GET['sentBy']) and empty($_GET['sentTo']))
48 $_GET['sentTo'] = array(intval($_SESSION['authId']));
50 echo '<table border="1" width="100%" cellpadding="5px" id="logTable">
53 <th>'.xlt('ID').'</th>
54 <th>'.xlt('Sent Date').'</th>
55 <th>'.xlt('From').'</th>
56 <th>'.xlt('To').'</th>
57 <th>'.xlt('Patient').'</th>
58 <th>'.xlt('Message').'</th>
59 <th>'.xlt('Due Date').'</th>
60 <th>'.xlt('Processed Date').'</th>
61 <th>'.xlt('Processed By').'</th>
65 $remindersArray = array();
66 $TempRemindersArray = logRemindersArray();
67 foreach($TempRemindersArray as $RA){
68 $remindersArray[$RA['messageID']]['messageID'] = $RA['messageID'];
69 $remindersArray[$RA['messageID']]['ToName'] = ($remindersArray[$RA['messageID']]['ToName'] ?
$remindersArray[$RA['messageID']]['ToName'].', '.$RA['ToName'] : $RA['ToName']);
70 $remindersArray[$RA['messageID']]['PatientName'] = $RA['PatientName'];
71 $remindersArray[$RA['messageID']]['message'] = $RA['message'];
72 $remindersArray[$RA['messageID']]['dDate'] = $RA['dDate'];
73 $remindersArray[$RA['messageID']]['sDate'] = $RA['sDate'];
74 $remindersArray[$RA['messageID']]['pDate'] = $RA['pDate'];
75 $remindersArray[$RA['messageID']]['processedByName'] = $RA['processedByName'];
76 $remindersArray[$RA['messageID']]['fromName'] = $RA['fromName'];
78 foreach($remindersArray as $RA){
79 echo '<tr class="heading">
80 <td>',text($RA['messageID']),'</td>
81 <td>',text($RA['sDate']),'</td>
82 <td>',text($RA['fromName']),'</td>
83 <td>',text($RA['ToName']),'</td>
84 <td>',text($RA['PatientName']),'</td>
85 <td>',text($RA['message']),'</td>
86 <td>',text($RA['dDate']),'</td>
87 <td>',text($RA['pDate']),'</td>
88 <td>',text($RA['processedByName']),'</td>
91 echo '</tbody></table>';
98 <link rel
="stylesheet" href
="<?php echo $css_header;?>" type
="text/css">
99 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/js/jquery.js"></script
>
100 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/js/jquery-calendar.js"></script
>
101 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/js/jquery.grouprows.js"></script
>
102 <script src
="<?php echo $GLOBALS['webroot'] ?>/library/js/grouprows.js"></script
>
103 <script language
="JavaScript">
104 $
(document
).ready(function (){
105 $
("#submitForm").click(function(){
106 // top.restoreSession(); --> can't use this as it negates this ajax refresh
107 $
.get("dated_reminders_log.php?"+$
("#logForm").serialize(),
109 $
("#resultsDiv").html(data
);
112 echo '$("select option").removeAttr("selected");';
123 <body
class="body_top">
124 <!-- Required
for the popup date selectors
-->
125 <div id
="overDiv" style
="position:absolute; visibility:hidden; z-index:1000;"></div
>
130 $uSQL = sqlStatement('SELECT id, fname, mname, lname FROM `users` WHERE `active` = 1 AND `facility_id` > 0 AND id != ?',array(intval($_SESSION['authId'])));
131 for($i=0; $uRow=sqlFetchArray($uSQL); $i++
){ $allUsers[] = $uRow; }
133 <form method
="get" id
="logForm" onsubmit
="return top.restoreSession()">
134 <h1
><?php
echo xlt('Dated Message Log') ?
></h1
>
135 <h2
><?php
echo xlt('filters') ?
> :</h2
>
136 <blockquote
><?php
echo xlt('Date The Message Was Sent') ?
><br
/>
137 <!----------------------------------------------------------------------------------------------------------------------------------------------------->
138 <?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
'); ?>' />  
; 
; 
;
139 <!----------------------------------------------------------------------------------------------------------------------------------------------------->
140 <?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
/>
141 <!----------------------------------------------------------------------------------------------------------------------------------------------------->
143 <table style
="width:100%">
145 <td style
="width:50%">
146 <?php
echo xlt('Sent By, Leave Blank For All') ?
> : <br
/>
147 <select style
="width:100%;" id
="sentBy" name
="sentBy[]" multiple
="multiple">
148 <option value
="<?php echo attr(intval($_SESSION['authId'])); ?>"><?php
echo xlt('Myself') ?
></option
>
151 foreach($allUsers as $user)
152 echo '<option value="',attr($user['id']),'">',text($user['fname'].' '.$user['mname'].' '.$user['lname']),'</option>';
156 <td style
="width:50%">
157 <?php
echo xlt('Sent To, Leave Blank For All') ?
> : <br
/>
158 <select style
="width:100%" id
="sentTo" name
="sentTo[]" multiple
="multiple">
159 <option value
="<?php echo attr(intval($_SESSION['authId'])); ?>"><?php
echo xlt('Myself') ?
></option
>
162 foreach($allUsers as $user)
163 echo '<option value="',attr($user['id']),'">',text($user['fname'].' '.$user['mname'].' '.$user['lname']),'</option>';
169 <!----------------------------------------------------------------------------------------------------------------------------------------------------->
170 <input type
="checkbox" name
="processed" id
="processed"><label
for="processed"><?php
echo xlt('Processed') ?
></label
>
171 <!----------------------------------------------------------------------------------------------------------------------------------------------------->
172 <input type
="checkbox" name
="pending" id
="pending"><label
for="pending"><?php
echo xlt('Pending') ?
></label
>
173 <!----------------------------------------------------------------------------------------------------------------------------------------------------->
175 <button value
="Refresh" id
="submitForm"><?php
echo xlt('Refresh') ?
></button
>
178 <div id
="resultsDiv"></div
>
181 <!-- stuff
for the popup calendar
-->
182 <style type
="text/css">@import
url(<?php
echo $GLOBALS['webroot'] ?
>/library
/dynarch_calendar
.css
);</style
>
183 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/dynarch_calendar.js"></script
>
184 <?php
include_once("{$GLOBALS['srcdir']}/dynarch_calendar_en.inc.php"); ?
>
185 <script type
="text/javascript" src
="<?php echo $GLOBALS['webroot'] ?>/library/dynarch_calendar_setup.js"></script
>
186 <script language
="Javascript">
187 Calendar
.setup({inputField
:"sd", ifFormat
:"%Y-%m-%d", button
:"img_begin_date", showsTime
:'false'});
188 Calendar
.setup({inputField
:"ed", ifFormat
:"%Y-%m-%d", button
:"img_begin_date", showsTime
:'false'});