diff --git a/web/app/controllers/groups.php b/web/app/controllers/groups.php index 200fc7d..98dd465 100644 --- a/web/app/controllers/groups.php +++ b/web/app/controllers/groups.php @@ -7,14 +7,18 @@ requirePHPLib('data'); Auth::check() || redirectToLogin(); if (UOJGroup::userCanCreateGroup(Auth::user())) { - $new_group_form = new UOJBs4Form('new_group'); + $new_group_form = new UOJForm('new_group'); $new_group_form->handle = function () { - DB::query("insert into `groups` (title, is_hidden) values ('新小组', 1)"); + DB::insert([ + "insert into `groups`", + DB::bracketed_fields(['title', 'is_hidden']), + "values", DB::tuple(['新小组', 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->config['submit_container']['class'] = 'text-end'; + $new_group_form->config['submit_button']['class'] = 'btn btn-primary'; + $new_group_form->config['submit_button']['text'] = UOJLocale::get('add new group'); + $new_group_form->config['confirm']['smart'] = true; $new_group_form->runAtServer(); } ?> @@ -23,7 +27,7 @@ if (UOJGroup::userCanCreateGroup(Auth::user())) {