Setup script bootstrapped with new theme selector - Take 2 (#2139)
[openemr.git] / library / ajax / dated_reminders_counter.php
blobd1b27bc76c0aefc8d43be657f65a01e2b6bb3331
1 <?php
2 /**
3 * Returns a count of due messages for current user.
5 * @package OpenEMR
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 require_once("../../interface/globals.php");
16 require_once("$srcdir/dated_reminder_functions.php");
17 require_once("$srcdir/pnotes.inc");
19 if (!verifyCsrfToken($_POST["csrf_token_form"])) {
20 csrfNotVerified();
23 // if portal is enable get various alerts
24 if (isset($_POST['isPortal'])) {
25 echo GetPortalAlertCounts();
26 exit();
29 //Collect number of due reminders
30 $dueReminders = GetDueReminderCount(5, strtotime(date('Y/m/d')));
32 //Collect number of active messages
33 $activeMessages = getPnotesByUser("1", "no", $_SESSION['authUser'], true);
35 $totalNumber = $dueReminders + $activeMessages;
36 echo ($totalNumber > 0 ? '('.text(intval($totalNumber)).')' : '');