if ($course->supplement != '') { $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 } } }
} } } if ($status_text) { $status_text = '<h3>' . $status_text . '</h3>'; } get_application_status($USER->id, $application, $text, $button_text); // get the approval trail and the next action (from user's perspective) $status_text .= $text; if ($button_text != 'approve') { // If not the next approver, check that this user can view the application if (!$manager && $USER->id != $application->userid) { $message = get_string('application_unavailable', 'local_obu_application'); } } $parameters = ['organisations' => get_organisations(), 'record' => $application, 'status_text' => $status_text, 'button_text' => $button_text]; $mform = new process_form(null, $parameters); if ($mform->is_cancelled()) { redirect($home); } if ($mform_data = $mform->get_data()) { if (isset($mform_data->submitbutton) && $mform_data->submitbutton != get_string('continue', 'local_obu_application')) { update_workflow($application, true, $mform_data->comment); // Approved } else { if (isset($mform_data->rejectbutton) && $mform_data->rejectbutton == get_string('reject', 'local_obu_application')) { update_workflow($application, false, $mform_data->comment); // Rejected } else { if (isset($mform_data->amendcoursebutton) && $mform_data->amendcoursebutton == get_string('amend_course', 'local_obu_application')) { redirect($home . 'local/obu_application/mdl_amend_course.php?id=' . $application->id);
} $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_funding.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 = ''; $organisations = get_organisations(); $parameters = ['organisations' => $organisations, 'application' => $application]; $mform = new mdl_amend_funding_form(null, $parameters); if ($mform->is_cancelled()) { redirect($process); } if ($mform_data = $mform->get_data()) { // Update the applications's funding fields $application->funding_id = $mform_data->funding_id; if ($application->funding_id == 0) { // Must be an invoice to a non-NHS organisation $application->funding_method = 0; // Invoice to a non-NHS organisation $application->funding_organisation = $mform_data->funding_organisation; // Organisation as input $application->funder_name = '';