コード例 #1
0
$parameters = ['modular' => $form->modular, 'data_id' => $data_id, 'template' => $template, 'username' => null, 'surname' => null, 'forenames' => null, 'current_course' => null, 'start_dates' => null, 'start_selected' => null, 'adviser' => null, 'supervisor' => null, 'course' => null, 'not_enroled' => null, 'enroled' => null, 'study_mode' => null, 'reason' => null, 'addition_reason' => null, 'deletion_reason' => null, 'fields' => $fields, 'auth_state' => $record->authorisation_state, 'auth_level' => $record->authorisation_level, 'status_text' => $status_text, 'button_text' => $button_text];
$mform = new form_view(null, $parameters);
if ($mform->is_cancelled()) {
    redirect($home);
} else {
    if ($mform_data = $mform->get_data()) {
        if ($mform_data->redirectbutton == get_string('redirect', 'local_obu_forms') && is_manager($form) && $record->authorisation_state == 0) {
            // They want to redirect the form
            redirect($redirect_form);
        } else {
            if ($button_text == 'authorise' && $mform_data->submitbutton != get_string('continue', 'local_obu_forms') && $mform_data->auth_state == $record->authorisation_state && $mform_data->auth_level == $record->authorisation_level) {
                // Check nothing happened while we were away (or they clicked twice)
                if ($mform_data->rejectbutton != get_string('reject', 'local_obu_forms')) {
                    update_workflow(true, $mform_data->comment);
                } else {
                    update_workflow(false, $mform_data->comment);
                }
            }
        }
        if ($USER->id == $record->author) {
            // Looking at their own form
            redirect($dir);
        } else {
            redirect($home);
        }
    }
}
echo $OUTPUT->header();
if ($message) {
    notice($message, $home);
} else {
コード例 #2
0
    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);
                // Amend the course
            } else {
                if (isset($mform_data->amendfundingbutton) && $mform_data->amendfundingbutton == get_string('amend_funding', 'local_obu_application')) {
                    redirect($home . 'local/obu_application/mdl_amend_funding.php?id=' . $application->id);
                    // Amend the funding
                }
            }
        }
    }
    redirect($home);
}
コード例 #3
0
        $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);
} else {
    if ($mform_data = $mform->get_data()) {
        if ($button_text == 'approve' && $mform_data->submitbutton != get_string('continue', 'local_obu_application') && $mform_data->approval_state == $application->approval_state && $mform_data->approval_level == $application->approval_level) {
            // Check nothing happened while we were away (or they clicked twice)
            if (isset($mform_data->rejectbutton) && $mform_data->rejectbutton == get_string('reject', 'local_obu_application')) {
                // Application rejected
                update_workflow($application, false, $mform_data);
            } else {
                update_workflow($application, true, $mform_data);
            }
            $approvals = get_approvals($USER->email);
            // Any more approval requests?
            if (empty($approvals)) {
                // No there aren't
                redirect($logout);
            }
        }
        redirect($home);
    }
}
echo $OUTPUT->header();
echo $OUTPUT->heading(get_string('application', 'local_obu_application', $application->id));
if ($message) {
    notice($message, $home);