Add submitter info to admin view of artworks

This commit is contained in:
Alex Cabal 2024-01-07 14:23:34 -06:00
parent 017baef7d3
commit 52033320e1
3 changed files with 21 additions and 7 deletions

View file

@ -20,6 +20,7 @@ use function Safe\sprintf;
* @property string $Dimensions
* @property Ebook $Ebook
* @property Museum $Museum
* @property User $Submitter
* @property ?ImageMimeType $MimeType
*/
class Artwork extends PropertiesBase{
@ -52,6 +53,7 @@ class Artwork extends PropertiesBase{
protected $_Dimensions = null;
protected $_Ebook = null;
protected $_Museum = null;
protected $_Submitter = null;
protected ?ImageMimeType $_MimeType = null;
// *******
@ -70,6 +72,14 @@ class Artwork extends PropertiesBase{
return $this->_UrlName;
}
protected function GetSubmitter(): User{
if($this->_Submitter === null){
$this->_Submitter = User::Get($this->SubmitterUserId);
}
return $this->_Submitter;
}
protected function GetUrl(): string{
if($this->_Url === null){
$this->_Url = '/artworks/' . $this->Artist->UrlName . '/' . $this->UrlName;

View file

@ -1,6 +1,6 @@
<?
$artwork = $artwork ?? null;
$showCopyrightNotice = $showCopyrightNotice ?? true;
$isAdminView = $isAdminView ?? false;
if($artwork === null){
return;
@ -16,9 +16,7 @@ if($artwork === null){
</picture>
</a>
<? if($showCopyrightNotice){ ?>
<?= Template::ImageCopyrightNotice() ?>
<? } ?>
<?= Template::ImageCopyrightNotice() ?>
<h2>Metadata</h2>
<table class="artwork-metadata">
@ -36,6 +34,10 @@ if($artwork === null){
<td>Year completed</td>
<td><? if($artwork->CompletedYear === null){ ?>Unknown<? }else{ ?><? if($artwork->CompletedYearIsCirca){ ?>Circa <? } ?><?= $artwork->CompletedYear ?><? } ?></td>
</tr>
<tr>
<td>Tags</td>
<td><ul class="tags"><? foreach($artwork->Tags as $tag){ ?><li><a href="<?= $tag->Url ?>"><?= Formatter::ToPlainText($tag->Name) ?></a></li><? } ?></ul></td>
</tr>
<tr>
<td>Dimensions</td>
<td><?= $artwork->Dimensions ?></td>
@ -44,10 +46,12 @@ if($artwork === null){
<td>Status</td>
<td><?= Template::ArtworkStatus(['artwork' => $artwork]) ?></td>
</tr>
<? if($isAdminView){ ?>
<tr>
<td>Tags</td>
<td><ul class="tags"><? foreach($artwork->Tags as $tag){ ?><li><a href="<?= $tag->Url ?>"><?= Formatter::ToPlainText($tag->Name) ?></a></li><? } ?></ul></td>
<td>Submitted by</td>
<td><? if($artwork->SubmitterUserId === null){ ?>Anonymous<? }else{ ?><a href="mailto:<?= Formatter::ToPlainText($artwork->Submitter->Email) ?>"><? if($artwork->Submitter->Name !== null){ ?> <?= Formatter::ToPlainText($artwork->Submitter->Name) ?><? }else{ ?><?= Formatter::ToPlainText($artwork->Submitter->Email) ?><? } ?></a><? } ?></td>
</tr>
<? } ?>
</table>
<h2>U.S. public domain proof</h2>

View file

@ -29,7 +29,7 @@ catch(Exceptions\AppException){
<main class="artworks">
<?= Template::Error(['exception' => $exception]) ?>
<section class="narrow">
<?= Template::ArtworkDetail(['artwork' => $artwork, 'showCopyrightNotice' => false]) ?>
<?= Template::ArtworkDetail(['artwork' => $artwork, 'isAdminView' => true]) ?>
<? if($artwork->Status == COVER_ARTWORK_STATUS_DECLINED){ ?>
<h2>Status</h2>
<p>This artwork has been declined by a reviewer.</p>