handle = function() { DB::query("insert into problems (title, is_hidden, submission_requirement) values ('New Problem', 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(); $new_luogu_problem_form = new UOJForm('new_luogu_problem'); $new_luogu_problem_form->addVInput('luogu_pid', 'text', '洛谷题号', '', function($id) { if (!validateLuoguProblemId($id)) { return '题目 ID 不合法'; } return ''; }, null); $new_luogu_problem_form->handle = function() { try { newLuoguRemoteProblem($_POST['luogu_pid']); } catch (Exception $e) { becomeMsgPage('

添加失败

' . $e->getMessage() . '
'); } }; // $new_luogu_problem_form->submit_button_config['align'] = 'right'; $new_luogu_problem_form->submit_button_config['class_str'] = 'btn btn-primary'; $new_luogu_problem_form->submit_button_config['text'] = UOJLocale::get('problems::add new'); $new_luogu_problem_form->submit_button_config['confirm'] = '新增来自洛谷的题目'; $new_luogu_problem_form->runAtServer(); } function echoProblem($problem) { global $myUser; if (isProblemVisibleToUser($problem, $myUser)) { echo ''; if ($problem['submission_id']) { echo ''; } else { echo ''; } echo '#', $problem['id'], ''; echo ''; if ($problem['is_hidden']) { echo ' [隐藏] '; } echo '', $problem['title'], ''; if (isset($_COOKIE['show_tags_mode'])) { foreach (queryProblemTags($problem['id']) as $tag) { echo '', '', HTML::escape($tag), '', ''; } } echo ''; if (isset($_COOKIE['show_submit_mode'])) { $perc = $problem['submit_num'] > 0 ? round(100 * $problem['ac_num'] / $problem['submit_num']) : 0; echo <<×{$problem['ac_num']} ×{$problem['submit_num']}
{$perc}%
EOD; } echo '', getClickZanBlock('P', $problem['id'], $problem['zan']), ''; 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').''; } $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" ) ); /* 3, 'table_classes' => array('table', 'table-bordered', 'table-hover', 'table-striped'), 'print_after_table' => function() { global $myUser; if (isSuperUser($myUser)) { global $new_problem_form; $new_problem_form->printHTML(); } }, 'head_pagination' => true ) ); ?>*/ $pag_config = array('page_len' => 100); $pag_config['col_names'] = array('*'); $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 = array('table-responsive'); $table_classes = array('table', 'table-bordered', 'table-hover', 'table-striped'); ?>
pagination(); ?>
'; echo ''; echo ''; echo $header; echo ''; echo ''; foreach ($pag->get() as $idx => $row) { echoProblem($row); echo "\n"; } if ($pag->isEmpty()) { echo ''; } echo ''; echo '
'.UOJLocale::get('none').'
'; echo ''; if (isSuperUser($myUser)) { echo '
'; $new_problem_form->printHTML(); echo '
'; echo '
'; echo '
'; $new_luogu_problem_form->printHTML(); echo '
'; echo '
'; echo ''; } echo $pag->pagination(); ?>