$erroritem->on = ''; $errors[] = $erroritem; get_slot_data($form); $form->what = 'doaddupdateslot'; $form->studentid = optional_param('studentid', '', PARAM_INT); if (!empty($form->studentid)) { $form->appointments = unserialize(stripslashes(optional_param('appointments', '', PARAM_RAW))); unset($form->appointments[$form->studentid]); } $form->availableslots = scheduler_get_available_slots($form->studentid, $scheduler->id); $form->slotid = optional_param('slotid', -1, PARAM_INT); break; case 'doaddappointed': unset($erroritem); $erroritem->message = get_string('dontforgetsaveadvice', 'scheduler'); $erroritem->on = ''; $errors[] = $erroritem; get_slot_data($form); $form->what = 'doaddupdateslot'; $form->appointments = unserialize(stripslashes(required_param('appointments', PARAM_RAW))); $form->slotid = optional_param('slotid', -1, PARAM_INT); $form->studentid = $appointment->studentid = required_param('studenttoadd', PARAM_INT); $form->availableslots = scheduler_get_available_slots($form->studentid, $scheduler->id); $appointment->attended = optional_param('attended', 0, PARAM_INT); $appointment->appointmentnote = optional_param('appointmentnote', '', PARAM_TEXT); $appointment->grade = optional_param('grade', 0, PARAM_CLEAN); $appointment->timecreated = time(); $appointment->timemodified = time(); $form->appointments[$appointment->studentid] = $appointment; break; }
} print_simple_box_start('center', '80%'); if (scheduler_has_slot($USER->id, $scheduler, true)) { print_string('welcomebackstudent', 'scheduler'); } else { print_string('welcomenewstudent', 'scheduler'); } print_simple_box_end(); // clean all late slots (for every body, anyway, they are passed !!) scheduler_free_late_unused_slots($scheduler->id); /// get information about appointment attention $sql = "\n SELECT\n COUNT(*)\n FROM\n {$CFG->prefix}scheduler_slots AS s,\n {$CFG->prefix}scheduler_appointment AS a\n WHERE\n s.id = a.slotid AND\n a.studentid = {$USER->id} AND\n a.attended = 1 AND\n s.schedulerid = {$scheduler->id}\n "; $hasattended = count_records_sql($sql); /// get available slots $haveunattendedappointments = false; if ($slots = scheduler_get_available_slots($USER->id, $scheduler->id, true)) { $minhidedate = 0; // very far in the past $studentSlots = array(); $studentAttendedSlots = array(); foreach ($slots as $slot) { /// check if other appointement is not "on the way". Student could not apply to it. if (scheduler_get_conflicts($scheduler->id, $slot->starttime, $slot->starttime + $slot->duration * 60, 0, $USER->id, SCHEDULER_OTHERS)) { continue; } /// check if not mine and late, don't care if (!$slot->appointedbyme and $slot->starttime + 60 * $slot->duration < time()) { continue; } /// check what to print in groupsession indication if ($slot->exclusivity == 0) {