3 * Used for displaying 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) 2018 Brady Miller <brady.g.miller@gmail.com>
11 * @license https://github.com/openemr/openemr/blob/master/LICENSE GNU General Public License 3
15 // removed as jquery is already called in messages page (if you need to use jQuery, uncomment it futher down)
16 require_once('../../globals.php');
17 require_once("$srcdir/dated_reminder_functions.php");
20 $alerts_to_show = $GLOBALS['dated_reminders_max_alerts_to_show'];
21 $updateDelay = 60; // time is seconds
24 // ----- get time stamp for start of today, this is used to check for due and overdue reminders
25 $today = strtotime(date('Y/m/d'));
27 // ----- set $hasAlerts to false, this is used for auto-hiding reminders if there are no due or overdue reminders
30 // mulitply $updateDelay by 1000 to get miliseconds
31 $updateDelay = $updateDelay * 1000;
33 //-----------------------------------------------------------------------------
34 // HANDEL AJAX TO MARK REMINDERS AS READ
35 // Javascript will send a post
36 // ----------------------------------------------------------------------------
37 if (isset($_POST['drR'])) {
38 if (!verifyCsrfToken($_POST["csrf_token_form"])) {
43 setReminderAsProcessed($_POST['drR']);
44 // ----- get updated data
45 $reminders = RemindersArray($days_to_show, $today, $alerts_to_show);
46 // ----- echo for ajax to use
47 echo getRemindersHTML($today, $reminders);
48 // stop any other output
52 //-----------------------------------------------------------------------------
53 // END HANDEL AJAX TO MARK REMINDERS AS READ
54 // ----------------------------------------------------------------------------
56 $reminders = RemindersArray($days_to_show, $today, $alerts_to_show);
60 <style type
="text/css">
69 padding
:5px
5px
8px
5px
;
77 text
-decoration
: none
;
82 text
-decoration
: underline
;
85 <script type
="text/javascript">
86 $
(document
).ready(function (){
87 $
(".hideDR").click(function(){
88 if($
(this
).html() == "<span><?php echo xla('Hide Reminders') ?></span>"){
89 $
(this
).html("<span><?php echo xla('Show Reminders') ?></span>");
90 $
(".drHide").slideUp("slow");
93 $
(this
).html("<span><?php echo xla('Hide Reminders') ?></span>");
94 $
(".drHide").slideDown("slow");
97 // run updater after 30 seconds
98 var updater
= setTimeout("updateme(0)", 1);
101 function openAddScreen(id
){
103 top
.restoreSession();
104 dlgopen('<?php echo $GLOBALS['webroot
']; ?>/interface/main/dated_reminders/dated_reminders_add.php', '_drAdd', 700, 500);
106 top
.restoreSession();
107 dlgopen('<?php echo $GLOBALS['webroot
']; ?>/interface/main/dated_reminders/dated_reminders_add.php?mID='+
encodeURIComponent(id
)+
'&csrf_token_form=<?php echo attr_url(collectCsrfToken()); ?>', '_drAdd', 700, 500);
111 function updateme(id
){
112 refreshInterval
= <?php
echo attr($updateDelay); ?
>;
114 $
(".drTD").html('<p style="text-size:3em; margin-left:200px; color:black; font-weight:bold;"><?php echo xla("Processing") ?>...</p>');
117 $
(".drTD").html('<p style="text-size:3em; margin-left:200px; color:black; font-weight:bold;"><?php echo xla("Processing") ?>...</p>');
119 top
.restoreSession();
120 // Send the skip_timeout_reset parameter to not count this as a manual entry in the
121 // timing out mechanism in OpenEMR.
122 $
.post("<?php echo $GLOBALS['webroot']; ?>/interface/main/dated_reminders/dated_reminders.php",
125 skip_timeout_reset
: "1",
126 csrf_token_form
: "<?php echo attr(collectCsrfToken()); ?>"
130 alert("<?php echo xls('Error Removing Message') ?>");
133 $
(".drTD").html('<p style="text-size:3em; margin-left:200px; color:black; font-weight:bold;"><?php echo xla("Refreshing Reminders") ?> ...</p>');
135 $
(".drTD").html(data
);
137 // run updater every refreshInterval seconds
138 var repeater
= setTimeout("updateme(0)", refreshInterval
);
142 function openLogScreen(){
143 top
.restoreSession();
144 dlgopen('<?php echo $GLOBALS['webroot
']; ?>/interface/main/dated_reminders/dated_reminders_log.php', '_drLog', 700, 500);
148 function goPid(pid
) {
149 top
.restoreSession();
151 echo " top.RTop.location = '../../patient_file/summary/demographics.php' " .
152 "+ '?set_pid=' + pid;\n";
158 // initialize html string
159 $pdHTML = '<div class="container">
160 <div class="drHide col-xs-12">'.
161 '<a title="'.xla('View Past and Future Reminders').'" onclick="openLogScreen()" class="btn btn-default btn-show" href="#"><span>'.xlt('View Log').'</span></a> '
162 .'<a onclick="openAddScreen(0)" class="btn btn-default btn-add" href="#"><span>'.xlt('Create A Dated Reminder').'</span></a>
164 <div class="col-xs-12 pre-scrollable oe-margin-t-10">
166 <legend>'.xla('Dated Reminders').'</legend>
167 <table class="table-condensed">
169 <td class="drHide drTD">';
171 $pdHTML .= getRemindersHTML($today, $reminders);
172 $pdHTML .= '</td></tr></table></fieldset></div></div>';