<?php
/**
 * @package Helix Ultimate Framework
 * @author JoomShaper https://www.joomshaper.com
 * @copyright Copyright (c) 2010 - 2021 JoomShaper
 * @license http://www.gnu.org/licenses/gpl-2.0.html GNU/GPLv2 or Later
*/

defined ('JPATH_BASE') or die();

use Joomla\CMS\Layout\LayoutHelper;
use Joomla\CMS\Language\Text;
use Joomla\CMS\Factory;
use Joomla\CMS\User\UserHelper;


$intro = (isset($displayData['intro']) && $displayData['intro']) ? $displayData['intro'] : false;
$displayData['articleView'] = ($intro) ? 'intro' : 'details';
$blockPosition = $displayData['params']->get('info_block_position', 0);
$template = HelixUltimate\Framework\Platform\Helper::loadTemplateData();
$blogReadTime = $template->params->get('blog_read_time'); 

$author = Factory::getUser( (int) $displayData['item']->created_by );
$profile = UserHelper::getProfile( (int) $displayData['item']->created_by );

?>
<div class="article-info">
    
	<?php if ($displayData['position'] === 'above' && ($blockPosition == 0 || $blockPosition == 2)
			|| $displayData['position'] === 'below' && ($blockPosition == 1)
			) : ?>

		<?php if ($displayData['params']->get('show_author') && !empty($displayData['item']->author )) : ?>
            <div class="article-author-text">
                <?php if($template->params->get('author_info', 0)) : ?>
                <img class="me-3" src="https://www.gravatar.com/avatar/<?php echo md5($author->get('email')); ?>?s=64&d=identicon&r=PG" alt="<?php echo $author->name; ?>">  
            <?php endif; ?>
                <div>
                    <?php echo "<p>" . Text::_('ARTICLE_AUTHOR_TITLE') ."</p>"?>
                    <?php echo $this->sublayout('author', $displayData); ?>
                </div>
            </div>
		<?php endif; ?>

		<?php if ($displayData['params']->get('show_parent_category') && !empty($displayData['item']->parent_slug) && $intro == false) : ?>
			<?php echo $this->sublayout('parent_category', $displayData); ?>
		<?php endif; ?>

		<?php if ($displayData['params']->get('show_category')) : ?>
            <div class="article-category-text">
                <?php echo "<p>" . Text::_('ARTICLE_CATEGORY_TITLE') ."</p>"?>
			    <?php echo $this->sublayout('category', $displayData); ?>
            </div>
		<?php endif; ?>

		<?php if ($displayData['params']->get('show_associations') && $intro == false) : ?>
			<?php echo $this->sublayout('associations', $displayData); ?>
		<?php endif; ?>

		<?php if ($displayData['params']->get('show_publish_date')) : ?>
            <div class="article-publish-date-text">
                <?php echo "<p>" . Text::_('ARTICLE_PUBLISHED_TITLE') ."</p>"?>
                <?php echo $this->sublayout('publish_date', $displayData); ?>
            </div>
		<?php endif; ?>
        <?php if ($blogReadTime) :?>
        <div class="article-reading-time-text">
                <?php echo "<p>" . Text::_('ARTICLE_READING_TIME_TITLE') ."</p>"?>
			    <?php echo $this->sublayout('reading_time', $displayData['item']); ?>
            </div>
		<?php endif; ?>

		<?php if ($intro) : ?>
			<?php echo LayoutHelper::render('joomla.content.blog.comments.count', $displayData); ?>
		<?php endif; ?>

	<?php endif; ?>

	<?php if ($displayData['position'] === 'above' && ($blockPosition == 0)
			|| $displayData['position'] === 'below' && ($blockPosition == 1 || $blockPosition == 2)
			) : ?>
		<?php if ($displayData['params']->get('show_create_date') && $intro == false) : ?>
			<?php echo $this->sublayout('create_date', $displayData); ?>
		<?php endif; ?>

		<?php if ($displayData['params']->get('show_modify_date') && $intro == false) : ?>
			<?php echo $this->sublayout('modify_date', $displayData); ?>
		<?php endif; ?>

		<?php if ($displayData['params']->get('show_hits') && $intro == false) : ?>
			<?php echo $this->sublayout('hits', $displayData); ?>
		<?php endif; ?>
		
		
	<?php endif; ?>
</div>
