diff --git a/admin/template/template.php b/admin/template/template.php index ff47b671..407fd8ac 100644 --- a/admin/template/template.php +++ b/admin/template/template.php @@ -175,6 +175,16 @@ echo $content; } ?> +<?php +/** + * @var OTS_Account $account_logged + */ +if ($logged && admin()) { + $twig->display('admin-bar.html.twig', [ + 'username' => USE_ACCOUNT_NAME ? $account_logged->getName() : $account_logged->getId() + ]); +} +?> <script src="<?php echo BASE_URL; ?>tools/js/bootstrap.min.js"></script> <script src="<?php echo BASE_URL; ?>tools/js/jquery-ui.min.js"></script> <?php if (isset($use_datatable)) { ?> diff --git a/index.php b/index.php index 1c47f2e8..2117cadc 100644 --- a/index.php +++ b/index.php @@ -369,6 +369,14 @@ if($config['backward_support']) { $topic = $title; } +/** + * @var OTS_Account $account_logged + */ +if ($logged && admin()) { + $content .= $twig->render('admin-bar.html.twig', [ + 'username' => USE_ACCOUNT_NAME ? $account_logged->getName() : $account_logged->getId() + ]); +} $title_full = (isset($title) ? $title . ' - ' : '') . $config['lua']['serverName']; require $template_path . '/' . $template_index; diff --git a/system/templates/admin-bar.html.twig b/system/templates/admin-bar.html.twig new file mode 100644 index 00000000..0825dd27 --- /dev/null +++ b/system/templates/admin-bar.html.twig @@ -0,0 +1,123 @@ +<style> +html { margin-top: 32px !important; } +* html body { margin-top: 32px !important; } + +#ma-admin-bar { + direction: ltr; + color: #ccc; + font-size: 13px; + font-weight: 400; + font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Oxygen-Sans, Ubuntu, Cantarell, "Helvetica Neue", sans-serif; + line-height: 2.46153846; + height: 32px; + position: fixed; + top: 0; + left: 0; + width: 100%; + min-width: 600px; + z-index: 99999; + background: #23282d; +} + +#ma-admin-bar a.ab-item { + color: #eee; + font-weight: normal; +} + +#ma-admin-bar ul, #ma-admin-bar ul li { + background: 0 0; + clear: none; + list-style: none; + margin: 0; + padding: 0 15px 0 0; + position: relative; + text-indent: 0; + z-index: 99999; +} + +#ma-admin-bar li { + float: left; +} + +#ma-admin-bar li:hover { + color: lightskyblue; +} + +#ma-admin-bar .ab-top-secondary>li { + float: right; + margin-right: 15px; +} + +.dropdown { + position: relative; + display: inline-block; +} + +.dropdown-content { + display: none; + position: absolute; + background-color: #343a40; + box-shadow: 0 8px 16px 0 rgba(0,0,0,0.2); + z-index: 1; +} + +.dropdown-content a { + color: #eee; + padding: 12px 16px; + text-decoration: none; + display: block; +} + +.dropdown-content a:hover {color: lightskyblue;} + +.dropdown:hover .dropdown-content {display: block;} + +</style> + +<div id="ma-admin-bar"> + <ul> + <li class="dropdown"> + <a href="{{ constant('ADMIN_URL') }}" class="ab-item"> + <img alt="MyAAC" src="{{ constant('ADMIN_URL') }}images/logo.png" class="brand-image img-circle elevation-3" style="opacity: .8; height: 26px; width: 26px"> + <span class="brand-text"> + <b>My</b>AAC + </span> + </a> + </li> + <li class="dropdown"> + <svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" fill="currentColor" class="bi bi-house-door" viewBox="0 0 16 16"> + <path d="M8.354 1.146a.5.5 0 0 0-.708 0l-6 6A.5.5 0 0 0 1.5 7.5v7a.5.5 0 0 0 .5.5h4.5a.5.5 0 0 0 .5-.5v-4h2v4a.5.5 0 0 0 .5.5H14a.5.5 0 0 0 .5-.5v-7a.5.5 0 0 0-.146-.354L13 5.793V2.5a.5.5 0 0 0-.5-.5h-1a.5.5 0 0 0-.5.5v1.293L8.354 1.146zM2.5 14V7.707l5.5-5.5 5.5 5.5V14H10v-4a.5.5 0 0 0-.5-.5h-3a.5.5 0 0 0-.5.5v4H2.5z"></path> + </svg> + <a class="ab-item" href="#"><i class="bi bi-house"></i>{{ config.lua.serverName }}</a> + <div class="dropdown-content"> + <a href="{{ getLink('') }}">Visit Site</a> + </div> + </li> + <li class="dropdown"> + <a class="ab-item" href="#"><i class="bi bi-house"></i>New</a> + <div class="dropdown-content"> + <a href="{{ constant('ADMIN_URL') }}?p=news&action=new">News</a> + <a href="{{ constant('ADMIN_URL') }}?p=pages&action=new">Page</a> + </div> + </li> + <li> + <a class="ab-item" href="{{ constant('ADMIN_URL') }}?p=plugins"> + Plugins + </a> + </li> + <li> + <a class="ab-item" href="{{ constant('ADMIN_URL') }}?p=dashboard&clear_cache"> + Clear Cache + </a> + </li> + </ul> + <ul class="ab-top-secondary"> + <li class="dropdown"> + <a class="ab-item" href="#">Hello, {{ username }}</a> + <div class="dropdown-content"> + <a href="{{ getLink('account/manage') }}">Manage Account</a> + <a href="{{ constant('ADMIN_URL') }}?action=logout">Logout</a> + </div> + </li> + </ul> +</div>