<?php
/**
 * Copyright © 2015 Ihor Vansach (ihor@megnor.com). All rights reserved.
 * See LICENSE.txt for license details (http://opensource.org/licenses/osl-3.0.php).
 *
 * Glory to Ukraine! Glory to the heroes!
 */
?>
<?php
/**
 * Blog post list item template
 *
 * @var $block \Megnor\Blog\Block\Post\AbstractPost
 */
?>
<?php
    $_post = $this->getPost();
    $_postUrl = $_post->getPostUrl();
    $_postName = $block->escapeHtml($_post->getTitle(), null, true);
?>
<div class="blog_inner post-holder post-holder-<?php echo $_post->getId() ?>">
    <div class="post-content product-image-inner-blog">
        <div class="post-description clearfix">
            <?php if ($featuredImage = $_post->getFeaturedImage()) { ?>
            <div class="post-ftimg-hld">
                <a href="<?php echo $_postUrl ?>" title="<?php echo $_postName ?>">
                    <img src="<?php echo $featuredImage ?>" alt="<?php echo $_postName ?>" />
                </a>
                <div class="post-image-hover"></div>
                <div class="image-hover-block">
                    <a href="<?php echo $featuredImage ?>" title="Click to zoom the image" class="zoom lightbox cboxElement"><i class="fa fa-search-plus"> &nbsp;</i></a>
                    <a href="<?php echo $_postUrl ?>" title="Click For Read More" class="read"><i class="fa fa-link"> &nbsp;</i></a>
                </div>
            </div>
            <?php } ?>
    <div class="blog-right-content">
	<div class="post-header post-content-inner">

        <div class="post-title-holder clearfix">
            <h2 class="post-title">
                <a class="post-item-link" href="<?php echo $_postUrl ?>">
                    <?php
                    $pnamecount = strlen($_postName);
                    $pname = $_postName; 
                    if($pnamecount >= 50){
                       echo  substr($pname,0,50)."....";
                    } else {
                       echo $pname; 
                    }
                ?>
                </a>
            </h2>

            <div class="item post-posed-date post-date">
                <i class="fa fa-calendar"> </i>
                <span class="value"><?php echo $_post->getPublishDate('F d, Y') ?></span>
             </div>

        </div>

        <?php echo $this->getInfoHtml() ?>
    </div>
            <div class="post-text-hld clearfix">
                <?php
                    $desccount = strlen($block->getShorContent($_post));
                    $desc = $block->getShorContent($_post); 
                    if($desccount >= 250){
                       echo  substr($desc,0,250)."....";
                    } else {
                       echo $desc; 
                    }
                ?>
            </div>
            <a class="post-read-more" href="<?php echo $_postUrl ?>" title="<?php echo $_postName ?>"
               >
               <?php echo __('Read more') ?>
            </a>
            <div class="addthis_toolbox addthis_default_style" addthis:url="<?php echo $_postUrl ?>">
                <a class="addthis_button_facebook"></a>
                <a class="addthis_button_twitter"></a>
                <a class="addthis_button_email"></a>
                <a class="addthis_button_compact"></a>
            </div>
        </div>
    </div>
    </div>
     
</div>
