2 // Copyright (C) 2011 Cassian LUP <cassi.lup@gmail.com>
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.
10 $sanitize_all_escapes=true;
12 //STOP FAKE REGISTER GLOBALS
13 $fake_register_globals=false;
15 //landing page definition -- where to go if something goes wrong
16 $landingpage = "index.php";
19 // kick out if patient not authenticated
21 if ( isset($_SESSION['pid']) && isset($_SESSION['patient_portal_onsite']) ) {
22 $pid = $_SESSION['pid'];
26 header('Location: '.$landingpage.'?w');
32 include_once('../interface/globals.php');
34 $query = "SELECT e.pc_eid, e.pc_aid, e.pc_title, e.pc_eventDate, " .
35 "e.pc_startTime, e.pc_hometext, u.fname, u.lname, u.mname, " .
37 "FROM openemr_postcalendar_events AS e, users AS u, " .
38 "openemr_postcalendar_categories AS c WHERE " .
39 "e.pc_pid = ? AND e.pc_eventDate >= CURRENT_DATE AND " .
40 "u.id = e.pc_aid AND e.pc_catid = c.pc_catid " .
41 "ORDER BY e.pc_eventDate, e.pc_startTime";
45 $res = sqlStatement($query, array($pid) );
48 if(sqlNumRows($res)>0)
52 while($row = sqlFetchArray($res)) {
54 $dayname = xl(date("l", strtotime($row['pc_eventDate'])));
56 $disphour = substr($row['pc_startTime'], 0, 2) +
0;
57 $dispmin = substr($row['pc_startTime'], 3, 2);
58 if ($disphour >= 12) {
60 if ($disphour > 12) $disphour -= 12;
62 if ($row['pc_hometext'] != "") {
63 $etitle = 'Comments'.": ".$row['pc_hometext']."\r\n";
67 if ($GLOBALS['portal_onsite_appt_modify']) {
68 echo "<a href='add_edit_event_user.php?eid=" . htmlspecialchars($row['pc_eid'],ENT_QUOTES
) .
69 "' class='edit_event iframe' title='" . htmlspecialchars($etitle,ENT_QUOTES
) . "'>";
71 echo "<b>" . htmlspecialchars($dayname . ", " . $row['pc_eventDate'],ENT_NOQUOTES
) . "</b><br>";
72 echo htmlspecialchars("$disphour:$dispmin " . $dispampm . " " . $row['pc_catname'],ENT_NOQUOTES
) . "<br>\n";
73 echo htmlspecialchars($row['fname'] . " " . $row['lname'],ENT_NOQUOTES
);
74 if ($GLOBALS['portal_onsite_appt_modify']) {
81 if (isset($res) && $res != null) {
82 if ( $count < 1 ) { echo " " . htmlspecialchars('None',ENT_NOQUOTES
); }
84 } else { // if no appts
85 echo htmlspecialchars( xl('No Appointments'),ENT_NOQUOTES
);