<?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;
 
?>

<div class="t-blog_detail clearfix">  
  <div class="col-lg-1 col-md-1 col-sm-2 col-xs-12 t-blog_detail_bloger_img">
      <div class="row">
        <div class="t-glyp_icon ">
            <span class="glyph-item mega" aria-hidden="true" data-icon="&#xe07f;" data-js-prompt="&amp;#xe07f;"></span>
            <?php if(property_exists( $this->item->author, 'avatar' )): ?>
            <img class="wow swing center  animated" alt="" data-wow-iteration="1" style="visibility: visible; animation-iteration-count: 1; animation-name: swing;" src="<?php echo $this->item->author->avatar; ?>" width="60">
            <?php endif; ?>
            
        </div>
      </div>
  </div>
  <div class="col-lg-11 col-md-11 col-sm-10 col-xs-12 t-blog_detail_content">
    <?php if($this->item->params->get('itemImage') && !empty($this->item->image)): ?>
      <!-- Item Image -->
      <img src="<?php echo $this->item->image; ?>" alt="<?php if(!empty($this->item->image_caption)) echo K2HelperUtilities::cleanHtml($this->item->image_caption); else echo K2HelperUtilities::cleanHtml($this->item->title); ?>" class="img-responsive" />
    <?php endif; ?>                           
    <div class="t-blog_detail_info">
    <?php if($this->item->params->get('itemTitle')): ?>
      <h2><?php echo $this->item->title; ?></h2>
      <?php endif; ?>
      <ul class="t-blog_general_info">
            <?php if($this->item->params->get('catItemDateCreated')): ?>
                <!-- Date created -->
                <li><span><?php echo JHTML::_( 'date', $this->item->created , 'M d Y' ); ?></span></li>
                <?php endif; ?>
                <?php if($this->item->params->get('catItemAuthor')): ?>
                <!-- Item Author -->
                <li><span class="catItemAuthor">
                    <?php echo K2HelperUtilities::writtenBy($this->item->author->profile->gender); ?> 
                    <?php echo $this->item->author->name; ?>
                </span></li>
                <?php endif; ?>
                <?php if($this->item->params->get('catItemCommentsAnchor') && ( ($this->item->params->get('comments') == '2' && !$this->user->guest) || ($this->item->params->get('comments') == '1')) ): ?>
                <!-- Anchor link to comments below -->
                <li class="catItemCommentsLink">
                    <?php if(!empty($this->item->event->K2CommentsCounter)): ?>
                        <!-- K2 Plugins: K2CommentsCounter -->
                        <span>
                            <i aria-hidden="true" class="icon-bubbles"></i>&nbsp;<?php echo $this->item->event->K2CommentsCounter; ?>
                        </span>
                    <?php else: ?>
                        <?php if($this->item->numOfComments > 0): ?>
                        <a href="<?php echo $this->item->link; ?>#itemCommentsAnchor">
                            <span><i class="icon-bubbles" aria-hidden="true"></i>&nbsp;<?php echo $this->item->numOfComments; ?></span>
                        </a>   
                        <?php else: ?>
                        <a href="<?php echo $this->item->link; ?>#itemCommentsAnchor">
                            <span><i aria-hidden="true" class="icon-bubbles"></i> &nbsp;0</span>
                        </a>
                        <?php endif; ?>
                    <?php endif; ?>
                </li>
                <?php endif; ?>
                <?php if($this->item->params->get('itemRating')): ?>
                <!-- Item Rating -->
                <li>
                    <div class="itemRatingBlock">
                        <div class="itemRatingForm">
                            <ul class="itemRatingList">
                                <li class="itemCurrentRating" id="itemCurrentRating<?php echo $this->item->id; ?>" style="width:<?php echo $this->item->votingPercentage; ?>%;"></li>
                                <li><a href="#" data-id="<?php echo $this->item->id; ?>" title="<?php echo JText::_('K2_1_STAR_OUT_OF_5'); ?>" class="one-star">1</a></li>
                                <li><a href="#" data-id="<?php echo $this->item->id; ?>" title="<?php echo JText::_('K2_2_STARS_OUT_OF_5'); ?>" class="two-stars">2</a></li>
                                <li><a href="#" data-id="<?php echo $this->item->id; ?>" title="<?php echo JText::_('K2_3_STARS_OUT_OF_5'); ?>" class="three-stars">3</a></li>
                                <li><a href="#" data-id="<?php echo $this->item->id; ?>" title="<?php echo JText::_('K2_4_STARS_OUT_OF_5'); ?>" class="four-stars">4</a></li>
                                <li><a href="#" data-id="<?php echo $this->item->id; ?>" title="<?php echo JText::_('K2_5_STARS_OUT_OF_5'); ?>" class="five-stars">5</a></li>
                            </ul>
                            <div id="itemRatingLog<?php echo $this->item->id; ?>" class="itemRatingLog"><?php echo $this->item->numOfvotes; ?></div>
                            <div class="clr"></div>
                        </div>
                        <div class="clr"></div>
                    </div>
                </li>
            <?php endif; ?> 
      </ul>
    </div>
    <div class="t-blog_detail_text">
      <?php if(!empty($this->item->fulltext)): ?>
      <?php if($this->item->params->get('itemIntroText')): ?>
      <!-- Item introtext -->
      <div class="itemIntroText">
          <?php echo $this->item->introtext; ?>
      </div>
      <?php endif; ?>
      <?php if($this->item->params->get('itemFullText')): ?>
      <!-- Item fulltext -->
      <div class="itemFullText">
          <?php echo $this->item->fulltext; ?>
      </div>
      <?php endif; ?>
      <?php else: ?>
      <!-- Item text -->
      <div class="itemFullText">
          <?php echo $this->item->introtext; ?>
      </div>
      <?php endif; ?>
    </div>
    <div class="t-pagination clearfix">
    <?php if($this->item->params->get('itemNavigation') && !JRequest::getCmd('print') && (isset($this->item->nextLink) || isset($this->item->previousLink))): ?>
      <div class="t-pagination_nav pull-left">  
        <ul>
          <?php if(isset($this->item->previousLink)): ?>
          <li><a class="fa fa-caret-left" href="<?php echo $this->item->previousLink; ?>"></a></li>
          <?php endif; ?>
          <?php if(isset($this->item->nextLink)): ?>
          <li><a class="fa fa-caret-right" href="<?php echo $this->item->nextLink; ?>"></a></li>
          <?php endif; ?>   
        </ul> 
      </div>
      <?php endif; ?>   
    <?php if($this->item->params->get('itemTwitterButton',1) || $this->item->params->get('itemFacebookButton',1) || $this->item->params->get('itemGooglePlusOneButton',1)): ?>
        <!-- Social sharing -->
        <div class="t-blog_social_links pull-right">
            <ul>

            <?php if($this->item->params->get('itemTwitterButton',1)): ?>
            <!-- Twitter Button -->
            <li><a href="https://twitter.com/intent/tweet?text=<?php echo K2HelperUtilities::cleanHtml($this->item->title) . ' ' . $this->item->link; ?>" class="fa fa-twitter"></a></li>   
            <?php endif; ?>

            <?php if($this->item->params->get('itemFacebookButton',1)): ?>
            <!-- Facebook Button -->
            <li><a href="https://www.facebook.com/sharer.php?u=<?php echo $this->item->link; ?>&t=<?php echo K2HelperUtilities::cleanHtml($this->item->title); ?>" class="fa fa-facebook"></a></li>          
            <?php endif; ?>

            <?php if($this->item->params->get('itemGooglePlusOneButton',1)): ?>
            <!-- Google +1 Button -->
            <li><a href="https://plus.google.com/share?url=<?php echo $this->item->link; ?>" class="fa fa-google-plus"></a></li>   
            <?php endif; ?>

            </ul> 
        </div>
        <?php endif; ?>    
    </div>
  </div>
</div>
<!-- BLOG COMMENT START -->
<?php if($this->item->params->get('itemComments') && ($this->item->params->get('comments') == '1' || ($this->item->params->get('comments') == '2')) && empty($this->item->event->K2CommentsBlock)): ?>
  <!-- Item comments -->
  <a name="itemCommentsAnchor" id="itemCommentsAnchor"></a>

  <div class="t-blog_comments xitemComments">

      <?php if($this->item->params->get('commentsFormPosition')=='above' && $this->item->params->get('itemComments') && !JRequest::getInt('print') && ($this->item->params->get('comments') == '1' || ($this->item->params->get('comments') == '2' && K2HelperPermissions::canAddComment($this->item->catid)))): ?>
      <!-- Item comments form -->
      <div class="itemCommentsForm">
          <?php echo $this->loadTemplate('comments_form'); ?>
      </div>
      <?php endif; ?>

      <?php if($this->item->numOfComments>0 && $this->item->params->get('itemComments') && ($this->item->params->get('comments') == '1' || ($this->item->params->get('comments') == '2'))): ?>
      <!-- Item user comments -->
      <header class="t-section_subheader">
          <h4 class="itemCommentsCounter">
              <span><?php echo $this->item->numOfComments; ?></span> <?php echo ($this->item->numOfComments>1) ? JText::_('K2_COMMENTS') : JText::_('K2_COMMENT'); ?>
          </h4>
          <span class="t-section_subheader_border"></span>
      </header>

      <div class="t-comment_listing itemCommentsList">
        <?php foreach ($this->item->comments as $key=>$comment): ?>
        <div class="t-single_user_cemment">
          <header class="t-single_comment_header clearfix">
            <h5><?php echo JFilterOutput::cleanText($comment->userName); ?></h5>
            <span><?php echo JHTML::_('date', $comment->commentDate, JText::_('K2_DATE_FORMAT_LC2')); ?></span>
          </header>
          <div class="t-single_comment_text">
            <p><?php echo $comment->commentText; ?></p>
          </div>
          <?php if($comment->reportUserLink): ?>
          <a href="<?php echo $comment->reportUserLink; ?>" class="t-single_comment_reply"><?php echo JText::_('K2_FLAG_AS_SPAMMER'); ?></a>
          <?php endif; ?> 
          <?php if($comment->userImage): ?>
            <div class="t-single_comment_user_img">
                <img src="<?php echo $comment->userImage; ?>" alt="<?php echo JFilterOutput::cleanText($comment->userName); ?>" width="<?php echo $this->item->params->get('commenterImgWidth'); ?>" class="wow swing center   animated" data-wow-iteration="1" alt="" style="visibility: visible; animation-iteration-count: 1; animation-name: swing;" />
            </div>
          <?php endif; ?> 
          </div>
        <?php endforeach; ?>
      </div>

      <div class="itemCommentsPagination">
          <?php echo $this->pagination->getPagesLinks(); ?>
          <div class="clr"></div>
      </div>
        <?php endif; ?>

        <?php if($this->item->params->get('commentsFormPosition')=='below' && $this->item->params->get('itemComments') && !JRequest::getInt('print') && ($this->item->params->get('comments') == '1' || ($this->item->params->get('comments') == '2' && K2HelperPermissions::canAddComment($this->item->catid)))): ?>
      <!-- Item comments form -->
      <div class="itemCommentsForm">
          <?php echo $this->loadTemplate('comments_form'); ?>
      </div>
      <?php endif; ?>

      <?php $user = JFactory::getUser(); if ($this->item->params->get('comments') == '2' && $user->guest): ?>
              <div><?php echo JText::_('K2_LOGIN_TO_POST_COMMENTS'); ?></div>
      <?php endif; ?>

  </div>
  <?php endif; ?>
