mirror of
https://github.com/Neetpone/ponepaste.git
synced 2025-03-11 14:10:06 +01:00
fix(admin): fix paginator
This commit is contained in:
parent
12b0f4976f
commit
d77dc5f1e0
2 changed files with 5 additions and 5 deletions
|
@ -249,7 +249,7 @@ function escapeLikeQuery(string $query) : string {
|
|||
return str_replace(['\\', '_', '%'], ['\\\\', '\\_', '\\%'], $query);
|
||||
}
|
||||
|
||||
function paginate(int $current_page, int $per_page, int $total_records) : string {
|
||||
function paginate(int $current_page, int $per_page, int $total_records, $prefix = '') : string {
|
||||
$first_page = 0;
|
||||
$last_page = floor($total_records / $per_page);
|
||||
$window = 2;
|
||||
|
@ -258,11 +258,11 @@ function paginate(int $current_page, int $per_page, int $total_records) : string
|
|||
// Do something?
|
||||
}
|
||||
|
||||
$_page_button = function(int $page, string $text, bool $disabled = false) use ($current_page) : string {
|
||||
$_page_button = function(int $page, string $text, bool $disabled = false) use ($current_page, $prefix) : string {
|
||||
/* We need to update the 'page' parameter in the request URI, or add it if it doesn't exist. */
|
||||
$request_uri = parse_url($_SERVER['REQUEST_URI']);
|
||||
parse_str((string) @$request_uri['query'], $parsed_query);
|
||||
$parsed_query['page'] = (string) $page;
|
||||
$parsed_query[$prefix . 'page'] = (string) $page;
|
||||
$page_uri = ((string) @$request_uri['path']) . '?' . http_build_query($parsed_query);
|
||||
|
||||
$selected_class = $current_page == $page ? ' paginator__button--selected' : '';
|
||||
|
|
|
@ -55,7 +55,7 @@ foreach (PageView::orderBy('id', 'desc')->take(7)->get() as $row) {
|
|||
$tvisit[] = $row['tvisit'];
|
||||
}
|
||||
|
||||
[$mm_per_page, $mm_current_page] = pp_setup_pagination('mm', 10);
|
||||
[$mm_per_page, $mm_current_page] = pp_setup_pagination('mm_', 10);
|
||||
|
||||
$admin_histories = AdminLog::with('user')
|
||||
->orderBy('id', 'desc')
|
||||
|
@ -303,7 +303,7 @@ $is_admin = $current_user->role >= User::ROLE_ADMIN;
|
|||
<input class="form-control" type="text" name="message" maxlength="255" placeholder="Message" style="width: 90%;">
|
||||
<input class="btn btn-primary" type="submit" name="send_message" value="Send" />
|
||||
</form>
|
||||
<?= paginate($mm_current_page, $mm_per_page, ModMessage::count()) ?>
|
||||
<?= paginate($mm_current_page, $mm_per_page, ModMessage::count(), 'mm_') ?>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
Loading…
Add table
Reference in a new issue