$mform = new apply_form(null, array('schoolid' => $schoolid, 'programid' => $programid, 'ptype' => $ptype)); $data = $mform->get_data(); echo '<div id="first">'; $mform->display(); echo '</div>'; if ($mform->is_cancelled()) { redirect($returnurl); } if ($data) { $flag = 1; } } if ($flag == 1) { $PAGE->requires->js('/local/admission/js/first.js'); $mform = new apply_form(null); $data = $mform->get_data(); if (!empty($data->schoolid) && $data->previousstudent == 1) { $apply = new admission_form(new moodle_url('/local/admission/basic.php', array('flag' => 1)), array('schoolid' => $data->schoolid, 'programid' => $data->programid, 'ptype' => $data->typeofprogram, 'atype' => $data->typeofapplication, 'stype' => $data->typeofstudent, 'previousstudent' => $data->previousstudent)); } elseif (empty($data->schoolid) && $student == 1) { $apply = new admission_form(new moodle_url('/local/admission/basic.php', array('flag' => 1)), array('schoolid' => $school, 'programid' => $program, 'ptype' => $pgmtype, 'atype' => $atype, 'stype' => $stype, 'previousstudent' => $student)); } else { $apply = new readmission_form(new moodle_url('/local/admission/basic.php', array('flag' => 1)), array('schoolid' => $data->schoolid, 'programid' => $data->programid, 'ptype' => $data->typeofprogram, 'atype' => $data->typeofapplication, 'stype' => $data->typeofstudent, 'previousstudent' => $data->previousstudent)); } $datas = $apply->get_data(); $apply->display(); if ($datas) { if ($datas->previousstudent == 1) { if ($datas->same == 1) { $datas->pcountry = $datas->currentcountry;
$supplement = get_supplement_form($course->supplement, is_siteadmin()); if (!$supplement) { $message = get_string('invalid_data', 'local_obu_application'); // Shouldn't be here } else { unpack_supplement_data($record->supplement_data, $fields); if ($fields['supplement'] != $supplement->ref || $fields['version'] != $supplement->version) { $message = get_string('complete_course', 'local_obu_application'); // Shouldn't be here } } } } } $parameters = ['organisations' => get_organisations(), 'record' => $record]; $mform = new apply_form(null, $parameters); if ($mform->is_cancelled()) { redirect($home); } else { if ($mform_data = $mform->get_data()) { if ($mform_data->submitbutton == get_string('apply', 'local_obu_application')) { $application_id = write_application($USER->id, $mform_data); // Code required to skip the 'manager' level authorisation $application = read_application($application_id); update_workflow($application, true, $mform_data); redirect($process_url . '?id=' . $application_id); // Kick-off the workflow process } } } echo $OUTPUT->header();