<?php
/**
 * IconPicker Widget template file
 */
?>

<?php
$intCols = 5;
?>

<?php if(!empty($this->files) && !empty($this->styles)): ?>
<?php // add css files to page to display the font icons
foreach($this->files as $file)
{
	$GLOBALS['TL_CSS'][] = $file;
}

?>

<div id="<?= $this->strId; ?>" class="iconpicker">
<form action="<?php echo $this->action; ?>" method="post">
<?php foreach($this->styles as $file => $styles): ?>	
<table cellpadding="0" cellspacing="0">
<thead><tr><th><h2><?php echo basename($file); ?></h2></th></tr></thead>
<tbody>
	<?php foreach($styles as $i => $element): ?>
	<?php if($i%$intCols == 0): ?><tr class="row <?php echo $i%2 == 0 ? 'even' : 'odd'; ?>"><?php endif;?>
	<td>
		<div class="iconbox">
			<div class="icon <?php echo $element['class']; ?>"></div>
			<div class="name"><?php echo $element['label']; ?></div>	
			<div class="radio_container">
				<input type="radio" name="icon" value="<?php echo $element['class']; ?>" <?php if(\Contao\Input::get('value') == $element['class']): ?>checked<?php endif;?>>
				<!--
				<label for="ctrl_<?php echo $element['class']; ?>">
					<span class="icon <?php echo $element['class']; ?>"></span>
					<span class="name"><?php echo $element['selector']; ?></span>
				</label>
				-->
			</div>
		</div>
	</td>
	<?php if($i+1%$intCols == 0): ?></tr><?php endif;?>
	<?php endforeach; ?>
</tbody>
</table>
<?php endforeach; ?>

</form>
</div>
<?php else: ?>
<p class="info"><?php echo $this->empty; ?></p>
<?php endif; ?>