<h1>View Appointment</h1> <div class="field"> <?php // Search for appointment with this student $appointments = Appointment::searchAppointments($COMMON, null, null, null, null, null, null, '', $studID); // if for some reason there really isn't a match, (something got messed up, tell them there really isn't one there) $num_rows = count($appointments); if ($num_rows > 0) { $appt = $appointments[0]; // get legit data $advisorID = $appt->getAdvisorID(); $datephp = strtotime($appt->getTime()); if ($advisorID != 0) { // Individual advisor - Get advisor info from database $advisor = new Advisor($COMMON, $advisorID); $advisorOffice = $advisor->getOffice(); $advisorName = $advisor->convertFullName(); } else { // Group advisor $advisorName = "Group"; } echo "<label for='info'>"; echo "Advisor: ", $advisorName, "<br>"; // If individual advisor, display office location if (isset($advisorOffice)) { echo "Office: ", $advisorOffice, "<br>"; } echo "Appointment: ", date('l, F d, Y g:i A', $datephp), "<br>"; // Display appointment location echo "Meeting Location: ", $appt->getMeeting(), "</label>"; } else {
// Display meeting location echo "Meeting Location: ", $appt->getMeeting(), "</label><br>"; // Hidden input for old appointment ID echo "<input type='hidden' name='oldAppID' value='{$oldApptID}'>"; } $currentAdvisorID = $_POST["advisor"]; $currentDatephp = strtotime($_POST["appTime"]); // Get appointment information for current appointment, even if it's taken $appointments = Appointment::searchAppointments($COMMON, $currentAdvisorID, $student->getMajor(), $_POST["appTime"], null, false, 1, ''); $currentAppt = $appointments[0]; $currentApptID = $currentAppt->getID(); if ($currentAdvisorID != 0) { // Individual advisor, so get info from database $currentAdvisor = new Advisor($COMMON, $currentAdvisorID); $currentAdvisorName = $currentAdvisor->convertFullName(); $currentAdvisorOffice = $currentAdvisor->getOffice(); } else { // Group advising appointment $currentAdvisorName = "Group"; } echo "<h2>Current Appointment</h2>"; echo "<label for='newinfo'>"; echo "Advisor: ", $currentAdvisorName, "<br>"; // Display office for individual advisor if (isset($currentAdvisorOffice)) { echo "Office: ", $currentAdvisorOffice, "<br>"; } echo "Appointment: ", date('l, F d, Y g:i A', $currentDatephp), "<br>"; echo "Meeting Location: ", $currentAppt->getMeeting(), "</label>"; // Hidden input for appointment id echo "<input type='hidden' name='appID' value='{$currentApptID}'>";
<h1>Cancel Appointment</h1> <div class="field"> <?php // Get student info from database $studid = $_SESSION["studID"]; $student = new Student($COMMON, $studid); // Get student's appointment from database $appointments = Appointment::searchAppointments($COMMON, null, null, null, null, null, null, '', $studid); $appt = $appointments[0]; $oldAdvisorID = $appt->getAdvisorID(); $oldDatephp = strtotime($appt->getTime()); if ($oldAdvisorID != 0) { // Individual advisor, so get advisor info $advisor = new Advisor($COMMON, $oldAdvisorID); $oldAdvisorName = $advisor->convertFullName(); $oldAdvisoOffice = $advisor->getOffice(); } else { // Group advisor $oldAdvisorName = "Group"; } // Display current appointment info echo "<h2>Current Appointment</h2>"; echo "<label for='info'>"; echo "Advisor: ", $oldAdvisorName, "<br>"; // Display office for individual advisor if (isset($oldAdvisorOffice)) { echo "Office: ", $oldAdvisorOffice, "<br>"; } echo "Appointment: ", date('l, F d, Y g:i A', $oldDatephp), "<br>"; echo "Meeting Location: ", $appt->getMeeting(), "</label><br>"; ?>