main.php 2.08 KB
<?php
    
    /* @var $this \yii\web\View */
    
    /* @var $content string */
    
    use frontend\assets\MaterializeAsset;
    use yii\helpers\Html;
    use yii\helpers\Url;
    use yii\web\View;
    use yii\widgets\Breadcrumbs;
    use frontend\assets\AppAsset;
    use common\widgets\Alert;
    
    AppAsset::register($this);
    MaterializeAsset::register($this);
    
    $js = <<< JS
$(".button-collapse").sideNav();
JS;
    
    $this->registerJs($js, View::POS_READY);

?>
<?php $this->beginPage() ?>
<!DOCTYPE html>
<html lang="<?= Yii::$app->language ?>">
  <head>
    <meta charset="<?= Yii::$app->charset ?>">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
      <?= Html::csrfMetaTags() ?>
    <title><?= Html::encode($this->title) ?></title>
      <?php $this->head() ?>
  </head>
  <body>
      <?php $this->beginBody() ?>
    
    <div class="wrap">
        
        <?php
            if (!\Yii::$app->getUser()->isGuest) {
                ?>
              <ul id="slide-out" class="side-nav">
                
                <li><a href="<?= Url::to([ 'site/index' ]) ?>"><i class="material-icons">home</i>Home</a></li>
                <li><a data-method="POST" href="<?= Url::to(
                        [ 'site/logout' ]
                    ) ?>"><i class="material-icons">exit_to_app</i>Logout</a>
                </li>
              
              </ul>
              <a href="#" data-activates="slide-out" class="button-collapse waves-effect waves-light btn"><i class="material-icons left">menu</i>Menu</a>
                <?php
            }
        ?>
      
      <div class="container">
          
          <?= Alert::widget() ?>
          <?= $content ?>
      </div>
    </div>
    
    <footer class="footer">
      <div class="container">
        <p class="pull-left">&copy; Calls - ArtWeb <?= date('Y') ?></p>
      </div>
    </footer>
      
      <?php $this->endBody() ?>
  </body>
</html>
<?php $this->endPage() ?>