refactor: add_contest page with bs5

This commit is contained in:
Baoshuo Ren 2022-10-02 14:41:26 +08:00
parent 327c61a251
commit 40921a5701
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A

View File

@ -7,20 +7,24 @@
become403Page();
}
if (!isset($_COOKIE['bootstrap4'])) {
$REQUIRE_LIB['bootstrap5'] = '';
}
requirePHPLib('form');
if (!isSuperUser($myUser)) {
become403Page();
}
$time_form = new UOJForm('time');
$time_form->addInput(
$time_form->addVInput(
'name', 'text', '比赛标题', 'New Contest',
function($str) {
return '';
},
null
);
$time_form->addInput(
$time_form->addVInput(
'start_time', 'text', '开始时间', date("Y-m-d H:i:s"),
function($str, &$vdata) {
try {
@ -32,7 +36,7 @@
},
null
);
$time_form->addInput(
$time_form->addVInput(
'last_min', 'text', '时长(单位:分钟)', 180,
function($str) {
return !validateUInt($str) ? '必须为一个整数' : '';
@ -54,10 +58,40 @@
$time_form->runAtServer();
?>
<?php echoUOJPageHeader('添加比赛') ?>
<h1 class="page-header">添加比赛</h1>
<div class="tab-pane active" id="tab-time">
<?php
$time_form->printHTML();
?>
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
<div class="row">
<div class="col-lg-9">
<?php endif ?>
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
<div class="card card-default mb-2">
<div class="card-body">
<?php endif ?>
<h1 class="page-header
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
h2 card-title
<?php endif ?>
">添加比赛</h1>
<div class="w-full" style="max-width: 400px">
<?php $time_form->printHTML(); ?>
</div>
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
</div>
</div>
<?php endif ?>
<?php if (isset($REQUIRE_LIB['bootstrap5'])): ?>
</div>
<aside class="col mt-3 mt-lg-0">
<?php uojIncludeView('sidebar', array()) ?>
</aside>
</div>
<?php endif ?>
<?php echoUOJPageFooter() ?>