3 * Used for adding dated reminders.
6 * @link http://www.open-emr.org
7 * @author Craig Bezuidenhout <http://www.tajemo.co.za/>
8 * @author Brady Miller <brady.g.miller@gmail.com>
9 * @copyright Copyright (c) 2012 tajemo.co.za <http://www.tajemo.co.za/>
10 * @copyright Copyright (c) 2017-2018 Brady Miller <brady.g.miller@gmail.com>
14 require_once("../../globals.php");
15 require_once("$srcdir/acl.inc");
16 require_once("$srcdir/dated_reminder_functions.php");
18 use OpenEMR\Core\Header
;
20 $isAdmin =acl_check('admin', 'users');
24 ------------------- HANDLE POST ---------------------
27 if (!verifyCsrfToken($_GET["csrf_token_form"])) {
28 die(xlt('Authentication Error'));
32 if (empty($_GET['sentBy']) and empty($_GET['sentTo'])) {
33 $_GET['sentTo'] = array(intval($_SESSION['authId']));
37 echo ' <div class="col-xs-12">
38 <h4>'.xlt('Click and drag bottom right corner to resize this display').'</h4>
39 <table class="table table-bordered" id="logTable">
42 <th>'.xlt('ID').'</th>
43 <th>'.xlt('Sent Date').'</th>
44 <th>'.xlt('From').'</th>
45 <th>'.xlt('To').'</th>
46 <th>'.xlt('Patient').'</th>
47 <th>'.xlt('Message').'</th>
48 <th>'.xlt('Due Date').'</th>
49 <th>'.xlt('Processed Date').'</th>
50 <th>'.xlt('Processed By').'</th>
54 $remindersArray = array();
55 $TempRemindersArray = logRemindersArray();
56 foreach ($TempRemindersArray as $RA) {
57 $remindersArray[$RA['messageID']]['messageID'] = $RA['messageID'];
58 $remindersArray[$RA['messageID']]['ToName'] = ($remindersArray[$RA['messageID']]['ToName'] ?
$remindersArray[$RA['messageID']]['ToName'].', '.$RA['ToName'] : $RA['ToName']);
59 $remindersArray[$RA['messageID']]['PatientName'] = $RA['PatientName'];
60 $remindersArray[$RA['messageID']]['message'] = $RA['message'];
61 $remindersArray[$RA['messageID']]['dDate'] = $RA['dDate'];
62 $remindersArray[$RA['messageID']]['sDate'] = $RA['sDate'];
63 $remindersArray[$RA['messageID']]['pDate'] = $RA['pDate'];
64 $remindersArray[$RA['messageID']]['processedByName'] = $RA['processedByName'];
65 $remindersArray[$RA['messageID']]['fromName'] = $RA['fromName'];
68 foreach ($remindersArray as $RA) {
69 echo '<tr class="heading">
70 <td>'.text($RA['messageID']).'</td>
71 <td>'.text($RA['sDate']).'</td>
72 <td>'.text($RA['fromName']).'</td>
73 <td>'.text($RA['ToName']).'</td>
74 <td>'.text($RA['PatientName']).'</td>
75 <td>'.text($RA['message']).'</td>
76 <td>'.text($RA['dDate']).'</td>
77 <td>'.text($RA['pDate']).'</td>
78 <td>'.text($RA['processedByName']).'</td>
82 echo '</tbody></table></div>';
89 <?php Header
::setupHeader(['datetime-picker']); ?
>
91 @media only screen
and (max
-width
: 680px
) {
94 text
-align
: left
!Important
;
98 <script language
="JavaScript">
99 $
(document
).ready(function (){
100 $
("#submitForm").click(function(){
101 // top.restoreSession(); --> can't use this as it negates this ajax refresh
102 $
.get("dated_reminders_log.php?"+$
("#logForm").serialize(),
104 $
("#resultsDiv").html(data
);
107 echo '$("select option").removeAttr("selected");';
116 $
('.datepicker').datetimepicker({
117 <?php
$datetimepicker_timepicker = false; ?
>
118 <?php
$datetimepicker_showseconds = false; ?
>
119 <?php
$datetimepicker_formatInput = false; ?
>
120 <?php
require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?
>
121 <?php
// can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
126 <body
class="body_top">
127 <div
class="container">
128 <!-- Required
for the popup date selectors
-->
129 <div id
="overDiv" style
="position:absolute; visibility:hidden; z-index:1000;"></div
>
132 $uSQL = sqlStatement('SELECT id, fname, mname, lname FROM `users` WHERE `active` = 1 AND `facility_id` > 0 AND id != ?', array(intval($_SESSION['authId'])));
133 for ($i=0; $uRow=sqlFetchArray($uSQL);
139 <div
class="col-xs-12">
140 <div
class="page-header">
141 <h2
><?php
echo xlt('Dated Message Log');?
>  
;<i id
="show_hide" class="fa fa-eye-slash fa-2x small" title
="<?php echo xla('Click to Hide Filters'); ?>"></i
></h2
>
145 <div
class="row hideaway">
146 <div
class="col-xs-12">
147 <form method
="get" id
="logForm" onsubmit
="return top.restoreSession()">
148 <input type
="hidden" name
="csrf_token_form" value
="<?php echo attr(collectCsrfToken()); ?>" />
151 <legend
><?php
echo xlt('Filters') ?
></legend
>
152 <div
class="col-xs-12">
153 <h5
><?php
echo xlt('Date The Message Was Sent');?
></h5
>
154 <div
class="col-xs-6">
155 <label
class="control-label" for="sd"><?php
echo xlt('Start Date') ?
>:</label
>
156 <input id
="sd" type
="text" class='form-control datepicker' name
="sd" value
="" title
='<?php echo xla('yyyy
-mm
-dd
'); ?>'>
158 <div
class="col-xs-6">
159 <label
class="control-label" for="ed"><?php
echo xlt('End Date') ?
>:</label
>
160 <input id
="ed" type
="text" class='form-control datepicker' name
="ed" value
="" title
='<?php echo xla('yyyy
-mm
-dd
'); ?>'>
163 <div
class="col-xs-12">
164 <div
class="col-xs-6">
165 <label
class="control-label" for="sentBy"><?php
echo xlt('Sent By, Leave Blank For All');?
>:</label
>
166 <select
class="form-control" id
="sentBy" name
="sentBy[]" multiple
="multiple">
167 <option value
="<?php echo attr(intval($_SESSION['authId'])); ?>"><?php
echo xlt('Myself') ?
></option
>
170 foreach ($allUsers as $user) {
171 echo '<option value="'.attr($user['id']).'">'.text($user['fname'].' '.$user['mname'].' '.$user['lname']).'</option>';
177 <div
class="col-xs-6">
178 <label
class="control-label" for="sentBy"><?php
echo xlt('Sent To, Leave Blank For All') ?
>:</label
>
179 <select
class="form-control" id
="sentTo" name
="sentTo[]" multiple
="multiple">
180 <option value
="<?php echo attr(intval($_SESSION['authId'])); ?>"><?php
echo xlt('Myself') ?
></option
>
183 foreach ($allUsers as $user) {
184 echo '<option value="'.attr($user['id']).'">'.text($user['fname'].' '.$user['mname'].' '.$user['lname']).'</option>';
191 <div
class="col-xs-12">
192 <div
class="col-xs-12 form-group">
193 <div
class="checkbox">
195 <input type
="checkbox" name
="processed" id
="processed"><?php
echo xlt('Processed') ?
>
198 <input type
="checkbox" name
="pending" id
="pending"><?php
echo xlt('Pending') ?
>
204 <div
class="form-group">
205 <div
class="col-sm-12 position-override">
206 <div
class="btn-group oe-opt-btn-group-pinch form-group" role
="group">
207 <button type
="button" value
="Refresh" id
="submitForm" class="btn btn-default btn-refresh" ><?php
echo xlt('Refresh') ?
></button
>
215 <div
class="col-xs-12">
216 <div id
="resultsDiv"></div
>
219 </div
><!--end of container div
-->
221 $
('#show_hide').click(function() {
222 var elementTitle
= $
('#show_hide').prop('title');
223 var hideTitle
= '<?php echo xla('Click to Hide Filters
'); ?>';
224 var showTitle
= '<?php echo xla('Click to Show Filters
'); ?>';
225 $
('.hideaway').toggle('1000');
226 $
(this
).toggleClass('fa-eye-slash fa-eye');
227 if (elementTitle
== hideTitle
) {
228 elementTitle
= showTitle
;
229 } else if (elementTitle
== showTitle
) {
230 elementTitle
= hideTitle
;
232 $
('#show_hide').prop('title', elementTitle
);