<?php
/**
 * @version		2.6.x
 * @package		K2
 * @author		JoomlaWorks http://www.joomlaworks.net
 * @copyright	Copyright (c) 2006 - 2014 JoomlaWorks Ltd. All rights reserved.
 * @license		GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
 */

// no direct access
defined('_JEXEC') or die;

?>

<!-- Start K2 Category Layout -->
<div id="k2Container" class="itemListView">

	<?php if((isset($this->leading) || isset($this->primary) || isset($this->secondary) || isset($this->links)) && (count($this->leading) || count($this->primary) || count($this->secondary) || count($this->links))): ?>
	<!-- Item list -->
	<div class="itemList">

		<?php if(isset($this->leading) && count($this->leading)): ?>
		    <?php foreach($this->leading as $key=>$item): ?>
                <?php
                    // Load category_item.php by default
                    $this->item = $item;
                    echo $this->loadTemplate('item');
                ?>
            <?php endforeach; ?>     
		<?php endif; ?>

		<?php if(isset($this->primary) && count($this->primary)): ?>
		    <?php foreach($this->primary as $key=>$item): ?>
                <?php
                    // Load category_item.php by default
                    $this->item=$item;
                    echo $this->loadTemplate('item');
                ?>
            <?php endforeach; ?>   
		<?php endif; ?>

		<?php if(isset($this->secondary) && count($this->secondary)): ?>
		    <?php foreach($this->secondary as $key=>$item): ?>
                <?php
                    // Load category_item.php by default
                    $this->item = $item;
                    echo $this->loadTemplate('item');
                ?>
            <?php endforeach; ?>   
		<?php endif; ?>

		<?php if(isset($this->links) && count($this->links)): ?>
		    <?php foreach($this->links as $key=>$item): ?>
                <?php
                    // Load category_item_links.php by default
                    $this->item=$item;
                    echo $this->loadTemplate('item');
                ?>
            <?php endforeach; ?>   
		<?php endif; ?>

	</div>

	<!-- Pagination -->
	    <?php if($this->pagination->getPagesLinks()): ?>
	    <div class="t-pagination clearfix">
		    <div class="t-pagination_number pull-left">
                <?php if($this->params->get('catPagination')) echo $this->pagination->getPagesLinks(); ?>
            </div>  
            <div class="t-pagination_nav pull-right">
                <?php $data = $this->pagination->getData(); ?>
                <ul>
                    <?php if( property_exists( $data, 'previous' ) && $data->previous->link ) : ?>
                    <li><a class="fa fa-caret-left" href="<?php echo $data->previous->link; ?>"></a></li>
                    <?php endif; ?>
                    <?php if( property_exists( $data, 'next' ) && $data->next->link ) : ?>
                    <li><a class="fa fa-caret-right" href="<?php echo $data->next->link; ?>"></a></li>
                    <?php endif; ?>
                </ul>
            </div>                                                                                          
	    </div>
	    <?php endif; ?>
	<?php endif; ?>
</div>
<!-- End K2 Category Layout -->
