diff --git a/web/app/controllers/group.php b/web/app/controllers/group.php index b017664..a5ba7b8 100644 --- a/web/app/controllers/group.php +++ b/web/app/controllers/group.php @@ -15,30 +15,79 @@ if (!validateUInt($group_id) || !($group = queryGroup($group_id))) { become404Page(); } + + if (!isset($_COOKIE['bootstrap4'])) { + $REQUIRE_LIB['bootstrap5'] = ''; + } ?> + +
+
+
+ + + +

+ + [隐藏] + + + (ID: #) +

+

(小组 ID: )

+ + + + + + + +
+ + + +
+
+

+
-
-
+ +
+
+

+
-
-
+ +
+
+

+
-
- true, 'group_id' => $group_id, 'by_accepted' => true)) ?> +
+ + +
+ true, + 'group_id' => $group_id, + 'by_accepted' => true, + 'table_classes' => isset($REQUIRE_LIB['bootstrap5']) + ? array('table', 'text-center', 'mb-0') + : array('table', 'table-bordered', 'table-hover', 'table-striped', 'table-text-center') + )) ?>
+ + +

+ + + +
+ + diff --git a/web/app/controllers/group_manage.php b/web/app/controllers/group_manage.php index 3273a9b..91194a5 100644 --- a/web/app/controllers/group_manage.php +++ b/web/app/controllers/group_manage.php @@ -127,11 +127,9 @@ }, null ); - $default_ddl = new DateTime(); $default_ddl->setTime(17, 0, 0); $default_ddl->add(new DateInterval("P7D")); - $add_new_assignment_form->addInput('new_assignment_deadline', 'text', '截止时间', $default_ddl->format('Y-m-d H:i'), function ($x) { $ddl = DateTime::createFromFormat('Y-m-d H:i', $x); @@ -143,8 +141,18 @@ }, null ); + $add_new_assignment_form->submit_button_config['align'] = 'compressed'; + $add_new_assignment_form->submit_button_config['text'] = '添加作业'; + $add_new_assignment_form->handle = function() { + global $group_id, $myUser; + $list_id = $_POST['new_assignment_list_id']; + $ddl = DateTime::createFromFormat('Y-m-d H:i', $_POST['new_assignment_deadline']); + $ddl_str = $ddl->format('Y-m-d H:i:s'); + + DB::insert("insert into assignments (group_id, list_id, create_time, deadline) values ({$group_id}, '{$list_id}', now(), '{$ddl_str}')"); + }; + $add_new_assignment_form->runAtServer(); - $remove_assignment_form = new UOJForm('remove_assignment'); $remove_assignment_form->addInput('remove_assignment_list_id', 'text', '题单 ID', '', function ($x) { @@ -223,4 +231,47 @@

删除小组的作业
printHTML(); ?> +
已被自动隐藏的作业
+
    + getTimestamp() - $ddl->getTimestamp() <= 604800) { + continue; + } // 7d + + echo '
  • '; + echo '', $ass['title'], ' (题单 #', $ass['list_id'], ')'; + + if ($ddl < $now) { + echo ' overdue'; + } elseif ($ddl->getTimestamp() - $now->getTimestamp() < 86400) { // 1d + echo ' soon'; + } elseif ($now->getTimestamp() - $create_time->getTimestamp() < 86400) { // 1d + echo ' new'; + } + + $ddl_str = $ddl->format('Y-m-d H:i'); + echo ' (截止时间: ', $ddl_str, ',查看完成情况)'; + echo '
  • '; + } + + if (count($assignments) == 0) { + echo '

    暂无作业

    '; + } + ?> +
+ diff --git a/web/app/libs/uoj-query-lib.php b/web/app/libs/uoj-query-lib.php index 0129377..da7da47 100644 --- a/web/app/libs/uoj-query-lib.php +++ b/web/app/libs/uoj-query-lib.php @@ -124,8 +124,11 @@ function queryGroupmateCurrentAC($username) { function queryGroupCurrentAC($group_id) { return DB::selectAll("select a.problem_id as problem_id, a.submitter as submitter, a.submission_id as submission_id, b.submit_time as submit_time, d.title as problem_title, b.submit_time as submit_time, e.realname as realname from best_ac_submissions a inner join submissions b on (a.submission_id = b.id) inner join groups_users c on (a.submitter = c.username and c.group_id = $group_id) inner join problems d on (a.problem_id = d.id and d.is_hidden = 0) inner join user_info e on (a.submitter = e.username) where b.submit_time > addtime(now(), '-360:00:00') order by b.submit_time desc limit 10", MYSQLI_ASSOC); } +function queryGroupAssignments($group_id) { + return DB::selectAll("select a.id as id, a.list_id as list_id, a.create_time as create_time, a.deadline as deadline, b.title from assignments a left join lists b on a.list_id = b.id where a.group_id = $group_id order by a.deadline asc", MYSQLI_ASSOC); +} function queryGroupActiveAssignments($group_id) { - return DB::selectAll("select a.id as id, a.list_id as list_id, a.create_time as create_time, a.deadline as deadline, b.title from assignments a left join lists b on a.list_id = b.id where a.group_id = $group_id and a.deadline > addtime(now(), '-360:00:00') order by a.deadline asc", MYSQLI_ASSOC); + return DB::selectAll("select a.id as id, a.list_id as list_id, a.create_time as create_time, a.deadline as deadline, b.title from assignments a left join lists b on a.list_id = b.id where a.group_id = $group_id and a.deadline > addtime(now(), '-168:00:00') order by a.deadline asc", MYSQLI_ASSOC); } function queryAssignment($id) {