mirror of
https://github.com/FH-Complete/FHC-Core.git
synced 2026-07-26 09:04:28 +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,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
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user