Beispiel #1
0
function process_form_submissions()
{
    switch ($_GET['m']) {
        case 'logout':
            process_logout();
            break;
        case 'agreements':
            process_agreements();
            break;
        case 'logs':
            process_logs();
            break;
        case 'universities':
            process_universities();
            break;
        case 'travels':
            process_travels();
            break;
        case 'foreigncredits':
            process_foreign_credits();
            break;
        case 'fmficredits':
            process_fmfi_credits();
            break;
        case 'students':
            process_students();
            break;
        case 'studyprogs':
            process_study_programs();
            break;
        case 'fmficourses':
            process_fmfi_courses();
            break;
        case 'subjectareas':
            process_subject_areas();
            break;
        case 'export':
            process_export();
            break;
        case 'app_list':
            get_applications();
            break;
        case 'application_edit':
            application_edit();
            break;
        case 'application_preview':
            application_preview();
            break;
        case 'application_delete':
            application_delete();
            break;
        case 'edit_form':
            edit_application();
            break;
        default:
        case 'welcome':
            show_welcome();
            break;
    }
}
if ($user_id == 0 || $user_id == $USER->id) {
    $user = $USER;
    $currentuser = true;
    $heading = get_string('myapplications', 'local_obu_application');
} else {
    $user = $DB->get_record('user', array('id' => $user_id));
    if (!$user) {
        print_error('invaliduserid');
    }
    $currentuser = false;
    // If we're looking at someone else's forms we may need to lock/remove some UI elements
    $heading = get_string('applications', 'local_obu_application') . ': ' . $user->firstname . ' ' . $user->lastname;
}
$PAGE->set_title($CFG->pageheading . ': ' . get_string('applications', 'local_obu_application'));
// The page contents
echo $OUTPUT->header();
echo $OUTPUT->heading($heading);
$process = new moodle_url('/local/obu_application/process.php');
$applications = get_applications($user->id);
// get all applications for the given user
foreach ($applications as $application) {
    get_application_status($USER->id, $application, $text, $button);
    // get the approval trail and the next action (from this user's perspective)
    if ($button != 'submit' || $currentuser || $manager) {
        echo '<h4><a href="' . $process . '?id=' . $application->id . '">Ref No ' . $application->id . '</a></h4>';
    } else {
        echo '<h4>Ref No ' . $application->id . '</h4>';
    }
    echo $text;
}
echo $OUTPUT->footer();
if ($mform->is_cancelled()) {
    redirect($home);
} else {
    if ($mform_data = $mform->get_data()) {
        if ($mform_data->xfer_type == 1 || $mform_data->xfer_type == 3) {
            $param = read_parameter('ADM');
        } else {
            $param = read_parameter('FIN');
        }
        if ($mform_data->xfer_id == 0) {
            $xfer_id = $param->number + 1;
            // Batch ID
        } else {
            $xfer_id = $mform_data->xfer_id;
        }
        $applications = get_applications();
        // get all applications
        $xfers = array();
        foreach ($applications as $application) {
            if ($application->approval_level == 3 && $application->approval_state == 2 && ($mform_data->xfer_type == 1 && ($application->admissions_xfer == 0 || $application->admissions_xfer == $xfer_id) || $mform_data->xfer_type == 2 && ($application->finance_xfer == 0 || $application->finance_xfer == $xfer_id) || $mform_data->xfer_type == 3 && $application->admissions_xfer == $xfer_id)) {
                // 'Process' (admissions data processing)
                $xfers[] = $application->id;
            }
        }
        if (empty($xfers)) {
            $message = get_string('no_xfer', 'local_obu_application');
        } else {
            if ($mform_data->xfer_type < 3) {
                $delimiter = ',';
                $extension = 'csv';
            } else {
// get outstanding approval requests
if ($approvals) {
    echo '<h2>' . get_string('your_approvals', 'local_obu_application') . '</h2>';
    foreach ($approvals as $approval) {
        $application = read_application($approval->application_id);
        $application_title = $application->firstname . ' ' . $application->lastname . ' (Application Ref HLS/' . $application->id . ')';
        echo '<h4><a href="' . $process . '?id=' . $application->id . '">' . $application_title . '</a></h4>';
        get_application_status($USER->id, $application, $text, $button);
        // get the approval trail and the next action (from the user's perspective)
        echo $text;
    }
} else {
    echo get_string('page_content', 'local_obu_application');
}
// Display applications submitted
$applications = get_applications($USER->id);
// get all applications for the user
if ($applications) {
    echo '<h2>' . get_string('your_applications', 'local_obu_application') . '</h2>';
    foreach ($applications as $application) {
        get_application_status($USER->id, $application, $text, $button);
        // get the approval trail and the next action (from this user's perspective)
        $application_title = $application->course_code . ' ' . $application->course_name . ' (Application Ref HLS/' . $application->id . ')';
        if ($button != 'submit' || $currentuser || $manager) {
            echo '<h4><a href="' . $process . '?id=' . $application->id . '">' . $application_title . '</a></h4>';
        } else {
            echo '<h4>' . $application_title . '</h4>';
        }
        echo $text;
    }
    echo '<h4>' . get_string('amend_application', 'local_obu_application') . '</h4>';