<?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;
?>
<?php if(count($items)): ?>   
    
    <?php if($params->get('itemPreText')): ?>
    <div class="t-section_pera">
        <p class="modulePretext"><?php echo $params->get('itemPreText'); ?></p>
    </div>
    <?php endif; ?>
    
    <div class="t-home_blog_listing clearfix"> 
        <div class="row">
            <?php foreach ($items as $key => $item) : ?>
            <?php if($params->get('itemImage')): ?>
                <div class="t-home_single_blog clearfix">
                    <div class="col-lg-1 col-md-2 col-sm-3 col-xs-12 t-home_bloger_img">
                          <div class="t-glyp_icon ">
                                <span class="glyph-item mega" aria-hidden="true" data-icon="&#xe07f;" data-js-prompt="&amp;#xe07f;"></span>
                                <?php if( $avatar = K2HelperUtilities::getAvatar( $item->created_by ) ) : ?>
                                  <img src="<?php echo $avatar; ?>" class="wow swing center animated" alt="" data-wow-iteration="1" width="60" height="60" >
                                <?php endif; ?>
                          </div>
                    </div>
                    <div class="col-lg-5 col-md-10 col-sm-9 col-xs-12 t-home_blog_img">
                          <a class="moduleItemImage" href="<?php echo $item->link; ?>" title="<?php echo K2HelperUtilities::cleanHtml($item->title); ?>">
                            <img src="<?php echo $item->image; ?>" alt="<?php echo K2HelperUtilities::cleanHtml($item->title); ?>" class="img-responsive" height="300"/>
                          </a>
                    </div>
                    <div class="col-lg-6 col-md-12 col-sm-12 col-xs-12 t_home_blog_content">
                          <div class="row t-home_blog_content_inner">
                                <?php if($params->get('itemTitle')): ?>
                                    <a href="<?php echo $item->link; ?>"><?php echo $item->title; ?></a>
                                <?php endif; ?>
                                <ul class="t-home_blog_info">
                                    <?php if($params->get('itemDateCreated')): ?>
                                    <li><span><?php echo JHTML::_('date', $item->created, 'M d, Y'); ?></span></li>
                                    <?php endif; ?>
                                    <?php if($params->get('itemAuthor')): ?>
                                    <li><span>
                                        <?php echo K2HelperUtilities::writtenBy($item->authorGender); ?>:
                                        <?php if(isset($item->authorLink)): ?>
                                            <a rel="author" title="<?php echo K2HelperUtilities::cleanHtml($item->author); ?>" href="<?php echo $item->authorLink; ?>"><?php echo $item->author; ?></a>
                                        <?php else: ?>
                                            <?php echo $item->author; ?>
                                        <?php endif; ?> 
                                    </span></li>
                                    <?php endif; ?>
                                    <?php if($params->get('itemCommentsCounter') && $componentParams->get('comments')): ?>        
                                    <li>
                                        <span>
                                            <i class="icon-bubbles" aria-hidden="true"></i>
                                            <?php if(!empty($item->event->K2CommentsCounter)): ?>
                                                <?php echo $item->event->K2CommentsCounter; ?>
                                            <?php else: ?>
                                                <?php if($item->numOfComments>0): ?>
                                                    <?php echo $item->numOfComments; ?>
                                                <?php else: ?>
                                                    0
                                                <?php endif; ?>
                                            <?php endif; ?>
                                        </span>
                                    </li>
                                    <?php endif; ?>       
                                </ul>  
                                <?php if($params->get('itemIntroText')): ?>
                                    <?php if( preg_match( '<p>', $item->introtext ) ) : ?>
                                        <?php echo $item->introtext; ?>
                                    <?php endif; ?>
                                <?php endif; ?>
                                <?php if($params->get('itemReadMore') && $item->fulltext): ?>
                                    <a class="t-btn t-btn_bg" href="<?php echo $item->link; ?>"><?php echo JText::_('K2_READ_MORE'); ?></a>
                                <?php endif; ?>
                          </div>
                    </div>
                </div>  
            <?php endif; ?>
            <?php endforeach; ?>
        </div>
        <?php if($params->get('itemCustomLink')): ?>
        <a class="t-btn t-btn_load_more" href="<?php echo $params->get('itemCustomLinkURL'); ?>" title="<?php echo K2HelperUtilities::cleanHtml($itemCustomLinkTitle); ?>"><?php echo $itemCustomLinkTitle; ?></a>
        <?php endif; ?>
    </div>  
  <?php endif; ?>
