Highway to PSR2
[openemr.git] / interface / main / dated_reminders / dated_reminders_log.php
blob49c6b1557946da68cf1d2dfbc88bd51c55e3dcf0
1 <?php
2 /**
3 * Used for displaying log of dated reminders.
5 * Copyright (C) 2012 tajemo.co.za <http://www.tajemo.co.za/>
6 * Copyright (C) 2017 Brady Miller <brady.g.miller@gmail.com>
8 * LICENSE: This program is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU General Public License
10 * as published by the Free Software Foundation; either version 3
11 * of the License, or (at your option) any later version.
12 * This program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with this program. If not, see <http://opensource.org/licenses/gpl-license.php>;.
19 * @package OpenEMR
20 * @author Craig Bezuidenhout <http://www.tajemo.co.za/>
21 * @author Brady Miller <brady.g.miller@gmail.com>
22 * @link http://www.open-emr.org
26 require_once("../../globals.php");
27 require_once("$srcdir/acl.inc");
28 require_once("$srcdir/dated_reminder_functions.php");
31 $isAdmin =acl_check('admin', 'users');
33 <?php
35 ------------------- HANDLE POST ---------------------
37 if ($_GET) {
38 if (!$isAdmin) {
39 if (empty($_GET['sentBy']) and empty($_GET['sentTo'])) {
40 $_GET['sentTo'] = array(intval($_SESSION['authId']));
44 echo '<table border="1" width="100%" cellpadding="5px" id="logTable">
45 <thead>
46 <tr>
47 <th>'.xlt('ID').'</th>
48 <th>'.xlt('Sent Date').'</th>
49 <th>'.xlt('From').'</th>
50 <th>'.xlt('To').'</th>
51 <th>'.xlt('Patient').'</th>
52 <th>'.xlt('Message').'</th>
53 <th>'.xlt('Due Date').'</th>
54 <th>'.xlt('Processed Date').'</th>
55 <th>'.xlt('Processed By').'</th>
56 </tr>
57 </thead>
58 <tbody>';
59 $remindersArray = array();
60 $TempRemindersArray = logRemindersArray();
61 foreach ($TempRemindersArray as $RA) {
62 $remindersArray[$RA['messageID']]['messageID'] = $RA['messageID'];
63 $remindersArray[$RA['messageID']]['ToName'] = ($remindersArray[$RA['messageID']]['ToName'] ? $remindersArray[$RA['messageID']]['ToName'].', '.$RA['ToName'] : $RA['ToName']);
64 $remindersArray[$RA['messageID']]['PatientName'] = $RA['PatientName'];
65 $remindersArray[$RA['messageID']]['message'] = $RA['message'];
66 $remindersArray[$RA['messageID']]['dDate'] = $RA['dDate'];
67 $remindersArray[$RA['messageID']]['sDate'] = $RA['sDate'];
68 $remindersArray[$RA['messageID']]['pDate'] = $RA['pDate'];
69 $remindersArray[$RA['messageID']]['processedByName'] = $RA['processedByName'];
70 $remindersArray[$RA['messageID']]['fromName'] = $RA['fromName'];
73 foreach ($remindersArray as $RA) {
74 echo '<tr class="heading">
75 <td>',text($RA['messageID']),'</td>
76 <td>',text($RA['sDate']),'</td>
77 <td>',text($RA['fromName']),'</td>
78 <td>',text($RA['ToName']),'</td>
79 <td>',text($RA['PatientName']),'</td>
80 <td>',text($RA['message']),'</td>
81 <td>',text($RA['dDate']),'</td>
82 <td>',text($RA['pDate']),'</td>
83 <td>',text($RA['processedByName']),'</td>
84 </tr>';
87 echo '</tbody></table>';
89 die;
92 <html>
93 <head>
94 <link rel="stylesheet" href="<?php echo $css_header;?>" type="text/css">
95 <link rel="stylesheet" href="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-datetimepicker-2-5-4/build/jquery.datetimepicker.min.css">
97 <script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-min-3-1-1/index.js"></script>
98 <script type="text/javascript" src="<?php echo $GLOBALS['assets_static_relative']; ?>/jquery-datetimepicker-2-5-4/build/jquery.datetimepicker.full.min.js"></script>
100 <script language="JavaScript">
101 $(document).ready(function (){
102 $("#submitForm").click(function(){
103 // top.restoreSession(); --> can't use this as it negates this ajax refresh
104 $.get("dated_reminders_log.php?"+$("#logForm").serialize(),
105 function(data) {
106 $("#resultsDiv").html(data);
107 <?php
108 if (!$isAdmin) {
109 echo '$("select option").removeAttr("selected");';
112 return false;
115 return false;
118 $('.datepicker').datetimepicker({
119 <?php $datetimepicker_timepicker = false; ?>
120 <?php $datetimepicker_showseconds = false; ?>
121 <?php $datetimepicker_formatInput = false; ?>
122 <?php require($GLOBALS['srcdir'] . '/js/xl/jquery-datetimepicker-2-5-4.js.php'); ?>
123 <?php // can add any additional javascript settings to datetimepicker here; need to prepend first setting with a comma ?>
126 </script>
127 </head>
128 <body class="body_top">
129 <!-- Required for the popup date selectors -->
130 <div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div>
133 <?php
134 $allUsers = array();
135 $uSQL = sqlStatement('SELECT id, fname, mname, lname FROM `users` WHERE `active` = 1 AND `facility_id` > 0 AND id != ?', array(intval($_SESSION['authId'])));
136 for ($i=0; $uRow=sqlFetchArray($uSQL);
137 $i++) {
138 $allUsers[] = $uRow;
141 <form method="get" id="logForm" onsubmit="return top.restoreSession()">
142 <h1><?php echo xlt('Dated Message Log') ?></h1>
143 <h2><?php echo xlt('filters') ?> :</h2>
144 <blockquote><?php echo xlt('Date The Message Was Sent') ?><br />
145 <!----------------------------------------------------------------------------------------------------------------------------------------------------->
146 <?php echo xlt('Start Date') ?> : <input id="sd" type="text" class='datepicker' name="sd" value="" title='<?php echo xla('yyyy-mm-dd'); ?>' /> &nbsp;&nbsp;&nbsp;
147 <!----------------------------------------------------------------------------------------------------------------------------------------------------->
148 <?php echo xlt('End Date') ?> : <input id="ed" type="text" class='datepicker' name="ed" value="" title='<?php echo xla('yyyy-mm-dd'); ?>' /> <br /><br />
149 <!----------------------------------------------------------------------------------------------------------------------------------------------------->
150 </blockquote>
151 <table style="width:100%">
152 <tr>
153 <td style="width:50%">
154 <?php echo xlt('Sent By, Leave Blank For All') ?> : <br />
155 <select style="width:100%;" id="sentBy" name="sentBy[]" multiple="multiple">
156 <option value="<?php echo attr(intval($_SESSION['authId'])); ?>"><?php echo xlt('Myself') ?></option>
157 <?php
158 if ($isAdmin) {
159 foreach ($allUsers as $user) {
160 echo '<option value="',attr($user['id']),'">',text($user['fname'].' '.$user['mname'].' '.$user['lname']),'</option>';
164 </select>
165 </td>
166 <td style="width:50%">
167 <?php echo xlt('Sent To, Leave Blank For All') ?> : <br />
168 <select style="width:100%" id="sentTo" name="sentTo[]" multiple="multiple">
169 <option value="<?php echo attr(intval($_SESSION['authId'])); ?>"><?php echo xlt('Myself') ?></option>
170 <?php
171 if ($isAdmin) {
172 foreach ($allUsers as $user) {
173 echo '<option value="',attr($user['id']),'">',text($user['fname'].' '.$user['mname'].' '.$user['lname']),'</option>';
177 </select>
178 </td>
179 </tr>
180 </table>
181 <!----------------------------------------------------------------------------------------------------------------------------------------------------->
182 <input type="checkbox" name="processed" id="processed"><label for="processed"><?php echo xlt('Processed') ?></label>
183 <!----------------------------------------------------------------------------------------------------------------------------------------------------->
184 <input type="checkbox" name="pending" id="pending"><label for="pending"><?php echo xlt('Pending') ?></label>
185 <!----------------------------------------------------------------------------------------------------------------------------------------------------->
186 <br /><br />
187 <button value="Refresh" id="submitForm"><?php echo xlt('Refresh') ?></button>
188 </form>
190 <div id="resultsDiv"></div>
192 </body>
193 </html>