Allow users to filter albums by contributors #48
@ -32,6 +32,7 @@ class ViewPhotoAlbum extends HTMLController
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
$id_tag = 1;
|
$id_tag = 1;
|
||||||
|
$tag = Tag::fromId($id_tag);
|
||||||
$title = 'Albums';
|
$title = 'Albums';
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -44,7 +45,7 @@ class ViewPhotoAlbum extends HTMLController
|
|||||||
|
|
||||||
// Can we do fancy things here?
|
// Can we do fancy things here?
|
||||||
// !!! TODO: permission system?
|
// !!! TODO: permission system?
|
||||||
$buttons = $this->getAlbumButtons($id_tag, $tag ?? null);
|
$buttons = $this->getAlbumButtons($tag);
|
||||||
if (!empty($buttons))
|
if (!empty($buttons))
|
||||||
$this->page->adopt(new AlbumButtonBox($buttons));
|
$this->page->adopt(new AlbumButtonBox($buttons));
|
||||||
|
|
||||||
@ -129,7 +130,7 @@ class ViewPhotoAlbum extends HTMLController
|
|||||||
return $albums;
|
return $albums;
|
||||||
}
|
}
|
||||||
|
|
||||||
private function getAlbumButtons($id_tag, $tag)
|
private function getAlbumButtons(Tag $tag)
|
||||||
{
|
{
|
||||||
$buttons = [];
|
$buttons = [];
|
||||||
$user = Registry::get('user');
|
$user = Registry::get('user');
|
||||||
@ -137,17 +138,17 @@ class ViewPhotoAlbum extends HTMLController
|
|||||||
if ($user->isLoggedIn())
|
if ($user->isLoggedIn())
|
||||||
{
|
{
|
||||||
$buttons[] = [
|
$buttons[] = [
|
||||||
'url' => BASEURL . '/download/?tag=' . $id_tag,
|
'url' => BASEURL . '/download/?tag=' . $tag->id_tag,
|
||||||
'caption' => 'Download album',
|
'caption' => 'Download album',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isset($tag))
|
if ($tag->id_parent != 0)
|
||||||
{
|
{
|
||||||
if ($tag->kind === 'Album')
|
if ($tag->kind === 'Album')
|
||||||
{
|
{
|
||||||
$buttons[] = [
|
$buttons[] = [
|
||||||
'url' => BASEURL . '/uploadmedia/?tag=' . $id_tag,
|
'url' => BASEURL . '/uploadmedia/?tag=' . $tag->id_tag,
|
||||||
'caption' => 'Upload photos here',
|
'caption' => 'Upload photos here',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@ -157,14 +158,14 @@ class ViewPhotoAlbum extends HTMLController
|
|||||||
if ($tag->kind === 'Album')
|
if ($tag->kind === 'Album')
|
||||||
{
|
{
|
||||||
$buttons[] = [
|
$buttons[] = [
|
||||||
'url' => BASEURL . '/editalbum/?id=' . $id_tag,
|
'url' => BASEURL . '/editalbum/?id=' . $tag->id_tag,
|
||||||
'caption' => 'Edit album',
|
'caption' => 'Edit album',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
elseif ($tag->kind === 'Person')
|
elseif ($tag->kind === 'Person')
|
||||||
{
|
{
|
||||||
$buttons[] = [
|
$buttons[] = [
|
||||||
'url' => BASEURL . '/edittag/?id=' . $id_tag,
|
'url' => BASEURL . '/edittag/?id=' . $tag->id_tag,
|
||||||
'caption' => 'Edit tag',
|
'caption' => 'Edit tag',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
@ -174,7 +175,7 @@ class ViewPhotoAlbum extends HTMLController
|
|||||||
if ($user->isAdmin() && (!isset($tag) || $tag->kind === 'Album'))
|
if ($user->isAdmin() && (!isset($tag) || $tag->kind === 'Album'))
|
||||||
{
|
{
|
||||||
$buttons[] = [
|
$buttons[] = [
|
||||||
'url' => BASEURL . '/addalbum/?tag=' . $id_tag,
|
'url' => BASEURL . '/addalbum/?tag=' . $tag->id_tag,
|
||||||
'caption' => 'Create subalbum',
|
'caption' => 'Create subalbum',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user