Introducing the AlbumHeaderBox. Removes a hack.

This commit is contained in:
2016-09-03 22:23:27 +02:00
parent fdc437b29c
commit 3220d361c3
3 changed files with 85 additions and 21 deletions

View File

@@ -26,32 +26,36 @@ class ViewPhotoAlbum extends HTMLController
$tag = Tag::fromSlug($_GET['tag']);
$id_tag = $tag->id_tag;
$title = $tag->tag;
$description = !empty($tag->description) ? '<p>' . $tag->description . '</p>' : '';
$description = !empty($tag->description) ? $tag->description : '';
// Can we go up a level?
if ($tag->id_parent != 0)
{
$ptag = Tag::fromId($tag->id_parent);
$description .= '<p><a href="' . BASEURL . '/' . (!empty($ptag->slug) ? $ptag->slug . '/' : '') . '">&laquo; Go back to &quot;' . $ptag->tag . '&quot;</a></p>';
$back_link = BASEURL . '/' . (!empty($ptag->slug) ? $ptag->slug . '/' : '');
$back_link_title = 'Back to &quot;' . $ptag->tag . '&quot;';
}
elseif ($tag->kind === 'Person')
$description .= '<p><a href="' . BASEURL . '/people/">&laquo; Go back to &quot;People&quot;</a></p>';
{
$back_link = BASEURL . '/people/';
$back_link_title = 'Back to &quot;People&quot;';
}
$header_box = new AlbumHeaderBox($title, $description, $back_link, $back_link_title);
}
// View the album root.
else
{
$id_tag = 1;
$title = 'Albums';
$description = '';
}
// What page are we at?
$page = isset($_GET['page']) ? (int) $_GET['page'] : 1;
parent::__construct($title . ' - Page ' . $page . ' - ' . SITE_TITLE);
if ($id_tag !== 1)
$this->page->adopt(new DummyBox($title, $description, 'page_title_box'));
if (isset($header_box))
$this->page->adopt($header_box);
// Fetch subalbums, but only if we're on the first page.
if ($page === 1)