Exemple #1
0
function add_all_user_to_a_reader($id)
{
    $uids = get_all_uids();
    foreach ($uids as $uid) {
        add_permission($uid, $id, null);
    }
}
Exemple #2
0
function list_readers_action($uid)
{
    // needed to set the tab active
    $readers_active = true;
    if (user_is_admin($uid)) {
        // dealing with permission add form
        if (isset($_POST['uid']) && isset($_POST['id'])) {
            $permission_added = get_permission($_POST['uid'], $_POST['id']);
            // permission exists
            if ($permission_added) {
                update_permission($_POST['uid'], $_POST['id'], $_POST['end']);
            } else {
                add_permission($_POST['uid'], $_POST['id'], $_POST['end']);
            }
        }
        // list all the readers
        $readers = get_all_readers();
        // list all the swipe records
        $swipes = get_all_swipes();
        // Fetch all the users UIDs
        $uids = get_all_uids();
        require 'templates/readers.php';
    } else {
        require 'templates/login.php';
    }
}