handle = function() { global $myUser, $contest; DB::query("delete from contests_registrants where username = '{$myUser['username']}' and contest_id = {$contest['id']}"); updateContestPlayerNum($contest); }; $unregister_form->submit_button_config['class_str'] = 'btn btn-danger btn-xs'; $unregister_form->submit_button_config['text'] = '取消报名'; $unregister_form->succ_href = "/contests"; $unregister_form->runAtServer(); } if ($has_contest_permission) { $pre_rating_form = new UOJForm('pre_rating'); $pre_rating_form->handle = function() { global $contest; foreach (DB::selectAll("select * from contests_registrants where contest_id = {$contest['id']}") as $reg) { $user = queryUser($reg['username']); DB::update("update contests_registrants set user_rating = {$user['rating']} where contest_id = {$contest['id']} and username = '{$user['username']}'"); } }; $pre_rating_form->submit_button_config['align'] = 'right'; $pre_rating_form->submit_button_config['class_str'] = 'btn btn-warning'; $pre_rating_form->submit_button_config['text'] = '重新计算参赛前的 rating'; $pre_rating_form->submit_button_config['smart_confirm'] = ''; $pre_rating_form->runAtServer(); } } ?>