Introducing the AlbumHeaderBox. Removes a hack.
This commit is contained in:
@@ -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 . '/' : '') . '">« Go back to "' . $ptag->tag . '"</a></p>';
|
||||
$back_link = BASEURL . '/' . (!empty($ptag->slug) ? $ptag->slug . '/' : '');
|
||||
$back_link_title = 'Back to "' . $ptag->tag . '"';
|
||||
}
|
||||
elseif ($tag->kind === 'Person')
|
||||
$description .= '<p><a href="' . BASEURL . '/people/">« Go back to "People"</a></p>';
|
||||
{
|
||||
$back_link = BASEURL . '/people/';
|
||||
$back_link_title = 'Back to "People"';
|
||||
}
|
||||
|
||||
$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)
|
||||
|
||||
Reference in New Issue
Block a user