diff --git a/application/config/navigation.php b/application/config/navigation.php
index 0ce27d318..ecdd5d9f7 100644
--- a/application/config/navigation.php
+++ b/application/config/navigation.php
@@ -1,64 +1,91 @@
array(
- 'FH-Complete' => site_url(''),
- 'Vilesci' => base_url('vilesci'),
- 'CIS' => CIS_ROOT
+ 'fhcomplete' => array(
+ 'link' => site_url(''),
+ 'icon' => '',
+ 'description' => 'FH-Complete',
+ 'sort' => 1
+ ),
+ 'vilesci' => array(
+ 'link' => base_url('vilesci'),
+ 'icon' => '',
+ 'description' => 'Vilesci',
+ 'sort' => 2
+ ),
+ 'cis' => array(
+ 'link' => CIS_ROOT,
+ 'icon' => '',
+ 'description' => 'CIS',
+ 'sort' => 3
+ )
)
);
+// --------------------------------------------------------------------------------------------------------------------
+// Left side menu
+
$config['navigation_menu'] = array();
$config['navigation_menu']['Vilesci/index'] = array(
- 'Dashboard' => array(
+ 'dashboard' => array(
'link' => '#',
'description' => 'Dashboard',
- 'icon' => 'dashboard'
+ 'icon' => 'dashboard',
+ 'sort' => 1
),
- 'Lehre' => array(
+ 'lehre' => array(
'link' => '#',
'icon' => 'graduation-cap',
'description' => 'Lehre',
'expand' => true,
+ 'sort' => 2,
'children'=> array(
- 'CIS' => array(
+ 'cis' => array(
'link' => CIS_ROOT,
'icon' => '',
'description' => 'CIS',
- 'expand' => true
+ 'expand' => true,
+ 'sort' => 1
),
- 'Infocenter' => array(
+ 'infocenter' => array(
'link' => site_url('system/infocenter/InfoCenter'),
'icon' => 'info',
'description' => 'Infocenter',
- 'expand' => true
+ 'expand' => true,
+ 'sort' => 2
),
)
),
- 'Administration' => array(
+ 'administration' => array(
'link' => '#',
'icon' => 'gear',
'description' => 'Administration',
'expand' => false,
+ 'sort' => 3,
'children'=> array(
- 'Vilesci' => array(
+ 'vilesci' => array(
'link' => base_url('vilesci'),
'icon' => '',
'description' => 'Vilesci',
- 'expand' => true
+ 'expand' => true,
+ 'sort' => 1
),
- 'Extensions' => array(
+ 'extensions' => array(
'link' => site_url('system/extensions/Manager'),
'icon' => 'cubes',
'description' => 'Extensions Manager',
- 'expand' => true
+ 'expand' => true,
+ 'sort' => 2
)
)
)
);
-
$config['navigation_menu']['system/infocenter/InfoCenter/index'] = array(
'freigegeben' => array(
'link' => site_url('system/infocenter/InfoCenter/freigegeben'),
diff --git a/application/helpers/message_helper.php b/application/helpers/message_helper.php
index 1cba07eec..1197a02ac 100644
--- a/application/helpers/message_helper.php
+++ b/application/helpers/message_helper.php
@@ -9,7 +9,7 @@
* @license GPLv3
* @since Version 1.0.0
*/
-
+
/**
* Message Helper
*
@@ -35,7 +35,7 @@ function success($retval, $code = null, $msg_indx_prefix = 'fhc_')
$success->fhcCode = $code;
if (!is_null($code)) $success->msg = lang($msg_indx_prefix . $code);
$success->retval = $retval;
-
+
return $success;
}
@@ -51,7 +51,7 @@ function error($retval = '', $code = null, $msg_indx_prefix = 'fhc_')
$error->fhcCode = $code;
if (!is_null($code)) $error->msg = lang($msg_indx_prefix . $code);
$error->retval = $retval;
-
+
return $error;
}
@@ -64,7 +64,7 @@ function isSuccess($result)
{
return true;
}
-
+
return false;
}
@@ -78,15 +78,16 @@ function hasData($result)
{
return true;
}
-
+
return false;
}
/**
* Checks if the result represents an error
* Wrapper function of isSuccess, more readable code
+ * Bob Dylan: ...there's no success like failure. And that failure's no success at all.
*/
function isError($result)
{
return !isSuccess($result);
-}
\ No newline at end of file
+}
diff --git a/application/libraries/NavigationLib.php b/application/libraries/NavigationLib.php
index 4d2187e04..756d2bf6a 100644
--- a/application/libraries/NavigationLib.php
+++ b/application/libraries/NavigationLib.php
@@ -97,6 +97,8 @@ class NavigationLib
}
}
+ $this->_sortArray($menuArray);
+
return $menuArray;
}
@@ -150,6 +152,8 @@ class NavigationLib
}
}
+ $this->_sortArray($headerArray);
+
return $headerArray;
}
@@ -158,17 +162,20 @@ class NavigationLib
*/
public function oneLevel(
$description, $link = '#', $children = null, $icon = '', $expand = false,
- $subscriptDescription = null, $subscriptLinkClass = null, $subscriptLinkValue = null)
+ $subscriptDescription = null, $subscriptLinkClass = null, $subscriptLinkValue = null, $target = '',
+ $sort = null)
{
return array(
'description' => $description,
'link' => $link,
+ 'target' => $target,
'children'=> $children,
'icon' => $icon,
'expand' => $expand,
'subscriptDescription' => $subscriptDescription,
'subscriptLinkClass' => $subscriptLinkClass,
- 'subscriptLinkValue' => $subscriptLinkValue
+ 'subscriptLinkValue' => $subscriptLinkValue,
+ 'sort' => $sort
);
}
@@ -350,4 +357,34 @@ class NavigationLib
return $navigationPage;
}
+
+ /**
+ * Sorts using the sort element present in the array
+ */
+ private function _sortArray(&$array)
+ {
+ uasort($array, function($a, $b) {
+
+ // If the element sort is not present then the default value is 999
+ $sortA = 999;
+ if (isset($a['sort'])) $sortA = $a['sort'];
+
+ // If the element sort is not present then the default value is 999
+ $sortB = 999;
+ if (isset($b['sort'])) $sortB = $b['sort'];
+
+ return $sortA - $sortB; // < 0 => lt, == 0 => equal, > 0 => gt
+ });
+
+ // Sort also the children
+ foreach ($array as $key => $value)
+ {
+ if (isset($value['children']) && is_array($value['children']) && count($value['children']) > 0)
+ {
+ // NOTE: keep this way to give the element by reference, $value has a different reference!
+ // otherwise the children will not be sorted
+ $this->_sortArray($array[$key]['children']); // recursive call
+ }
+ }
+ }
}
diff --git a/public/css/NavigationWidget.css b/public/css/NavigationWidget.css
index f7475259c..9d7753825 100644
--- a/public/css/NavigationWidget.css
+++ b/public/css/NavigationWidget.css
@@ -33,3 +33,22 @@
font-weight: bold;
text-decoration: underline;
}
+
+.navbar-brand {
+ float: left;
+ height: 50px;
+ padding-top: 15px;
+ padding-right: 20px;
+ padding-left: 7px;
+ font-size: 18px;
+ line-height: 20px;
+}
+
+.navbar-brand-icon {
+ float: left;
+ height: 50px;
+ padding-top: 15px;
+ padding-right: 12px;
+ padding-left: 7px;
+ font-size: 16px;
+}
diff --git a/public/js/NavigationWidget.js b/public/js/NavigationWidget.js
index 5929d04c6..4f7d05792 100644
--- a/public/js/NavigationWidget.js
+++ b/public/js/NavigationWidget.js
@@ -31,7 +31,20 @@ var FHC_NavigationWidget = {
if (FHC_AjaxClient.hasData(data))
{
jQuery.each(FHC_AjaxClient.getData(data), function(i, e) {
- $(".menu-header-items").append('' + i + '');
+
+ var headerEntry = '';
+
+ if (e['icon'] != 'undefined' && e['icon'] != '')
+ {
+ headerEntry += '';
+ }
+
+ var target = '';
+ if (e['target'] != null) target = e['target'];
+
+ headerEntry += '' + e['description'] + '';
+
+ $(".menu-header-items").append(headerEntry);
});
}
}
@@ -116,7 +129,10 @@ var FHC_NavigationWidget = {
strMenu += '';
}
- strMenu += '';
+ var target = '';
+ if (item['target'] != null) target = item['target'];
+
+ strMenu += '';
if (item['icon'] != 'undefined')
{