Session fix in interface/main/finder/dynamic_finder.php
[openemr.git] / interface / main / dated_reminders / dated_reminders_log.php
blob451e2e3bdf80459c74b269261c5b7cbbd3a6a1f2
1 <?php
2 /**
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>;.
18 * @package OpenEMR
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');
34 <?php
36 ------------------- HANDLE POST ---------------------
38 if($_GET){
39 if(!$isAdmin){
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">
44 <thead>
45 <tr>
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>
55 </tr>
56 </thead>
57 <tbody>';
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>
82 </tr>';
84 echo '</tbody></table>';
86 die;
88 ?>
89 <html>
90 <head>
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(),
101 function(data) {
102 $("#resultsDiv").html(data);
103 <?php
104 if(!$isAdmin){
105 echo '$("select option").removeAttr("selected");';
108 return false;
111 return false;
114 </script>
115 </head>
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>
121 <?php
122 $allUsers = array();
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'); ?>' /> &nbsp;&nbsp;&nbsp;
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 <!----------------------------------------------------------------------------------------------------------------------------------------------------->
135 </blockquote>
136 <table style="width:100%">
137 <tr>
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>
142 <?php
143 if($isAdmin)
144 foreach($allUsers as $user)
145 echo '<option value="',attr($user['id']),'">',text($user['fname'].' '.$user['mname'].' '.$user['lname']),'</option>';
147 </select>
148 </td>
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>
153 <?php
154 if($isAdmin)
155 foreach($allUsers as $user)
156 echo '<option value="',attr($user['id']),'">',text($user['fname'].' '.$user['mname'].' '.$user['lname']),'</option>';
158 </select>
159 </td>
160 </tr>
161 </table>
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 <!----------------------------------------------------------------------------------------------------------------------------------------------------->
167 <br /><br />
168 <button value="Refresh" id="submitForm"><?php echo xlt('Refresh') ?></button>
169 </form>
171 <div id="resultsDiv"></div>
173 </body>
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'});
182 </script>
183 </html>