mirror of
https://github.com/renbaoshuo/S2OJ.git
synced 2024-11-22 16:08:42 +00:00
fix(web/group): group rank list pagination
This commit is contained in:
parent
bee296a1d9
commit
ee6169f621
@ -143,6 +143,7 @@ EOD,
|
||||
'page_len' => 50,
|
||||
'group_id' => $group_id,
|
||||
'by_accepted' => true,
|
||||
'div_classes' => ['table-responsive', 'mb-3'],
|
||||
'table_classes' => ['table', 'text-center', 'mb-0'],
|
||||
]) ?>
|
||||
</div>
|
||||
|
@ -1389,10 +1389,13 @@ function echoRanklist($config = array()) {
|
||||
$col_names = array('b.username as username', 'count(*) as ac_num', 'b.motto as motto');
|
||||
$cond = '1';
|
||||
$tail = 'group by username order by ac_num desc, username asc';
|
||||
$config['pagination_table'] = 'user_info';
|
||||
|
||||
if (isset($config['group_id'])) {
|
||||
$group_id = $config['group_id'];
|
||||
$from = "best_ac_submissions a inner join user_info b on a.submitter = b.username inner join groups_users c on (a.submitter = c.username and c.group_id = {$group_id})";
|
||||
$config['pagination_table'] = 'groups_users';
|
||||
$config['pagination_cond'] = "group_id = {$group_id}";
|
||||
}
|
||||
|
||||
if (isset($config['top10'])) {
|
||||
@ -1400,6 +1403,5 @@ function echoRanklist($config = array()) {
|
||||
}
|
||||
|
||||
$config['get_row_index'] = '';
|
||||
$config['pagination_table'] = 'user_info';
|
||||
echoLongTable($col_names, $from, $cond, $tail, $header_row, $print_row, $config);
|
||||
}
|
||||
|
@ -17,10 +17,12 @@ class Paginator {
|
||||
$this->table = $config['data'];
|
||||
} elseif (!isset($config['echo_full'])) {
|
||||
$table = $config['table_name'];
|
||||
$cond = isset($config['cond']) ? $config['cond'] : '1';
|
||||
if (isset($config['pagination_table'])) {
|
||||
$table = $config['pagination_table'];
|
||||
$cond = isset($config['pagination_cond']) ? $config['pagination_cond'] : $cond;
|
||||
}
|
||||
$this->n_rows = DB::selectCount("select count(*) from {$table} where {$config['cond']}");
|
||||
$this->n_rows = DB::selectCount("select count(*) from {$table} where {$cond}");
|
||||
|
||||
$this->page_len = isset($config['page_len']) ? $config['page_len'] : 10;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user