get_perm_roles ()

Retrieves a list of roles from the roles table.

Return: (mixed)

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

View source


Used by


Source

function get_perm_roles()
{
    $app = \Liten\Liten::getInstance();
    try {
        $query = $app->db->query('SELECT
    		trim(leading "0" from id) AS roleID, roleName
		FROM role');
        $result = $query->find(function ($data) {
            $array = [];
            foreach ($data as $d) {
                $array[] = $d;
            }
            return $array;
        });

        foreach ($result as $r) {
            echo '<option value="' . _h($r['roleID']) . '">' . _h($r['roleName']) . '</option>' . "\n";
        }
    } catch (NotFoundException $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 (ORMException $e) {
        Cascade::getLogger('error')->error($e->getMessage());
        _etsis_flash()->error(_etsis_flash()->notice(409));
    }
}


Changelog


User Contributed Notes

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