{**
 * templates/frontend/objects/article_summary.tpl
 *
 * Copyright (c) 2014-2024 Simon Fraser University Library
 * Copyright (c) 2003-2024 John Willinsky
 * Distributed under the GNU GPL v3. For full terms see the file docs/COPYING.
 *
 * @brief View of an Article summary which is shown within a list of articles.
 *
 * @uses $article Article The article
 * @uses $authorUserGroups Traversible The set of author user groups
 * @uses $hasAccess bool Can this user access galleys for this context? The
 *       context may be an issue or an article
 * @uses $showGalleyLinks bool Show galley links to users without access?
 * @uses $hideGalleys bool Hide the article galleys for this article?
 * @uses $primaryGenreIds array List of file genre ids for primary file types
 *}
{assign var=publication value=$article->getCurrentPublication()}
{assign var=articlePath value=$article->getBestId($currentJournal)}
{if (!$section.hideAuthor && $article->getHideAuthor() == \APP\submission\Submission::AUTHOR_TOC_DEFAULT) || $article->getHideAuthor() == \APP\submission\Submission::AUTHOR_TOC_SHOW}
	{assign var="showAuthor" value=true}
{/if}

<div class="article-summary media">
	{if $publication->getLocalizedData('coverImage')}
		{assign var="coverImage" value=$publication->getLocalizedData('coverImage')}
		<div class="cover media-left">
			<a href="{if $journal}{url journal=$journal->getPath() page="article" op="view" path=$articlePath}{else}{url page="article" op="view" path=$articlePath}{/if}" class="file">
				<img class="media-object" src="{$publication->getLocalizedCoverImageUrl($currentContext->getId())|escape}" alt="{$coverImage.altText|escape|default:''}">
			</a>
		</div>
	{/if}

	<div class="media-body ">
		<h3 class="media-heading">
            <a href="{if $journal}{url journal=$journal->getPath() page="article" op="view" path=$articlePath}{else}{url page="article" op="view" path=$articlePath}{/if}">
				{$article->getLocalizedTitle()|strip_unsafe_html}
				{if $article->getLocalizedSubtitle()}
					<p>
						<small>{$article->getLocalizedSubtitle()|escape}</small>
					</p>
				{/if}
			</a>
		</h3>

{if $showAuthor || $article->getPages()}

			{if $showAuthor}
				<div class="meta well well-sm">
					{if $showAuthor}
						<div class="authors">
						    <i class="bi bi-people-fill"></i><strong> 	{$article->getCurrentPublication()->getAuthorString($authorUserGroups)|escape}</strong>  | 
						    {* Page numbers for this article *}
						    			{if $article->getPages()} <i class="bi bi-file-earmark-text-fill"></i>
                					{$article->getPages()|escape} Pages
                			{/if}
						</div>
					{/if}
					
					{foreach from=$pubIdPlugins item=pubIdPlugin}
                    {if $issue->getPublished()}
                    {assign var=pubId value=$article->getStoredPubId($pubIdPlugin->getPubIdType())}
                        {else}
                        {assign var=pubId value=$pubIdPlugin->getPubId($article)}{* Preview pubId *}
                    {/if}
                    {if $pubId}
                    {assign var="doiUrl" value=$pubIdPlugin->getResolvingURL($currentJournal->getId(), $pubId)|escape}
                    <img src="https://ia-education.com/journal/public/site/icon-doi.png"> {translate key="plugins.pubIds.doi.readerDisplayName"} :
                    <a href="{$doiUrl}">
                    {$doiUrl}
                    <br></a>
                {/if}
            {/foreach}
				</div>
			{/if}

			{* Page numbers for this article *}
			{*	{if $article->getPages()}
				<p class="pages">
					{$article->getPages()|escape}
				</p>
			{/if} *}

		{/if}

<div class="breadcrumb">
	{if !$hideGalleys && $article->getGalleys()}
		{foreach from=$article->getGalleys() item=galley}
			{if $primaryGenreIds}
				{assign var="file" value=$galley->getFile()}
				{if !$galley->getRemoteUrl() && !($file && in_array($file->getGenreId(), $primaryGenreIds))}
					{continue}
				{/if}
			{/if}
			{assign var="hasArticleAccess" value=$hasAccess}
			{if $currentContext->getSetting('publishingMode') == $smarty.const.PUBLISHING_MODE_OPEN || $publication->getData('accessStatus') == $smarty.const.ARTICLE_ACCESS_OPEN}
				{assign var="hasArticleAccess" value=1}
			{/if}
			{include file="frontend/objects/galley_link.tpl" parent=$article hasAccess=$hasArticleAccess}
		{/foreach}
		<div class="galley_info">
		<i class="bi bi-eye-fill"></i> Abstract Views: {$article->getViews()} times | <i class="bi bi-cloud-arrow-down-fill"></i> Downloaded: {$galley->getViews()} times | <i class="bi bi-cloud-arrow-up-fill"></i> Published: {$article->getDatePublished()|date_format:$dateFormatShort}</div>
	{/if}

	{call_hook name="Templates::Issue::Issue::Article"}
</div><!-- .article-summary -->
