Merge pull request #627 from MatthewVita/message_broken_link_fix
[openemr.git] / patients / get_appointments.php
blob43616eb526ccab369e1d80545b037c47c0ad0572
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) $apptNum2 = abs($apptNum);
19 else $apptNum2 = 20;
20 $events = fetchNextXAppts($current_date2, $pid, $apptNum2);
21 ///////
23 $count = 0;
25 foreach($events as $row) {
26 $count++;
27 $dayname = xl(date("l", strtotime($row['pc_eventDate'])));
28 $dispampm = "am";
29 $disphour = substr($row['pc_startTime'], 0, 2) + 0;
30 $dispmin = substr($row['pc_startTime'], 3, 2);
31 if ($disphour >= 12) {
32 $dispampm = "pm";
33 if ($disphour > 12) $disphour -= 12;
35 if ($row['pc_hometext'] != "") {
36 $etitle = 'Comments'.": ".$row['pc_hometext']."\r\n";
37 } else {
38 $etitle = "";
40 if ($GLOBALS['portal_onsite_appt_modify']) {
41 echo "<a href='add_edit_event_user.php?date=" . htmlspecialchars(preg_replace("/-/", "", $row['pc_eventDate']),ENT_QUOTES) .
42 "&eid=" . htmlspecialchars($row['pc_eid'],ENT_QUOTES) .
43 "' class='edit_event iframe' title='" . htmlspecialchars($etitle,ENT_QUOTES) . "'>";
45 echo "<b>" . htmlspecialchars($row['pc_eventDate'] . " (" . $dayname . ")" ,ENT_NOQUOTES) . "</b><br>";
46 echo htmlspecialchars("$disphour:$dispmin " . $dispampm . " " . $row['pc_catname'],ENT_NOQUOTES) . "<br>\n";
47 echo htmlspecialchars($row['ufname'] . " " . $row['ulname'],ENT_NOQUOTES);
48 if ($GLOBALS['portal_onsite_appt_modify']) {
49 echo "</a><br>\n";
51 else {
52 echo "<br>\n";
55 if ($resNotNull) {
56 if ( $count < 1 ) { echo "&nbsp;&nbsp;" . htmlspecialchars('No Appointments',ENT_NOQUOTES); }