<?php
/**
 * @package     Joomla.Plugin
 * @subpackage  Content.pagenavigation
 *
 * @copyright   (C) 2013 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

defined('_JEXEC') or die;

use Joomla\CMS\Router\Route;
use Joomla\CMS\Language\Text;
use Joomla\CMS\HTML\HTMLHelper;
use Joomla\CMS\Factory;
use Joomla\CMS\Table\Table;

HTMLHelper::_('bootstrap.tooltip');

$lang = Factory::getLanguage();
$menu = $app->getMenu();
$article = Table::getInstance('content');
?>

<ul class="pager pagenav">
<?php if ($row->prev) :
	$direction = $lang->isRtl() ? 'right' : 'left'; ?>
	<li class="previous">
		<a class="hasTooltip" title="<?php echo htmlspecialchars($rows[$location-1]->title); ?>" aria-label="<?php echo Text::sprintf('JPREVIOUS_TITLE', htmlspecialchars($rows[$location-1]->title)); ?>" href="<?php echo $row->prev; ?>" rel="prev">
			
			<?php
				//$item = $menu->getItem($rows[$location-1]->id);
				//$link = Route::_($item->link . '&Itemid=' . $item->id);
			?>

			<div class="nav-text">
				<span class="icon-chevron-<?php echo $direction;?>"></span>
				<span aria-hidden="true"><?php echo Text::_('JPREVIOUS'); ?></span>
			</div>

			<div class="nav-info">
				<div class="title"><p><?php echo htmlspecialchars($rows[$location-1]->title); ?></p></div>
			</div>
		</a>
	</li>
<?php endif; ?>

<?php if ($row->next) :
	$direction = $lang->isRtl() ? 'left' : 'right'; ?>
	<li class="next">
		<a class="hasTooltip" title="<?php echo htmlspecialchars($rows[$location+1]->title); ?>" aria-label="<?php echo Text::sprintf('JNEXT_TITLE', htmlspecialchars($rows[$location+1]->title)); ?>" href="<?php echo $row->next; ?>" rel="next">
			<div class="nav-text">
				<span aria-hidden="true"><?php echo Text::_('JNEXT'); ?></span>
				<span class="icon-chevron-<?php echo $direction;?>"></span>
			</div>

			<div class="nav-info">
				<div class="title"><p><?php echo htmlspecialchars($rows[$location+1]->title); ?></p></div>
			</div>
		</a>
	</li>
<?php endif; ?>
</ul>
