mirror of
https://github.com/standardebooks/web.git
synced 2025-07-13 18:11:52 -04:00
Convert SORT_COVER_ constants to an enum
This commit is contained in:
parent
09b4385100
commit
004a4a27c3
4 changed files with 11 additions and 8 deletions
6
lib/ArtworkSort.php
Normal file
6
lib/ArtworkSort.php
Normal file
|
@ -0,0 +1,6 @@
|
||||||
|
<?
|
||||||
|
enum ArtworkSort: string{
|
||||||
|
case CreatedNewest = 'created-newest';
|
||||||
|
case ArtistAlpha = 'artist-alpha';
|
||||||
|
case CompletedNewest = 'completed-newest';
|
||||||
|
}
|
|
@ -44,9 +44,6 @@ const ARTWORK_MAX_STRING_LENGTH = 250;
|
||||||
const ARTWORK_MAX_TAGS = 15;
|
const ARTWORK_MAX_TAGS = 15;
|
||||||
const ARTWORK_IMAGE_MINIMUM_WIDTH = 300;
|
const ARTWORK_IMAGE_MINIMUM_WIDTH = 300;
|
||||||
const ARTWORK_IMAGE_MINIMUM_HEIGHT = 300;
|
const ARTWORK_IMAGE_MINIMUM_HEIGHT = 300;
|
||||||
const SORT_COVER_ARTWORK_CREATED_NEWEST = 'created-newest';
|
|
||||||
const SORT_COVER_ARTIST_ALPHA = 'artist-alpha';
|
|
||||||
const SORT_COVER_ARTWORK_COMPLETED_NEWEST = 'completed-newest';
|
|
||||||
|
|
||||||
const CAPTCHA_IMAGE_HEIGHT = 72;
|
const CAPTCHA_IMAGE_HEIGHT = 72;
|
||||||
const CAPTCHA_IMAGE_WIDTH = 230;
|
const CAPTCHA_IMAGE_WIDTH = 230;
|
||||||
|
|
|
@ -210,10 +210,10 @@ class Library{
|
||||||
}
|
}
|
||||||
|
|
||||||
$orderBy = 'art.Created desc';
|
$orderBy = 'art.Created desc';
|
||||||
if($sort == SORT_COVER_ARTIST_ALPHA){
|
if($sort == ArtworkSort::ArtistAlpha->value){
|
||||||
$orderBy = 'a.Name';
|
$orderBy = 'a.Name';
|
||||||
}
|
}
|
||||||
elseif($sort == SORT_COVER_ARTWORK_COMPLETED_NEWEST){
|
elseif($sort == ArtworkSort::CompletedNewest->value){
|
||||||
$orderBy = 'art.CompletedYear desc';
|
$orderBy = 'art.CompletedYear desc';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -142,9 +142,9 @@ catch(Exceptions\PageOutOfBoundsException){
|
||||||
<span>Sort</span>
|
<span>Sort</span>
|
||||||
<span>
|
<span>
|
||||||
<select name="sort">
|
<select name="sort">
|
||||||
<option value="<?= SORT_COVER_ARTWORK_CREATED_NEWEST ?>"<? if($sort == SORT_COVER_ARTWORK_CREATED_NEWEST){ ?> selected="selected"<? } ?>>Date added (new → old)</option>
|
<option value="<?= ArtworkSort::CreatedNewest->value ?>"<? if($sort == ArtworkSort::CreatedNewest->value){ ?> selected="selected"<? } ?>>Date added (new → old)</option>
|
||||||
<option value="<?= SORT_COVER_ARTIST_ALPHA ?>"<? if($sort == SORT_COVER_ARTIST_ALPHA){ ?> selected="selected"<? } ?>>Artist name (a → z)</option>
|
<option value="<?= ArtworkSort::ArtistAlpha->value ?>"<? if($sort == ArtworkSort::ArtistAlpha->value){ ?> selected="selected"<? } ?>>Artist name (a → z)</option>
|
||||||
<option value="<?= SORT_COVER_ARTWORK_COMPLETED_NEWEST ?>"<? if($sort == SORT_COVER_ARTWORK_COMPLETED_NEWEST){ ?> selected="selected"<? } ?>>Date of artwork completion (new → old)</option>
|
<option value="<?= ArtworkSort::CompletedNewest->value ?>"<? if($sort == ArtworkSort::CompletedNewest->value){ ?> selected="selected"<? } ?>>Date of artwork completion (new → old)</option>
|
||||||
</select>
|
</select>
|
||||||
</span>
|
</span>
|
||||||
</label>
|
</label>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue