<?php
	global $tm_count;
    if (!isset($tm_count)) {
        $tm_count = 1;
    }
    else {
        $tm_count++;
    }
?>

<?php if($this->warp['system']->application->input->get('view') == 'category' && $this->warp['system']->application->input->get('layout') == 'blog' && $this['config']->get('article_timeline', 0)) { ?>

<!-- Article Timeline -->
	<article class="uk-article <?php echo (($tm_count) % 2 == 1) ? 'tm-left' : 'tm-right'; ?> uk-width-small-1-1 uk-width-medium-1-2 uk-width-large-1-2" <?php if ($this->warp['system']->application->input->get('view') == 'article') : ?><?php if ($permalink) echo 'data-permalink="'.$permalink.'"'; ?><?php endif; ?>>

			<?php if ($author || $date || $category) : ?>
			<div class="tm-timeline-info">
			<p class="uk-article-meta" data-uk-scrollspy="{cls:'uk-animation-fade', repeat: false}">

				<?php

					$author   = ($author && $author_url) ? '<a href="'.$author_url.'">'.$author.'</a>' : $author;
					$date     = ($date) ? ($datetime ? '<time datetime="'.$datetime.'">'.JHtml::_('date', $date, JText::_('DATE_FORMAT_LC3')).'</time>' : JHtml::_('date', $date, JText::_('DATE_FORMAT_LC3'))) : '';
					$category = ($category && $category_url) ? '<a href="'.$category_url.'">'.$category.'</a>' : $category;

					if($author && $date) {
						printf(JText::_('TPL_WARP_META_AUTHOR_DATE'), $author, $date);
					} elseif ($author) {
						printf(JText::_('TPL_WARP_META_AUTHOR'), $author);
					} elseif ($date) {
						printf(JText::_('TPL_WARP_META_DATE'), $date);
					}

					if ($category) {
						echo ' ';
						printf(JText::_('TPL_WARP_META_CATEGORY'), $category);
					}

				?>

			</p>
			
			<?php if ($edit) : ?>
			<p><?php echo $edit; ?></p>
			<?php endif; ?>
			
			</div>
			<?php endif; ?>

			<i class="uk-icon-info-circle uk-icon-large"></i>

		<div class="uk-panel uk-panel-box uk-panel-space" data-uk-scrollspy="{cls:'uk-animation-slide-bottom', repeat: false}">
		
			<?php if ($image && $image_alignment == 'none') : ?>
				<?php if ($url) : ?>
				<div class="uk-panel-teaser">
					<a href="<?php echo $url; ?>" title="<?php echo $image_caption; ?>"><img src="<?php echo $image; ?>" alt="<?php echo $image_alt; ?>"></a>
				</div>
				<?php else : ?>
				<div class="uk-panel-teaser">
					<img src="<?php echo $image; ?>" alt="<?php echo $image_alt; ?>">
				</div>
				<?php endif; ?>
			<?php endif; ?>

			<?php if ($title) : ?>
				<h2 class="tm-title">
				<?php if ($url && $title_link) : ?>
				<a href="<?php echo $url; ?>" title="<?php echo $title; ?>"><?php echo $title; ?></a>
				<?php else : ?>
					<?php echo $title; ?>
				<?php endif; ?>
				</h2>
			<?php endif; ?>

			<?php echo $hook_aftertitle; ?>

			<?php if ($image && $image_alignment != 'none') : ?>
				<?php if ($url) : ?>
					<a class="uk-align-<?php echo $image_alignment; ?>" href="<?php echo $url; ?>" title="<?php echo $image_caption; ?>"><img src="<?php echo $image; ?>" alt="<?php echo $image_alt; ?>"></a>
				<?php else : ?>
					<img class="uk-align-<?php echo $image_alignment; ?>" src="<?php echo $image; ?>" alt="<?php echo $image_alt; ?>">
				<?php endif; ?>
			<?php endif; ?>

			<?php echo $hook_beforearticle; ?>

			<?php if ($article) : ?>
				<?php echo $article; ?>
			<?php endif; ?>

			<?php if ($tags) : ?>
			<p><?php echo JText::_('TPL_WARP_TAGS').': '.$tags; ?></p>
			<?php endif; ?>

			<?php if ($more) : ?>
			<p class="tm-timeline-more">
				<a href="<?php echo $url; ?>" title="<?php echo $title; ?>"><?php echo $more; ?></a>
			</p>
			<?php endif; ?>



			<?php if ($this['config']->get('article_meta', false) && ($date_published || $date_modified || $hits)) : ?>
			<?php
				$date_published = ($date_published) ? JHtml::_('date', $date_published, JText::_('DATE_FORMAT_LC3')) : '';
				$date_modified = ($date_modified) ? JHtml::_('date', $date_modified, JText::_('DATE_FORMAT_LC3')) : '';
			?>
			<ul class="uk-list">
				<?php if ($date_published) : ?>
					<li><?php printf(JText::_('COM_CONTENT_PUBLISHED_DATE_ON'), $date_published); ?></li>
				<?php endif; ?>

				<?php if ($date_modified) : ?>
					<li><?php printf(JText::_('COM_CONTENT_LAST_UPDATED'), $date_modified); ?></li>
				<?php endif; ?>

				<?php if ($hits) : ?>
					<li><?php printf(JText::_('COM_CONTENT_ARTICLE_HITS'), $hits); ?></li>
				<?php endif; ?>
			</ul>
			<?php endif; ?>

			<?php if ($previous || $next) : ?>
			<ul class="uk-pagination">
				<?php if ($previous) : ?>
				<li class="uk-pagination-previous">
					<a href="<?php echo $previous; ?>"><i class="uk-icon-angle-double-left"></i> <?php echo JText::_('JPREV'); ?></a>
				</li>
				<?php endif; ?>

				<?php if ($next) : ?>
				<li class="uk-pagination-next">
					<a href="<?php echo $next; ?>"><?php echo JText::_('JNEXT'); ?> <i class="uk-icon-angle-double-right"></i></a>
				</li>
				<?php endif; ?>
			</ul>
			<?php endif; ?>

			<?php echo $hook_afterarticle; ?>
		</div>
	</article>

<?php } elseif ($this->warp['system']->application->input->get('view') == 'featured' && $more && $this['config']->get('featured_articles', 0)) { ?>

<!-- Article Featured-->
	<div class="uk-position-relative">
			<article class="uk-article" <?php if ($this->warp['system']->application->input->get('view') == 'article') : ?><?php if ($permalink) echo 'data-permalink="'.$permalink.'"'; ?><?php endif; ?>>

				<?php if ($image && $image_alignment == 'none') : ?>
					<?php if ($url) : ?>
						<a href="<?php echo $url; ?>" title="<?php echo $image_caption; ?>"><img src="<?php echo $image; ?>" alt="<?php echo $image_alt; ?>"></a>
					<?php else : ?>
						<img src="<?php echo $image; ?>" alt="<?php echo $image_alt; ?>">
					<?php endif; ?>
				<?php endif; ?>

				<div class="<?php echo (($tm_count) % 2 == 1) ? 'tm-mask-article-white' : 'tm-mask-article-grey'; ?>"></div>

			<?php if ($title) : ?>
				<h2 class="tm-title">
				<?php if ($url && $title_link) : ?>
				<a href="<?php echo $url; ?>" title="<?php echo $title; ?>"><?php echo $title; ?></a>
				<?php else : ?>
					<?php echo $title; ?>
				<?php endif; ?>
				</h2>
			<?php endif; ?>

				<?php echo $hook_aftertitle; ?>

				<?php if ($author || $date || $category) : ?>
				<p class="uk-article-meta uk-text-center">

					<?php

						$author   = ($author && $author_url) ? '<a href="'.$author_url.'">'.$author.'</a>' : $author;
						$date     = ($date) ? ($datetime ? '<time datetime="'.$datetime.'">'.JHtml::_('date', $date, JText::_('DATE_FORMAT_LC3')).'</time>' : JHtml::_('date', $date, JText::_('DATE_FORMAT_LC3'))) : '';
						$category = ($category && $category_url) ? '<a href="'.$category_url.'">'.$category.'</a>' : $category;

						if($author && $date) {
							printf(JText::_('TPL_WARP_META_AUTHOR_DATE'), $author, $date);
						} elseif ($author) {
							printf(JText::_('TPL_WARP_META_AUTHOR'), $author);
						} elseif ($date) {
							printf(JText::_('TPL_WARP_META_DATE'), $date);
						}

						if ($category) {
							echo ' ';
							printf(JText::_('TPL_WARP_META_CATEGORY'), $category);
						}

					?>

				</p>
				<?php endif; ?>

				<?php if ($image && $image_alignment != 'none') : ?>
					<?php if ($url) : ?>
						<a class="uk-align-<?php echo $image_alignment; ?>" href="<?php echo $url; ?>" title="<?php echo $image_caption; ?>"><img src="<?php echo $image; ?>" alt="<?php echo $image_alt; ?>"></a>
					<?php else : ?>
						<img class="uk-align-<?php echo $image_alignment; ?>" src="<?php echo $image; ?>" alt="<?php echo $image_alt; ?>">
					<?php endif; ?>
				<?php endif; ?>

				<?php echo $hook_beforearticle; ?>

				<?php if ($article) : ?>
					<?php echo $article; ?>
				<?php endif; ?>

				<?php if ($tags) : ?>
				<p><?php echo JText::_('TPL_WARP_TAGS').': '.$tags; ?></p>
				<?php endif; ?>


				<div class="tm-more uk-text-center">
					<a href="<?php echo $url; ?>" title="<?php echo $title; ?>"><?php echo $more; ?></a>
				</div>


				<?php if ($edit) : ?>
				<div class="tm-edit uk-text-center"><?php echo $edit; ?></div>
				<?php endif; ?>

				<?php if ($this['config']->get('article_meta', false) && ($date_published || $date_modified || $hits)) : ?>
				<?php
					$date_published = ($date_published) ? JHtml::_('date', $date_published, JText::_('DATE_FORMAT_LC3')) : '';
					$date_modified = ($date_modified) ? JHtml::_('date', $date_modified, JText::_('DATE_FORMAT_LC3')) : '';
				?>
				<ul class="uk-list">
					<?php if ($date_published) : ?>
						<li><?php printf(JText::_('COM_CONTENT_PUBLISHED_DATE_ON'), $date_published); ?></li>
					<?php endif; ?>

					<?php if ($date_modified) : ?>
						<li><?php printf(JText::_('COM_CONTENT_LAST_UPDATED'), $date_modified); ?></li>
					<?php endif; ?>

					<?php if ($hits) : ?>
						<li><?php printf(JText::_('COM_CONTENT_ARTICLE_HITS'), $hits); ?></li>
					<?php endif; ?>
				</ul>
				<?php endif; ?>

				<?php if ($previous || $next) : ?>
				<ul class="uk-pagination">
					<?php if ($previous) : ?>
					<li class="uk-pagination-previous">
						<a href="<?php echo $previous; ?>"><i class="uk-icon-angle-double-left"></i> <?php echo JText::_('JPREV'); ?></a>
					</li>
					<?php endif; ?>

					<?php if ($next) : ?>
					<li class="uk-pagination-next">
						<a href="<?php echo $next; ?>"><?php echo JText::_('JNEXT'); ?> <i class="uk-icon-angle-double-right"></i></a>
					</li>
					<?php endif; ?>
				</ul>
				<?php endif; ?>

				<?php echo $hook_afterarticle; ?>

			</article>
	</div>

<?php } else { ?>

	<!-- Default Article -->
	<article class="uk-article" <?php if ($this->warp['system']->application->input->get('view') == 'article') : ?><?php if ($permalink) echo 'data-permalink="'.$permalink.'"'; ?><?php endif; ?>>

		<?php if ($image && $image_alignment == 'none') : ?>
			<?php if ($url) : ?>
				<a href="<?php echo $url; ?>" title="<?php echo $image_caption; ?>"><img src="<?php echo $image; ?>" alt="<?php echo $image_alt; ?>"></a>
			<?php else : ?>
				<img src="<?php echo $image; ?>" alt="<?php echo $image_alt; ?>">
			<?php endif; ?>
		<?php endif; ?>

			<?php if ($title) : ?>
				<h2 class="tm-title">
				<?php if ($url && $title_link) : ?>
				<a href="<?php echo $url; ?>" title="<?php echo $title; ?>"><?php echo $title; ?></a>
				<?php else : ?>
					<?php echo $title; ?>
				<?php endif; ?>
				</h2>
			<?php endif; ?>

		<?php echo $hook_aftertitle; ?>

		<?php if ($author || $date || $category) : ?>
		<p class="uk-article-meta">

			<?php

				$author   = ($author && $author_url) ? '<a href="'.$author_url.'">'.$author.'</a>' : $author;
				$date     = ($date) ? ($datetime ? '<time datetime="'.$datetime.'">'.JHtml::_('date', $date, JText::_('DATE_FORMAT_LC3')).'</time>' : JHtml::_('date', $date, JText::_('DATE_FORMAT_LC3'))) : '';
				$category = ($category && $category_url) ? '<a href="'.$category_url.'">'.$category.'</a>' : $category;

				if($author && $date) {
					printf(JText::_('TPL_WARP_META_AUTHOR_DATE'), $author, $date);
				} elseif ($author) {
					printf(JText::_('TPL_WARP_META_AUTHOR'), $author);
				} elseif ($date) {
					printf(JText::_('TPL_WARP_META_DATE'), $date);
				}

				if ($category) {
					echo ' ';
					printf(JText::_('TPL_WARP_META_CATEGORY'), $category);
				}

			?>

		</p>
		<?php endif; ?>

		<?php if ($image && $image_alignment != 'none') : ?>
			<?php if ($url) : ?>
				<a class="uk-align-<?php echo $image_alignment; ?>" href="<?php echo $url; ?>" title="<?php echo $image_caption; ?>"><img src="<?php echo $image; ?>" alt="<?php echo $image_alt; ?>"></a>
			<?php else : ?>
				<img class="uk-align-<?php echo $image_alignment; ?>" src="<?php echo $image; ?>" alt="<?php echo $image_alt; ?>">
			<?php endif; ?>
		<?php endif; ?>

		<?php echo $hook_beforearticle; ?>

		<?php if ($article) : ?>
			<?php echo $article; ?>
		<?php endif; ?>

		<?php if ($tags) : ?>
		<p><?php echo JText::_('TPL_WARP_TAGS').': '.$tags; ?></p>
		<?php endif; ?>

		<?php if ($more) : ?>
		<p class="tm-default-more">
			<a href="<?php echo $url; ?>" title="<?php echo $title; ?>"><?php echo $more; ?></a>
		</p>
		<?php endif; ?>

		<?php if ($edit) : ?>
		<p><?php echo $edit; ?></p>
		<?php endif; ?>

		<?php if ($this['config']->get('article_meta', false) && ($date_published || $date_modified || $hits)) : ?>
		<?php
			$date_published = ($date_published) ? JHtml::_('date', $date_published, JText::_('DATE_FORMAT_LC3')) : '';
			$date_modified = ($date_modified) ? JHtml::_('date', $date_modified, JText::_('DATE_FORMAT_LC3')) : '';
		?>
		<ul class="uk-list">
			<?php if ($date_published) : ?>
				<li><?php printf(JText::_('COM_CONTENT_PUBLISHED_DATE_ON'), $date_published); ?></li>
			<?php endif; ?>

			<?php if ($date_modified) : ?>
				<li><?php printf(JText::_('COM_CONTENT_LAST_UPDATED'), $date_modified); ?></li>
			<?php endif; ?>

			<?php if ($hits) : ?>
				<li><?php printf(JText::_('COM_CONTENT_ARTICLE_HITS'), $hits); ?></li>
			<?php endif; ?>
		</ul>
		<?php endif; ?>

		<?php if ($previous || $next) : ?>
		<ul class="uk-pagination">
			<?php if ($previous) : ?>
			<li class="uk-pagination-previous">
				<a href="<?php echo $previous; ?>"><i class="uk-icon-angle-double-left"></i> <?php echo JText::_('JPREV'); ?></a>
			</li>
			<?php endif; ?>

			<?php if ($next) : ?>
			<li class="uk-pagination-next">
				<a href="<?php echo $next; ?>"><?php echo JText::_('JNEXT'); ?> <i class="uk-icon-angle-double-right"></i></a>
			</li>
			<?php endif; ?>
		</ul>
		<?php endif; ?>

		<?php echo $hook_afterarticle; ?>

	</article>

<?php } ?>