public function actionIndex()
    {
        /** @var User */
        $user = Yii::$app->user;
        $subscribedOnly = $user->can('nfy.queue.read.subscribed');
        $queues = [];
        foreach ($this->module->queues as $queueId) {
            /** @var Queue */
            $queue = Yii::$app->get($queueId);
            if (!($queue instanceof components\QueueInterface)
                || ($subscribedOnly
                    && !$queue->isSubscribed($user->getId()))
            ) {
                continue;
            }
            $queues[$queueId] = $queue;
        }

        return $this->render('index', [
            'queues' => $queues,
            'subscribedOnly' => $subscribedOnly,
        ]);
    }
public function actionIndex()
    {
        /** @var User */
        $user = Yii::$app->user;
        $subscribedOnly = $user->can('nfy.queue.read.subscribed');
        $queues = [];
        foreach ($this->module->queues as $queueId) {
            /** @var Queue */
            $queue = Yii::$app->get($queueId);
            if (!($queue instanceof components\QueueInterface)
                || ($subscribedOnly
                    && !$queue->isSubscribed($user->getId()))
            ) {
                continue;
            }
            $queues[$queueId] = $queue;
        }

        return $this->render('index', [
            'queues' => $queues,
            'subscribedOnly' => $subscribedOnly,
        ]);
    }
public function actionIndex ( ) { /** @var User */ $ user = Yii :: $ app -> user ; $ subscribedOnly = $ user -> can ( 'nfy.queue.read.subscribed' ) ; $ queues = [ ] ; foreach ( $ this -> module -> queues as $ queueId ) { /** @var Queue */ $ queue = Yii :: $ app -> get ( $ queueId ) ; if ( ! ( $ queue instanceof components \ QueueInterface ) || ( $ subscribedOnly && ! $ queue -> isSubscribed ( $ user -> getId ( ) ) ) ) { continue ; } $ queues [ $ queueId ] = $ queue ; } return $ this -> render ( 'index' , [ 'queues' => $ queues , 'subscribedOnly' => $ subscribedOnly , ] ) ; }
Displays a list of queues and their subscriptions.
Displays a list of queues and their subscriptions .