handle = function() {
DB::query("insert into `groups` (title, is_hidden) values ('新小组', 1)");
};
$new_group_form->submit_button_config['align'] = 'right';
$new_group_form->submit_button_config['class_str'] = 'btn btn-primary';
$new_group_form->submit_button_config['text'] = UOJLocale::get('add new group');
$new_group_form->submit_button_config['smart_confirm'] = '';
$new_group_form->runAtServer();
}
function echoGroup($group) {
global $myUser, $REQUIRE_LIB;
echo '
';
echo '';
echo '#', $group['group_id'], ' | ';
if (isset($REQUIRE_LIB['bootstrap5'])) {
echo '';
} else {
echo ' | ';
}
if ($group['is_hidden']) {
echo ' [隐藏] ';
}
echo '', $group['title'], '';
echo ' | ';
echo "{$group['user_count']} | ";
echo '
';
}
?>
= UOJLocale::get('groups') ?>
printHTML(); ?>
ID |
{$groups_caption} |
{$users_caption} |
EOD;
if (isSuperUser($myUser)) {
$cond = "1";
} else {
$cond = 'is_hidden = 0';
}
$from = "`groups` a left join groups_users b on a.id = b.group_id";
$table_config = array('page_len' => 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', 'my-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',
$table_config
);
?>