- Renamed widget FHC_navheader as NavigationHeaderWidget

- Renamed widget FHC_navigation as NavigationMenuWidget
- Added new widget NavigationWidget to create header and menu
- Renamed view fhcnavheader as navigationHeader
- Renamed view fhcnavigation as navigationMenu
- Added new view navigation
- InfoCenter controller creates the header array
- NavigationHeaderWidget print the header items from an array
This commit is contained in:
Paolo
2018-01-24 15:04:08 +01:00
parent 1bda0b6cad
commit 1ad45e4802
12 changed files with 103 additions and 135 deletions
@@ -45,6 +45,7 @@ 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
@@ -70,6 +71,11 @@ class InfoCenter extends VileSci_Controller
$this->_setAuthUID(); // sets property uid
$this->_setNavigationMenuArray(); // sets property navigationMenuArray
$this->navigationHeaderArray = array(
'headertext' => 'Infocenter',
'headertextlink' => base_url('index.ci.php/system/infocenter/InfoCenter')
);
}
// -----------------------------------------------------------------------------------------------------------------
@@ -80,7 +86,13 @@ class InfoCenter extends VileSci_Controller
*/
public function index()
{
$this->load->view('system/infocenter/infocenter.php', array('navigationMenuArray' => $this->navigationMenuArray));
$this->load->view(
'system/infocenter/infocenter.php',
array(
'navigationHeaderArray' => $this->navigationHeaderArray,
'navigationMenuArray' => $this->navigationMenuArray
)
);
}
/**
@@ -98,7 +110,17 @@ class InfoCenter extends VileSci_Controller
$prestudentdata = $this->_loadPrestudentData($person_id);
$this->load->view('system/infocenter/infocenterDetails.php', array_merge($persondata, $prestudentdata, array('navigationMenuArray' => $this->navigationMenuArray)));
$this->load->view(
'system/infocenter/infocenterDetails.php',
array_merge(
$persondata,
$prestudentdata,
array(
'navigationHeaderArray' => $this->navigationHeaderArray,
'navigationMenuArray' => $this->navigationMenuArray
)
)
);
}
/**
@@ -19,19 +19,15 @@
<body>
<div id="wrapper">
<nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0">
<?php
<?php
echo $this->widgetlib->widget(
'FHC_navheader'
'NavigationWidget',
array(
'navigationHeader' => $navigationHeaderArray,
'navigationMenu' => $navigationMenuArray
)
);
echo $this->widgetlib->widget(
'FHC_navigation',
$navigationMenuArray
);
?>
</nav>
?>
<div id="page-wrapper">
<div class="container-fluid">
<div class="row">
@@ -3,19 +3,15 @@ $this->load->view('templates/FHC-Header', array('title' => 'InfocenterDetails',
?>
<body>
<div id="wrapper">
<nav class="navbar navbar-default navbar-static-top" role="navigation" style="margin-bottom: 0">
<?php
<?php
echo $this->widgetlib->widget(
'FHC_navheader'
'NavigationWidget',
array(
'navigationHeader' => $navigationHeaderArray,
'navigationMenu' => $navigationMenuArray
)
);
echo $this->widgetlib->widget(
'FHC_navigation',
$navigationMenuArray
);
?>
</nav>
?>
<div id="page-wrapper">
<div class="container-fluid">
<div class="row">
@@ -1,39 +0,0 @@
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Men&uuml; 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>
</div>
<ul class="nav navbar-top-links navbar-right">
<?php foreach($items as $name => $item): ?>
<li class="dropdown">
<a class="dropdown-toggle" data-toggle="dropdown" href="#">
<i class="fa fa-<?php echo $item['icon'] ?> fa-fw"></i> <i class="fa fa-caret-down"></i>
</a>
<ul class="dropdown-menu dropdown-<?php echo $name ?>">
<?php foreach($item['children'] as $child): ?>
<li>
<a href="<?php echo $child['link'] ?>">
<?php echo $child['html'] ?>
</a>
</li>
<li class="divider"></li>
<?php endforeach;
if(isset($item['showall'])):
?>
<li>
<a class="text-center" href="<?php echo $item['showall']['showalllink'] ?>">
<strong><?php echo $item['showall']['showalltext'] ?></strong>
<i class="fa fa-angle-right"></i>
</a>
</li>
<?php endif; ?>
</ul>
</li>
<?php endforeach; ?>
</ul>
@@ -1,9 +0,0 @@
<div class="navbar-default sidebar" role="navigation">
<div class="sidebar-nav navbar-collapse">
<ul class="nav" id="side-menu">
<?php
FHC_navigation::printNavigationMenu();
?>
</ul>
</div>
</div>
+9
View File
@@ -0,0 +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]);
// Left menu
echo $this->widgetlib->widget('NavigationMenuWidget', $widgetData[NavigationWidget::NAVIGATION_MENU]);
?>
</nav>
@@ -0,0 +1,9 @@
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target=".navbar-collapse">
<span class="sr-only">Men&uuml; 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>
</div>
@@ -0,0 +1,7 @@
<div class="navbar-default sidebar" role="navigation">
<div class="sidebar-nav navbar-collapse">
<ul class="nav" id="side-menu">
<?php NavigationMenuWidget::printNavigationMenu(); ?>
</ul>
</div>
</div>
-56
View File
@@ -1,56 +0,0 @@
<?php
class FHC_navheader extends Widget
{
public function display($data)
{
if (!isset($data['items']))
{
//default nav header
$data = array('headertext' => 'Infocenter', 'headertextlink' => base_url('index.ci.php/system/infocenter/InfoCenter'));
$data['items'] = array(
'messages' =>
array(
'icon' => 'envelope', 'showall' => array('showalllink' => '#', 'showalltext' => 'Alle Nachrichten anzeigen'), 'children' =>
array(array('link' => '#', 'html' => '
<div>
<strong>Maximillion Pegasus</strong>
<span class="pull-right text-muted">
<em>Gestern</em>
</span>
</div>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eleifend...</div>
'), array('link' => '#', 'html' => '
<div>
<strong>Yugi Muto</strong>
<span class="pull-right text-muted">
<em>Vorgestern</em>
</span>
</div>
<div>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Pellentesque eleifend...</div>
'))
),
'alerts' =>
array(
'icon' => 'bell', 'showall' => array('showalllink' => '#', 'showalltext' => 'Alle Aktionen anzeigen'), 'children' =>
array(array('link' => '#', 'html' => '
<div>
<i class="fa fa-upload fa-fw"></i> Dokument hochgeladen
<span class="pull-right text-muted small">vor 2 Minuten</span>
</div>'), array('link' => '#', 'html' => '
<div>
<i class="fa fa-envelope fa-fw"></i> Nachricht versandt
<span class="pull-right text-muted small">vor 4 Minuten</span>
</div>'), array('link' => '#', 'html' => '
<div>
<i class="fa fa-share fa-fw"></i> InteressentIn freigegeben
<span class="pull-right text-muted small">vor 5 Minuten</span>
</div>'))
)
);
}
$this->view('widgets/fhcnavheader', $data);
}
}
@@ -0,0 +1,15 @@
<?php
/**
*
*/
class NavigationHeaderWidget extends Widget
{
/**
*
*/
public function display($data)
{
$this->view('widgets/navigationHeader', $data);
}
}
@@ -3,13 +3,11 @@
/**
*
*/
class FHC_navigation extends Widget
class NavigationMenuWidget extends Widget
{
const NAVIGATION_MENU = 'navigationMenu'; //
private $navigationMenu;
private static $FHC_navigationInstance;
private static $NavigationMenuWidgetInstance;
/**
*
@@ -18,9 +16,9 @@ class FHC_navigation extends Widget
{
$this->navigationMenu = $widgetData;
self::$FHC_navigationInstance = $this;
self::$NavigationMenuWidgetInstance = $this;
$this->view('widgets/fhcnavigation');
$this->view('widgets/navigationMenu');
}
/**
@@ -28,8 +26,10 @@ class FHC_navigation extends Widget
*/
public static function printNavigationMenu()
{
foreach (self::$FHC_navigationInstance->navigationMenu as $item)
foreach (self::$NavigationMenuWidgetInstance->navigationMenu as $item)
{
self::printNavItem($item);
}
}
/**
+18
View File
@@ -0,0 +1,18 @@
<?php
/**
*
*/
class NavigationWidget extends Widget
{
const NAVIGATION_HEADER = 'navigationHeader'; //
const NAVIGATION_MENU = 'navigationMenu'; //
/**
*
*/
public function display($widgetData)
{
$this->view('widgets/navigation', array('widgetData' => $widgetData));
}
}