2016-09-04 14:49:13 +02:00
|
|
|
<?php
|
|
|
|
/*****************************************************************************
|
|
|
|
* AlbumButtonBox.php
|
|
|
|
* Defines the AlbumButtonBox template.
|
|
|
|
*
|
|
|
|
* Kabuki CMS (C) 2013-2016, Aaron van Geffen
|
|
|
|
*****************************************************************************/
|
|
|
|
|
2023-03-11 13:37:59 +01:00
|
|
|
class AlbumButtonBox extends Template
|
2016-09-04 14:49:13 +02:00
|
|
|
{
|
2024-01-14 21:28:45 +01:00
|
|
|
private $active_filter;
|
2022-12-25 13:50:33 +01:00
|
|
|
private $buttons;
|
2024-01-14 21:28:45 +01:00
|
|
|
private $filters;
|
2022-12-25 13:50:33 +01:00
|
|
|
|
2024-01-14 21:28:45 +01:00
|
|
|
public function __construct(array $buttons, array $filters, $active_filter)
|
2016-09-04 14:49:13 +02:00
|
|
|
{
|
2024-01-14 21:28:45 +01:00
|
|
|
$this->active_filter = $active_filter;
|
2016-09-04 14:49:13 +02:00
|
|
|
$this->buttons = $buttons;
|
2024-01-14 21:28:45 +01:00
|
|
|
$this->filters = $filters;
|
2016-09-04 14:49:13 +02:00
|
|
|
}
|
|
|
|
|
2023-03-11 13:37:59 +01:00
|
|
|
public function html_main()
|
2016-09-04 14:49:13 +02:00
|
|
|
{
|
|
|
|
echo '
|
|
|
|
<div class="album_button_box">';
|
|
|
|
|
|
|
|
foreach ($this->buttons as $button)
|
|
|
|
echo '
|
2023-03-11 13:51:12 +01:00
|
|
|
<a class="btn btn-light" href="', $button['url'], '">', $button['caption'], '</a>';
|
2016-09-04 14:49:13 +02:00
|
|
|
|
|
|
|
echo '
|
2024-01-14 21:28:45 +01:00
|
|
|
<div class="dropdown">
|
|
|
|
<button class="btn btn-light dropdown-toggle" type="button" data-bs-toggle="dropdown" aria-expanded="false">
|
|
|
|
<i class="bi bi-filter"></i>
|
|
|
|
</button>
|
|
|
|
<ul class="dropdown-menu">';
|
|
|
|
|
|
|
|
foreach ($this->filters as $key => $filter)
|
|
|
|
{
|
|
|
|
$is_active = $key === $this->active_filter;
|
|
|
|
echo '
|
|
|
|
<li><a class="dropdown-item', $is_active ? ' active' : '',
|
|
|
|
'" href="', $filter['link'], '">',
|
|
|
|
$filter['caption'],
|
|
|
|
'</a></li>';
|
|
|
|
}
|
|
|
|
|
|
|
|
echo '
|
|
|
|
</ul>
|
|
|
|
</div>
|
2016-09-04 14:49:13 +02:00
|
|
|
</div>';
|
|
|
|
}
|
|
|
|
}
|