4 * Used for adding dated reminders.
7 * @link http://www.open-emr.org
8 * @author Craig Bezuidenhout <http://www.tajemo.co.za/>
9 * @author Brady Miller <brady.g.miller@gmail.com>
10 * @copyright Copyright (c) 2012 tajemo.co.za <http://www.tajemo.co.za/>
11 * @copyright Copyright (c) 2017-2018 Brady Miller <brady.g.miller@gmail.com>
14 require_once("../../globals.php");
15 require_once("$srcdir/dated_reminder_functions.php");
17 use OpenEMR\Common\Acl\AclMain
;
18 use OpenEMR\Common\Csrf\CsrfUtils
;
19 use OpenEMR\Core\Header
;
21 $isAdmin = AclMain
::aclCheckCore('admin', 'users');
25 ------------------- HANDLE POST ---------------------
28 if (!CsrfUtils
::verifyCsrfToken($_GET["csrf_token_form"])) {
29 CsrfUtils
::csrfNotVerified();
33 if (empty($_GET['sentBy']) and empty($_GET['sentTo'])) {
34 $_GET['sentTo'] = array(intval($_SESSION['authUserID']));
38 echo ' <div class="col-12">
39 <h4>' . xlt('Click and drag bottom right corner to resize this display') . '</h4>
40 <table class="table table-bordered" id="logTable">
43 <th>' . xlt('ID') . '</th>
44 <th>' . xlt('Sent Date') . '</th>
45 <th>' . xlt('From') . '</th>
46 <th>' . xlt('To{{Destination}}') . '</th>
47 <th>' . xlt('Patient') . '</th>
48 <th>' . xlt('Message') . '</th>
49 <th>' . xlt('Due Date') . '</th>
50 <th>' . xlt('Processed Date') . '</th>
51 <th>' . xlt('Processed By') . '</th>
55 $remindersArray = array();
56 $TempRemindersArray = logRemindersArray();
57 foreach ($TempRemindersArray as $RA) {
58 $remindersArray[$RA['messageID']]['messageID'] = $RA['messageID'];
59 $remindersArray[$RA['messageID']]['ToName'] = ((!empty($remindersArray[$RA['messageID']]['ToName'])) ?
$remindersArray[$RA['messageID']]['ToName'] . ', ' . ($RA['ToName'] ??
'') : ($RA['ToName'] ??
''));
60 $remindersArray[$RA['messageID']]['PatientName'] = $RA['PatientName'];
61 $remindersArray[$RA['messageID']]['message'] = $RA['message'];
62 $remindersArray[$RA['messageID']]['dDate'] = $RA['dDate'];
63 $remindersArray[$RA['messageID']]['sDate'] = $RA['sDate'];
64 $remindersArray[$RA['messageID']]['pDate'] = $RA['pDate'];
65 $remindersArray[$RA['messageID']]['processedByName'] = $RA['processedByName'];
66 $remindersArray[$RA['messageID']]['fromName'] = $RA['fromName'];
69 foreach ($remindersArray as $RA) {
70 echo '<tr class="heading">
71 <td>' . text($RA['messageID']) . '</td>
72 <td>' . text(oeFormatDateTime($RA['sDate'])) . '</td>
73 <td>' . text($RA['fromName']) . '</td>
74 <td>' . text($RA['ToName']) . '</td>
75 <td>' . text($RA['PatientName']) . '</td>
76 <td>' . text($RA['message']) . '</td>
77 <td>' . text(oeFormatShortDate($RA['dDate'])) . '</td>
78 <td>' . text(oeFormatDateTime($RA['pDate'])) . '</td>
79 <td>' . text($RA['processedByName']) . '</td>
83 echo '</tbody></table></div>';
90 <?php Header
::setupHeader(['datetime-picker']); ?
>
94 $
("#submitForm").click(function(){
95 // top.restoreSession(); --> can't use this as it negates this ajax refresh
96 $
.get("dated_reminders_log.php?"+$
("#logForm").serialize(),
98 $
("#resultsDiv").html(data
);
101 echo '$("select option").removeAttr("selected");';
110 $
('.datepicker').datetimepicker({
111 <?php
$datetimepicker_timepicker = false; ?
>
112 <?php
$datetimepicker_showseconds = false; ?
>
113 <?php
$datetimepicker_formatInput = true; ?
>
114 <?php
require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?
>
115 <?php
// can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
121 <div
class="container">
122 <!-- Required
for the popup date selectors
-->
123 <div id
="overDiv" style
="position:absolute; visibility:hidden; z-index:1000;"></div
>
126 $uSQL = sqlStatement('SELECT id, fname, mname, lname FROM `users` WHERE `active` = 1 AND `facility_id` > 0 AND id != ?', array(intval($_SESSION['authUserID'])));
127 for ($i = 0; $uRow = sqlFetchArray($uSQL); $i++
) {
133 <h2
><?php
echo xlt('Dated Message Log');?
>  
;<i id
="show_hide" class="fa fa-eye-slash fa-2x small" data
-toggle
="tooltip" data
-placement
="top" title
="<?php echo xla('Click to Hide Filters'); ?>"></i
></h2
>
135 <div
class="col-12 hideaway">
136 <form method
="get" id
="logForm" onsubmit
="return top.restoreSession()">
137 <input type
="hidden" name
="csrf_token_form" value
="<?php echo attr(CsrfUtils::collectCsrfToken()); ?>" />
139 <legend
><?php
echo xlt('Filters') ?
></legend
>
140 <h5
><?php
echo xlt('Date The Message Was Sent');?
></h5
>
141 <div
class="form-group row">
142 <div
class="col-12 col-md-6">
143 <label
class="col-form-label" for="sd"><?php
echo xlt('Start Date') ?
>:</label
>
144 <input id
="sd" type
="text" class='form-control datepicker' name
="sd" value
="" title
='<?php echo attr(DateFormatRead('validateJS
')) ?>'>
146 <div
class="col-12 col-md-6">
147 <label
class="col-form-label" for="ed"><?php
echo xlt('End Date') ?
>:</label
>
148 <input id
="ed" type
="text" class='form-control datepicker' name
="ed" value
="" title
='<?php echo attr(DateFormatRead('validateJS
')) ?>'>
151 <div
class="form-group row">
152 <div
class="col-12 col-md-6">
153 <label
class="col-form-label" for="sentBy"><?php
echo xlt('Sent By, Leave Blank For All');?
>:</label
>
154 <select
class="form-control" id
="sentBy" name
="sentBy[]" multiple
="multiple">
155 <option value
="<?php echo attr(intval($_SESSION['authUserID'])); ?>"><?php
echo xlt('Myself') ?
></option
>
158 foreach ($allUsers as $user) {
159 echo '<option value="' . attr($user['id']) . '">' . text($user['fname'] . ' ' . $user['mname'] . ' ' . $user['lname']) . '</option>';
165 <div
class="col-12 col-md-6">
166 <label
class="col-form-label" for="sentBy"><?php
echo xlt('Sent To, Leave Blank For All') ?
>:</label
>
167 <select
class="form-control" id
="sentTo" name
="sentTo[]" multiple
="multiple">
168 <option value
="<?php echo attr(intval($_SESSION['authUserID'])); ?>"><?php
echo xlt('Myself') ?
></option
>
171 foreach ($allUsers as $user) {
172 echo '<option value="' . attr($user['id']) . '">' . text($user['fname'] . ' ' . $user['mname'] . ' ' . $user['lname']) . '</option>';
179 <div
class="form-group row">
180 <div
class="checkbox">
182 <input type
="checkbox" name
="processed" id
="processed"><?php
echo xlt('Processed') ?
>
185 <input type
="checkbox" name
="pending" id
="pending"><?php
echo xlt('Pending') ?
>
190 <div
class="form-group row">
191 <div
class="col-sm-12 position-override">
192 <div
class="btn-group form-group" role
="group">
193 <button type
="button" value
="Refresh" id
="submitForm" class="btn btn-secondary btn-refresh" ><?php
echo xlt('Refresh') ?
></button
>
200 <div id
="resultsDiv"></div
>
203 </div
><!--end of container div
-->
205 $
('#show_hide').click(function() {
206 var elementTitle
= $
('#show_hide').prop('title');
207 var hideTitle
= '<?php echo xla('Click to Hide Filters
'); ?>';
208 var showTitle
= '<?php echo xla('Click to Show Filters
'); ?>';
209 $
('.hideaway').toggle('1000');
210 $
(this
).toggleClass('fa-eye-slash fa-eye');
211 if (elementTitle
== hideTitle
) {
212 elementTitle
= showTitle
;
213 } else if (elementTitle
== showTitle
) {
214 elementTitle
= hideTitle
;
216 $
('#show_hide').prop('title', elementTitle
);
219 $
('[data-toggle="tooltip"]').tooltip();