<?php

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

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

AppAsset::register($this);
//print_r(Yii::$app->user->identity);
//exit;
?>


 <header class="main-header">
         <?= Html::a("<i>NexGMap</i>", Yii::$app->homeUrl, ['class' => 'logo']) ?>
        <!-- Header Navbar: style can be found in header.less -->
        <nav class="navbar navbar-static-top" role="navigation">
          <!-- Sidebar toggle button-->
                <?php if (Yii::$app->controller->action->id == 'map') { ?>
              <a href="#" class="sidebar-toggle" data-toggle="offcanvas" role="button">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </a>
        <?php } ?>
          <div class="navbar-custom-menu">
            <ul class="nav navbar-nav">
                       <?php if (@Yii::$app->user->identity->username) { ?>
                    <li>
                        <a href="<?php echo Url::to(['/locations']); ?>">
                            <i class="glyphicon glyphicon-list"></i>

                            &nbsp;
                            <span>Locations</span>
                            &nbsp;
                        </a>
                    </li>
                    <li>
                        <a href="<?php echo Url::to(['site/map']); ?>">
                            <i class="glyphicon glyphicon-map-marker"></i>

                            &nbsp;
                            <span>Map</span>
                            &nbsp;
                        </a>
                    </li>
                    <li>
                        <a href="#">
                            <i class="glyphicon glyphicon-user"></i>

                            &nbsp;
                            <span><?= @Yii::$app->user->identity->username ?></span>
                            &nbsp;
                        </a>
                    </li>
                    <li>
                        <a href="<?php echo Url::to(['site/logout']); ?>">
                            <i class="glyphicon glyphicon-log-out"></i>&nbsp;
                            <span> Logout</span>
                        </a>
                    </li>   

                <?php } else {
                    ?>
                    <li>   
                        <a href="<?php echo Url::to(['site/login']); ?>">
                            <i class="glyphicon glyphicon-log-in"></i>
                            <span> Login</span>
                        </a>
                    </li>   
                <?php } ?>

            </ul>
          </div>
        </nav>
      </header>

