handle = function () { DB::insert([ "insert into problems", "(title, uploader, is_hidden, submission_requirement)", "values", DB::tuple(["New Problem", Auth::id(), 1, "{}"]) ]); $id = DB::insert_id(); DB::insert([ "insert into problems_contents", "(id, statement, statement_md)", "values", DB::tuple([$id, "", "## 题目描述\n\n## 输入格式\n\n## 输出格式\n\n## 输入输出样例\n\n### 输入样例 #1\n\n\n\n### 输出样例 #1\n\n\n\n### 样例解释 #1\n\n\n\n## 数据范围与约定\n\n\n"]) ]); 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 getProblemTR($info) { $problem = new UOJProblem($info); $html = ''; if ($info['submission_id']) { $html .= ''; } else { $html .= ''; } $html .= "#{$info['id']}"; $html .= ''; $html .= $problem->getLink(['with' => 'none']); if ($problem->isUserOwnProblem(Auth::user())) { $html .= ' ' . UOJLocale::get('problems::my problem') . ' '; } if ($info['is_hidden']) { $html .= ' ' . UOJLocale::get('hidden') . ' '; } if (isset($_COOKIE['show_tags_mode'])) { foreach ($problem->queryTags() as $tag) { $html .= ' ' . '' . HTML::escape($tag) . '' . ' '; } } $html .= ''; if (isset($_COOKIE['show_submit_mode'])) { $perc = $info['submit_num'] > 0 ? round(100 * $info['ac_num'] / $info['submit_num']) : 0; $html .= '×' . $info['ac_num'] . ''; $html .= '×' . $info['submit_num'] . ''; $html .= ''; $html .= '
'; $html .= '
'; $html .= $perc . '%'; $html .= '
'; $html .= '
'; $html .= ''; } $html .= '' . ClickZans::getCntBlock($problem->info['zan']) . ''; $html .= ''; return $html; } $cond = []; $search_tag = UOJRequest::get('tag', 'is_string', null); $search_content = UOJRequest::get('search', 'is_string', ''); $search_is_effective = false; $cur_tab = UOJRequest::get('tab', 'is_string', 'all'); if ($cur_tab == 'template') { $search_tag = "模板题"; } if (is_string($search_tag)) { $cond[] = [ DB::rawvalue($search_tag), "in", DB::rawbracket([ "select tag from problems_tags", "where", ["problems_tags.problem_id" => DB::raw("problems.id")] ]) ]; } if ($search_content !== '') { foreach (explode(' ', $search_content) as $key) { if (strlen($key) > 0) { $cond[] = DB::lor([ [DB::instr(DB::raw('title'), $key), '>', 0], DB::exists([ "select tag from problems_tags", "where", [ [DB::instr(DB::raw('tag'), $key), '>', 0], "problems_tags.problem_id" => DB::raw("problems.id") ] ]), "id" => $key, ]); $search_is_effective = true; } } } if (isset($_GET['is_hidden'])) { $cond['problems.is_hidden'] = true; } if (Auth::check() && isset($_GET['my'])) { $cond['problems.uploader'] = Auth::id(); } if (empty($cond)) { $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 = new Paginator([ 'col_names' => ['*'], 'table_name' => [ "problems left join best_ac_submissions", "on", [ "best_ac_submissions.submitter" => Auth::id(), "problems.id" => DB::raw("best_ac_submissions.problem_id") ], ], 'cond' => $cond, 'tail' => "order by id asc", 'page_len' => 40, 'post_filter' => function ($problem) { return (new UOJProblem($problem))->userCanView(Auth::user()); } ]); // if ($search_is_effective) { // $search_summary = [ // 'count_in_cur_page' => $pag->countInCurPage(), // 'first_a_few' => [] // ]; // foreach ($pag->get(5) as $info) { // $problem = new UOJProblem($info); // $search_summary['first_a_few'][] = [ // 'type' => 'problem', // 'id' => $problem->info['id'], // 'title' => $problem->getTitle() // ]; // } // DB::insert([ // "insert into search_requests", // "(created_at, remote_addr, type, cache_id, q, content, result)", // "values", DB::tuple([DB::now(), UOJContext::remoteAddr(), 'search', 0, $search_content, UOJContext::requestURI(), json_encode($search_summary)]) // ]); // } ?>

printHTML(); ?>
/>
/>
/>
pagination() ?>
get(), [ 'table_attr' => [ 'class' => ['table', 'uoj-table', 'mb-0'], ], 'tr' => function ($row, $idx) { return getProblemTR($row); } ]); ?>
pagination() ?>