handle = function() {
mysql_query("insert into problems (title, is_hidden, submission_requirement) values ('New Problem', 1, '{}')");
$id = mysql_insert_id();
mysql_query("insert into problems_contents (id, statement, statement_md) values ($id, '', '')");
svnNewProblem($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;
if (isProblemVisibleToUser($problem, $myUser)) {
echo '
';
if ($problem['submission_id']) {
echo '';
} else {
echo ' | ';
}
echo '#', $problem['id'], ' | ';
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']} |
|
EOD;
}
echo '', getClickZanBlock('P', $problem['id'], $problem['zan']), ' | ';
echo '
';
}
}
$cond = array();
$search_tag = null;
$search_word = $_GET["search"];
$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($search_word) {
$cond[]="title like '%".$search_word."%' or id like '%".$search_word."%'";
}
if ($cond) {
$cond = join($cond, ' and ');
} else {
$cond = '1';
}
$header = '