FIX Menu users not visible on dolidroid.

This commit is contained in:
Laurent Destailleur 2016-09-30 10:56:35 +02:00
parent 17d9c15825
commit 8d2ae73663
3 changed files with 14 additions and 7 deletions

View File

@ -85,7 +85,7 @@ if (! class_exists('MenuManager'))
}
$menumanager = new MenuManager($db, empty($user->societe_id)?0:1);
$menumanager->loadMenu('all','all');
//var_dump($menumanager->tabMenu);exit;
$menumanager->showmenu('jmobile');
print '</body>';

View File

@ -434,7 +434,8 @@ function print_end_menu_array()
/**
* Core function to output left menu eldy
*
* Fill &$menu (example with $forcemainmenu='home' $forceleftmenu='all', return left menu tree of Home)
*
* @param DoliDB $db Database handler
* @param array $menu_array_before Table of menu entries to show before entries of menu handler (menu->liste filled with menu->add)
* @param array $menu_array_after Table of menu entries to show after entries of menu handler (menu->liste filled with menu->add)
@ -442,7 +443,7 @@ function print_end_menu_array()
* @param Menu $menu Object Menu to return back list of menu entries
* @param int $noout Disable output (Initialise &$menu only).
* @param string $forcemainmenu 'x'=Force mainmenu to mainmenu='x'
* @param string $forceleftmenu 'all'=Force leftmenu to '' (= all)
* @param string $forceleftmenu 'all'=Force leftmenu to '' (= all). If value come being '', we change it to value in session and 'none' if not efined in session.
* @param array $moredata An array with more data to output
* @return int nb of menu entries
*/
@ -586,7 +587,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$newmenu->add("/user/home.php?leftmenu=users", $langs->trans("MenuUsersAndGroups"), 0, $user->rights->user->user->lire, '', $mainmenu, 'users');
if ($user->rights->user->user->lire)
{
if (! empty($leftmenu) && $leftmenu=="users")
if (empty($leftmenu) || $leftmenu=="users")
{
$newmenu->add("", $langs->trans("Users"), 1, $user->rights->user->user->lire || $user->admin);
$newmenu->add("/user/card.php?leftmenu=users&action=create", $langs->trans("NewUser"),2, $user->rights->user->user->creer || $user->admin, '', 'home');
@ -597,6 +598,7 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
$newmenu->add("/user/group/index.php?leftmenu=users", $langs->trans("ListOfGroups"), 2, ($conf->global->MAIN_USE_ADVANCED_PERMS?$user->rights->user->group_advance->read:$user->rights->user->user->lire) || $user->admin);
}
}
}

View File

@ -105,6 +105,8 @@ class MenuManager
$menuArbo = new Menubase($this->db,'eldy');
$menuArbo->menuLoad($mainmenu, $leftmenu, $this->type_user, 'eldy', $tabMenu);
$this->tabMenu=$tabMenu;
//if ($forcemainmenu == 'all') { var_dump($this->tabMenu); exit; }
}
@ -150,8 +152,9 @@ class MenuManager
if ($mode == 'jmobile')
{
print_eldy_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,1,$mode);
print_eldy_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu,1,$mode); // Fill this->menu that is empty with top menu
print '<!-- Generate menu list from menu handler '.$this->name.' -->'."\n";
foreach($this->menu->liste as $key => $val) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu'
{
@ -169,8 +172,9 @@ class MenuManager
$tmpmainmenu=$val['mainmenu'];
$tmpleftmenu='all';
$submenu=new Menu();
print_left_eldy_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$submenu,1,$tmpmainmenu,$tmpleftmenu);
$nexturl=dol_buildpath($submenu->liste[0]['url'],1);
print_left_eldy_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$submenu,1,$tmpmainmenu,$tmpleftmenu); // Fill $submenu (example with tmpmainmenu='home' tmpleftmenu='all', return left menu tree of Home)
//if ($tmpmainmenu.'-'.$tmpleftmenu == 'home-all') { var_dump($submenu);exit; }
$nexturl=dol_buildpath($submenu->liste[0]['url'],1);
$canonrelurl=preg_replace('/\?.*$/','',$relurl);
$canonnexturl=preg_replace('/\?.*$/','',$nexturl);
@ -194,6 +198,7 @@ class MenuManager
print '</a>';
print '</li>'."\n";
}
foreach($submenu->liste as $key2 => $val2) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu']
{
$showmenu=true;