handle = function() { global $myUser; DB::query("insert into problems (title, uploader, is_hidden, submission_requirement) values ('New Problem', '{$myUser['username']}', 1, '{}')"); $id = DB::insert_id(); DB::query("insert into problems_contents (id, statement, statement_md) values ($id, '', '')"); dataNewProblem($id); }; $new_problem_form->submit_button_config['align'] = 'right'; $new_problem_form->submit_button_config['class_str'] = 'btn btn-primary'; $new_problem_form->submit_button_config['text'] = UOJLocale::get('problems::add new'); $new_problem_form->submit_button_config['smart_confirm'] = ''; $new_problem_form->runAtServer(); } function echoProblem($problem) { global $myUser, $REQUIRE_LIB; if (isProblemVisibleToUser($problem, $myUser)) { echo ''; if ($problem['submission_id']) { echo ''; } else { echo ''; } echo '#', $problem['id'], ''; if (isset($REQUIRE_LIB['bootstrap5'])) { echo ''; } else { echo ''; } echo '', $problem['title'], ''; if ($problem['uploader'] == $myUser['username']) { echo ' ', UOJLocale::get('problems::my problem') ,' '; } if ($problem['is_hidden']) { echo ' ', UOJLocale::get('hidden'), ' '; } if (isset($_COOKIE['show_tags_mode'])) { foreach (queryProblemTags($problem['id']) as $tag) { if (isset($REQUIRE_LIB['bootstrap5'])) { echo ' '; echo ''; } else { echo ' '; echo ''; } echo HTML::escape($tag), ''; echo ' '; } } echo ''; if (isset($_COOKIE['show_submit_mode'])) { $a_class = ''; if (isset($REQUIRE_LIB['bootstrap5'])) { $a_class .= ' text-decoration-none '; } $perc = $problem['submit_num'] > 0 ? round(100 * $problem['ac_num'] / $problem['submit_num']) : 0; echo <<×{$problem['ac_num']} ×{$problem['submit_num']}
{$perc}%
EOD; } if (isset($_COOKIE['show_difficulty'])) { $extra_config = getProblemExtraConfig($problem); if ($extra_config['difficulty'] == 0) { echo ""; } else { echo "{$extra_config['difficulty']}"; } } echo '', getClickZanBlock('P', $problem['id'], $problem['zan'], null, false), ''; echo ''; } } $cond = array(); $search_tag = null; $cur_tab = isset($_GET['tab']) ? $_GET['tab'] : 'all'; if ($cur_tab == 'template') { $search_tag = "模板题"; } if (isset($_GET['tag'])) { $search_tag = $_GET['tag']; } if ($search_tag) { $cond[] = "'".DB::escape($search_tag)."' in (select tag from problems_tags where problems_tags.problem_id = problems.id)"; } if (isset($_GET["search"])) { $cond[]="title like '%".DB::escape($_GET["search"])."%' or id like '%".DB::escape($_GET["search"])."%'"; } if ($cond) { $cond = join($cond, ' and '); } else { $cond = '1'; } $header = ''; $header .= 'ID'; $header .= ''.UOJLocale::get('problems::problem').''; if (isset($_COOKIE['show_submit_mode'])) { $header .= ''.UOJLocale::get('problems::ac').''; $header .= ''.UOJLocale::get('problems::submit').''; $header .= ''.UOJLocale::get('problems::ac ratio').''; } if (isset($_COOKIE['show_difficulty'])) { $header .= ''.UOJLocale::get('problems::difficulty').''; } $header .= ''.UOJLocale::get('appraisal').''; $header .= ''; $tabs_info = array( 'all' => array( 'name' => UOJLocale::get('problems::all problems'), 'url' => "/problems" ), 'template' => array( 'name' => UOJLocale::get('problems::template problems'), 'url' => "/problems/template" ) ); $pag_config = array('page_len' => 40); $pag_config['col_names'] = array('best_ac_submissions.submission_id as submission_id', 'problems.id as id', 'problems.is_hidden as is_hidden', 'problems.title as title', 'problems.submit_num as submit_num', 'problems.ac_num as ac_num', 'problems.zan as zan', 'problems.extra_config as extra_config', 'problems.uploader as uploader', 'problems.extra_config as extra_config'); $pag_config['table_name'] = "problems left join best_ac_submissions on best_ac_submissions.submitter = '{$myUser['username']}' and problems.id = best_ac_submissions.problem_id"; $pag_config['cond'] = $cond; $pag_config['tail'] = "order by id asc"; $pag = new Paginator($pag_config); $div_classes = isset($REQUIRE_LIB['bootstrap5']) ? array('card', 'my-3', 'table-responsive') : array('table-responsive'); $table_classes = isset($REQUIRE_LIB['bootstrap5']) ? array('table', 'uoj-table', 'mb-0') : array('table', 'table-bordered', 'table-hover', 'table-striped'); ?>

printHTML(); ?>
pagination(); ?>
pagination(); ?>
get() as $idx => $row) { echoProblem($row); echo "\n"; } if ($pag->isEmpty()) { echo ''; } ?>
'.UOJLocale::get('none').'
pagination() ?>