48 lines
921 B
PHP
48 lines
921 B
PHP
<?php
|
|
|
|
namespace Picea\Ui\Method;
|
|
|
|
use Psr\Http\Message\ServerRequestInterface;
|
|
|
|
class PaginationHandler {
|
|
|
|
protected ServerRequestInterface $request;
|
|
|
|
protected FormInterface $form;
|
|
|
|
public int $limit;
|
|
|
|
public int $offset;
|
|
|
|
public int $page = 1;
|
|
|
|
public int $count;
|
|
|
|
public string $url;
|
|
|
|
public array $params;
|
|
|
|
public function __construct(ServerRequestInterface $request, string $name, ? string $url, ? array $params)
|
|
{
|
|
$this->request = $request;
|
|
|
|
$query = $request->getQueryParams();
|
|
|
|
$this->page = $query['page'] ?? 1;
|
|
$this->limit = 15;
|
|
$this->offset = 1;
|
|
$this->count = $this->page * $this->limit;
|
|
|
|
if ( $url ) {
|
|
$this->url = $url;
|
|
}
|
|
|
|
$this->params = $params ?? [];
|
|
}
|
|
|
|
public function __toString() {
|
|
return "";
|
|
}
|
|
|
|
}
|