courseList ( $id = '' )

Prints a list of active courses.

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

View source


Used by


Source

function courseList($id = '')
{
    $app = \Liten\Liten::getInstance();
    try {
        $crse = $app->db->course()
            ->select('courseCode')
            ->where('courseID <> ?', $id)->_and_()
            ->where('currStatus = "A"')->_and_()
            ->where('endDate IS NULL')->_or_()
            ->whereLte('endDate', '0000-00-00');
        $q = $crse->find(function ($data) {
            $array = [];
            foreach ($data as $d) {
                $array[] = $d;
            }
            return $array;
        });

        $a = [];
        foreach ($q as $r) {
            $a[] = $r['courseCode'];
        }
        return $a;
    } 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));
    }
}


User Contributed Notes

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