diff --git a/web/app/controllers/groups.php b/web/app/controllers/groups.php index 067e4dc..69e9fcf 100644 --- a/web/app/controllers/groups.php +++ b/web/app/controllers/groups.php @@ -11,6 +11,10 @@ become403Page(); } + if (!isset($_COOKIE['bootstrap4'])) { + $REQUIRE_LIB['bootstrap5'] = ''; + } + if (isSuperUser($myUser)) { $new_group_form = new UOJForm('new_group'); $new_group_form->handle = function() { @@ -24,17 +28,25 @@ } function echoGroup($group) { - global $myUser; + global $myUser, $REQUIRE_LIB; echo ''; echo ''; echo '#', $group['group_id'], ''; - echo ''; + if (isset($REQUIRE_LIB['bootstrap5'])) { + echo ''; + } else { + echo ''; + } if ($group['is_hidden']) { echo ' [隐藏] '; } - echo '', $group['title'], ''; + echo '', $group['title'], ''; echo ''; echo "{$group['user_count']}"; @@ -45,6 +57,24 @@ + +
+ +

+ +

+ + + +
+ + printHTML(); ?> + +
+
+ + + 40, + 'table_classes' => array('table', 'table-bordered', 'table-hover', 'table-striped'), + 'head_pagination' => true, + 'pagination_table' => "`groups`" + ); + + if (isset($REQUIRE_LIB['bootstrap5'])) { + $table_config['div_classes'] = array('card', 'mb-3'); + $table_config['table_classes'] = array('table', 'uoj-table', 'mb-0'); + } + echoLongTable( array('a.id as group_id', 'a.title as title', 'a.is_hidden as is_hidden', 'count(b.username) as user_count'), $from, $cond, 'group by a.id order by a.id asc', $header, 'echoGroup', - array('page_len' => 40, - 'table_classes' => array('table', 'table-bordered', 'table-hover', 'table-striped'), - 'print_after_table' => function() { - global $myUser; - if (isSuperUser($myUser)) { - global $new_group_form; - $new_group_form->printHTML(); - } - }, - 'head_pagination' => true, - 'pagination_table' => "`groups`" - ) + $table_config ); ?>