Move enums into their own namespace

This commit is contained in:
Alex Cabal 2024-11-08 16:34:21 -06:00
parent c3c588cc1b
commit be5574eaec
45 changed files with 164 additions and 154 deletions

View file

@ -87,7 +87,7 @@ $isEditForm = $isEditForm ?? false;
type="file"
name="artwork-image"
<? if(!$isEditForm){ ?>required="required"<? } ?>
accept="<?= implode(',', ImageMimeType::Values()) ?>"
accept="<?= implode(',', Enums\ImageMimeType::Values()) ?>"
/>
</label>
</fieldset>
@ -179,9 +179,9 @@ $isEditForm = $isEditForm ?? false;
<span>Artwork approval status</span>
<span>
<select name="artwork-status">
<option value="<?= ArtworkStatusType::Unverified->value ?>"<? if($artwork->Status == ArtworkStatusType::Unverified){ ?> selected="selected"<? } ?>>Unverified</option>
<option value="<?= ArtworkStatusType::Declined->value ?>"<? if($artwork->Status == ArtworkStatusType::Declined){ ?> selected="selected"<? } ?>>Declined</option>
<option value="<?= ArtworkStatusType::Approved->value ?>"<? if($artwork->Status == ArtworkStatusType::Approved){ ?> selected="selected"<? } ?>>Approved</option>
<option value="<?= Enums\ArtworkStatusType::Unverified->value ?>"<? if($artwork->Status == Enums\ArtworkStatusType::Unverified){ ?> selected="selected"<? } ?>>Unverified</option>
<option value="<?= Enums\ArtworkStatusType::Declined->value ?>"<? if($artwork->Status == Enums\ArtworkStatusType::Declined){ ?> selected="selected"<? } ?>>Declined</option>
<option value="<?= Enums\ArtworkStatusType::Approved->value ?>"<? if($artwork->Status == Enums\ArtworkStatusType::Approved){ ?> selected="selected"<? } ?>>Approved</option>
</select>
</span>
</label>

View file

@ -13,11 +13,11 @@
}
switch($artwork->Status){
case ArtworkStatusType::Unverified:
case Enums\ArtworkStatusType::Unverified:
$class .= ' unverified';
break;
case ArtworkStatusType::Declined:
case Enums\ArtworkStatusType::Declined:
$class .= ' declined';
break;
}

View file

@ -4,10 +4,10 @@
* @var array<Ebook> $ebooks
*/
$view = $view ?? ViewType::Grid;
$view = $view ?? Enums\ViewType::Grid;
$collection = $collection ?? null;
?>
<ol class="ebooks-list<? if($view == ViewType::List){ ?> list<? }else{ ?> grid<? } ?>"<? if($collection !== null){ ?> typeof="schema:BookSeries" about="<?= $collection->Url ?>"<? } ?>>
<ol class="ebooks-list<? if($view == Enums\ViewType::List){ ?> list<? }else{ ?> grid<? } ?>"<? if($collection !== null){ ?> typeof="schema:BookSeries" about="<?= $collection->Url ?>"<? } ?>>
<? if($collection !== null){ ?>
<meta property="schema:name" content="<?= Formatter::EscapeHtml($collection->Name) ?>"/>
<? } ?>
@ -26,7 +26,7 @@ $collection = $collection ?? null;
</a>
</div>
<p><a href="<?= $ebook->Url ?>" property="schema:url"><span property="schema:name"><?= Formatter::EscapeHtml($ebook->Title) ?></span></a></p>
<? if($view == ViewType::Grid){ ?>
<? if($view == Enums\ViewType::Grid){ ?>
<? foreach($ebook->Authors as $author){ ?>
<p class="author" typeof="schema:Person" property="schema:author" resource="<?= $ebook->AuthorsUrl ?>"><? if($author->Name != 'Anonymous'){ ?><a href="<?= Formatter::EscapeHtml(SITE_URL . $ebook->AuthorsUrl) ?>" property="schema:url"><span property="schema:name"><?= Formatter::EscapeHtml($author->Name) ?></span></a><? } ?></p>
<? } ?>

View file

@ -1,8 +1,8 @@
<?
/**
* @var array<string> $tags
* @var EbookSortType $sort
* @var ViewType $view
* @var Enums\EbookSortType $sort
* @var Enums\ViewType $view
* @var int $perPage
*/
@ -24,10 +24,10 @@ $isAllSelected = sizeof($tags) == 0 || in_array('all', $tags);
<span>Sort</span>
<span>
<select name="sort">
<option value="<?= EbookSortType::Newest->value ?>"<? if($sort == EbookSortType::Newest){ ?> selected="selected"<? } ?>>S.E. release date (new &#x2192; old)</option>
<option value="<?= EbookSortType::AuthorAlpha->value ?>"<? if($sort == EbookSortType::AuthorAlpha){ ?> selected="selected"<? } ?>>Author name (a &#x2192; z)</option>
<option value="<?= EbookSortType::ReadingEase->value ?>"<? if($sort == EbookSortType::ReadingEase){ ?> selected="selected"<? } ?>>Reading ease (easy &#x2192; hard)</option>
<option value="<?= EbookSortType::Length->value ?>"<? if($sort == EbookSortType::Length){ ?> selected="selected"<? } ?>>Length (short &#x2192; long)</option>
<option value="<?= Enums\EbookSortType::Newest->value ?>"<? if($sort == Enums\EbookSortType::Newest){ ?> selected="selected"<? } ?>>S.E. release date (new &#x2192; old)</option>
<option value="<?= Enums\EbookSortType::AuthorAlpha->value ?>"<? if($sort == Enums\EbookSortType::AuthorAlpha){ ?> selected="selected"<? } ?>>Author name (a &#x2192; z)</option>
<option value="<?= Enums\EbookSortType::ReadingEase->value ?>"<? if($sort == Enums\EbookSortType::ReadingEase){ ?> selected="selected"<? } ?>>Reading ease (easy &#x2192; hard)</option>
<option value="<?= Enums\EbookSortType::Length->value ?>"<? if($sort == Enums\EbookSortType::Length){ ?> selected="selected"<? } ?>>Length (short &#x2192; long)</option>
</select>
</span>
</label>
@ -35,8 +35,8 @@ $isAllSelected = sizeof($tags) == 0 || in_array('all', $tags);
<span>View</span>
<span>
<select name="view">
<option value="<?= ViewType::Grid->value ?>"<? if($view == ViewType::Grid){ ?> selected="selected"<? } ?>>Grid</option>
<option value="<?= ViewType::List->value ?>"<? if($view == ViewType::List){ ?> selected="selected"<? } ?>>List</option>
<option value="<?= Enums\ViewType::Grid->value ?>"<? if($view == Enums\ViewType::Grid){ ?> selected="selected"<? } ?>>Grid</option>
<option value="<?= Enums\ViewType::List->value ?>"<? if($view == Enums\ViewType::List){ ?> selected="selected"<? } ?>>List</option>
</select>
</span>
</label>