2023-03-11 18:22:27 +01:00
|
|
|
<?php
|
|
|
|
/*****************************************************************************
|
|
|
|
* FeaturedThumbnailManager.php
|
|
|
|
* Contains the featured thumbnail manager template.
|
|
|
|
*
|
|
|
|
* Kabuki CMS (C) 2013-2021, Aaron van Geffen
|
|
|
|
*****************************************************************************/
|
|
|
|
|
|
|
|
class FeaturedThumbnailManager extends SubTemplate
|
|
|
|
{
|
|
|
|
private $assets;
|
|
|
|
private $currentThumbnailId;
|
|
|
|
|
|
|
|
public function __construct(AssetIterator $assets, $currentThumbnailId)
|
|
|
|
{
|
|
|
|
$this->assets = $assets;
|
|
|
|
$this->currentThumbnailId = $currentThumbnailId;
|
|
|
|
}
|
|
|
|
|
|
|
|
protected function html_content()
|
|
|
|
{
|
|
|
|
echo '
|
2023-03-11 19:49:17 +01:00
|
|
|
<form action="" method="post">
|
|
|
|
<button class="btn btn-primary float-end" type="submit" name="changeThumbnail">Save thumbnail selection</button>
|
2023-03-11 18:22:27 +01:00
|
|
|
<h2>Select thumbnail</h2>
|
|
|
|
<ul id="featuredThumbnail">';
|
|
|
|
|
|
|
|
while ($asset = $this->assets->next())
|
|
|
|
{
|
|
|
|
$image = $asset->getImage();
|
|
|
|
echo '
|
|
|
|
<li>
|
|
|
|
<input class="form-check-input" type="radio" name="featuredThumbnail" value="', $image->getId(), '"',
|
|
|
|
$this->currentThumbnailId == $image->getId() ? ' checked' : '', '>
|
|
|
|
<img src="', $image->getThumbnailUrl(150, 100, 'top'), '" alt="" title="', $image->getTitle(), '" onclick="this.parentNode.children[0].checked = true">
|
|
|
|
</li>';
|
|
|
|
}
|
|
|
|
|
|
|
|
$this->assets->clean();
|
|
|
|
|
|
|
|
echo '
|
2023-03-11 19:49:17 +01:00
|
|
|
</ul>
|
|
|
|
<input type="hidden" name="', Session::getSessionTokenKey(), '" value="', Session::getSessionToken(), '">
|
|
|
|
</form>';
|
2023-03-11 18:22:27 +01:00
|
|
|
}
|
|
|
|
}
|