check_prereq ( int $stuID, int $sectID )

The prereq check runs when a student tries to register for a course.

Return: (boolean)

Source file: app/functions/student-function.php

View source


Parameters

$stuID

(int) (Required) Unique student ID.

$sectID

(int) (Required) Unique course section ID.


Used by

Uses


Source

function check_prereq($stuID, $sectID)
{
    $app = \Liten\Liten::getInstance();
    /**
     * If staff member has this permission, then he/she
     * will be able to register a student into a course section
     * in spite of the student's restriction.
     */
    if (hasPermission('override_rule')) {
        return true;
    }

    $sect = get_course_sec($sectID);
    $crse = get_course(_h($sect->courseID));
    $dept = get_department(_h($crse->deptCode));

    if (crse_prereq($stuID, $sectID) == false || etsis_prereq_rule($stuID, _h($crse->courseID)) == false) {
        $message = _escape($crse->printText);
        $message = str_replace('{name}', get_name($stuID), $message);
        $message = str_replace('{stuID}', get_alt_id($stuID), $message);
        $message = str_replace('{course}', _h($crse->courseCode), $message);
        $message = str_replace('{deptName}', _h($dept->deptName), $message);
        $message = str_replace('{deptEmail}', _h($dept->deptEmail), $message);
        $message = str_replace('{deptPhone}', _h($dept->deptPhone), $message);
        _etsis_flash()->error($message, $app->req->server['HTTP_REFERER']);
        return false;
    }
    return true;
}


Changelog

  • Since: eduTrac SIS 6.3.0

User Contributed Notes

You must log in before being able to contribute a note.