47 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			47 lines
		
	
	
		
			1.4 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?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 '
 | 
						|
		<form action="" method="post">
 | 
						|
			<button class="btn btn-primary float-end" type="submit" name="changeThumbnail">Save thumbnail selection</button>
 | 
						|
			<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 '
 | 
						|
				</ul>
 | 
						|
				<input type="hidden" name="', Session::getSessionTokenKey(), '" value="', Session::getSessionToken(), '">
 | 
						|
			</form>';
 | 
						|
	}
 | 
						|
}
 |