mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-26 09:48:41 +00:00
refactor(super_manage/custom_test): uoj_form_v2
This commit is contained in:
parent
33c8b6bd4a
commit
8da485e595
@ -924,30 +924,33 @@ if ($cur_tab == 'index') {
|
|||||||
'page_len' => 10
|
'page_len' => 10
|
||||||
]);
|
]);
|
||||||
|
|
||||||
$custom_test_deleter = new UOJBs4Form('custom_test_deleter');
|
$custom_test_deleter = new UOJForm('custom_test_deleter');
|
||||||
$custom_test_deleter->addInput(
|
$custom_test_deleter->addInput('last', [
|
||||||
'last',
|
'div_class' => 'col-auto',
|
||||||
'text',
|
'label' => '删除末尾记录',
|
||||||
'删除末尾记录',
|
'default_value' => '5',
|
||||||
'5',
|
'validator_php' => function ($x, &$vdata) {
|
||||||
function ($x, &$vdata) {
|
|
||||||
if (!validateUInt($x)) {
|
if (!validateUInt($x)) {
|
||||||
return '不合法';
|
return '不合法';
|
||||||
}
|
}
|
||||||
|
|
||||||
$vdata['last'] = $x;
|
$vdata['last'] = $x;
|
||||||
|
|
||||||
return '';
|
return '';
|
||||||
},
|
},
|
||||||
null
|
]);
|
||||||
);
|
|
||||||
$custom_test_deleter->handle = function (&$vdata) {
|
$custom_test_deleter->handle = function (&$vdata) {
|
||||||
$all = DB::selectAll("select * from custom_test_submissions order by id asc limit {$vdata['last']}");
|
$all = DB::selectAll("select * from custom_test_submissions order by id asc limit {$vdata['last']}");
|
||||||
|
|
||||||
foreach ($all as $submission) {
|
foreach ($all as $submission) {
|
||||||
$content = json_decode($submission['content'], true);
|
$content = json_decode($submission['content'], true);
|
||||||
unlink(UOJContext::storagePath() . $content['file_name']);
|
unlink(UOJContext::storagePath() . $content['file_name']);
|
||||||
}
|
}
|
||||||
|
|
||||||
DB::delete("delete from custom_test_submissions order by id asc limit {$vdata['last']}");
|
DB::delete("delete from custom_test_submissions order by id asc limit {$vdata['last']}");
|
||||||
};
|
};
|
||||||
$custom_test_deleter->submit_button_config['align'] = 'compressed';
|
$custom_test_deleter->config['form']['class'] = 'row gy-2 gx-3 align-items-end';
|
||||||
|
$custom_test_deleter->config['submit_container']['class'] = 'col-auto';
|
||||||
$custom_test_deleter->runAtServer();
|
$custom_test_deleter->runAtServer();
|
||||||
} elseif ($cur_tab == 'judger') {
|
} elseif ($cur_tab == 'judger') {
|
||||||
$judger_adder = new UOJBs4Form('judger_adder');
|
$judger_adder = new UOJBs4Form('judger_adder');
|
||||||
|
Loading…
Reference in New Issue
Block a user