} $application = read_application($_REQUEST['id']); if ($application === false || $application->approval_level != 3 || $application->approval_state != 0) { // Must be awaiting approval/rejection by HLS redirect($home); } $program = $home . 'local/obu_application/mdl_amend_course.php?id=' . $application->id; $process = $home . 'local/obu_application/mdl_process.php?id=' . $application->id; $PAGE->set_context($context); $PAGE->set_pagelayout('standard'); $PAGE->set_title(get_string('plugintitle', 'local_obu_application') . ': ' . get_string('process', 'local_obu_application')); // Part of application processing $PAGE->set_url($program); $PAGE->navbar->add(get_string('application', 'local_obu_application', $application->id)); $message = ''; $parameters = ['courses' => get_course_names(), 'application' => $application]; $mform = new mdl_amend_course_form(null, $parameters); if ($mform->is_cancelled()) { redirect($process); } if ($mform_data = $mform->get_data()) { // Update the applications's course fields $course = read_course_record($mform_data->course_code); $application->course_code = $course->code; $application->course_name = $course->name; $application->course_date = $mform_data->course_date; update_application($application); redirect($process); } echo $OUTPUT->header(); echo $OUTPUT->heading(get_string('application', 'local_obu_application', $application->id));
$home = new moodle_url('/local/obu_application/'); $url = $home . 'course.php'; $supplement = $home . 'supplement.php'; $apply = $home . 'apply.php'; $PAGE->set_title($CFG->pageheading . ': ' . get_string('apply', 'local_obu_application')); // HTTPS is required in this page when $CFG->loginhttps enabled $PAGE->https_required(); $PAGE->set_url($url); $record = read_applicant($USER->id, false); if ($record === false || $record->birthdate == 0) { // Must complete the profile first $message = get_string('complete_profile', 'local_obu_application'); } else { $message = ''; } $parameters = ['courses' => get_course_names(), 'record' => $record]; $mform = new course_form(null, $parameters); if ($mform->is_cancelled()) { redirect($home); } if ($mform_data = $mform->get_data()) { if ($mform_data->submitbutton == get_string('save_continue', 'local_obu_application')) { $course = read_course_record($mform_data->course_code); $mform_data->course_name = $course->name; write_course($USER->id, $mform_data); if ($course->supplement != '') { redirect($supplement); } else { redirect($apply); } }