mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-20 00:12:15 +00:00
- Added navigation.php in application/config to configure menus used by NavigationWidget
- Addded controller system/Navigation to retrive menus via ajax - Renamed method _setNavigationMenuArray to setNavigationMenuArray and set as public in system/infocenter/InfoCenter - Now the InfoCenter menu is stored in the session - The menu is generated by the widget NavigationWidget via JS - No need anymore to give as parameters to the views the menu arrays
This commit is contained in:
@@ -5,87 +5,11 @@
|
||||
*/
|
||||
class NavigationMenuWidget extends Widget
|
||||
{
|
||||
private $navigationMenu;
|
||||
|
||||
private static $navigationMenuWidgetInstance;
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function display($widgetData)
|
||||
{
|
||||
$this->navigationMenu = $widgetData;
|
||||
|
||||
self::$navigationMenuWidgetInstance = $this;
|
||||
|
||||
$this->view('widgets/navigationMenu');
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public static function printNavigationMenu()
|
||||
{
|
||||
foreach (self::$navigationMenuWidgetInstance->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.'">';
|
||||
|
||||
if (isset($item['subscriptLinkId']) && isset($item['subscriptDescription']))
|
||||
{
|
||||
echo '<span>';
|
||||
}
|
||||
|
||||
echo '<a href="'.$item['link'].'"'.$expanded.'>';
|
||||
|
||||
if (isset($item['icon']))
|
||||
{
|
||||
echo '<i class="fa fa-'.$item['icon'].' fa-fw"></i> ';
|
||||
}
|
||||
|
||||
echo $item['description'];
|
||||
|
||||
if (!empty($item['children']))
|
||||
{
|
||||
echo '<span class="fa arrow"></span>';
|
||||
}
|
||||
|
||||
echo '</a>';
|
||||
|
||||
if (isset($item['subscriptLinkId']) && isset($item['subscriptDescription']))
|
||||
{
|
||||
echo '<a id="'.$item['subscriptLinkId'].'" class="menuSubscriptLink" value="'.$item['subscriptLinkValue'].'" href="#">'.$item['subscriptDescription'].'</a>';
|
||||
}
|
||||
|
||||
if (isset($item['subscriptLinkId']) && isset($item['subscriptDescription']))
|
||||
{
|
||||
echo '</span>';
|
||||
}
|
||||
|
||||
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>';
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user