Compare commits

..

5 Commits

Author SHA1 Message Date
03e6a1cb99
refactor: remove echo
All checks were successful
continuous-integration/drone/push Build is passing
2022-09-20 17:20:23 +08:00
03ba52b90d
feat: head_pagination 2022-09-20 17:19:51 +08:00
6926a6f912
fix: pagination count table 2022-09-20 17:19:11 +08:00
7b4fb77260
feat: faq page not require login 2022-09-20 17:06:25 +08:00
a73b212b32
fix: accepted problems style 2022-09-20 17:03:11 +08:00
7 changed files with 37 additions and 35 deletions

View File

@ -2,10 +2,6 @@
requireLib('shjs');
requireLib('mathjax');
if (!Auth::check()) {
become403Page(UOJLocale::get('need login'));
}
echoUOJPageHeader(UOJLocale::get('help'));
?>
<article>

View File

@ -78,7 +78,8 @@ EOD;
$new_group_form->printHTML();
}
},
'head_pagination' => true
'head_pagination' => true,
'pagination_table' => "`groups`"
)
);
?>

View File

@ -99,7 +99,8 @@ EOD;
'print_after_table' => function() {
global $myUser;
},
'head_pagination' => true
'head_pagination' => true,
'pagination_table' => 'lists'
)
);
?>

View File

@ -127,6 +127,11 @@ EOD;
$table_classes = array('table', 'table-bordered', 'table-hover', 'table-striped');
?>
<?php echoUOJPageHeader(UOJLocale::get('problems')) ?>
<?php
if (isSuperUser($myUser) || isProblemManager($myUser) || isProblemUploader($myUser)) {
$new_problem_form->printHTML();
}
?>
<div class="row">
<div class="col-sm-4">
<?= HTML::tablist($tabs_info, $cur_tab, 'nav-pills') ?>
@ -158,30 +163,22 @@ $('#input-show_submit_mode').click(function() {
location.reload();
});
</script>
<div class="<?= join($div_classes, ' ') ?>">
<table class="<?= join($table_classes, ' ') ?>">
<thead><?= $header ?></thead>
<tbody>
<?php
echo '<div class="', join($div_classes, ' '), '">';
echo '<table class="', join($table_classes, ' '), '">';
echo '<thead>';
echo $header;
echo '</thead>';
echo '<tbody>';
foreach ($pag->get() as $idx => $row) {
echoProblem($row);
echo "\n";
}
if ($pag->isEmpty()) {
echo '<tr><td class="text-center" colspan="233">'.UOJLocale::get('none').'</td></tr>';
}
echo '</tbody>';
echo '</table>';
echo '</div>';
if (isSuperUser($myUser) || isProblemManager($myUser) || isProblemUploader($myUser)) {
$new_problem_form->printHTML();
}
echo $pag->pagination();
foreach ($pag->get() as $idx => $row) {
echoProblem($row);
echo "\n";
}
if ($pag->isEmpty()) {
echo '<tr><td class="text-center" colspan="233">'.UOJLocale::get('none').'</td></tr>';
}
?>
</tbody>
</table>
</div>
<?= $pag->pagination() ?>
<?php echoUOJPageFooter() ?>

View File

@ -127,16 +127,16 @@
$ac_problems = DB::selectAll("select a.problem_id as problem_id, b.title as title from best_ac_submissions a inner join problems b on a.problem_id = b.id where submitter = '{$user['username']}';");
?>
<h4 class="list-group-item-heading"><?= UOJLocale::get('accepted problems').''.UOJLocale::get('n problems in total', count($ac_problems))?> </h4>
<p class="list-group-item-text">
<div class="list-group-item-text">
<?php
foreach ($ac_problems as $problem) {
echo '<a href="/problem/', $problem['problem_id'], '" style="display:inline-block; margin-right:0.25em;">#', $problem['problem_id'], '. ', $problem['title'], '</a>';
echo '<a href="/problem/', $problem['problem_id'], '" role="button" class="btn btn-light mr-1">#', $problem['problem_id'], '. ', $problem['title'], '</a>';
}
if (empty($ac_problems)) {
echo UOJLocale::get('none');
}
?>
</p>
</div>
</div>
</div>
</div>

View File

@ -166,6 +166,10 @@ function echoLongTable($col_names, $table_name, $cond, $tail, $header_row, $prin
$div_classes = isset($config['div_classes']) ? $config['div_classes'] : array('table-responsive');
$table_classes = isset($config['table_classes']) ? $config['table_classes'] : array('table', 'table-bordered', 'table-hover', 'table-striped', 'table-text-center');
if (isset($config['head_pagination']) && $config['head_pagination']) {
echo $pag->pagination();
}
echo '<div class="', join($div_classes, ' '), '">';
echo '<table class="', join($table_classes, ' '), '">';
echo '<thead>';

View File

@ -16,7 +16,10 @@ class Paginator {
$this->cur_start = 0;
$this->table = $config['data'];
} elseif (!isset($config['echo_full'])) {
$this->n_rows = DB::selectCount("select count(*) from {$config['table_name']} where {$config['cond']}");
if (!isset($config['pagination_table'])) {
$config['pagination_table'] = $config['table'];
}
$this->n_rows = DB::selectCount("select count(*) from {$config['pagination_table']} where {$config['cond']}");
$this->page_len = isset($config['page_len']) ? $config['page_len'] : 10;