<?php
/**
 * @package     VP Advanced User
 * @subpackage  Module - 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::stylesheet('com_vpadvanceduser/general.css', array(), true);
?>
<div class="vp-wrapper vp-logout-module<?php echo $moduleclass_sfx ?>">
	<form action="<?php echo JRoute::_(htmlspecialchars(JUri::getInstance()->toString()), true, $params->get('usesecure')); ?>" method="post">
		<?php if($params->get('greeting') || ($params->get('profile_picture') && $hasProfilePicture)) : ?>
			<div class="vp-logout-module-avatar">
				<?php if(($params->get('profile_picture') && $hasProfilePicture)) : ?>
					<div class="vp-profile-picture-cont">
						<span><?php echo JHtml::_('vpaufield.avatar', $profilePicture, 'class="vp-profile-picture" alt="' . htmlspecialchars($user->get('name')) . '"') ?></span>
					</div>
				<?php endif ?>
				<div class="vp-logout-module-info">
					<?php if($params->get('greeting')) : ?>
						<div class="login-greeting">
							<?php if ($params->get('name') == 0) : 
								echo JText::sprintf('MOD_VPADVANCEDUSER_HINAME', htmlspecialchars($user->get('name')));
							else :
								echo JText::sprintf('MOD_VPADVANCEDUSER_HINAME', htmlspecialchars($user->get('username')));
							endif; ?>
						</div>
					<?php endif ?>
					<ul class="vp-list-inline">
						<?php if($params->get('profile_link')) : ?>
							<li>
								<a href="<?php echo JRoute::_(VPAdvancedUserHelperRoute::getURL('profile')) ?>" class="vp-btn vp-btn-primary"><?php echo JText::_('COM_VPADVANCEDUSER_PROFILE') ?></a>
							</li>
						<?php endif ?>
						<li>
							<button type="submit" class="vp-btn vp-btn-primary"><?php echo JText::_('JLOGOUT'); ?></button>
						</li>
					</ul>
				</div>
			</div>
		<?php else : ?>
			<ul class="vp-list-inline">
				<?php if($params->get('profile_link')) : ?>
					<li>
						<a href="<?php echo JRoute::_($profile_url) ?>" class="vp-btn vp-btn-primary"><?php echo JText::_('COM_VPADVANCEDUSER_PROFILE') ?></a>
					</li>
				<?php endif ?>
				<li>
					<button type="submit" class="vp-btn vp-btn-primary"><?php echo JText::_('JLOGOUT'); ?></button>
				</li>
			</ul>
		<?php endif ?>
		
		<input type="hidden" name="option" value="com_vpadvanceduser" />
		<input type="hidden" name="task" value="user.logout" />
		<?php echo JHtml::_('form.token'); ?>
		<input type="hidden" name="return" value="<?php echo $return ?>" />
	</form>
</div>
