Highway to PSR2
[openemr.git] / patients / get_appointments.php
blobb38979bce79ec7c63b2c854134dc9efa35d5cd2a
1 <?php
2 // Copyright (C) 2011 Cassian LUP <cassi.lup@gmail.com>
3 //
4 // This program is free software; you can redistribute it and/or
5 // modify it under the terms of the GNU General Public License
6 // as published by the Free Software Foundation; either version 2
7 // of the License, or (at your option) any later version.
8 //
9 // Modified to support recurring appointments by Ian Jardine 2016.
11 require_once("verify_session.php");
12 ///////
13 require_once(dirname(__FILE__)."/../library/appointments.inc.php");
15 $current_date2 = date('Y-m-d');
16 $events = array();
17 $apptNum = (int)$GLOBALS['patient_portal_appt_display_num'];
18 if ($apptNum != 0) {
19 $apptNum2 = abs($apptNum);
20 } else {
21 $apptNum2 = 20;
24 $events = fetchNextXAppts($current_date2, $pid, $apptNum2);
25 ///////
27 $count = 0;
29 foreach ($events as $row) {
30 $count++;
31 $dayname = xl(date("l", strtotime($row['pc_eventDate'])));
32 $dispampm = "am";
33 $disphour = substr($row['pc_startTime'], 0, 2) + 0;
34 $dispmin = substr($row['pc_startTime'], 3, 2);
35 if ($disphour >= 12) {
36 $dispampm = "pm";
37 if ($disphour > 12) {
38 $disphour -= 12;
42 if ($row['pc_hometext'] != "") {
43 $etitle = 'Comments'.": ".$row['pc_hometext']."\r\n";
44 } else {
45 $etitle = "";
48 if ($GLOBALS['portal_onsite_appt_modify']) {
49 echo "<a href='add_edit_event_user.php?date=" . htmlspecialchars(preg_replace("/-/", "", $row['pc_eventDate']), ENT_QUOTES) .
50 "&eid=" . htmlspecialchars($row['pc_eid'], ENT_QUOTES) .
51 "' class='edit_event iframe' title='" . htmlspecialchars($etitle, ENT_QUOTES) . "'>";
54 echo "<b>" . htmlspecialchars($row['pc_eventDate'] . " (" . $dayname . ")", ENT_NOQUOTES) . "</b><br>";
55 echo htmlspecialchars("$disphour:$dispmin " . $dispampm . " " . $row['pc_catname'], ENT_NOQUOTES) . "<br>\n";
56 echo htmlspecialchars($row['ufname'] . " " . $row['ulname'], ENT_NOQUOTES);
57 if ($GLOBALS['portal_onsite_appt_modify']) {
58 echo "</a><br>\n";
59 } else {
60 echo "<br>\n";
64 if ($resNotNull) {
65 if ($count < 1) {
66 echo "&nbsp;&nbsp;" . htmlspecialchars('No Appointments', ENT_NOQUOTES);