Files
FHC-Core/application/widgets/FHC_navigation.php
T
Paolo 8b28b48ff9 - Merged controller system/infocenter/InfoCenter.php into system/infocenter/InfocenterDetails.php
- Removed controller application/controllers/system/infocenter/InfocenterDetails.php
- Removed method _getFilterList from controller system/infocenter/InfoCenter.php
- Added method _setNavigationMenuArray to controller system/infocenter/InfoCenter.php to generate the array for the left menu
- Added public method getFilterList to model Filters_model
- Removed view application/views/widgets/navigation.php
- Removed widget application/widgets/navigation.php
- Widget application/widgets/FHC_navigation.php now is usable to print any menu from an array
2018-01-23 18:49:09 +01:00

59 lines
1.2 KiB
PHP

<?php
/**
*
*/
class FHC_navigation extends Widget
{
const NAVIGATION_MENU = 'navigationMenu'; //
private $navigationMenu;
private static $FHC_navigationInstance;
/**
*
*/
public function display($widgetData)
{
$this->navigationMenu = $widgetData;
self::$FHC_navigationInstance = $this;
$this->view('widgets/fhcnavigation');
}
/**
*
*/
public static function printNavigationMenu()
{
foreach (self::$FHC_navigationInstance->navigationMenu as $item)
self::printNavItem($item);
}
/**
*
*/
public static function printNavItem($item, $depth = 1)
{
$expanded = isset($item['expand']) && $item['expand'] === true ? ' active' : '';
echo '<li class="'.$expanded.'">
<a href="'.$item['link'].'"'.$expanded.'>'.(isset($item['icon']) ? '<i class="fa fa-'.$item['icon'].' fa-fw"></i> ' : '').$item['description'].(!empty($item['children']) ? '<span class="fa arrow"></span>':'').'</a>';
if (!empty($item['children']))
{
$level = '';
if ($depth === 1)
$level = 'second';
elseif ($depth > 1)
$level = 'third';
echo '<ul class="nav nav-'.$level.'-level" '.$expanded.'>';
foreach ($item['children'] as $child)
self::printNavItem($child, ++$depth);
echo '</ul>';
}
echo '</li>';
}
}