mirror of
https://github.com/standardebooks/web.git
synced 2025-07-16 11:26:37 -04:00
Refactor Library::FilterEbooks and Template::SearchForm to accept EbookSort
This commit is contained in:
parent
980ed8cea9
commit
d95d9b3349
3 changed files with 13 additions and 17 deletions
|
@ -8,7 +8,7 @@ try{
|
|||
$tags = HttpInput::GetArray('tags') ?? [];
|
||||
$collection = HttpInput::Str(GET, 'collection');
|
||||
$view = HttpInput::Str(GET, 'view');
|
||||
$sort = HttpInput::Str(GET, 'sort');
|
||||
$sort = EbookSort::tryFrom(HttpInput::Str(GET, 'sort') ?? '');
|
||||
$pages = 0;
|
||||
$totalEbooks = 0;
|
||||
$collectionObject = null;
|
||||
|
@ -35,15 +35,11 @@ try{
|
|||
$view = mb_strtolower($view);
|
||||
}
|
||||
|
||||
if($sort !== null){
|
||||
$sort = mb_strtolower($sort);
|
||||
}
|
||||
|
||||
if($view === 'grid'){
|
||||
$view = null;
|
||||
}
|
||||
|
||||
if($sort === 'newest'){
|
||||
if($sort == EbookSort::Newest){
|
||||
$sort = null;
|
||||
}
|
||||
|
||||
|
@ -103,7 +99,7 @@ try{
|
|||
}
|
||||
|
||||
if($sort !== null){
|
||||
$queryString .= '&sort=' . urlencode($sort);
|
||||
$queryString .= '&sort=' . urlencode($sort->value);
|
||||
}
|
||||
|
||||
if($perPage !== EBOOKS_PER_PAGE){
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue