<?php
/**
 * @package    VP Advanced User
 * @author     Abhishek Das <info@virtueplanet.com>
 * @copyright  Copyright (C) 2012-2019 VirtuePlanet Services LLP. All rights reserved.
 * @license    GNU General Public License version 2 or later; see LICENSE.txt
 * @link       https://www.virtueplanet.com
 */

defined('_JEXEC') or die;

JHtml::addIncludePath(JPATH_ADVANCEDUSER_SITE . '/helpers/html');

JHtml::_('behavior.keepalive');
JHtml::_('vpadvanceduser.loadjs');

JHtml::_('vpadvanceduser.stylesheet', 'com_vpadvanceduser/general.css', array(), true);
?>
<div class="vp-wrapper vp-profile-page<?php echo $this->pageclass_sfx?>">
	<?php if ($this->params->get('show_page_heading')) : ?>
		<div class="page-header">
			<h1>
				<?php echo $this->escape($this->params->get('page_heading')); ?>
			</h1>
		</div>
	<?php endif; ?>
	<div class="vp-profile-header vp-clearfix<?php echo $this->profile_picture ? ' with-profile-picture' : '' ?>">
		<?php if($this->profile_picture) : ?>
			<div class="vp-profile-picture-cont">
				<span>
					<?php echo JHtml::_('vpaufield.avatar', $this->profile_picture->value, 'class="vp-profile-picture" alt="' . $this->escape($this->data->name) . '"') ?>
				</span>
			</div>
		<?php endif; ?>
		<div class="vp-account-info-cont">
			<div class="vp-user-name">
				<h3><?php echo $this->data->name; ?></h3>
				<ul class="ul-inline pull-right">
					<?php if (JFactory::getUser()->id == $this->data->id) : ?>
						<li>
							<a class="vp-btn vp-btn-primary" href="<?php echo JRoute::_('index.php?option=com_vpadvanceduser&task=profile.edit&user_id=' . (int) $this->data->id) ?>">
								<?php echo JText::_('COM_USERS_EDIT_PROFILE'); ?>
							</a>
						</li>
					<?php endif ?>
						<li>
							<a class="vp-btn" href="<?php echo JRoute::_('index.php?option=com_vpadvanceduser&task=user.logout&' . JSession::getFormToken() . '=1') ?>">
								<?php echo JText::_('JLOGOUT'); ?>
							</a>
						</li>
				</ul>
			</div>
			<dl class="dl-inline">
				<?php if(!$this->params->get('email_as_username')) : ?>
					<dt><?php echo JText::_('COM_USERS_PROFILE_USERNAME_LABEL'); ?></dt>
					<dd><?php echo htmlspecialchars($this->data->username); ?></dd>
				<?php endif ?>
				<dt><?php echo JText::_('COM_USERS_PROFILE_REGISTERED_DATE_LABEL'); ?></dt>
				<dd><?php echo JHtml::_('date', $this->data->registerDate); ?></dd>
				<dt><?php echo JText::_('COM_USERS_PROFILE_LAST_VISITED_DATE_LABEL'); ?></dt>
				<?php if ($this->data->lastvisitDate != '0000-00-00 00:00:00') : ?>
					<dd><?php echo JHtml::_('date', $this->data->lastvisitDate); ?></dd>
				<?php else : ?>
					<dd><?php echo JText::_('COM_USERS_PROFILE_NEVER_VISITED'); ?></dd>
				<?php endif ?>
			</dl>
		</div>
	</div>
	
	<?php echo $this->loadTemplate('custom'); ?>
	<?php echo $this->loadTemplate('params'); ?>

</div>