LSaddon / view : permit to hide a LSaddon view in menu

This commit is contained in:
Benjamin Renard 2015-08-24 12:24:33 +02:00
parent abad943aef
commit 18550a5fb2
2 changed files with 9 additions and 3 deletions

View file

@ -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;
}

View file

@ -34,7 +34,9 @@
<li class='menu'><a href='view.php?LSobject={$LSobject_type}' class='menu'>{tr msg=$label}</a></li>
{/foreach}
{foreach from=$LSaddonsViewsAccess item=access}
{if $access.showInMenu}
<li class='menu'><a href='addon_view.php?LSaddon={$access.LSaddon}&view={$access.id}' class='menu'>{tr msg=$access.label}</a></li>
{/if}
{/foreach}
</ul>
</td>