2013-05-24 10:14:49 -04:00
|
|
|
<?php
|
2024-03-21 13:59:08 +08:00
|
|
|
//USER LAYOUT
|
2022-01-14 22:47:17 +03:00
|
|
|
/** @var yii\web\View $this */
|
2024-02-09 14:14:45 +08:00
|
|
|
|
2022-01-14 22:47:17 +03:00
|
|
|
/** @var string $content */
|
2015-07-09 12:47:20 +03:00
|
|
|
|
2013-11-13 18:17:05 +02:00
|
|
|
use app\assets\AppAsset;
|
2021-05-19 14:01:06 +02:00
|
|
|
use app\widgets\Alert;
|
2022-06-17 17:15:52 +01:00
|
|
|
use yii\bootstrap5\Breadcrumbs;
|
|
|
|
use yii\bootstrap5\Html;
|
|
|
|
use yii\bootstrap5\Nav;
|
|
|
|
use yii\bootstrap5\NavBar;
|
2024-03-08 15:26:36 +08:00
|
|
|
use yii\web\View;
|
2013-05-24 10:14:49 -04:00
|
|
|
|
2013-11-12 06:24:07 +02:00
|
|
|
AppAsset::register($this);
|
2022-08-19 00:57:02 +03:00
|
|
|
|
|
|
|
$this->registerCsrfMetaTags();
|
|
|
|
$this->registerMetaTag(['charset' => Yii::$app->charset], 'charset');
|
|
|
|
$this->registerMetaTag(['name' => 'viewport', 'content' => 'width=device-width, initial-scale=1, shrink-to-fit=no']);
|
|
|
|
$this->registerMetaTag(['name' => 'description', 'content' => $this->params['meta_description'] ?? '']);
|
|
|
|
$this->registerMetaTag(['name' => 'keywords', 'content' => $this->params['meta_keywords'] ?? '']);
|
2022-08-24 17:33:32 +03:00
|
|
|
$this->registerLinkTag(['rel' => 'icon', 'type' => 'image/x-icon', 'href' => Yii::getAlias('@web/favicon.ico')]);
|
2024-03-08 15:26:36 +08:00
|
|
|
$darkMode = Yii::$app->user->isGuest ? 0 : Yii::$app->user->identity->dark_mode;
|
2013-05-24 10:14:49 -04:00
|
|
|
?>
|
2013-11-28 01:19:43 +04:00
|
|
|
<?php $this->beginPage() ?>
|
2013-05-24 10:14:49 -04:00
|
|
|
<!DOCTYPE html>
|
2024-04-01 14:26:47 +08:00
|
|
|
<html lang="<?= Yii::$app->language ?>" class="h-100" <?= $darkMode === 1 ? 'data-bs-theme="dark"' : '' ?> >
|
2013-05-24 10:14:49 -04:00
|
|
|
<head>
|
2024-04-01 14:26:47 +08:00
|
|
|
<title><?= Html::encode($this->title) . ' | ' . Yii::$app->name ?></title>
|
2014-03-16 10:46:16 +06:00
|
|
|
<?php $this->head() ?>
|
2024-04-01 14:26:47 +08:00
|
|
|
<?php
|
|
|
|
if ($_ENV['CLARITY_ENABLED'] === 'true') {
|
|
|
|
$clarityId = $_ENV['CLARITY_ID'];
|
|
|
|
echo <<<EOL
|
|
|
|
<script type="text/javascript">
|
|
|
|
(function(c,l,a,r,i,t,y){
|
|
|
|
c[a]=c[a]||function(){(c[a].q=c[a].q||[]).push(arguments)};
|
|
|
|
t=l.createElement(r);t.async=1;t.src="https://www.clarity.ms/tag/"+i;
|
|
|
|
y=l.getElementsByTagName(r)[0];y.parentNode.insertBefore(t,y);
|
|
|
|
})(window, document, "clarity", "script", "$clarityId");
|
|
|
|
</script>
|
|
|
|
EOL;
|
|
|
|
}
|
|
|
|
if ($_ENV['GA_ENABLED'] === 'true') {
|
|
|
|
$gaId = $_ENV['GA_ID'];
|
|
|
|
echo <<<EOL
|
|
|
|
<!-- Google tag (gtag.js) -->
|
|
|
|
<script async src="https://www.googletagmanager.com/gtag/js?id=$gaId"></script>
|
|
|
|
<script>
|
|
|
|
window.dataLayer = window.dataLayer || [];
|
|
|
|
function gtag(){dataLayer.push(arguments);}
|
|
|
|
gtag('js', new Date());
|
|
|
|
|
|
|
|
gtag('config', '$gaId');
|
|
|
|
</script>
|
|
|
|
EOL;
|
|
|
|
}
|
|
|
|
?>
|
2013-05-24 10:14:49 -04:00
|
|
|
</head>
|
2021-05-19 14:01:06 +02:00
|
|
|
<body class="d-flex flex-column h-100">
|
2013-11-28 01:19:43 +04:00
|
|
|
<?php $this->beginBody() ?>
|
2015-07-09 12:47:20 +03:00
|
|
|
|
2022-08-19 00:57:02 +03:00
|
|
|
<header id="header">
|
2015-07-09 12:47:20 +03:00
|
|
|
<?php
|
|
|
|
NavBar::begin([
|
2024-02-15 11:08:46 +08:00
|
|
|
'brandLabel' => Yii::$app->name,
|
2015-07-09 12:47:20 +03:00
|
|
|
'brandUrl' => Yii::$app->homeUrl,
|
2022-08-19 00:57:02 +03:00
|
|
|
'options' => ['class' => 'navbar-expand-md navbar-dark bg-dark fixed-top']
|
2015-07-09 12:47:20 +03:00
|
|
|
]);
|
|
|
|
echo Nav::widget([
|
2021-05-19 14:01:06 +02:00
|
|
|
'options' => ['class' => 'navbar-nav'],
|
2015-07-09 12:47:20 +03:00
|
|
|
'items' => [
|
2024-02-10 12:03:11 +08:00
|
|
|
['label' => '首页', 'url' => ['/site/index']],
|
2024-02-10 17:41:07 +08:00
|
|
|
['label' => '我的文件', 'url' => ['/home/index']],
|
2024-03-10 16:37:22 +08:00
|
|
|
['label' => '文件保险箱', 'url' => ['/vault/index']],
|
2024-02-16 15:13:29 +08:00
|
|
|
['label' => '分享管理', 'url' => ['/share/index']],
|
2024-02-23 14:37:36 +08:00
|
|
|
['label' => '文件收集', 'url' => ['/collection/index']],
|
2024-03-01 18:04:21 +08:00
|
|
|
['label' => '个人设置', 'url' => ['/user/info']],
|
2022-08-19 00:57:02 +03:00
|
|
|
Yii::$app->user->isGuest
|
2024-02-09 14:14:45 +08:00
|
|
|
? ['label' => '登录', 'url' => ['/user/login']]
|
2022-08-19 00:57:02 +03:00
|
|
|
: '<li class="nav-item">'
|
2024-02-09 14:14:45 +08:00
|
|
|
. Html::beginForm(['/user/logout'])
|
|
|
|
. Html::submitButton(
|
|
|
|
'Logout (' . Yii::$app->user->identity->username . ')',
|
|
|
|
['class' => 'nav-link btn btn-link logout']
|
|
|
|
)
|
|
|
|
. Html::endForm()
|
|
|
|
. '</li>'
|
2022-08-19 00:57:02 +03:00
|
|
|
]
|
2015-07-09 12:47:20 +03:00
|
|
|
]);
|
|
|
|
NavBar::end();
|
|
|
|
?>
|
2021-05-19 14:01:06 +02:00
|
|
|
</header>
|
2013-05-24 10:14:49 -04:00
|
|
|
|
2022-08-19 00:57:02 +03:00
|
|
|
<main id="main" class="flex-shrink-0" role="main">
|
2015-07-09 12:47:20 +03:00
|
|
|
<div class="container">
|
2022-08-19 00:57:02 +03:00
|
|
|
<?php if (!empty($this->params['breadcrumbs'])): ?>
|
|
|
|
<?= Breadcrumbs::widget(['links' => $this->params['breadcrumbs']]) ?>
|
|
|
|
<?php endif ?>
|
2017-08-08 13:02:19 +03:00
|
|
|
<?= Alert::widget() ?>
|
2015-07-09 12:47:20 +03:00
|
|
|
<?= $content ?>
|
2014-03-16 10:46:16 +06:00
|
|
|
</div>
|
2021-05-19 14:01:06 +02:00
|
|
|
</main>
|
2015-07-09 12:47:20 +03:00
|
|
|
|
2024-03-08 15:26:36 +08:00
|
|
|
<footer id="footer" class="mt-auto py-3">
|
2015-07-09 12:47:20 +03:00
|
|
|
<div class="container">
|
2022-08-19 00:57:02 +03:00
|
|
|
<div class="row text-muted">
|
2024-02-09 14:14:45 +08:00
|
|
|
<div class="col-md-6 text-center text-md-start"><?php echo '© Created & Design by ' . '<a href="https://blog.chenx221.cyou" rel="external">Chenx221</a> | 2024 - ' . date('Y') ?></div>
|
|
|
|
<div class="col-md-6 text-center text-md-end"><?= Yii::t('yii', 'Powered by {yii}', [
|
2024-02-16 13:59:54 +08:00
|
|
|
'yii' => '<a href="https://www.yiiframework.com/" rel="external">' . Yii::t('yii',
|
2024-02-09 14:14:45 +08:00
|
|
|
'Yii Framework') . '</a>',
|
|
|
|
]) ?></div>
|
2022-08-19 00:57:02 +03:00
|
|
|
</div>
|
2015-07-09 12:47:20 +03:00
|
|
|
</div>
|
|
|
|
</footer>
|
2013-05-24 10:14:49 -04:00
|
|
|
|
2013-11-28 01:19:43 +04:00
|
|
|
<?php $this->endBody() ?>
|
2013-05-24 10:14:49 -04:00
|
|
|
</body>
|
|
|
|
</html>
|
2024-03-08 15:26:36 +08:00
|
|
|
<?php
|
2024-04-01 14:26:47 +08:00
|
|
|
if ($darkMode === 2) {
|
2024-03-08 15:26:36 +08:00
|
|
|
$this->registerJsFile('@web/js/darkmode_auto.js', ['position' => View::POS_BEGIN]);
|
2024-04-01 14:26:47 +08:00
|
|
|
} else if ($darkMode === 1) {
|
2024-03-08 15:26:36 +08:00
|
|
|
$this->registerJsFile('@web/js/darkmode.js', ['position' => View::POS_BEGIN]);
|
|
|
|
}
|
|
|
|
?>
|
2013-11-28 01:19:43 +04:00
|
|
|
<?php $this->endPage() ?>
|
2024-03-08 15:26:36 +08:00
|
|
|
|