Example #1
0
    $navItems = [['label' => 'Home', 'url' => ['/site/index']], ['label' => 'Outside Attraction', 'url' => ['/outside-attraction/index']], ['label' => 'Schedule', 'url' => ['/activity/index']], ['label' => 'Login', 'url' => ['/site/login']]];
} else {
    $navItems = [['label' => 'User', 'url' => ['/user/index'], 'visible' => Yii::$app->user->can('userIndex')], ['label' => 'Schedule', 'url' => ['/activity/index']], ['label' => 'Outside Attraction', 'url' => ['/outside-attraction/index']], ['label' => 'Forum', 'url' => ['/post/index']], ['label' => 'Feedback', 'url' => ['/survey/index']], ['label' => 'Attendance', 'url' => ['/activity/record'], 'visible' => Yii::$app->user->can('activityRecord')], ['label' => 'Announcement', 'url' => ['/announcement/index'], 'visible' => Yii::$app->user->can('announcementIndex')], ['label' => 'Venue Management', 'items' => [['label' => 'Venue', 'url' => ['/venue/index'], 'visible' => Yii::$app->user->can('venueIndex')], ['label' => 'Venue Type', 'url' => ['/venue-type/index'], 'visible' => Yii::$app->user->can('venueTypeIndex')]], 'visible' => Yii::$app->user->can('venueIndex')], ['label' => 'Topic/Category Management', 'items' => [['label' => 'Topic', 'url' => ['/topic/index'], 'visible' => Yii::$app->user->can('topicIndex')], ['label' => 'Category', 'url' => ['/category/index'], 'visible' => Yii::$app->user->can('categoryIndex')]], 'visible' => Yii::$app->user->can('topicIndex')], ['label' => 'Coupon', 'url' => ['/coupon/index']], ['label' => 'Speaker Display', 'url' => ['/user-bibi/index'], 'visible' => Yii::$app->user->can('userBibiIndex')], ['label' => 'Logout (' . Yii::$app->user->identity->username . ')', 'url' => ['/site/logout'], 'linkOptions' => ['data-method' => 'post']]];
}
echo Nav::widget(['options' => ['class' => 'navbar-nav'], 'items' => $navItems]);
if (Yii::$app->user->can('qrCodeGenerate')) {
    //processing qr code data
    $errorCorrectionLevel = 'L';
    $matrixPointSize = 4;
    if (isset($_REQUEST['level']) && in_array($_REQUEST['level'], array('L', 'M', 'Q', 'H'))) {
        $errorCorrectionLevel = $_REQUEST['level'];
    }
    if (isset($_REQUEST['size'])) {
        $matrixPointSize = min(max((int) $_REQUEST['size'], 1), 10);
    }
    $activity = \app\models\Activity::getNextActivity();
    if (!Yii::$app->user->isGuest && $activity != false) {
        // user data
        QRcode::png('https://comp3421-3-ansonmouse1-1.c9users.io/web/index.php?r=participant-has-activity/attend&id=' . Yii::$app->user->identity->getId() . '&activity=' . $activity['id'] . '&user=admin&token=admin', $filename, $errorCorrectionLevel, $matrixPointSize, 2);
        echo '<div class="qrCode">
                    <img src="' . $PNG_WEB_DIR . basename($filename) . '"><br>
                    Token for activity at<br> ' . $activity['startDatetime'] . '
                  </div>';
    }
}
NavBar::end();
if (!Yii::$app->user->isGuest) {
    echo '<div class="notification-dropdown-container">
                <button class="btn btn-default dropdown-toggle" type="button" id="notification-btn" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
                    <span class="glyphicon glyphicon-inbox" aria-hidden="true"></span>
                    <span class="badge" id="notification-counter"></span>