<?php
/**
* FW Food menu 5.1.1
* @copyright C 2019 Fastw3b
* @license http://www.gnu.org/copyleft/gpl.html GNU/GPL
* @link http://www.fastw3b.net/ Official website
**/
defined( '_JEXEC' ) or die( 'Restricted access' );

$view = $displayData['view'];

$management = array();
$view->app->triggerEvent('ongetUsersectionManagementMenu', array('com_fwfoodmenu', $view, &$management));
$account = array();
$view->app->triggerEvent('ongetUsersectionAccountMenu', array('com_fwfoodmenu', $view, &$account));

$layout = $view->getLayout();
$menu_id = $view->app->input->getInt('Itemid');
if ($management) {
?><div class="fwfm-management-panel-section">
	<div class="uk-card uk-card-default uk-padding-small uk-margin">
		<div class="uk-h6 uk-text-uppercase fwfm-management-panel-header"><?php echo JText::_('FWFM_MANAGE_LISTINGS'); ?></div>
		<ul class="uk-nav uk-dropdown-nav"><?php
		foreach ($management as $title=>$item) {
			$active = ($layout == $item['layout']);

			$buff = explode('_', $layout);
			if (count($buff) == 2 and $buff[1] == 'edit' and $buff[0] == $item['layout']) {
				$active = true;
			}
			?><li<?php if ($active) { ?> class="uk-active"<?php } ?>><?php
			?><a href="<?php echo fwFoodMenuHelper::route('index.php?option=com_fwfoodmenu&view=usersection&layout='.$item['layout'].'&Itemid='.$menu_id); ?>"><span uk-icon="icon: <?php echo esc_attr($item['icon']); ?>" class="uk-margin-small-right"></span> <?php echo JText::_($title); ?></a><?php
			?></li><?php
		}
?>
		</ul>
	</div>
  </div>
<?php
}
if ($account) {
?><div class="fwfm-management-panel-section">
	<ul class="uk-nav uk-dropdown-nav"><?php
	foreach ($account as $title=>$item) {
		$active = ($layout == $item['layout']);

		$buff = explode('_', $layout);
		if (count($buff) == 2 and $buff[1] == 'edit' and $buff[0] == $item['layout']) {
			$active = true;
		}
		?><li><?php
		?><a href="<?php echo fwFoodMenuHelper::route('index.php?option=com_fwfoodmenu&view=usersection&layout='.$item['layout'].'&Itemid='.$menu_id); ?>"><span uk-icon="icon: <?php echo esc_attr($item['icon']); ?>" class="uk-margin-small-right"></span> <?php echo JText::_($title); ?></a><?php
		?></li><?php
	}
?></ul>
	</div>
<?php
}
