handle = function () { DB::insert("insert into lists (title, is_hidden) values ('未命名题单', 1)"); $id = DB::insert_id(); DB::insert("insert into lists_contents (id, content, content_md) values ($id, '', '')"); }; $new_list_form->submit_button_config['align'] = 'right'; $new_list_form->submit_button_config['class_str'] = 'btn btn-primary'; $new_list_form->submit_button_config['text'] = UOJLocale::get('problems::add new list'); $new_list_form->submit_button_config['smart_confirm'] = ''; $new_list_form->runAtServer(); } function getListTR($info) { $list = new UOJList($info); $problems = $list->getProblemIDs(); if (Auth::check() && !empty($problems)) { $accepted = DB::selectCount([ "select count(*)", "from best_ac_submissions", "where", [ "submitter" => Auth::id(), ["problem_id", "in", DB::rawtuple($problems)], ], ]); } else { $accepted = -1; } $html = HTML::tag_begin('tr', ['class' => 'text-center']); $html .= HTML::tag('td', ['class' => $accepted == count($problems) ? 'table-success' : ''], "#{$list->info['id']}"); $html .= HTML::tag_begin('td', ['class' => 'text-start']); $html .= $list->getLink(); if ($list->info['is_hidden']) { $html .= ' ' . UOJLocale::get('hidden') . ' '; } if (isset($_COOKIE['show_tags_mode'])) { foreach ($list->queryTags() as $tag) { $html .= ' ' . HTML::escape($tag) . ' '; } } $html .= HTML::tag('td', [], max(0, $accepted)); $html .= HTML::tag('td', [], count($problems)); $html .= HTML::tag_end('td'); return $html; } $cond = []; $search_tag = UOJRequest::get('tag', 'is_string', null); if (is_string($search_tag)) { $cond[] = [ DB::rawvalue($search_tag), "in", DB::rawbracket([ "select tag from lists_tags", "where", ["lists_tags.list_id" => DB::raw("lists.id")] ]) ]; } if (empty($cond)) { $cond = '1'; } $header = HTML::tag('tr', [], [ HTML::tag('th', ['class' => 'text-center', 'style' => 'width:5em'], 'ID'), HTML::tag('th', [], UOJLocale::get('problems::problem list')), HTML::tag('th', ['class' => 'text-center', 'style' => 'width:5em'], UOJLocale::get('problems::ac')), HTML::tag('th', ['class' => 'text-center', 'style' => 'width:5em'], UOJLocale::get('problems::total')), ]); $pag = new Paginator([ 'col_names' => ['*'], 'table_name' => 'lists', 'cond' => $cond, 'tail' => "order by id desc", 'page_len' => 40, 'post_filter' => function ($info) { return (new UOJList($info))->userCanView(Auth::user()); } ]); ?>

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