mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-23 18:02:18 +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:
@@ -0,0 +1,75 @@
|
||||
<?php
|
||||
|
||||
$config['navigation_header'] = array(
|
||||
'Vilesci/index' => array(
|
||||
'FH-Complete' => base_url('index.ci.php/'),
|
||||
'Vilesci' => base_url('/vilesci'),
|
||||
'CIS' => CIS_ROOT
|
||||
),
|
||||
'system/infocenter/InfoCenter/index' => array(
|
||||
'FH-Complete' => base_url('index.ci.php/'),
|
||||
'Vilesci' => base_url('/vilesci'),
|
||||
'CIS' => CIS_ROOT
|
||||
),
|
||||
'system/infocenter/InfoCenter/showDetails' => array(
|
||||
'FH-Complete' => base_url('index.ci.php/'),
|
||||
'Vilesci' => base_url('/vilesci'),
|
||||
'CIS' => CIS_ROOT
|
||||
)
|
||||
);
|
||||
|
||||
$config['navigation_menu'] = array();
|
||||
|
||||
$config['navigation_menu']['Vilesci/index'] = array(
|
||||
'Dashboard' => array(
|
||||
'link' => '#',
|
||||
'description' => 'Dashboard',
|
||||
'icon' => 'dashboard'
|
||||
),
|
||||
'Lehre' => array(
|
||||
'link' => '#',
|
||||
'icon' => 'graduation-cap',
|
||||
'description' => 'Lehre',
|
||||
'expand' => true,
|
||||
'children'=> array(
|
||||
'CIS' => array(
|
||||
'link' => CIS_ROOT,
|
||||
'icon' => '',
|
||||
'description' => 'CIS',
|
||||
'expand' => true
|
||||
),
|
||||
'Infocenter' => array(
|
||||
'link' => base_url('index.ci.php/system/infocenter/InfoCenter'),
|
||||
'icon' => 'info',
|
||||
'description' => 'Infocenter',
|
||||
'expand' => true
|
||||
),
|
||||
)
|
||||
),
|
||||
'Administration' => array(
|
||||
'link' => '#',
|
||||
'icon' => 'gear',
|
||||
'description' => 'Administration',
|
||||
'expand' => false,
|
||||
'children'=> array(
|
||||
'Vilesci' => array(
|
||||
'link' => base_url('vilesci/'),
|
||||
'icon' => '',
|
||||
'description' => 'Vilesci',
|
||||
'expand' => true
|
||||
),
|
||||
'Extensions' => array(
|
||||
'link' => base_url('index.ci.php/system/extensions/Manager'),
|
||||
'icon' => 'cubes',
|
||||
'description' => 'Extensions Manager',
|
||||
'expand' => true
|
||||
),
|
||||
'Datenschutz' => array(
|
||||
'link' => base_url('index.ci.php/extensions/FHC-Core-DSMS/export'),
|
||||
'description' => 'Datenschutz',
|
||||
'icon' => 'legal',
|
||||
'expand' => true
|
||||
)
|
||||
)
|
||||
)
|
||||
);
|
||||
@@ -0,0 +1,98 @@
|
||||
<?php
|
||||
|
||||
if (! defined('BASEPATH')) exit('No direct script access allowed');
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
class Navigation extends VileSci_Controller
|
||||
{
|
||||
const SESSION_NAME = 'NAVIGATION_MENU';
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function __construct()
|
||||
{
|
||||
parent::__construct();
|
||||
|
||||
$this->config->load('navigation');
|
||||
|
||||
// Load session library
|
||||
$this->load->library('session');
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function menu()
|
||||
{
|
||||
$navigation_widget_called = $this->input->get('navigation_widget_called');
|
||||
$json = array();
|
||||
|
||||
if (isset($navigation_widget_called))
|
||||
{
|
||||
$navigationMenuArray = $this->config->item('navigation_menu');
|
||||
|
||||
if (isset($navigationMenuArray) && is_array($navigationMenuArray))
|
||||
{
|
||||
if (isset($navigationMenuArray[$navigation_widget_called]))
|
||||
{
|
||||
$json = $navigationMenuArray[$navigation_widget_called];
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_SESSION['navigation_menu']))
|
||||
{
|
||||
$navigationMenuSessionArray = $_SESSION['navigation_menu'];
|
||||
|
||||
if (isset($navigationMenuSessionArray) && is_array($navigationMenuSessionArray))
|
||||
{
|
||||
if (isset($navigationMenuSessionArray[$navigation_widget_called]))
|
||||
{
|
||||
$json = array_merge($json, $navigationMenuSessionArray[$navigation_widget_called]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->output->set_content_type('application/json')->set_output(json_encode($json));
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function header()
|
||||
{
|
||||
$navigation_widget_called = $this->input->get('navigation_widget_called');
|
||||
$json = array();
|
||||
|
||||
if (isset($navigation_widget_called))
|
||||
{
|
||||
$navigationHeaderArray = $this->config->item('navigation_header');
|
||||
|
||||
if (isset($navigationHeaderArray) && is_array($navigationHeaderArray))
|
||||
{
|
||||
if (isset($navigationHeaderArray[$navigation_widget_called]))
|
||||
{
|
||||
$json = $navigationHeaderArray[$navigation_widget_called];
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($_SESSION['navigation_header']))
|
||||
{
|
||||
$navigationHeaderSessionArray = $_SESSION['navigation_header'];
|
||||
|
||||
if (isset($navigationHeaderSessionArray) && is_array($navigationHeaderSessionArray))
|
||||
{
|
||||
if (isset($navigationHeaderSessionArray[$navigation_widget_called]))
|
||||
{
|
||||
$json = array_merge($json, $navigationHeaderSessionArray[$navigation_widget_called]);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->output->set_content_type('application/json')->set_output(json_encode($json));
|
||||
}
|
||||
}
|
||||
@@ -45,8 +45,6 @@ class InfoCenter extends VileSci_Controller
|
||||
)
|
||||
);
|
||||
private $uid; // contains the UID of the logged user
|
||||
private $navigationMenuArray; // contains all the voices for the navigation menu
|
||||
private $navigationHeaderArray;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
@@ -77,12 +75,7 @@ class InfoCenter extends VileSci_Controller
|
||||
if(!$this->permissionlib->isBerechtigt('basis/person'))
|
||||
show_error('You have no Permission! You need Infocenter Role');
|
||||
|
||||
$this->_setNavigationMenuArray(); // sets property navigationMenuArray
|
||||
|
||||
$this->navigationHeaderArray = array(
|
||||
'headertext' => 'Infocenter',
|
||||
'headertextlink' => base_url('index.ci.php/system/infocenter/InfoCenter')
|
||||
);
|
||||
$this->setNavigationMenuArray(); // sets property navigationMenuArray
|
||||
}
|
||||
|
||||
// -----------------------------------------------------------------------------------------------------------------
|
||||
@@ -93,13 +86,7 @@ class InfoCenter extends VileSci_Controller
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$this->load->view(
|
||||
'system/infocenter/infocenter.php',
|
||||
array(
|
||||
'navigationHeaderArray' => $this->navigationHeaderArray,
|
||||
'navigationMenuArray' => $this->navigationMenuArray
|
||||
)
|
||||
);
|
||||
$this->load->view('system/infocenter/infocenter.php');
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -131,11 +118,7 @@ class InfoCenter extends VileSci_Controller
|
||||
'system/infocenter/infocenterDetails.php',
|
||||
array_merge(
|
||||
$persondata,
|
||||
$prestudentdata,
|
||||
array(
|
||||
'navigationHeaderArray' => $this->navigationHeaderArray,
|
||||
'navigationMenuArray' => $this->navigationMenuArray
|
||||
)
|
||||
$prestudentdata
|
||||
)
|
||||
);
|
||||
}
|
||||
@@ -464,7 +447,7 @@ class InfoCenter extends VileSci_Controller
|
||||
/**
|
||||
*
|
||||
*/
|
||||
private function _setNavigationMenuArray()
|
||||
public function setNavigationMenuArray()
|
||||
{
|
||||
$listFiltersSent = array();
|
||||
$listFiltersNotSent = array();
|
||||
@@ -532,12 +515,22 @@ class InfoCenter extends VileSci_Controller
|
||||
$this->_fillCustomFilters($listCustomFilters, $filtersarray['personal']);
|
||||
}
|
||||
|
||||
$this->navigationMenuArray = array(
|
||||
'dashboard' => array(
|
||||
if (!isset($_SESSION['navigation_menu']))
|
||||
{
|
||||
$_SESSION['navigation_menu'] = array();
|
||||
}
|
||||
|
||||
$_SESSION['navigation_menu']['system/infocenter/InfoCenter/index'] = array(
|
||||
'filters' => array(
|
||||
'link' => '#',
|
||||
'description' => 'Dashboard',
|
||||
'icon' => 'dashboard'
|
||||
),
|
||||
'description' => 'Filter',
|
||||
'icon' => 'filter',
|
||||
'expand' => true,
|
||||
'children' => $filtersarray
|
||||
)
|
||||
);
|
||||
|
||||
$_SESSION['navigation_menu']['system/infocenter/InfoCenter/showDetails'] = array(
|
||||
'filters' => array(
|
||||
'link' => '#',
|
||||
'description' => 'Filter',
|
||||
@@ -565,11 +558,17 @@ class InfoCenter extends VileSci_Controller
|
||||
foreach ($filters as $filterId => $description)
|
||||
{
|
||||
$toPrint = "%s=%s";
|
||||
|
||||
if ($this->router->method != 'index')
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
$tofill['children'][] = array(
|
||||
'link' => sprintf($toPrint, base_url('index.ci.php/system/infocenter/InfoCenter?filter_id'), $filterId),
|
||||
'description' => $description,
|
||||
'subscriptDescription' => 'Remove',
|
||||
'subscriptLinkId' => 'removeFilterById',
|
||||
'subscriptLinkClass' => 'remove-filter',
|
||||
'subscriptLinkValue' => $filterId
|
||||
);
|
||||
}
|
||||
|
||||
@@ -11,35 +11,9 @@ $this->load->view('templates/FHC-Header',
|
||||
?>
|
||||
<body>
|
||||
<div id="wrapper">
|
||||
<?php
|
||||
|
||||
$navigationHeaderArray = array('headertext' => 'FH-Complete', 'headertextlink' => base_url('index.ci.php/'));
|
||||
$navigationMenuArray = array(
|
||||
'Dashboard' => array('link' => '#', 'description' => 'Dashboard', 'icon' => 'dashboard'),
|
||||
'Lehre' => array('link' => '#', 'icon' => 'graduation-cap', 'description' => 'Lehre', 'expand' => true,
|
||||
'children'=> array(
|
||||
'CIS' => array('link' => CIS_ROOT, 'icon' => '', 'description' => 'CIS', 'expand' => true),
|
||||
'Infocenter' => array('link' => base_url('index.ci.php/system/infocenter/InfoCenter'), 'icon' => 'info', 'description' => 'Infocenter', 'expand' => true),
|
||||
)
|
||||
),
|
||||
'Administration' => array('link' => '#', 'icon' => 'gear', 'description' => 'Administration', 'expand' => false,
|
||||
'children'=> array(
|
||||
'Vilesci' => array('link' => base_url('vilesci/'), 'icon' => '', 'description' => 'Vilesci', 'expand' => true),
|
||||
'Extensions' => array('link' => base_url('index.ci.php/system/extensions/Manager'), 'icon' => 'cubes', 'description' => 'Extensions Manager', 'expand' => true),
|
||||
'Datenschutz' => array('link' => base_url('index.ci.php/extensions/FHC-Core-DSMS/export'), 'description' => 'Datenschutz', 'icon' => 'legal','expand' => true)
|
||||
)
|
||||
),
|
||||
);
|
||||
<?php echo $this->widgetlib->widget('NavigationWidget'); ?>
|
||||
|
||||
echo $this->widgetlib->widget(
|
||||
'NavigationWidget',
|
||||
array(
|
||||
'navigationHeader' => $navigationHeaderArray,
|
||||
'navigationMenu' => $navigationMenuArray
|
||||
)
|
||||
);
|
||||
|
||||
?>
|
||||
<div id="page-wrapper">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
|
||||
@@ -17,15 +17,9 @@
|
||||
|
||||
<body>
|
||||
<div id="wrapper">
|
||||
<?php
|
||||
echo $this->widgetlib->widget(
|
||||
'NavigationWidget',
|
||||
array(
|
||||
'navigationHeader' => $navigationHeaderArray,
|
||||
'navigationMenu' => $navigationMenuArray
|
||||
)
|
||||
);
|
||||
?>
|
||||
|
||||
<?php echo $this->widgetlib->widget('NavigationWidget'); ?>
|
||||
|
||||
<div id="page-wrapper">
|
||||
<div class="container-fluid">
|
||||
<div class="row">
|
||||
|
||||
@@ -26,15 +26,9 @@
|
||||
?>
|
||||
<body>
|
||||
<div id="wrapper">
|
||||
<?php
|
||||
echo $this->widgetlib->widget(
|
||||
'NavigationWidget',
|
||||
array(
|
||||
'navigationHeader' => $navigationHeaderArray,
|
||||
'navigationMenu' => $navigationMenuArray
|
||||
)
|
||||
);
|
||||
?>
|
||||
|
||||
<?php echo $this->widgetlib->widget('NavigationWidget'); ?>
|
||||
|
||||
<div id="page-wrapper">
|
||||
<div class="container-fluid">
|
||||
<input type="hidden" id="hiddenpersonid" value="<?php echo $stammdaten->person_id ?>">
|
||||
|
||||
@@ -94,9 +94,26 @@
|
||||
</style>
|
||||
<script language="Javascript" type="text/javascript">
|
||||
|
||||
$(document).ready(function() {
|
||||
function refreshSideMenu()
|
||||
{
|
||||
$.ajax({
|
||||
url: "<?php echo base_url('index.ci.php/system/infocenter/InfoCenter/setNavigationMenuArray'); ?>",
|
||||
method: "GET",
|
||||
data: {}
|
||||
})
|
||||
.done(function(data, textStatus, jqXHR) {
|
||||
|
||||
renderSideMenu();
|
||||
|
||||
}).fail(function(jqXHR, textStatus, errorThrown) {
|
||||
alert(textStatus);
|
||||
});
|
||||
}
|
||||
|
||||
function sideMenuHook()
|
||||
{
|
||||
$(".remove-filter").click(function() {
|
||||
|
||||
$("#removeFilterById").click(function() {
|
||||
$.ajax({
|
||||
url: "<?php echo base_url('index.ci.php/system/Filters/deleteCustomFilter'); ?>",
|
||||
method: "POST",
|
||||
@@ -105,11 +122,17 @@
|
||||
}
|
||||
})
|
||||
.done(function(data, textStatus, jqXHR) {
|
||||
alert("Filter successfully removed");
|
||||
|
||||
refreshSideMenu();
|
||||
|
||||
}).fail(function(jqXHR, textStatus, errorThrown) {
|
||||
alert(textStatus);
|
||||
});
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$("[data-toggle='collapse']").click(function() {
|
||||
|
||||
|
||||
@@ -13,14 +13,16 @@
|
||||
}
|
||||
})
|
||||
.done(function(data, textStatus, jqXHR) {
|
||||
alert("Filter successfully saved");
|
||||
|
||||
refreshSideMenu()
|
||||
|
||||
}).fail(function(jqXHR, textStatus, errorThrown) {
|
||||
alert(textStatus);
|
||||
});
|
||||
}
|
||||
else
|
||||
{
|
||||
alert("You forgot something!");
|
||||
alert("Please fill te description of this filter");
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
<nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0">
|
||||
<?php
|
||||
// Header
|
||||
echo $this->widgetlib->widget('NavigationHeaderWidget', $widgetData[NavigationWidget::NAVIGATION_HEADER]);
|
||||
echo $this->widgetlib->widget('NavigationHeaderWidget');
|
||||
|
||||
// Left menu
|
||||
echo $this->widgetlib->widget('NavigationMenuWidget', $widgetData[NavigationWidget::NAVIGATION_MENU]);
|
||||
echo $this->widgetlib->widget('NavigationMenuWidget');
|
||||
?>
|
||||
</nav>
|
||||
|
||||
@@ -1,9 +1,39 @@
|
||||
<script language="Javascript" type="text/javascript">
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
$.ajax({
|
||||
url: "<?php echo base_url('index.ci.php/system/Navigation/header'); ?>",
|
||||
method: "GET",
|
||||
data: {
|
||||
navigation_widget_called: "<?php echo $this->router->directory.$this->router->class.'/'.$this->router->method; ?>"
|
||||
}
|
||||
})
|
||||
.done(function(data, textStatus, jqXHR) {
|
||||
|
||||
if (data != null)
|
||||
{
|
||||
jQuery.each(data, function(i, e) {
|
||||
$(".menu-header-items").append('<a class="navbar-brand" href="' + e + '">' + i + '</a>');
|
||||
});
|
||||
}
|
||||
|
||||
}).fail(function(jqXHR, textStatus, errorThrown) {
|
||||
alert(textStatus);
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<div class="navbar-header">
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
||||
<span class="sr-only">Menü umschalten </span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
<a class="navbar-brand" href="<?php echo $headertextlink ?>"><?php echo $headertext ?></a>
|
||||
<span>
|
||||
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
|
||||
<span class="sr-only">Menü umschalten </span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
<span class="icon-bar"></span>
|
||||
</button>
|
||||
</span>
|
||||
<span class="menu-header-items"></span>
|
||||
</div>
|
||||
|
||||
@@ -1,14 +1,3 @@
|
||||
<div class="navbar-default sidebar" role="navigation">
|
||||
<div class="sidebar-nav navbar-collapse">
|
||||
<ul class="nav" id="side-menu">
|
||||
<li id="collapseicon" class="text-right" style="cursor: pointer; color: #337ab7">
|
||||
<i class="fa fa-angle-double-left fa-fw"></i>
|
||||
</li>
|
||||
<?php NavigationMenuWidget::printNavigationMenu(); ?>
|
||||
</ul>
|
||||
</div>
|
||||
<i id="collapseinicon" class="fa fa-angle-double-right fa-fw"></i>
|
||||
</div>
|
||||
<style>
|
||||
#collapseinicon {
|
||||
display: none;
|
||||
@@ -23,16 +12,15 @@
|
||||
background-color: #F8F8F8;
|
||||
}
|
||||
|
||||
.nav > li > span {
|
||||
position: relative;
|
||||
display: block;
|
||||
.nav > li > span > a:focus, .nav > li > span > a:hover {
|
||||
text-decoration: none;
|
||||
}
|
||||
|
||||
.nav > li > span > a {
|
||||
display: inline;
|
||||
padding-top: 10px;
|
||||
padding-bottom: 10px;
|
||||
padding-right: 123px;
|
||||
.nav > li > span {
|
||||
position: relative;
|
||||
display: inline-block;
|
||||
padding-top: 15px;
|
||||
padding-bottom: 15px;
|
||||
}
|
||||
|
||||
.menuSubscriptLink {
|
||||
@@ -48,20 +36,129 @@
|
||||
}
|
||||
|
||||
</style>
|
||||
<script>
|
||||
|
||||
// Hiding/showing navigation menu - works only with sb admin 2 template!!
|
||||
<script language="Javascript" type="text/javascript">
|
||||
|
||||
$("#collapseicon").click(function() {
|
||||
$("#page-wrapper").css('margin-left', '0px');
|
||||
$("#side-menu").hide();
|
||||
$("#collapseinicon").show();
|
||||
});
|
||||
function printNavItem(item, depth = 1)
|
||||
{
|
||||
strMenu = "";
|
||||
var expanded = typeof item['expand'] != 'undefined' && item['expand'] === true ? ' active' : '';
|
||||
|
||||
strMenu += '<li class="' + expanded + '">';
|
||||
|
||||
if (typeof item['subscriptLinkClass'] != 'undefined' && typeof item['subscriptDescription'] != 'undefined')
|
||||
{
|
||||
strMenu += '<span>';
|
||||
}
|
||||
|
||||
strMenu += '<a href="' + item['link'] + '"' + expanded + '>';
|
||||
|
||||
if (item['icon'] != 'undefined')
|
||||
{
|
||||
strMenu += '<i class="fa fa-' + item['icon'] + ' fa-fw"></i> ';
|
||||
}
|
||||
|
||||
strMenu += item['description'];
|
||||
|
||||
if (typeof item['children'] != 'undefined' && Object.keys(item['children']).length > 0)
|
||||
{
|
||||
strMenu += '<span class="fa arrow"></span>';
|
||||
}
|
||||
|
||||
strMenu += '</a>';
|
||||
|
||||
if (typeof item['subscriptLinkClass'] != 'undefined' && typeof item['subscriptDescription'] != 'undefined')
|
||||
{
|
||||
strMenu += '<a class="' + item['subscriptLinkClass'] + ' menuSubscriptLink" value="' + item['subscriptLinkValue'] + '" href="#"> (' + item['subscriptDescription'] + ')</a>';
|
||||
strMenu += '</span>';
|
||||
}
|
||||
|
||||
if (typeof item['children'] != 'undefined' && Object.keys(item['children']).length > 0)
|
||||
{
|
||||
var level = '';
|
||||
if (depth === 1)
|
||||
{
|
||||
level = 'second';
|
||||
}
|
||||
else if (depth > 1)
|
||||
{
|
||||
level = 'third';
|
||||
}
|
||||
|
||||
strMenu += '<ul class="nav nav-' + level + '-level" ' + expanded + '>';
|
||||
|
||||
jQuery.each(item['children'], function(i, e) {
|
||||
strMenu += printNavItem(e, ++depth);
|
||||
});
|
||||
|
||||
strMenu += '</ul>';
|
||||
}
|
||||
|
||||
strMenu += '</li>';
|
||||
|
||||
return strMenu;
|
||||
}
|
||||
|
||||
function renderSideMenu()
|
||||
{
|
||||
$.ajax({
|
||||
url: "<?php echo base_url('index.ci.php/system/Navigation/menu'); ?>",
|
||||
method: "GET",
|
||||
data: {
|
||||
navigation_widget_called: "<?php echo $this->router->directory.$this->router->class.'/'.$this->router->method; ?>"
|
||||
}
|
||||
})
|
||||
.done(function(data, textStatus, jqXHR) {
|
||||
|
||||
if (data != null)
|
||||
{
|
||||
var strMenu = '';
|
||||
|
||||
$("#side-menu").html('<li id="collapseicon" class="text-right" style="cursor: pointer; color: #337ab7"><i class="fa fa-angle-double-left fa-fw"></i></li>');
|
||||
|
||||
jQuery.each(data, function(i, e) {
|
||||
strMenu += printNavItem(e);
|
||||
});
|
||||
|
||||
$("#side-menu").append(strMenu);
|
||||
$("#side-menu").metisMenu();
|
||||
}
|
||||
|
||||
if (typeof sideMenuHook == 'function')
|
||||
{
|
||||
sideMenuHook();
|
||||
}
|
||||
|
||||
}).fail(function(jqXHR, textStatus, errorThrown) {
|
||||
alert(textStatus);
|
||||
});
|
||||
}
|
||||
|
||||
$(document).ready(function() {
|
||||
|
||||
renderSideMenu();
|
||||
|
||||
// Hiding/showing navigation menu - works only with sb admin 2 template!!
|
||||
|
||||
$("#collapseicon").click(function() {
|
||||
$("#page-wrapper").css('margin-left', '0px');
|
||||
$("#side-menu").hide();
|
||||
$("#collapseinicon").show();
|
||||
});
|
||||
|
||||
$("#collapseinicon").click(function() {
|
||||
$("#page-wrapper").css('margin-left', '250px');
|
||||
$("#side-menu").show();
|
||||
$("#collapseinicon").hide();
|
||||
});
|
||||
|
||||
$("#collapseinicon").click(function() {
|
||||
$("#page-wrapper").css('margin-left', '250px');
|
||||
$("#side-menu").show();
|
||||
$("#collapseinicon").hide();
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
<div class="navbar-default sidebar" role="navigation">
|
||||
<div class="sidebar-nav navbar-collapse">
|
||||
<ul class="nav" id="side-menu"></ul>
|
||||
</div>
|
||||
<i id="collapseinicon" class="fa fa-angle-double-right fa-fw"></i>
|
||||
</div>
|
||||
|
||||
@@ -8,8 +8,8 @@ class NavigationHeaderWidget extends Widget
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function display($data)
|
||||
public function display($widgetData)
|
||||
{
|
||||
$this->view('widgets/navigationHeader', $data);
|
||||
$this->view('widgets/navigationHeader');
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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>';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,14 +5,11 @@
|
||||
*/
|
||||
class NavigationWidget extends Widget
|
||||
{
|
||||
const NAVIGATION_HEADER = 'navigationHeader'; //
|
||||
const NAVIGATION_MENU = 'navigationMenu'; //
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public function display($widgetData)
|
||||
{
|
||||
$this->view('widgets/navigation', array('widgetData' => $widgetData));
|
||||
$this->view('widgets/navigation');
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user