diff --git a/db/app_uoj233.sql b/db/app_uoj233.sql index ad8f5cb..13fad39 100644 --- a/db/app_uoj233.sql +++ b/db/app_uoj233.sql @@ -332,6 +332,29 @@ LOCK TABLES `contests_submissions` WRITE; /*!40000 ALTER TABLE `contests_submissions` ENABLE KEYS */; UNLOCK TABLES; +-- +-- Table structure for table `countdowns` +-- + +/*!40101 SET @saved_cs_client = @@character_set_client */; +/*!40101 SET character_set_client = utf8mb4 */; +CREATE TABLE `countdowns` ( + `id` int(10) unsigned NOT NULL AUTO_INCREMENT, + `title` text NOT NULL, + `endtime` datetime NOT NULL, + PRIMARY KEY (`id`) +) ENGINE=MyISAM DEFAULT CHARSET=utf8mb4; +/*!40101 SET character_set_client = @saved_cs_client */; + +-- +-- Dumping data for table `countdowns` +-- + +LOCK TABLES `countdowns` WRITE; +/*!40000 ALTER TABLE `countdowns` DISABLE KEYS */; +/*!40000 ALTER TABLE `countdowns` ENABLE KEYS */; +UNLOCK TABLES; + -- -- Table structure for table `custom_test_submissions` -- diff --git a/web/app/controllers/index.php b/web/app/controllers/index.php index 62ecd03..8f3336f 100644 --- a/web/app/controllers/index.php +++ b/web/app/controllers/index.php @@ -1,11 +1,12 @@ -
-
-
-
+
+
+
+
@@ -14,7 +15,7 @@ - +
-
- Logo +
+ +
+

+ true, 'top10' => true, 'by_accepted' => true)) ?> +
+ +
+
+ +
+
+
+ Logo +
+
+
+

倒计时

+
+ + +

+ 0): ?> + 距离 还有 天。 + + 已开始。 + +

+ +
- -
-
-

- true, 'top10' => true, 'by_accepted' => true)) ?> -
- -
-
-
- diff --git a/web/app/controllers/super_manage.php b/web/app/controllers/super_manage.php index 0c684f9..a7331d2 100644 --- a/web/app/controllers/super_manage.php +++ b/web/app/controllers/super_manage.php @@ -298,6 +298,67 @@ }; $blog_deleter->runAtServer(); + $countdown_adder = new UOJForm('new_countdown'); + $countdown_adder->submit_button_config['align'] = 'compressed'; + $countdown_adder->addInput('new_countdown_title', 'text', '标题', '', + function ($new_countdown_title) { + return ''; + }, + null + ); + $countdown_adder->addInput('new_countdown_endtime', 'text', '截止日期', date("Y-m-d H:i:s"), + function($str, &$vdata) { + try { + $vdata['new_countdown_endtime'] = new DateTime($str); + } catch (Exception $e) { + return '无效时间格式'; + } + return ''; + }, + null + ); + $countdown_adder->handle = function() { + $new_countdown_title = $_POST['new_countdown_title']; + $new_countdown_endtime = $_POST['new_countdown_endtime']; + $new_countdown_title = DB::escape($new_countdown_title); + + DB::query("insert into countdowns (title, endtime) values ('$new_countdown_title', '$new_countdown_endtime')"); + }; + $countdown_adder->runAtServer(); + + $countdown_deleter = new UOJForm('delete_countdown'); + $countdown_deleter->submit_button_config['align'] = 'compressed'; + $countdown_deleter->addInput('delete_countdown_id', 'text', 'ID', '', + function ($delete_countdown_id) { + return ''; + }, + null + ); + $countdown_deleter->handle = function() { + $delete_countdown_id = $_POST['delete_countdown_id']; + $delete_countdown_id = DB::escape($delete_countdown_id); + + DB::query("delete from countdowns where id = '$delete_countdown_id'"); + }; + $countdown_deleter->runAtServer(); + + $countdowns_header_row = << + ID + 标题 + 时间 + +EOD; + $countdowns_print_row = function($row) { + echo << + {$row['id']} + {$row['title']} + {$row['endtime']} + +EOD; + }; + $contest_submissions_deleter = new UOJForm('contest_submissions'); $contest_submissions_deleter->addInput('contest_id', 'text', '比赛ID', '', function ($x) { @@ -453,6 +514,10 @@ EOD; 'name' => '博客管理', 'url' => "/super-manage/blogs" ), + 'index' => array( + 'name' => '首页管理', + 'url' => '/super-manage/index' + ), 'submissions' => array( 'name' => '提交记录', 'url' => "/super-manage/submissions" @@ -529,6 +594,15 @@ EOD;

删除博客

printHTML(); ?>
+ +
+

倒计时管理

+ +
添加倒计时
+ printHTML(); ?> +
删除倒计时
+ printHTML(); ?> +

删除赛前提交记录