etsis_clvr_rule ( int $stuID, string $level )

Student class level rule.

Return: (string)

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

View source


Parameters

$stuID

(int) (Required) Unique student ID.

$level

(string) (Required) Student academic level.


Used by


Source

function etsis_clvr_rule($stuID, $level)
{
    $app = \Liten\Liten::getInstance();
    try {
        $node = Node::table('clvr')->where('level', '=', $level)->findAll();
        foreach ($node as $clvr) {
            $rlde = get_rule_by_code(_escape($clvr->rule));
            try {
                $clas = $app->db->query(
                    "SELECT v_scrd.stuID FROM $rlde->file"
                    . " INNER JOIN stal ON v_scrd.stuID = stal.stuID AND v_scrd.acadLevel = stal.acadLevelCode"
                    . " WHERE v_scrd.acadLevel = ?"
                    . " AND $rlde->rule"
                    . " AND (stal.endDate IS NULL"
                    . " OR stal.endDate <= '0000-00-00')", [_escape($clvr->level)]
                );

                $q = $clas->find(function ($data) {
                    $array = [];
                    foreach ($data as $d) {
                        $array[] = $d;
                    }
                    return $array;
                });
                $a = [];
                foreach ($q as $row) {
                    $a[] = _escape($row['stuID']);
                }

                if (in_array($stuID, $a)) {
                    return _escape($clvr->value);
                }
            } catch (NotFoundException $e) {
                Cascade::getLogger('error')->error($e->getMessage());
                _etsis_flash()->error(_etsis_flash()->notice(409));
            } catch (ORMException $e) {
                Cascade::getLogger('error')->error($e->getMessage());
                _etsis_flash()->error(_etsis_flash()->notice(409));
            } catch (Exception $e) {
                Cascade::getLogger('error')->error($e->getMessage());
                _etsis_flash()->error(_etsis_flash()->notice(409));
            }
        }
    } catch (NodeQException $e) {
        Cascade::getLogger('error')->error(sprintf('NODEQSTATE[%s]: %s', $e->getCode(), $e->getMessage()));
    } catch (Exception $e) {
        Cascade::getLogger('error')->error(sprintf('NODEQSTATE[%s]: %s', $e->getCode(), $e->getMessage()));
    }
}

Changelog

  • Since: eduTrac SIS 6.3.0

User Contributed Notes

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