feat: allow admins to edit usertype
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Baoshuo Ren 2023-01-11 11:17:08 +08:00
parent 8b2de39c5f
commit 2dd91d1853
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
2 changed files with 13 additions and 1 deletions

View File

@ -342,6 +342,17 @@ EOD);
}
$update_user_permissions_form->appendHTML(HTML::tag('span', [], UOJLocale::get('user::user group')));
$update_user_permissions_form->appendHTML(HTML::tag('span', ['class' => 'd-inline-block ms-3'], $type_text));
$update_user_permissions_form->addSelect('user_type', [
'label' => '账号类型',
'options' => [
'student' => '学生',
'teacher' => '老师',
'system' => '系统',
],
'div_class' => 'my-3 row gy-2 gx-3 align-items-center',
'label_class' => 'form-label col-auto',
'select_class' => 'form-select w-auto col-auto',
]);
$update_user_permissions_form->appendHTML(HTML::tag('h3', ['class' => 'h5 mt-3'], '题目'));
$update_user_permissions_form->addCheckbox('problems__view', [
'checked' => $extra['permissions']['problems']['view'],
@ -673,6 +684,7 @@ EOD);
DB::update([
"update user_info",
"set", [
"usertype" => $_POST['user_type'],
"extra" => json_encode($extra),
],
"where", [

View File

@ -165,7 +165,7 @@ class UOJForm {
'options' => [],
'default_value' => '',
'label' => '',
'label_class' => 'form-check-label',
'label_class' => 'form-label',
'help' => '',
'help_class' => 'form-text',
'disabled' => false,