<commit_before><commit_msg>导航栏  各个角色的判断 没弄完<commit_after><?php

/* @var $this \yii\web\View */
/* @var $content string */

use yii\helpers\Html;
use yii\bootstrap\Nav;
use yii\bootstrap\NavBar;
use yii\widgets\Breadcrumbs;
use app\assets\AppAsset;

AppAsset::register($this);
?>
<?php $this->beginPage() ?>
<!DOCTYPE html>
<html lang="<?= Yii::$app->language ?>">
<head>
    <meta charset="<?= Yii::$app->charset ?>">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <?= Html::csrfMetaTags() ?>
    <title><?= Html::encode($this->title) ?></title>
    <?php $this->head() ?>
</head>
<body>
<?php $this->beginBody() ?>

<div class="wrap">
    <?php
    $session = Yii::$app->session;
    $session->open();
    NavBar::begin([
        'brandLabel' => 'Selecting Subjects System',
        'brandUrl' => Yii::$app->homeUrl,
        'options' => [
            'class' => 'navbar-inverse navbar-fixed-top',
        ],
    ]);
    $items = array();
    switch ($session['yii']['type']) {
        case 'xs':
            $items = [
                ['label' => 'Edit', 'url' => ['/student/index']],
                ['label' => 'about', 'url' => ['/index/about']],
                [
                    'label' => 'Logout (' . $_SESSION['yii']['name'] . ')',
                    'url' => ['/index/logout'],
//                    'linkOptions' => ['data-method' => 'post']
                ],
            ];
            break;
        case 'tc':
            $items = [
                ['label' => 'Edit', 'url' => ['/index/index']],
                ['label' => 'about', 'url' => ['/index/about']],
                [
                    'label' => 'Logout (' . $_SESSION['yii']['name'] . ')',
                    'url' => ['/index/logout'],
//                    'linkOptions' => ['data-method' => 'post']
                ],
            ];
            break;
        case 'su':
            $items = [
                ['label' => 'Edit', 'url' => ['/su/index/index']],
                ['label' => 'about', 'url' => ['/index/about']],
                [
                    'label' => 'Logout (' . $_SESSION['yii']['name'] . ')',
                    'url' => ['/su/index/logout'],
//                    'linkOptions' => ['data-method' => 'post']
                ],
            ];
            break;
        default:
            $items = [
                ['label' => 'Home', 'url' => ['/index/index']],
                ['label' => 'about', 'url' => ['/index/about']],
                ['label' => 'login', 'url' => ['/index/login']],
            ];
            break;
    }

//    echo Nav::widget([
//        'options' => ['class' => 'navbar-nav navbar-right'],
//        'items' =>$items
//    ]);
//    NavBar::end();
    echo Nav::widget([
        'options' => ['class' => 'navbar-nav navbar-right'],
        'items' => [
            !isset($_SESSION['yii']['islogin']) ?
                ['label' => 'Home', 'url' => ['/index/index']] :
                ['label' => 'Edit', 'url' => ['/student/index']],
            ['label' => 'About', 'url' => ['/index/about']],
            !isset($_SESSION['yii']['islogin']) ?
                ['label' => 'Login', 'url' => ['/index/login']] :
                [
                    'label' => 'Logout (' . $_SESSION['yii']['name'] . ')',
                    'url' => ['/index/logout'],
//                    'linkOptions' => ['data-method' => 'post']
                ],
        ],
    ]);
    NavBar::end();
    ?>

    <div class="container">
        <?= Breadcrumbs::widget([
            'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
        ]) ?>
        <?= $content ?>
    </div>
</div>

<footer class="footer">
    <div class="container">
        <p class="pull-left">&copy; My Company <?= date('Y') ?></p>

        <p class="pull-right"><?= Yii::powered() ?></p>
    </div>
</footer>

<?php $this->endBody() ?>
</body>
</html>
<?php $this->endPage() ?>

{'fraction_non_alphanumeric': 0.2449341438703141, 'fraction_numerical': 0.00025329280648429586, 'mean_word_length': 1.6791044776119404, 'pattern_counts': {'":': 0, '<': 41, '<?xml version=': 0, '>': 107, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '502149', 'n_tokens_mistral': 1273, 'n_tokens_neox': 1246, 'n_words': 215}