Next step for rewriting menu managers.
This commit is contained in:
parent
de6d40237d
commit
c11f7dfc71
@ -54,7 +54,7 @@ class Menu
|
|||||||
* @param string $url Url to follow on click
|
* @param string $url Url to follow on click
|
||||||
* @param string $titre Label of menu to add
|
* @param string $titre Label of menu to add
|
||||||
* @param string $level Level of menu to add
|
* @param string $level Level of menu to add
|
||||||
* @param int $enabled Menu active or not
|
* @param int $enabled Menu active or not (0=Not active, 1=Active, 2=Active but grey)
|
||||||
* @param string $target Target lien
|
* @param string $target Target lien
|
||||||
* @param string $mainmenu Main menu ('home', 'companies', 'products', ...)
|
* @param string $mainmenu Main menu ('home', 'companies', 'products', ...)
|
||||||
* @param string $leftmenu Left menu ('setup', 'system', 'admintools', ...)
|
* @param string $leftmenu Left menu ('setup', 'system', 'admintools', ...)
|
||||||
|
|||||||
@ -88,10 +88,13 @@ if (! class_exists('MenuManager'))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$menumanager = new MenuManager($db, empty($user->societe_id)?0:1);
|
$menumanager = new MenuManager($db, empty($user->societe_id)?0:1);
|
||||||
|
$menumanager->loadMenu();
|
||||||
|
|
||||||
$menumanager->showmenu('jmobile');
|
$menumanager->showmenu('jmobile');
|
||||||
|
|
||||||
print '</body></html>'."\n";
|
print '</body>';
|
||||||
|
|
||||||
|
print '</html>'."\n";
|
||||||
|
|
||||||
$db->close();
|
$db->close();
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -33,7 +33,7 @@
|
|||||||
* @param array &$tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty)
|
* @param array &$tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty)
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function print_smartphone_menu($db,$atarget,$type_user,$limitmenuto,&$tabMenu)
|
function print_smartphone_menu($db,$atarget,$type_user,$limitmenuto,&$tabMenu,&$menu)
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php';
|
||||||
|
|
||||||
|
|||||||
@ -45,7 +45,15 @@ class MenuSmart
|
|||||||
{
|
{
|
||||||
$this->type_user=$type_user;
|
$this->type_user=$type_user;
|
||||||
$this->db=$db;
|
$this->db=$db;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load this->tabMenu
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function loadMenu()
|
||||||
|
{
|
||||||
// On sauve en session le menu principal choisi
|
// On sauve en session le menu principal choisi
|
||||||
if (isset($_GET["mainmenu"])) $_SESSION["mainmenu"]=$_GET["mainmenu"];
|
if (isset($_GET["mainmenu"])) $_SESSION["mainmenu"]=$_GET["mainmenu"];
|
||||||
if (isset($_GET["idmenu"])) $_SESSION["idmenu"]=$_GET["idmenu"];
|
if (isset($_GET["idmenu"])) $_SESSION["idmenu"]=$_GET["idmenu"];
|
||||||
@ -86,8 +94,8 @@ class MenuSmart
|
|||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php';
|
||||||
$tabMenu=array();
|
$tabMenu=array();
|
||||||
$menuArbo = new Menubase($db,'smartphone');
|
$menuArbo = new Menubase($this->db,'smartphone');
|
||||||
$menuArbo->menuLoad($mainmenu, $leftmenu, $type_user, 'smartphone', $tabMenu);
|
$menuArbo->menuLoad($mainmenu, $leftmenu, $this->type_user, 'smartphone', $tabMenu);
|
||||||
$this->tabMenu=$tabMenu;
|
$this->tabMenu=$tabMenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -110,7 +118,11 @@ class MenuSmart
|
|||||||
$conf->global->MAIN_SEARCHFORM_CONTACT=0;
|
$conf->global->MAIN_SEARCHFORM_CONTACT=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
print_smartphone_menu($this->db,$this->atarget,$this->hideifnotallowed,$mode,$this->tabMenu);
|
$this->menu=new Menu();
|
||||||
|
|
||||||
|
print_smartphone_menu($this->db,$this->atarget,$this->hideifnotallowed,$mode,$this->tabMenu,$this->menu);
|
||||||
|
|
||||||
|
unset($this->menu);
|
||||||
|
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -32,9 +32,10 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php';
|
|||||||
* @param string $atarget Target
|
* @param string $atarget Target
|
||||||
* @param int $type_user 0=Internal,1=External,2=All
|
* @param int $type_user 0=Internal,1=External,2=All
|
||||||
* @param array &$tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty)
|
* @param array &$tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty)
|
||||||
|
* @param array &$menu Object Menu to return back list of menu entries
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function print_auguria_menu($db,$atarget,$type_user,&$tabMenu)
|
function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu)
|
||||||
{
|
{
|
||||||
global $user,$conf,$langs,$dolibarr_main_db_name;
|
global $user,$conf,$langs,$dolibarr_main_db_name;
|
||||||
|
|
||||||
@ -122,7 +123,7 @@ function print_start_menu_entry_auguria($idsel,$classname)
|
|||||||
* Output menu entry
|
* Output menu entry
|
||||||
*
|
*
|
||||||
* @param string $text Text
|
* @param string $text Text
|
||||||
* @param int $showmode 1 or 2
|
* @param int $showmode 1 = allowed or 2 = not allowed
|
||||||
* @param string $url Url
|
* @param string $url Url
|
||||||
* @param string $id Id
|
* @param string $id Id
|
||||||
* @param string $idsel Id sel
|
* @param string $idsel Id sel
|
||||||
@ -150,6 +151,10 @@ function print_text_menu_entry_auguria($text, $showmode, $url, $id, $idsel, $cla
|
|||||||
{
|
{
|
||||||
print '<div class="'.$id.' '.$idsel.'"><span class="mainmenu_'.$idsel.' '.$id.'" id="mainmenuspan_'.$idsel.'"></span></div>';
|
print '<div class="'.$id.' '.$idsel.'"><span class="mainmenu_'.$idsel.' '.$id.'" id="mainmenuspan_'.$idsel.'"></span></div>';
|
||||||
print '<a class="tmenudisabled" id="mainmenua_'.$idsel.'" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">';
|
print '<a class="tmenudisabled" id="mainmenua_'.$idsel.'" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">';
|
||||||
|
print '<span class="mainmenuaspan">';
|
||||||
|
print $text;
|
||||||
|
print '</span>';
|
||||||
|
print '</a>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -181,18 +186,19 @@ function print_end_menu_array_auguria()
|
|||||||
/**
|
/**
|
||||||
* Core function to output left menu auguria
|
* Core function to output left menu auguria
|
||||||
*
|
*
|
||||||
* @param DoliDB $db Database handler
|
* @param DoliDB $db Database handler
|
||||||
* @param array $menu_array_before Table of menu entries to show before entries of menu handler
|
* @param array $menu_array_before Table of menu entries to show before entries of menu handler
|
||||||
* @param array $menu_array_after Table of menu entries to show after entries of menu handler
|
* @param array $menu_array_after Table of menu entries to show after entries of menu handler
|
||||||
* @param array &$tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty)
|
* @param array &$tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty)
|
||||||
|
* @param array &$menu Object Menu to return back list of menu entries
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabMenu)
|
function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabMenu,&$menu)
|
||||||
{
|
{
|
||||||
global $user,$conf,$langs,$dolibarr_main_db_name,$mysoc;
|
global $user,$conf,$langs,$dolibarr_main_db_name,$mysoc;
|
||||||
|
|
||||||
$overwritemenufor = array();
|
$overwritemenufor = array();
|
||||||
$newmenu = new Menu();
|
$newmenu = $menu;
|
||||||
|
|
||||||
$mainmenu=$_SESSION["mainmenu"];
|
$mainmenu=$_SESSION["mainmenu"];
|
||||||
$leftmenu=$_SESSION["leftmenu"];
|
$leftmenu=$_SESSION["leftmenu"];
|
||||||
|
|||||||
@ -47,12 +47,21 @@ class MenuManager
|
|||||||
*/
|
*/
|
||||||
function __construct($db, $type_user)
|
function __construct($db, $type_user)
|
||||||
{
|
{
|
||||||
global $conf, $user, $langs;
|
|
||||||
|
|
||||||
$this->type_user=$type_user;
|
$this->type_user=$type_user;
|
||||||
$this->db=$db;
|
$this->db=$db;
|
||||||
|
}
|
||||||
// On sauve en session le menu principal choisi
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load this->tabMenu
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function loadMenu()
|
||||||
|
{
|
||||||
|
global $conf, $user, $langs;
|
||||||
|
|
||||||
|
// On sauve en session le menu principal choisi
|
||||||
if (isset($_GET["mainmenu"])) $_SESSION["mainmenu"]=$_GET["mainmenu"];
|
if (isset($_GET["mainmenu"])) $_SESSION["mainmenu"]=$_GET["mainmenu"];
|
||||||
if (isset($_GET["idmenu"])) $_SESSION["idmenu"]=$_GET["idmenu"];
|
if (isset($_GET["idmenu"])) $_SESSION["idmenu"]=$_GET["idmenu"];
|
||||||
|
|
||||||
@ -92,8 +101,8 @@ class MenuManager
|
|||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php';
|
||||||
$tabMenu=array();
|
$tabMenu=array();
|
||||||
$menuArbo = new Menubase($db,'auguria');
|
$menuArbo = new Menubase($this->db,'auguria');
|
||||||
$menuArbo->menuLoad($mainmenu, $leftmenu, $type_user, 'auguria', $tabMenu);
|
$menuArbo->menuLoad($mainmenu, $leftmenu, $this->type_user, 'auguria', $tabMenu);
|
||||||
|
|
||||||
// Modules system tools
|
// Modules system tools
|
||||||
// TODO Find a way to add parent menu only if child menu exists. For the moment, no other method than hard coded methods.
|
// TODO Find a way to add parent menu only if child menu exists. For the moment, no other method than hard coded methods.
|
||||||
@ -158,9 +167,14 @@ class MenuManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
$res='ErrorBadParameterForMode';
|
$res='ErrorBadParameterForMode';
|
||||||
if ($mode == 'top') $res=print_auguria_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu);
|
|
||||||
if ($mode == 'left') $res=print_left_auguria_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu);
|
$this->menu=new Menu();
|
||||||
|
|
||||||
|
if ($mode == 'top') $res=print_auguria_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu);
|
||||||
|
if ($mode == 'left') $res=print_left_auguria_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$this->menu);
|
||||||
|
|
||||||
|
unset($this->menu);
|
||||||
|
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -31,10 +31,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php';
|
|||||||
* @param DoliDB $db Database handler
|
* @param DoliDB $db Database handler
|
||||||
* @param string $atarget Target
|
* @param string $atarget Target
|
||||||
* @param int $type_user 0=Menu for backoffice, 1=Menu for front office
|
* @param int $type_user 0=Menu for backoffice, 1=Menu for front office
|
||||||
* @param array &$tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty)
|
* @param array &$tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty)
|
||||||
|
* @param array &$menu Object Menu to return back list of menu entries
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function print_eldy_menu($db,$atarget,$type_user,&$tabMenu)
|
function print_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu)
|
||||||
{
|
{
|
||||||
global $user,$conf,$langs,$dolibarr_main_db_name;
|
global $user,$conf,$langs,$dolibarr_main_db_name;
|
||||||
|
|
||||||
@ -72,6 +73,7 @@ function print_eldy_menu($db,$atarget,$type_user,&$tabMenu)
|
|||||||
print_start_menu_entry($idsel,$classname);
|
print_start_menu_entry($idsel,$classname);
|
||||||
print_text_menu_entry($langs->trans("ThirdParties"), $showmode, DOL_URL_ROOT.'/societe/index.php?mainmenu=companies&leftmenu=', $id, $idsel, $classname, $atarget);
|
print_text_menu_entry($langs->trans("ThirdParties"), $showmode, DOL_URL_ROOT.'/societe/index.php?mainmenu=companies&leftmenu=', $id, $idsel, $classname, $atarget);
|
||||||
print_end_menu_entry();
|
print_end_menu_entry();
|
||||||
|
$menu->add(DOL_URL_ROOT.'/societe/index.php?mainmenu=companies&leftmenu=', $langs->trans("ThirdParties"), 0, $showmode, $atarget, $mainmenu, $leftmenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Products-Services
|
// Products-Services
|
||||||
@ -312,7 +314,7 @@ function print_start_menu_entry($idsel,$classname)
|
|||||||
* Output menu entry
|
* Output menu entry
|
||||||
*
|
*
|
||||||
* @param string $text Text
|
* @param string $text Text
|
||||||
* @param int $showmode 1 or 2
|
* @param int $showmode 1 = allowed or 2 = not allowed
|
||||||
* @param string $url Url
|
* @param string $url Url
|
||||||
* @param string $id Id
|
* @param string $id Id
|
||||||
* @param string $idsel Id sel
|
* @param string $idsel Id sel
|
||||||
@ -340,6 +342,10 @@ function print_text_menu_entry($text, $showmode, $url, $id, $idsel, $classname,
|
|||||||
{
|
{
|
||||||
print '<div class="'.$id.' '.$idsel.'"><span class="'.$id.'" id="mainmenuspan_'.$idsel.'"></span></div>';
|
print '<div class="'.$id.' '.$idsel.'"><span class="'.$id.'" id="mainmenuspan_'.$idsel.'"></span></div>';
|
||||||
print '<a class="tmenudisabled" id="mainmenua_'.$idsel.'" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">';
|
print '<a class="tmenudisabled" id="mainmenua_'.$idsel.'" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">';
|
||||||
|
print '<span class="mainmenuaspan">';
|
||||||
|
print $text;
|
||||||
|
print '</span>';
|
||||||
|
print '</a>';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -375,13 +381,14 @@ function print_end_menu_array()
|
|||||||
* @param array $menu_array_before Table of menu entries to show before entries of menu handler
|
* @param array $menu_array_before Table of menu entries to show before entries of menu handler
|
||||||
* @param array $menu_array_after Table of menu entries to show after entries of menu handler
|
* @param array $menu_array_after Table of menu entries to show after entries of menu handler
|
||||||
* @param array &$tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty)
|
* @param array &$tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty)
|
||||||
|
* @param array &$menu Object Menu to return back list of menu entries
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu)
|
function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu,&$menu)
|
||||||
{
|
{
|
||||||
global $user,$conf,$langs,$dolibarr_main_db_name,$mysoc;
|
global $user,$conf,$langs,$dolibarr_main_db_name,$mysoc;
|
||||||
|
|
||||||
$newmenu = new Menu();
|
$newmenu = $menu;
|
||||||
|
|
||||||
$mainmenu=$_SESSION["mainmenu"];
|
$mainmenu=$_SESSION["mainmenu"];
|
||||||
$leftmenu=$_SESSION["leftmenu"];
|
$leftmenu=$_SESSION["leftmenu"];
|
||||||
@ -1241,15 +1248,14 @@ function print_left_eldy_menu($db,$menu_array_before,$menu_array_after,&$tabMenu
|
|||||||
* @param array &$tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty)
|
* @param array &$tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty)
|
||||||
* @return void
|
* @return void
|
||||||
*/
|
*/
|
||||||
function print_jmobile_eldy_menu($db,$atarget,$type_user,&$tabMenu)
|
function print_jmobile_eldy_menu($db,$atarget,$type_user,&$tabMenu,&$menu)
|
||||||
{
|
{
|
||||||
print '<ul data-role="listview" data-inset="true">
|
print '<ul data-role="listview" data-inset="true">';
|
||||||
<li><a href="#">Acura</a></li>
|
foreach ($tabMenu as $key => $val)
|
||||||
<li><a href="#">Audi</a></li>
|
{
|
||||||
<li><a href="#">BMW</a></li>
|
print '<li><a href="#">'.$key.'</a></li>';
|
||||||
<li><a href="#">Cadillac</a></li>
|
}
|
||||||
<li><a href="#">Ferrari</a></li>
|
print '</ul>';
|
||||||
</ul>';
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@ -48,7 +48,16 @@ class MenuManager
|
|||||||
{
|
{
|
||||||
$this->type_user=$type_user;
|
$this->type_user=$type_user;
|
||||||
$this->db=$db;
|
$this->db=$db;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load this->tabMenu
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function loadMenu()
|
||||||
|
{
|
||||||
// On sauve en session le menu principal choisi
|
// On sauve en session le menu principal choisi
|
||||||
if (isset($_GET["mainmenu"])) $_SESSION["mainmenu"]=$_GET["mainmenu"];
|
if (isset($_GET["mainmenu"])) $_SESSION["mainmenu"]=$_GET["mainmenu"];
|
||||||
if (isset($_GET["idmenu"])) $_SESSION["idmenu"]=$_GET["idmenu"];
|
if (isset($_GET["idmenu"])) $_SESSION["idmenu"]=$_GET["idmenu"];
|
||||||
@ -89,8 +98,8 @@ class MenuManager
|
|||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php';
|
||||||
$tabMenu=array();
|
$tabMenu=array();
|
||||||
$menuArbo = new Menubase($db,'eldy');
|
$menuArbo = new Menubase($this->db,'eldy');
|
||||||
$menuArbo->menuLoad($mainmenu, $leftmenu, $type_user, 'eldy', $tabMenu);
|
$menuArbo->menuLoad($mainmenu, $leftmenu, $this->type_user, 'eldy', $tabMenu);
|
||||||
$this->tabMenu=$tabMenu;
|
$this->tabMenu=$tabMenu;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,12 +121,19 @@ class MenuManager
|
|||||||
$conf->global->MAIN_SEARCHFORM_SOCIETE=0;
|
$conf->global->MAIN_SEARCHFORM_SOCIETE=0;
|
||||||
$conf->global->MAIN_SEARCHFORM_CONTACT=0;
|
$conf->global->MAIN_SEARCHFORM_CONTACT=0;
|
||||||
}
|
}
|
||||||
|
|
||||||
$res='ErrorBadParameterForMode';
|
|
||||||
if ($mode == 'top') $res=print_eldy_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu);
|
|
||||||
if ($mode == 'left') $res=print_left_eldy_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu);
|
|
||||||
if ($mode == 'jmobile') $res=print_jmobile_eldy_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu);
|
|
||||||
|
|
||||||
|
$res='ErrorBadParameterForMode';
|
||||||
|
|
||||||
|
$this->menu=new Menu();
|
||||||
|
|
||||||
|
if ($mode == 'top') $res=print_eldy_menu($this->db,$this->atarget,$this->type_user,$this->tabMenu,$this->menu);
|
||||||
|
if ($mode == 'left') $res=print_left_eldy_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$this->menu);
|
||||||
|
if ($mode == 'jmobile') $res=print_jmobile_eldy_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$this->menu);
|
||||||
|
|
||||||
|
unset($this->menu);
|
||||||
|
|
||||||
|
//print 'xx'.$mode;
|
||||||
|
//var_dump($this->menu);
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -29,7 +29,7 @@ class MenuManager
|
|||||||
var $type_user=0; // Put 0 for internal users, 1 for external users
|
var $type_user=0; // Put 0 for internal users, 1 for external users
|
||||||
var $atarget=""; // To store default target to use onto links
|
var $atarget=""; // To store default target to use onto links
|
||||||
|
|
||||||
var $menu_array;
|
var $menu;
|
||||||
var $menu_array_after;
|
var $menu_array_after;
|
||||||
|
|
||||||
|
|
||||||
@ -46,6 +46,17 @@ class MenuManager
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Load this->tabMenu
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
function loadMenu()
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show menu
|
* Show menu
|
||||||
*
|
*
|
||||||
@ -58,6 +69,8 @@ class MenuManager
|
|||||||
|
|
||||||
$id='mainmenu';
|
$id='mainmenu';
|
||||||
|
|
||||||
|
$this->menu=new Menu();
|
||||||
|
|
||||||
if ($mode == 'top')
|
if ($mode == 'top')
|
||||||
{
|
{
|
||||||
print_start_menu_array_empty();
|
print_start_menu_array_empty();
|
||||||
@ -74,40 +87,35 @@ class MenuManager
|
|||||||
|
|
||||||
if ($mode == 'left')
|
if ($mode == 'left')
|
||||||
{
|
{
|
||||||
$newmenu = new Menu();
|
|
||||||
|
|
||||||
// Put here left menu entries
|
// Put here left menu entries
|
||||||
// ***** START *****
|
// ***** START *****
|
||||||
|
|
||||||
$langs->load("admin"); // Load translation file admin.lang
|
$langs->load("admin"); // Load translation file admin.lang
|
||||||
$newmenu->add("/admin/index.php?leftmenu=setup", $langs->trans("Setup"),0);
|
$this->menu->add("/admin/index.php?leftmenu=setup", $langs->trans("Setup"),0);
|
||||||
$newmenu->add("/admin/company.php", $langs->trans("MenuCompanySetup"),1);
|
$this->menu->add("/admin/company.php", $langs->trans("MenuCompanySetup"),1);
|
||||||
$newmenu->add("/admin/modules.php", $langs->trans("Modules"),1);
|
$this->menu->add("/admin/modules.php", $langs->trans("Modules"),1);
|
||||||
$newmenu->add("/admin/menus.php", $langs->trans("Menus"),1);
|
$this->menu->add("/admin/menus.php", $langs->trans("Menus"),1);
|
||||||
$newmenu->add("/admin/ihm.php", $langs->trans("GUISetup"),1);
|
$this->menu->add("/admin/ihm.php", $langs->trans("GUISetup"),1);
|
||||||
$newmenu->add("/admin/boxes.php", $langs->trans("Boxes"),1);
|
$this->menu->add("/admin/boxes.php", $langs->trans("Boxes"),1);
|
||||||
$newmenu->add("/admin/delais.php",$langs->trans("Alerts"),1);
|
$this->menu->add("/admin/delais.php",$langs->trans("Alerts"),1);
|
||||||
$newmenu->add("/admin/proxy.php?mainmenu=home", $langs->trans("Security"),1);
|
$this->menu->add("/admin/proxy.php?mainmenu=home", $langs->trans("Security"),1);
|
||||||
$newmenu->add("/admin/limits.php?mainmenu=home", $langs->trans("MenuLimits"),1);
|
$this->menu->add("/admin/limits.php?mainmenu=home", $langs->trans("MenuLimits"),1);
|
||||||
$newmenu->add("/admin/pdf.php?mainmenu=home", $langs->trans("PDF"),1);
|
$this->menu->add("/admin/pdf.php?mainmenu=home", $langs->trans("PDF"),1);
|
||||||
$newmenu->add("/admin/mails.php?mainmenu=home", $langs->trans("Emails"),1);
|
$this->menu->add("/admin/mails.php?mainmenu=home", $langs->trans("Emails"),1);
|
||||||
$newmenu->add("/admin/sms.php?mainmenu=home", $langs->trans("SMS"),1);
|
$this->menu->add("/admin/sms.php?mainmenu=home", $langs->trans("SMS"),1);
|
||||||
$newmenu->add("/admin/dict.php?mainmenu=home", $langs->trans("DictionnarySetup"),1);
|
$this->menu->add("/admin/dict.php?mainmenu=home", $langs->trans("DictionnarySetup"),1);
|
||||||
$newmenu->add("/admin/const.php?mainmenu=home", $langs->trans("OtherSetup"),1);
|
$this->menu->add("/admin/const.php?mainmenu=home", $langs->trans("OtherSetup"),1);
|
||||||
|
|
||||||
// ***** END *****
|
// ***** END *****
|
||||||
|
|
||||||
// do not change code after this
|
// do not change code after this
|
||||||
|
|
||||||
// override menu_array by value array in $newmenu
|
|
||||||
$this->menu_array=$newmenu->liste;
|
|
||||||
|
|
||||||
$alt=0;
|
$alt=0;
|
||||||
$num=count($this->menu_array);
|
$num=count($this->menu->liste);
|
||||||
for ($i = 0; $i < $num; $i++)
|
for ($i = 0; $i < $num; $i++)
|
||||||
{
|
{
|
||||||
$alt++;
|
$alt++;
|
||||||
if (empty($this->menu_array[$i]['level']))
|
if (empty($this->menu->liste[$i]['level']))
|
||||||
{
|
{
|
||||||
if (($alt%2==0))
|
if (($alt%2==0))
|
||||||
{
|
{
|
||||||
@ -121,7 +129,7 @@ class MenuManager
|
|||||||
|
|
||||||
// Place tabulation
|
// Place tabulation
|
||||||
$tabstring='';
|
$tabstring='';
|
||||||
$tabul=($this->menu_array[$i]['level'] - 1);
|
$tabul=($this->menu->liste[$i]['level'] - 1);
|
||||||
if ($tabul > 0)
|
if ($tabul > 0)
|
||||||
{
|
{
|
||||||
for ($j=0; $j < $tabul; $j++)
|
for ($j=0; $j < $tabul; $j++)
|
||||||
@ -130,31 +138,31 @@ class MenuManager
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->menu_array[$i]['level'] == 0) {
|
if ($this->menu->liste[$i]['level'] == 0) {
|
||||||
if ($this->menu_array[$i]['enabled'])
|
if ($this->menu->liste[$i]['enabled'])
|
||||||
{
|
{
|
||||||
print '<div class="menu_titre">'.$tabstring.'<a class="vmenu" href="'.dol_buildpath($this->menu_array[$i]['url'],1).'"'.($this->menu_array[$i]['target']?' target="'.$this->menu_array[$i]['target'].'"':'').'>'.$this->menu_array[$i]['titre'].'</a></div>'."\n";
|
print '<div class="menu_titre">'.$tabstring.'<a class="vmenu" href="'.dol_buildpath($this->menu->liste[$i]['url'],1).'"'.($this->menu->liste[$i]['target']?' target="'.$this->menu->liste[$i]['target'].'"':'').'>'.$this->menu->liste[$i]['titre'].'</a></div>'."\n";
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
print '<div class="menu_titre">'.$tabstring.'<font class="vmenudisabled">'.$this->menu_array[$i]['titre'].'</font></div>'."\n";
|
print '<div class="menu_titre">'.$tabstring.'<font class="vmenudisabled">'.$this->menu->liste[$i]['titre'].'</font></div>'."\n";
|
||||||
}
|
}
|
||||||
print '<div class="menu_top"></div>'."\n";
|
print '<div class="menu_top"></div>'."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($this->menu_array[$i]['level'] > 0) {
|
if ($this->menu->liste[$i]['level'] > 0) {
|
||||||
print '<div class="menu_contenu">';
|
print '<div class="menu_contenu">';
|
||||||
|
|
||||||
if ($this->menu_array[$i]['enabled'])
|
if ($this->menu->liste[$i]['enabled'])
|
||||||
print $tabstring.'<a class="vsmenu" href="'.dol_buildpath($this->menu_array[$i]['url'],1).'">'.$this->menu_array[$i]['titre'].'</a><br>';
|
print $tabstring.'<a class="vsmenu" href="'.dol_buildpath($this->menu->liste[$i]['url'],1).'">'.$this->menu->liste[$i]['titre'].'</a><br>';
|
||||||
else
|
else
|
||||||
print $tabstring.'<font class="vsmenudisabled">'.$this->menu_array[$i]['titre'].'</font><br>';
|
print $tabstring.'<font class="vsmenudisabled">'.$this->menu->liste[$i]['titre'].'</font><br>';
|
||||||
|
|
||||||
print '</div>'."\n";
|
print '</div>'."\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
// If next is a new block or end
|
// If next is a new block or end
|
||||||
if (empty($this->menu_array[$i+1]['level']))
|
if (empty($this->menu->liste[$i+1]['level']))
|
||||||
{
|
{
|
||||||
print '<div class="menu_end"></div>'."\n";
|
print '<div class="menu_end"></div>'."\n";
|
||||||
print "</div>\n";
|
print "</div>\n";
|
||||||
|
|||||||
@ -807,6 +807,7 @@ if (! defined('NOREQUIREMENU'))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
$menumanager = new MenuManager($db, empty($user->societe_id)?0:1);
|
$menumanager = new MenuManager($db, empty($user->societe_id)?0:1);
|
||||||
|
$menumanager->loadMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user