S2OJ/web/app/views/main-nav.php

282 lines
10 KiB
PHP
Raw Normal View History

2022-09-23 13:00:17 +00:00
<?php
2023-02-04 03:29:12 +00:00
if (isset($REQUIRE_LIB['bootstrap5'])) {
$new_user_msg_num = DB::selectCount("select count(*) from user_msg where receiver = '" . Auth::id() . "' and read_time is null");
$new_system_msg_num = DB::selectCount("select count(*) from user_system_msg where receiver = '" . Auth::id() . "' and read_time is null");
$new_msg_tot = $new_user_msg_num + $new_system_msg_num;
}
?>
2022-09-23 13:00:17 +00:00
2022-09-23 22:58:20 +00:00
<div class="navbar navbar-light navbar-expand-md
2023-02-04 03:29:12 +00:00
<?php if (isset($REQUIRE_LIB['bootstrap5'])) : ?>
2022-09-23 22:58:20 +00:00
bg-white shadow-sm
2023-02-04 03:29:12 +00:00
<?php else : ?>
2022-09-23 22:58:20 +00:00
bg-light
<?php endif ?>
2023-02-04 03:29:12 +00:00
<?php if (!isset($disable_navbar_margin_bottom)) : ?>
2023-01-30 10:47:44 +00:00
mb-4
<?php endif ?>
" role="navigation">
2023-02-04 03:29:12 +00:00
<?php if (isset($REQUIRE_LIB['bootstrap5'])) : ?>
<div class="container">
<?php endif ?>
2023-01-30 10:47:44 +00:00
<a class="navbar-brand fw-normal" href="<?= HTML::url('/') ?>">
2023-02-04 03:29:12 +00:00
<?php if (isset($REQUIRE_LIB['bootstrap5'])) : ?>
<img src="<?= HTML::url('/images/logo_small.png') ?>" alt="Logo" width="24" height="24" class="d-inline-block align-text-top" />
2022-09-23 13:00:17 +00:00
<?php endif ?>
<?= UOJConfig::$data['profile']['oj-name-short'] ?>
</a>
2023-02-04 03:29:12 +00:00
<?php if (isset($REQUIRE_LIB['bootstrap5'])) : ?>
<button class="navbar-toggler" type="button" data-bs-toggle="collapse" data-bs-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<?php else : ?>
<button type="button" class="navbar-toggler collapsed" data-toggle="collapse" data-target=".navbar-collapse">
2022-10-12 12:35:23 +00:00
<?php endif ?>
2023-02-04 03:29:12 +00:00
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarSupportedContent">
<ul class="nav navbar-nav mr-auto">
<li class="nav-item">
<a class="nav-link" href="<?= HTML::url('/contests') ?>">
<?php if (isset($REQUIRE_LIB['bootstrap5'])) : ?>
<i class="bi bi-bar-chart"></i>
<?php else : ?>
<span class="glyphicon glyphicon-stats"></span>
<?php endif ?>
<?= UOJLocale::get('contests') ?>
2022-09-23 13:00:17 +00:00
</a>
</li>
2023-02-04 03:29:12 +00:00
<li class="nav-item">
<a class="nav-link" href="<?= HTML::url('/problems') ?>">
<?php if (isset($REQUIRE_LIB['bootstrap5'])) : ?>
<i class="bi bi-list-task"></i>
<?php else : ?>
<span class="glyphicon glyphicon-th-list"></span>
<?php endif ?>
<?= UOJLocale::get('problems') ?>
2022-09-23 13:00:17 +00:00
</a>
</li>
2023-02-04 03:29:12 +00:00
<li class="nav-item">
<a class="nav-link" href="<?= HTML::url('/groups') ?>">
<?php if (isset($REQUIRE_LIB['bootstrap5'])) : ?>
<i class="bi bi-people"></i>
<?php else : ?>
<span class="glyphicon glyphicon-education"></span>
<?php endif ?>
<?= UOJLocale::get('groups') ?>
</a>
</li>
<li class="nav-item">
<a class="nav-link" href="<?= HTML::url('/lists') ?>">
<?php if (isset($REQUIRE_LIB['bootstrap5'])) : ?>
<i class="bi bi-card-list"></i>
<?php else : ?>
<span class="glyphicon glyphicon-list-alt"></span>
<?php endif ?>
<?= UOJLocale::get('problems lists') ?>
2022-09-23 13:00:17 +00:00
</a>
</li>
2023-02-04 03:29:12 +00:00
<li class="nav-item">
<a class="nav-link" href="<?= HTML::url('/submissions') ?>">
<?php if (isset($REQUIRE_LIB['bootstrap5'])) : ?>
<i class="bi bi-pie-chart"></i>
<?php else : ?>
<span class="glyphicon glyphicon-tasks"></span>
2022-09-23 13:00:17 +00:00
<?php endif ?>
2023-02-04 03:29:12 +00:00
<?= UOJLocale::get('submissions') ?>
2022-09-23 13:00:17 +00:00
</a>
</li>
2023-02-04 03:29:12 +00:00
<li class="nav-item">
<a class="nav-link" href="<?= HTML::url('/hacks') ?>">
<?php if (isset($REQUIRE_LIB['bootstrap5'])) : ?>
<i class="bi bi-flag"></i>
<?php else : ?>
<span class="glyphicon glyphicon-flag"></span>
2022-09-23 13:00:17 +00:00
<?php endif ?>
2023-02-04 03:29:12 +00:00
<?= UOJLocale::get('hacks') ?>
2022-09-23 13:00:17 +00:00
</a>
</li>
2023-02-04 03:29:12 +00:00
<li class="nav-item">
<a class="nav-link" href="<?= HTML::blog_list_url() ?>">
<?php if (isset($REQUIRE_LIB['bootstrap5'])) : ?>
<i class="bi bi-pencil-square"></i>
<?php else : ?>
<span class="glyphicon glyphicon-edit"></span>
<?php endif ?>
<?= UOJLocale::get('blogs') ?>
</a>
</li>
<?php if (isset($REQUIRE_LIB['bootstrap5'])) : ?>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
<i class="bi bi-grid-3x3-gap"></i>
<?= UOJLocale::get('apps') ?>
2022-09-23 13:00:17 +00:00
</a>
2023-02-04 03:29:12 +00:00
<ul class="dropdown-menu">
<li>
<a class="dropdown-item" href="<?= HTML::url('/apps/image_hosting') ?>">
<i class="bi bi-images"></i>
<?= UOJLocale::get('image hosting') ?>
</a>
</li>
<li>
<a class="dropdown-item" href="<?= HTML::url('/apps/html2markdown') ?>">
<i class="bi bi-markdown"></i>
<?= UOJLocale::get('html to markdown') ?>
</a>
</li>
<li>
<a class="dropdown-item" href="<?= HTML::url('/apps/diff_online') ?>">
<i class="bi bi-file-earmark-diff"></i>
<?= UOJLocale::get('diff online') ?>
</a>
</li>
</ul>
2022-09-23 13:00:17 +00:00
</li>
<?php endif ?>
2023-02-04 03:29:12 +00:00
<li class="nav-item">
<a class="nav-link" href="<?= HTML::url('/faq') ?>">
<?php if (isset($REQUIRE_LIB['bootstrap5'])) : ?>
<i class="bi bi-question-circle"></i>
<?php else : ?>
<span class="glyphicon glyphicon-info-sign"></span>
<?php endif ?>
<?= UOJLocale::get('help') ?>
2022-09-23 13:00:17 +00:00
</a>
</li>
</ul>
2023-02-04 03:29:12 +00:00
<?php if (isset($REQUIRE_LIB['bootstrap5'])) : ?>
<hr class="d-md-none text-muted">
<ul class="nav navbar-nav ms-md-auto">
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
<i class="bi bi-translate"></i>
<?= UOJLocale::get('_common_name') ?>
</a>
<ul class="dropdown-menu">
<li>
<a class="dropdown-item" href="<?= HTML::url(UOJContext::requestURI(), array('params' => array('locale' => 'zh-cn'))) ?>">
中文
</a>
</li>
<li>
<a class="dropdown-item" href="<?= HTML::url(UOJContext::requestURI(), array('params' => array('locale' => 'en'))) ?>">
English
</a>
</li>
</ul>
</li>
<?php if (Auth::check()) : ?>
<li class="nav-item dropdown">
<a class="nav-link dropdown-toggle" href="#" role="button" data-bs-toggle="dropdown" aria-expanded="false">
<i class="bi bi-person-fill"></i>
<span class="position-relative">
<?= Auth::id() ?>
<?php if ($new_msg_tot) : ?>
<span class="badge bg-danger rounded-pill">
<?= $new_msg_tot > 99 ? "99+" : $new_msg_tot ?>
</span>
<?php endif ?>
</span>
</a>
<ul class="dropdown-menu">
<li>
<a class="dropdown-item" href="<?= HTML::url('/user/' . Auth::id()) ?>">
<?= UOJLocale::get('my profile') ?>
</a>
</li>
<li>
<a class="dropdown-item" href="<?= HTML::url('/user_msg') ?>">
<?= UOJLocale::get('private message') ?>
<?php if ($new_user_msg_num) : ?>
<span class="badge bg-danger rounded-pill">
<?= $new_user_msg_num > 99 ? "99+" : $new_user_msg_num ?>
</span>
<?php endif ?>
</a>
</li>
<li>
<a class="dropdown-item" href="<?= HTML::url('/user/' . Auth::id() . '/system_msg') ?>">
<?= UOJLocale::get('system message') ?>
<?php if ($new_system_msg_num) : ?>
<span class="badge bg-danger rounded-pill">
<?= $new_system_msg_num > 99 ? "99+" : $new_system_msg_num ?>
</span>
<?php endif ?>
</a>
</li>
<?php if (isSuperUser(Auth::user())) : ?>
<li>
<a class="dropdown-item" href="<?= HTML::url('/super_manage') ?>">
<?= UOJLocale::get('system manage') ?>
</a>
</li>
<?php endif ?>
<li>
<hr class="dropdown-divider">
</li>
<li>
<a class="dropdown-item" href="<?= HTML::url('/logout?_token=' . crsf_token()) ?>">
<?= UOJLocale::get('logout') ?>
</a>
</li>
</ul>
</li>
<?php else : ?>
<li class="nav-item">
<a class="nav-link" href="<?= HTML::url('/login') ?>">
<i class="bi bi-box-arrow-in-right"></i>
<?= UOJLocale::get('login') ?>
</a>
</li>
<?php if (UOJConfig::$data['switch']['open-register'] || !DB::selectCount("SELECT COUNT(*) FROM user_info")) : ?>
<li class="nav-item">
<a class="nav-link" href="<?= HTML::url('/register') ?>">
<i class="bi bi-person-plus-fill"></i>
<?= UOJLocale::get('register') ?>
</a>
</li>
<?php endif ?>
<?php endif ?>
</ul>
<?php else : ?>
<form id="form-search-problem" class="form-inline my-2 my-lg-0" method="get">
<div class="input-group">
<input type="text" class="form-control" name="search" id="input-search" placeholder="<?= UOJLocale::get('search') ?>" />
<div class="input-group-append">
<button type="submit" class="btn btn-search btn-outline-primary" id="submit-search"><span class="glyphicon glyphicon-search"></span></button>
</div>
</div>
</form>
<?php endif ?>
2022-09-23 23:01:13 +00:00
</div>
2023-02-04 03:29:12 +00:00
<?php if (isset($REQUIRE_LIB['bootstrap5'])) : ?>
2022-09-23 13:00:17 +00:00
</div>
<?php endif ?>
2016-07-18 16:39:37 +00:00
</div>
2022-09-23 13:00:17 +00:00
2022-09-23 23:01:13 +00:00
<script>
var zan_link = '';
</script>
2023-02-04 03:29:12 +00:00
<?php if (!isset($REQUIRE_LIB['bootstrap5'])) : ?>
<script type="text/javascript">
$('#form-search-problem').submit(function(e) {
e.preventDefault();
url = '<?= HTML::url('/problems') ?>';
qs = [];
$(['search']).each(function() {
if ($('#input-' + this).val()) {
qs.push(this + '=' + encodeURIComponent($('#input-' + this).val()));
}
});
if (qs.length > 0) {
url += '?' + qs.join('&');
}
2023-02-04 03:29:12 +00:00
location.href = url;
});
2023-02-04 03:29:12 +00:00
</script>
2022-09-23 13:00:17 +00:00
<?php endif ?>