Skip to content

Commit

Permalink
New: Support __USERID__ into menu entries
Browse files Browse the repository at this point in the history
  • Loading branch information
eldy committed Mar 30, 2013
1 parent 79f40f2 commit ef571de
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
8 changes: 5 additions & 3 deletions htdocs/core/menus/standard/auguria.lib.php
Expand Up @@ -76,7 +76,9 @@ function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0)
}
$url=preg_replace('/__LOGIN__/',$user->login,$url);
$shorturl=preg_replace('/__LOGIN__/',$user->login,$shorturl);

$url=preg_replace('/__USERID__/',$user->id,$url);
$shorturl=preg_replace('/__USERID__/',$user->id,$shorturl);

// Define the class (top menu selected or not)
if (! empty($_SESSION['idmenu']) && $newTabMenu[$i]['rowid'] == $_SESSION['idmenu']) $classname='class="tmenusel"';
else if (! empty($_SESSION["mainmenu"]) && $newTabMenu[$i]['mainmenu'] == $_SESSION["mainmenu"]) $classname='class="tmenusel"';
Expand Down Expand Up @@ -256,7 +258,7 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM
{
$showmenu=true;
if (! empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED) && empty($menu_array[$i]['enabled'])) $showmenu=false;

$alt++;
if (empty($menu_array[$i]['level']) && $showmenu)
{
Expand Down Expand Up @@ -335,7 +337,7 @@ function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabM
}
}
}

return count($menu_array);
}

Expand Down
6 changes: 5 additions & 1 deletion htdocs/core/menus/standard/eldy.lib.php
Expand Up @@ -280,6 +280,8 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0)
}
$url=preg_replace('/__LOGIN__/',$user->login,$url);
$shorturl=preg_replace('/__LOGIN__/',$user->login,$shorturl);
$url=preg_replace('/__USERID__/',$user->id,$url);
$shorturl=preg_replace('/__USERID__/',$user->id,$shorturl);

// Define the class (top menu selected or not)
if (! empty($_SESSION['idmenu']) && $newTabMenu[$i]['rowid'] == $_SESSION['idmenu']) $classname='class="tmenusel"';
Expand Down Expand Up @@ -414,7 +416,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu

$mainmenu=($forcemainmenu?$forcemainmenu:$_SESSION["mainmenu"]);
$leftmenu=($forceleftmenu?'':(empty($_SESSION["leftmenu"])?'none':$_SESSION["leftmenu"]));

// Show logo company
if (empty($noout) && ! empty($conf->global->MAIN_SHOW_LOGO))
{
Expand Down Expand Up @@ -1206,6 +1208,8 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu

// For external modules
$url = dol_buildpath($menu_array[$i]['url'], 1);
$url=preg_replace('/__LOGIN__/',$user->login,$url);
$url=preg_replace('/__USERID__/',$user->id,$url);

print '<!-- Add menu entry with mainmenu='.$menu_array[$i]['mainmenu'].', leftmenu='.$menu_array[$i]['leftmenu'].', level='.$menu_array[$i]['level'].' -->'."\n";

Expand Down

0 comments on commit ef571de

Please sign in to comment.