yii2-netdisk/views/layouts/main.php

82 lines
2.3 KiB
PHP
Raw Normal View History

2013-05-24 22:14:49 +08:00
<?php
/** @var yii\web\View $this */
/** @var string $content */
use app\assets\AppAsset;
2021-05-19 20:01:06 +08:00
use app\widgets\Alert;
use yii\bootstrap4\Breadcrumbs;
use yii\bootstrap4\Html;
use yii\bootstrap4\Nav;
use yii\bootstrap4\NavBar;
2013-05-24 22:14:49 +08:00
2013-11-12 12:24:07 +08:00
AppAsset::register($this);
2013-05-24 22:14:49 +08:00
?>
2013-11-28 05:19:43 +08:00
<?php $this->beginPage() ?>
2013-05-24 22:14:49 +08:00
<!DOCTYPE html>
2021-05-19 20:01:06 +08:00
<html lang="<?= Yii::$app->language ?>" class="h-100">
2013-05-24 22:14:49 +08:00
<head>
<meta charset="<?= Yii::$app->charset ?>">
2021-05-19 20:01:06 +08:00
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<?php $this->registerCsrfMetaTags() ?>
2014-03-16 12:46:16 +08:00
<title><?= Html::encode($this->title) ?></title>
<?php $this->head() ?>
2013-05-24 22:14:49 +08:00
</head>
2021-05-19 20:01:06 +08:00
<body class="d-flex flex-column h-100">
2013-11-28 05:19:43 +08:00
<?php $this->beginBody() ?>
2021-05-19 20:01:06 +08:00
<header>
<?php
NavBar::begin([
'brandLabel' => Yii::$app->name,
'brandUrl' => Yii::$app->homeUrl,
'options' => [
2021-05-19 20:01:06 +08:00
'class' => 'navbar navbar-expand-md navbar-dark bg-dark fixed-top',
],
]);
echo Nav::widget([
2021-05-19 20:01:06 +08:00
'options' => ['class' => 'navbar-nav'],
'items' => [
['label' => 'Home', 'url' => ['/site/index']],
['label' => 'About', 'url' => ['/site/about']],
['label' => 'Contact', 'url' => ['/site/contact']],
Yii::$app->user->isGuest ? (
['label' => 'Login', 'url' => ['/site/login']]
) : (
'<li>'
2021-05-19 20:01:06 +08:00
. Html::beginForm(['/site/logout'], 'post', ['class' => 'form-inline'])
. Html::submitButton(
'Logout (' . Yii::$app->user->identity->username . ')',
2016-10-14 06:13:07 +08:00
['class' => 'btn btn-link logout']
)
. Html::endForm()
. '</li>'
)
],
]);
NavBar::end();
?>
2021-05-19 20:01:06 +08:00
</header>
2013-05-24 22:14:49 +08:00
2021-05-19 20:01:06 +08:00
<main role="main" class="flex-shrink-0">
<div class="container">
<?= Breadcrumbs::widget([
'links' => isset($this->params['breadcrumbs']) ? $this->params['breadcrumbs'] : [],
]) ?>
2017-08-08 18:02:19 +08:00
<?= Alert::widget() ?>
<?= $content ?>
2014-03-16 12:46:16 +08:00
</div>
2021-05-19 20:01:06 +08:00
</main>
2021-05-19 20:01:06 +08:00
<footer class="footer mt-auto py-3 text-muted">
<div class="container">
2021-05-19 20:01:06 +08:00
<p class="float-left">&copy; My Company <?= date('Y') ?></p>
<p class="float-right"><?= Yii::powered() ?></p>
</div>
</footer>
2013-05-24 22:14:49 +08:00
2013-11-28 05:19:43 +08:00
<?php $this->endBody() ?>
2013-05-24 22:14:49 +08:00
</body>
</html>
2013-11-28 05:19:43 +08:00
<?php $this->endPage() ?>