<?php include('category_breadcrumb.tpl.php'); ?>

<?php if (!Utility::isEmpty($description = $tpl['format_description']($tpl['category']['description']))) : ?>
<div class="object_desc" id="cat_desc"><?php echo $description; ?></div>
<?php endif; ?>

<?php if ($tpl['pages']['count'] > 1) : ?>
<div id="pages_top">
<?php include('pagination.tpl.php'); ?>
</div>
<?php endif; ?>

<?php if (isset($tpl['categories'])) : ?>
<div id="thumbs_cat" class="<?php echo $thumbs_cat_layout; ?>">
<?php foreach ($tpl['categories'] as &$i) : ?>
	<dl<?php if ($i['unlocked']) : ?> class="unlocked"<?php elseif ($i['locked']) : $locked = TRUE; ?> class="locked"<?php endif; ?>>
		<dt>
			<a href="<?php echo $i['link']; ?><?php if (!$i['locked']) : ?>#content<?php endif; ?>" <?php if ($i['description'] && $tpl['config']('thumbs_cat_info_description')) : ?> title="<?php echo $tpl['strip_tags']($i['description'], $tpl['config']('thumbs_cat_info_description_limit')); ?>"<?php endif; ?><?php if ($i['locked']) : ?> data-box="password"<?php endif; ?> data-id="<?php echo $i['id']; ?>">
<?php if ($i['locked']) : ?>
				<span></span>
<?php else : ?>
				<img alt="<?php echo $i['title']; ?>" src="<?php echo $i['thumb_src']($thumbs_cat_size); ?>"<?php if ($i['thumb_type'] == 'video') : ?> data-video-id="<?php echo $i['thumb_id']; ?>"<?php endif; ?>>
<?php endif; ?>
<?php if (!$i['locked'] && ($i['stats']['views'] || $i['stats']['comments'] || $i['stats']['votes'] || $i['stats']['favorites'])) : ?>
				<ul class="stats_icon">
<?php if ($i['stats']['views']) : ?>
					<li class="views"><span><?php echo $i['stats']['views']['short']; ?></span><span>&#xe907;</span></li>
<?php endif; ?>
<?php if ($i['stats']['comments']) : ?>
					<li class="comments"><span><?php echo $i['stats']['comments']['short']; ?></span><span>&#xe932;</span></li>
<?php endif; ?>
<?php if ($i['stats']['votes']) : ?>
					<li class="votes"><span><?php echo $i['stats']['votes']['short']; ?></span><span>&#xe9d9;</span></li>
<?php endif; ?>
<?php if ($i['stats']['favorites']) : ?>
					<li class="favorites"><span><?php echo $i['stats']['favorites']['short']; ?></span><span>&#xe910;</span></li>
<?php endif; ?>
				</ul>
<?php endif; ?>
			</a>
		</dt>
		<dd>
<?php if ($i['recent']['value'] && !$i['locked']) : ?>
			<a class="recent" title="<?php echo $i['recent']['text']; ?>" href="<?php echo $i['recent']['link']; ?>#content"><?php echo $i['recent']['formated']; ?></a>
<?php endif; ?>
<?php if ($i['title'] !== '') : ?>
			<span class="title"><a tabindex="-1" <?php if ($i['locked']) : ?>data-box="password" data-cat-id="<?php echo $i['id']; ?>" <?php endif; ?>href="<?php echo $i['link']; ?>"><?php echo $i['title']; ?></a></span>
<?php endif; ?>
<?php if (!$i['locked']) : ?>
			<ul class="stats">
<?php if ($i['stats']['rating']) : ?>
				<li class="rating"><span title="<?php echo $i['stats']['rating']['text']; ?>"><?php foreach ($i['stats']['rating']['array'] as $k => $v) : ?><span><?php if ($v == 1) : ?>&#xe9d9;<?php elseif ($v == 0) : ?>&#xe9d7;<?php else : ?>&#xe9d8;<?php endif; ?></span><?php endforeach; ?></span></li>
<?php endif; ?>
<?php if ($i['stats']['images'] || $i['stats']['videos']) : ?>
				<li class="items"><?php if ($i['stats']['images']['value']) : ?><span><a href="<?php echo $i['stats']['images']['link']; ?>#content"><?php echo $i['stats']['images']['text']; ?></a></span><?php endif; ?><?php if ($i['stats']['videos']['value']) : ?><span><a href="<?php echo $i['stats']['videos']['link']; ?>#content"><?php echo $i['stats']['videos']['text']; ?></a></span><?php endif; ?></li>
<?php endif; ?>
<?php if ($i['stats']['albums'] || $i['stats']['filesize']) : ?>
				<li class="albums_filesize"><?php if ($i['stats']['albums']) : ?><span><?php echo $i['stats']['albums']['text']; ?></span><?php endif; ?><?php if ($i['stats']['filesize']) : ?><span><?php echo $i['stats']['filesize']['text']; ?></span><?php endif; ?></li>
<?php endif; ?>
			</ul>
<?php endif; ?>
		</dd>
	</dl>
<?php endforeach; ?>
</div>
<?php endif; ?>

<?php if ($tpl['pages']['count'] > 1) : ?>
<div id="pages_bottom">
<?php include('pagination.tpl.php'); ?>
</div>
<?php endif; ?>

<?php if (!empty($tpl['rss'])) : ?>
<ul id="rss">
	<li><a title="<?php echo $tpl['rss']['items']['title']; ?>" href="<?php echo $tpl['rss']['items']['link']; ?>"><span>&#xe901;</span> <span><?php echo $tpl['rss']['items']['link_text']; ?></span></a></li>
	<li><a title="<?php echo $tpl['rss']['comments']['title']; ?>" href="<?php echo $tpl['rss']['comments']['link']; ?>"><span>&#xe901;</span> <span><?php echo $tpl['rss']['comments']['link_text']; ?></span></a></li>
</ul>
<?php endif; ?>
