$studid = $_SESSION["studID"]; $student = new Student($COMMON, $studid); // Check if student already has appointment $appointments = Appointment::searchAppointments($COMMON, null, null, null, null, null, null, '', $studid); $reschedule = count($appointments) > 0; if ($reschedule) { // Student was already scheduled for appointment $appt = $appointments[0]; $oldApptID = $appt->getID(); $oldAdvisorID = $appt->getAdvisorID(); $oldDatephp = strtotime($appt->getTime()); if ($oldAdvisorID != 0) { // Individual advisor - get info from database $oldAdvisor = new Advisor($COMMON, $oldAdvisorID); $oldAdvisorName = $oldAdvisor->convertFullName(); $oldAdvisorOffice = $oldAdvisor->getMeeting(); } else { // Group adivising $oldAdvisorName = "Group"; } echo "<h2>Previous Appointment</h2>"; echo "<label for='info'>"; echo "Advisor: ", $oldAdvisorName, "<br>"; // Display advisor office for individual advisor if (isset($oldAdvisorOffice)) { echo "Office: ", $oldAdvisorOffice, "<br>"; } echo "Appointment: ", date('l, F d, Y g:i A', $oldDatephp), "<br>"; // Display meeting location echo "Meeting Location: ", $appt->getMeeting(), "</label><br>"; // Hidden input for old appointment ID
//major stuff $majorDB = ""; $majorPrint = "All"; if (!empty($majors)) { $majorPrint = ""; foreach ($majors as $m) { $majorDB .= $m . " "; $majorPrint .= $m . ", "; } $majorPrint = substr($majorPrint, 0, -2); } //get advisor id $id = $_SESSION['UserID']; $adv = new Advisor($COMMON, $id); $advID = $adv->getID(); $location = $adv->getMeeting(); //make sure app doesn't exist //insert new app to DB //print app foreach ($datetimes as $dt) { // Attempt to create appointment $created = Appointment::createAppointment($COMMON, $dt, $advID, $majorDB, 1, $location); echo date('l, F d, Y g:i A', strtotime($dt)), "<br>Advisor: ", $adv->getFirstName(), " ", $adv->getLastName(), "<br>Location: ", $location, " <br> Majors: ", $majorPrint; if (!$created) { // Appointment already exists echo "<br><span style='color:red'>!!</span>"; } echo "<br><br>"; } ?> <br>