From 18550a5fb2c6f5d995ec7770cb69e5b1f4aac00b Mon Sep 17 00:00:00 2001 From: Benjamin Renard Date: Mon, 24 Aug 2015 12:24:33 +0200 Subject: [PATCH] LSaddon / view : permit to hide a LSaddon view in menu --- public_html/includes/class/class.LSsession.php | 10 +++++++--- public_html/templates/default/top.tpl | 2 ++ 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/public_html/includes/class/class.LSsession.php b/public_html/includes/class/class.LSsession.php index b6becb0e..16bcee3a 100644 --- a/public_html/includes/class/class.LSsession.php +++ b/public_html/includes/class/class.LSsession.php @@ -1782,7 +1782,8 @@ class LSsession { $LSaddonsViewsAccess[]=array ( 'LSaddon' => $addon, 'id' => $viewId, - 'label' => $viewConf['label'] + 'label' => $viewConf['label'], + 'showInMenu' => $viewConf['showInMenu'] ); } } @@ -2501,9 +2502,11 @@ class LSsession { * @param[in] $allowedLSprofiles array|null Array listing allowed profiles. * If null, no access control will * be done for this view. + * @param[in] $showInMenu boolean Show (or not) this view in menu + * * @retval bool True is the view have been registred, false otherwise **/ - public static function registerLSaddonView($LSaddon,$viewId,$label,$viewFunction,$allowedLSprofiles=null) { + public static function registerLSaddonView($LSaddon,$viewId,$label,$viewFunction,$allowedLSprofiles=null,$showInMenu=True) { if (function_exists($viewFunction)) { $func = new ReflectionFunction($viewFunction); if (basename($func->getFileName())=="LSaddons.$LSaddon.php") { @@ -2511,7 +2514,8 @@ class LSsession { 'LSaddon' => $LSaddon, 'label' => $label, 'function' => $viewFunction, - 'allowedLSprofiles' => $allowedLSprofiles + 'allowedLSprofiles' => $allowedLSprofiles, + 'showInMenu' => (bool)$showInMenu ); return True; } diff --git a/public_html/templates/default/top.tpl b/public_html/templates/default/top.tpl index 15f8d8e2..9f6d057e 100644 --- a/public_html/templates/default/top.tpl +++ b/public_html/templates/default/top.tpl @@ -34,7 +34,9 @@ {/foreach} {foreach from=$LSaddonsViewsAccess item=access} + {if $access.showInMenu} + {/if} {/foreach}