Qual: Merge the 2 class MenuTop and MenuLeft into menu handler file
into 1 class MenuManager. This make code simpler and is also a first step to optimize performance of menu loading.
This commit is contained in:
parent
ec5b4f5fa7
commit
db1cd6b27f
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
/* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
||||||
* Copyright (C) 2009 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2008-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2008-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -31,78 +31,49 @@
|
|||||||
/**
|
/**
|
||||||
* Classe permettant la gestion du menu du haut Auguria
|
* Classe permettant la gestion du menu du haut Auguria
|
||||||
*/
|
*/
|
||||||
class MenuTop
|
class MenuManager
|
||||||
{
|
{
|
||||||
var $db;
|
var $db;
|
||||||
var $require_left=array("auguria_backoffice"); // Si doit etre en phase avec un gestionnaire de menu gauche particulier
|
var $require_left=array("auguria_backoffice"); // Si doit etre en phase avec un gestionnaire de menu gauche particulier
|
||||||
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=""; // Valeur du target a utiliser dans les liens
|
var $atarget=""; // Valeur du target a utiliser dans les liens
|
||||||
|
|
||||||
|
var $menu_array;
|
||||||
|
var $menu_array_after;
|
||||||
|
|
||||||
/**
|
|
||||||
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param DoliDb $db Database handler
|
|
||||||
*/
|
|
||||||
function __construct($db)
|
|
||||||
{
|
|
||||||
$this->db=$db;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show menu
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
function showmenu()
|
|
||||||
{
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/menus/standard/auguria.lib.php';
|
|
||||||
|
|
||||||
print_auguria_menu($this->db,$this->atarget,$this->type_user);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Classe permettant la gestion du menu du gauche Auguria
|
|
||||||
*/
|
|
||||||
class MenuLeft
|
|
||||||
{
|
|
||||||
var $db;
|
|
||||||
var $menu_array;
|
|
||||||
var $menu_array_after;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
*
|
|
||||||
* @param DoliDB $db Database handler
|
* @param DoliDB $db Database handler
|
||||||
* @param array &$menu_array Table of menu entries to show before entries of menu handler
|
* @param array &$menu_array 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
|
||||||
*/
|
*/
|
||||||
function __construct($db,&$menu_array,&$menu_array_after)
|
function __construct($db, &$menu_array, &$menu_array_after)
|
||||||
{
|
{
|
||||||
$this->db=$db;
|
$this->db=$db;
|
||||||
$this->menu_array=$menu_array;
|
$this->menu_array=$menu_array;
|
||||||
$this->menu_array_after=$menu_array_after;
|
$this->menu_array_after=$menu_array_after;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show menu
|
* Show menu
|
||||||
*
|
*
|
||||||
* @return int Number of menu entries shown
|
* @param string $mode 'top' or 'left'
|
||||||
|
* @return int Number of menu entries shown
|
||||||
*/
|
*/
|
||||||
function showmenu()
|
function showmenu($mode)
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/menus/standard/auguria.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/menus/standard/auguria.lib.php';
|
||||||
|
|
||||||
$res=print_left_auguria_menu($this->db,$this->menu_array,$this->menu_array_after);
|
$res='ErrorBadParameterForMode';
|
||||||
|
if ($mode == 'top') $res=print_auguria_menu($this->db,$this->atarget,$this->type_user);
|
||||||
|
if ($mode == 'left') $res=print_left_auguria_menu($this->db,$this->menu_array,$this->menu_array_after);
|
||||||
|
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
?>
|
?>
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
/* Copyright (C) 2007 Patrick Raguin <patrick.raguin@gmail.com>
|
||||||
* Copyright (C) 2009 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
* Copyright (C) 2008-2009 Laurent Destailleur <eldy@users.sourceforge.net>
|
* Copyright (C) 2008-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -31,7 +31,7 @@
|
|||||||
/**
|
/**
|
||||||
* Classe permettant la gestion du menu du haut Auguria
|
* Classe permettant la gestion du menu du haut Auguria
|
||||||
*/
|
*/
|
||||||
class MenuTop
|
class MenuManager
|
||||||
{
|
{
|
||||||
var $db;
|
var $db;
|
||||||
var $require_left=array("auguria_backoffice"); // Si doit etre en phase avec un gestionnaire de menu gauche particulier
|
var $require_left=array("auguria_backoffice"); // Si doit etre en phase avec un gestionnaire de menu gauche particulier
|
||||||
@ -39,43 +39,10 @@ class MenuTop
|
|||||||
var $atarget=""; // Valeur du target a utiliser dans les liens
|
var $atarget=""; // Valeur du target a utiliser dans les liens
|
||||||
|
|
||||||
|
|
||||||
/**
|
var $menu_array;
|
||||||
* Constructor
|
var $menu_array_after;
|
||||||
*
|
|
||||||
* @param DoliDb $db Database handler
|
|
||||||
*/
|
|
||||||
function __construct($db)
|
|
||||||
{
|
|
||||||
$this->db=$db;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show menu
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
function showmenu()
|
|
||||||
{
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/menus/standard/auguria.lib.php';
|
|
||||||
|
|
||||||
print_auguria_menu($this->db,$this->atarget,$this->type_user);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Classe permettant la gestion du menu du gauche Auguria
|
|
||||||
*/
|
|
||||||
class MenuLeft
|
|
||||||
{
|
|
||||||
var $db;
|
|
||||||
var $menu_array;
|
|
||||||
var $menu_array_after;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
@ -83,29 +50,32 @@ class MenuLeft
|
|||||||
* @param array &$menu_array Table of menu entries to show before entries of menu handler
|
* @param array &$menu_array 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
|
||||||
*/
|
*/
|
||||||
function __construct($db,&$menu_array,&$menu_array_after)
|
function __construct($db, &$menu_array, &$menu_array_after)
|
||||||
{
|
{
|
||||||
$this->db=$db;
|
$this->db=$db;
|
||||||
$this->menu_array=$menu_array;
|
$this->menu_array=$menu_array;
|
||||||
$this->menu_array_after=$menu_array_after;
|
$this->menu_array_after=$menu_array_after;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show menu
|
* Show menu
|
||||||
*
|
*
|
||||||
* @return int Number of menu entries shown
|
* @param string $mode 'top' or 'left'
|
||||||
*/
|
* @return int Number of menu entries shown
|
||||||
function showmenu()
|
*/
|
||||||
{
|
function showmenu($mode)
|
||||||
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/menus/standard/auguria.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/menus/standard/auguria.lib.php';
|
||||||
|
|
||||||
$res=print_left_auguria_menu($this->db,$this->menu_array,$this->menu_array_after);
|
|
||||||
|
|
||||||
$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_auguria_menu($this->db,$this->atarget,$this->type_user);
|
||||||
|
if ($mode == 'left') $res=print_left_auguria_menu($this->db,$this->menu_array,$this->menu_array_after);
|
||||||
|
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2005-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2007-2010 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2007-2010 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -28,49 +28,15 @@
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class to manage top menu Eldy (for internal users)
|
* Classe to manage menu Eldy
|
||||||
*/
|
*/
|
||||||
class MenuTop
|
class MenuManager
|
||||||
{
|
{
|
||||||
var $db;
|
var $db;
|
||||||
var $require_left=array("eldy_backoffice"); // Si doit etre en phase avec un gestionnaire de menu gauche particulier
|
var $require_left=array("eldy_backoffice"); // Si doit etre en phase avec un gestionnaire de menu gauche particulier
|
||||||
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=""; // Valeur du target a utiliser dans les liens
|
var $atarget=""; // Valeur du target a utiliser dans les liens
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
*
|
|
||||||
* @param DoliDb $db Database handler
|
|
||||||
*/
|
|
||||||
function __construct($db)
|
|
||||||
{
|
|
||||||
$this->db=$db;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show menu
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
function showmenu()
|
|
||||||
{
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/menus/standard/eldy.lib.php';
|
|
||||||
|
|
||||||
print_eldy_menu($this->db,$this->atarget,$this->type_user);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* \class MenuLeft
|
|
||||||
* \brief Classe permettant la gestion du menu du gauche Eldy
|
|
||||||
*/
|
|
||||||
class MenuLeft
|
|
||||||
{
|
|
||||||
var $db;
|
|
||||||
var $menu_array;
|
var $menu_array;
|
||||||
var $menu_array_after;
|
var $menu_array_after;
|
||||||
|
|
||||||
@ -82,7 +48,7 @@ class MenuLeft
|
|||||||
* @param array &$menu_array Table of menu entries to show before entries of menu handler
|
* @param array &$menu_array 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
|
||||||
*/
|
*/
|
||||||
function __construct($db,&$menu_array,&$menu_array_after)
|
function __construct($db, &$menu_array, &$menu_array_after)
|
||||||
{
|
{
|
||||||
$this->db=$db;
|
$this->db=$db;
|
||||||
$this->menu_array=$menu_array;
|
$this->menu_array=$menu_array;
|
||||||
@ -93,13 +59,16 @@ class MenuLeft
|
|||||||
/**
|
/**
|
||||||
* Show menu
|
* Show menu
|
||||||
*
|
*
|
||||||
* @return int Number of menu entries shown
|
* @param string $mode 'top' or 'left'
|
||||||
|
* @return int Number of menu entries shown
|
||||||
*/
|
*/
|
||||||
function showmenu()
|
function showmenu($mode)
|
||||||
{
|
{
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/menus/standard/eldy.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/menus/standard/eldy.lib.php';
|
||||||
|
|
||||||
$res=print_left_eldy_menu($this->db,$this->menu_array,$this->menu_array_after);
|
$res='ErrorBadParameterForMode';
|
||||||
|
if ($mode == 'top') $res=print_eldy_menu($this->db,$this->atarget,$this->type_user);
|
||||||
|
if ($mode == 'left') $res=print_left_eldy_menu($this->db,$this->menu_array,$this->menu_array_after);
|
||||||
|
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2005-2010 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2005-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
* Copyright (C) 2007-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
* Copyright (C) 2007-2009 Regis Houssin <regis.houssin@capnetworks.com>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
@ -28,48 +28,15 @@
|
|||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Class to manage top menu Eldy (for external users)
|
* Class to manage menu Eldy (for external users)
|
||||||
*/
|
*/
|
||||||
class MenuTop
|
class MenuManager
|
||||||
{
|
{
|
||||||
var $db;
|
var $db;
|
||||||
var $require_left=array("eldy_frontoffice"); // Si doit etre en phase avec un gestionnaire de menu gauche particulier
|
var $require_left=array("eldy_frontoffice"); // Si doit etre en phase avec un gestionnaire de menu gauche particulier
|
||||||
var $type_user=1; // Put 0 for internal users, 1 for external users
|
var $type_user=1; // Put 0 for internal users, 1 for external users
|
||||||
var $atarget=""; // Valeur du target a utiliser dans les liens
|
var $atarget=""; // Valeur du target a utiliser dans les liens
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
*
|
|
||||||
* @param DoliDb $db Database handler
|
|
||||||
*/
|
|
||||||
function __construct($db)
|
|
||||||
{
|
|
||||||
$this->db=$db;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show menu
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
function showmenu()
|
|
||||||
{
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/menus/standard/eldy.lib.php';
|
|
||||||
|
|
||||||
print_eldy_menu($this->db,$this->atarget,$this->type_user);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Classe permettant la gestion du menu du gauche Eldy
|
|
||||||
*/
|
|
||||||
class MenuLeft
|
|
||||||
{
|
|
||||||
var $db;
|
|
||||||
var $menu_array;
|
var $menu_array;
|
||||||
var $menu_array_after;
|
var $menu_array_after;
|
||||||
|
|
||||||
@ -92,19 +59,22 @@ class MenuLeft
|
|||||||
/**
|
/**
|
||||||
* Show menu
|
* Show menu
|
||||||
*
|
*
|
||||||
|
* @param string $mode 'top' or 'left'
|
||||||
* @return int Number of menu entries shown
|
* @return int Number of menu entries shown
|
||||||
*/
|
*/
|
||||||
function showmenu()
|
function showmenu($mode)
|
||||||
{
|
{
|
||||||
global $conf;
|
global $conf;
|
||||||
|
|
||||||
require_once DOL_DOCUMENT_ROOT.'/core/menus/standard/eldy.lib.php';
|
require_once DOL_DOCUMENT_ROOT.'/core/menus/standard/eldy.lib.php';
|
||||||
|
|
||||||
$res=print_left_eldy_menu($this->db,$this->menu_array,$this->menu_array_after);
|
|
||||||
|
|
||||||
$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);
|
||||||
|
if ($mode == 'left') $res=print_left_eldy_menu($this->db,$this->menu_array,$this->menu_array_after);
|
||||||
|
|
||||||
return $res;
|
return $res;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
<?php
|
<?php
|
||||||
/* Copyright (C) 2006-2011 Laurent Destailleur <eldy@users.sourceforge.net>
|
/* Copyright (C) 2006-2013 Laurent Destailleur <eldy@users.sourceforge.net>
|
||||||
*
|
*
|
||||||
* This program is free software; you can redistribute it and/or modify
|
* This program is free software; you can redistribute it and/or modify
|
||||||
* it under the terms of the GNU General Public License as published by
|
* it under the terms of the GNU General Public License as published by
|
||||||
@ -21,56 +21,156 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \class MenuTop
|
* Class to manage empty menu
|
||||||
* \brief Class for top empty menu
|
|
||||||
*/
|
*/
|
||||||
class MenuTop
|
class MenuManager
|
||||||
{
|
{
|
||||||
var $db;
|
var $db;
|
||||||
var $require_left=array("empty"); // If this top menu handler must be used with a particular left menu handler
|
var $require_left=array("empty"); // If this top menu handler must be used with a particular left menu handler
|
||||||
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 arget to use in menu links
|
var $atarget=""; // To store arget to use in menu links
|
||||||
|
|
||||||
|
var $menu_array;
|
||||||
|
var $menu_array_after;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Constructor
|
* Constructor
|
||||||
*
|
*
|
||||||
* @param DoliDB $db Database handler
|
* @param DoliDB $db Database handler
|
||||||
*/
|
* @param array &$menu_array Table of menu entries to show before entries of menu handler
|
||||||
function __construct($db)
|
* @param array &$menu_array_after Table of menu entries to show after entries of menu handler
|
||||||
{
|
*/
|
||||||
$this->db=$db;
|
function __construct($db, &$menu_array, &$menu_array_after)
|
||||||
}
|
{
|
||||||
|
$this->db=$db;
|
||||||
|
$this->menu_array=$menu_array;
|
||||||
|
$this->menu_array_after=$menu_array_after;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Show menu
|
* Show menu
|
||||||
*
|
*
|
||||||
* @return void
|
* @param string $mode 'top' or 'left'
|
||||||
*/
|
* @return void
|
||||||
function showmenu()
|
*/
|
||||||
{
|
function showmenu($mode)
|
||||||
global $user,$conf,$langs,$dolibarr_main_db_name;
|
{
|
||||||
|
global $user,$conf,$langs,$dolibarr_main_db_name;
|
||||||
|
|
||||||
print_start_menu_array_empty();
|
if ($mode == 'top')
|
||||||
|
{
|
||||||
|
print_start_menu_array_empty();
|
||||||
|
|
||||||
$idsel='home';
|
$idsel='home';
|
||||||
$classname='class="tmenu"';
|
$classname='class="tmenu"';
|
||||||
|
|
||||||
print_start_menu_entry_empty($idsel);
|
print_start_menu_entry_empty($idsel);
|
||||||
print '<a class="tmenuimage" href="'.dol_buildpath('/index.php',1).'?mainmenu=home&leftmenu="'.($this->atarget?' target="'.$this->atarget.'"':'').'>';
|
print '<a class="tmenuimage" href="'.dol_buildpath('/index.php',1).'?mainmenu=home&leftmenu="'.($this->atarget?' target="'.$this->atarget.'"':'').'>';
|
||||||
print '<div class="mainmenu '.$idsel.'"><span class="mainmenu_'.$idsel.' tmenuimage" id="mainmenuspan_'.$idsel.'"></span></div>';
|
print '<div class="mainmenu '.$idsel.'"><span class="mainmenu_'.$idsel.' tmenuimage" id="mainmenuspan_'.$idsel.'"></span></div>';
|
||||||
print '</a>';
|
print '</a>';
|
||||||
print '<a '.$classname.' id="mainmenua_'.$idsel.'" href="'.DOL_URL_ROOT.'"'.($this->atarget?' target="'.$this->atarget.'"':'').'>';
|
print '<a '.$classname.' id="mainmenua_'.$idsel.'" href="'.DOL_URL_ROOT.'"'.($this->atarget?' target="'.$this->atarget.'"':'').'>';
|
||||||
print_text_menu_entry_empty($langs->trans("Home"));
|
print_text_menu_entry_empty($langs->trans("Home"));
|
||||||
print '</a>';
|
print '</a>';
|
||||||
print_end_menu_entry_empty();
|
print_end_menu_entry_empty();
|
||||||
|
|
||||||
print_end_menu_array_empty();
|
print_end_menu_array_empty();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ($mode == 'left')
|
||||||
|
{
|
||||||
|
$newmenu = new Menu();
|
||||||
|
|
||||||
|
// Put here left menu entries
|
||||||
|
// ***** START *****
|
||||||
|
|
||||||
|
$langs->load("admin"); // Load translation file admin.lang
|
||||||
|
$newmenu->add("/admin/index.php?leftmenu=setup", $langs->trans("Setup"),0);
|
||||||
|
$newmenu->add("/admin/company.php", $langs->trans("MenuCompanySetup"),1);
|
||||||
|
$newmenu->add("/admin/modules.php", $langs->trans("Modules"),1);
|
||||||
|
$newmenu->add("/admin/menus.php", $langs->trans("Menus"),1);
|
||||||
|
$newmenu->add("/admin/ihm.php", $langs->trans("GUISetup"),1);
|
||||||
|
$newmenu->add("/admin/boxes.php", $langs->trans("Boxes"),1);
|
||||||
|
$newmenu->add("/admin/delais.php",$langs->trans("Alerts"),1);
|
||||||
|
$newmenu->add("/admin/proxy.php?mainmenu=home", $langs->trans("Security"),1);
|
||||||
|
$newmenu->add("/admin/limits.php?mainmenu=home", $langs->trans("MenuLimits"),1);
|
||||||
|
$newmenu->add("/admin/pdf.php?mainmenu=home", $langs->trans("PDF"),1);
|
||||||
|
$newmenu->add("/admin/mails.php?mainmenu=home", $langs->trans("Emails"),1);
|
||||||
|
$newmenu->add("/admin/sms.php?mainmenu=home", $langs->trans("SMS"),1);
|
||||||
|
$newmenu->add("/admin/dict.php?mainmenu=home", $langs->trans("DictionnarySetup"),1);
|
||||||
|
$newmenu->add("/admin/const.php?mainmenu=home", $langs->trans("OtherSetup"),1);
|
||||||
|
|
||||||
|
// ***** END *****
|
||||||
|
|
||||||
|
// do not change code after this
|
||||||
|
|
||||||
|
// override menu_array by value array in $newmenu
|
||||||
|
$this->menu_array=$newmenu->liste;
|
||||||
|
|
||||||
|
$alt=0;
|
||||||
|
$num=count($this->menu_array);
|
||||||
|
for ($i = 0; $i < $num; $i++)
|
||||||
|
{
|
||||||
|
$alt++;
|
||||||
|
if (empty($this->menu_array[$i]['level']))
|
||||||
|
{
|
||||||
|
if (($alt%2==0))
|
||||||
|
{
|
||||||
|
print '<div class="blockvmenuimpair">'."\n";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<div class="blockvmenupair">'."\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Place tabulation
|
||||||
|
$tabstring='';
|
||||||
|
$tabul=($this->menu_array[$i]['level'] - 1);
|
||||||
|
if ($tabul > 0)
|
||||||
|
{
|
||||||
|
for ($j=0; $j < $tabul; $j++)
|
||||||
|
{
|
||||||
|
$tabstring.=' ';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->menu_array[$i]['level'] == 0) {
|
||||||
|
if ($this->menu_array[$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";
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
print '<div class="menu_titre">'.$tabstring.'<font class="vmenudisabled">'.$this->menu_array[$i]['titre'].'</font></div>'."\n";
|
||||||
|
}
|
||||||
|
print '<div class="menu_top"></div>'."\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($this->menu_array[$i]['level'] > 0) {
|
||||||
|
print '<div class="menu_contenu">';
|
||||||
|
|
||||||
|
if ($this->menu_array[$i]['enabled'])
|
||||||
|
print $tabstring.'<a class="vsmenu" href="'.dol_buildpath($this->menu_array[$i]['url'],1).'">'.$this->menu_array[$i]['titre'].'</a><br>';
|
||||||
|
else
|
||||||
|
print $tabstring.'<font class="vsmenudisabled">'.$this->menu_array[$i]['titre'].'</font><br>';
|
||||||
|
|
||||||
|
print '</div>'."\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
// If next is a new block or end
|
||||||
|
if (empty($this->menu_array[$i+1]['level']))
|
||||||
|
{
|
||||||
|
print '<div class="menu_end"></div>'."\n";
|
||||||
|
print "</div>\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Output menu entry
|
* Output menu entry
|
||||||
*
|
*
|
||||||
@ -136,127 +236,4 @@ function print_end_menu_array_empty()
|
|||||||
print "\n";
|
print "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Class for left empty menu
|
|
||||||
*/
|
|
||||||
class MenuLeft
|
|
||||||
{
|
|
||||||
var $db;
|
|
||||||
var $menu_array;
|
|
||||||
var $menu_array_after;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Constructor
|
|
||||||
*
|
|
||||||
* @param DoliDB $db Database handler
|
|
||||||
* @param array &$menu_array 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
|
|
||||||
*/
|
|
||||||
function __construct($db,&$menu_array,&$menu_array_after)
|
|
||||||
{
|
|
||||||
$this->db=$db;
|
|
||||||
$this->menu_array=$menu_array;
|
|
||||||
$this->menu_array_after=$menu_array_after;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Show menu
|
|
||||||
*
|
|
||||||
* @return void
|
|
||||||
*/
|
|
||||||
function showmenu()
|
|
||||||
{
|
|
||||||
global $user,$conf,$langs,$dolibarr_main_db_name;
|
|
||||||
$newmenu = new Menu();
|
|
||||||
|
|
||||||
// Put here left menu entries
|
|
||||||
// ***** START *****
|
|
||||||
|
|
||||||
$langs->load("admin"); // Load translation file admin.lang
|
|
||||||
$newmenu->add("/admin/index.php?leftmenu=setup", $langs->trans("Setup"),0);
|
|
||||||
$newmenu->add("/admin/company.php", $langs->trans("MenuCompanySetup"),1);
|
|
||||||
$newmenu->add("/admin/modules.php", $langs->trans("Modules"),1);
|
|
||||||
$newmenu->add("/admin/menus.php", $langs->trans("Menus"),1);
|
|
||||||
$newmenu->add("/admin/ihm.php", $langs->trans("GUISetup"),1);
|
|
||||||
$newmenu->add("/admin/boxes.php", $langs->trans("Boxes"),1);
|
|
||||||
$newmenu->add("/admin/delais.php",$langs->trans("Alerts"),1);
|
|
||||||
$newmenu->add("/admin/perms.php", $langs->trans("Security"),1);
|
|
||||||
$newmenu->add("/admin/mails.php", $langs->trans("EMails"),1);
|
|
||||||
$newmenu->add("/admin/limits.php", $langs->trans("Limits"),1);
|
|
||||||
$newmenu->add("/admin/dict.php", $langs->trans("DictionnarySetup"),1);
|
|
||||||
$newmenu->add("/admin/const.php", $langs->trans("OtherSetup"),1);
|
|
||||||
|
|
||||||
// ***** END *****
|
|
||||||
|
|
||||||
// do not change code after this
|
|
||||||
|
|
||||||
// override menu_array by value array in $newmenu
|
|
||||||
$this->menu_array=$newmenu->liste;
|
|
||||||
|
|
||||||
$alt=0;
|
|
||||||
$num=count($this->menu_array);
|
|
||||||
for ($i = 0; $i < $num; $i++)
|
|
||||||
{
|
|
||||||
$alt++;
|
|
||||||
if (empty($this->menu_array[$i]['level']))
|
|
||||||
{
|
|
||||||
if (($alt%2==0))
|
|
||||||
{
|
|
||||||
print '<div class="blockvmenuimpair">'."\n";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<div class="blockvmenupair">'."\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Place tabulation
|
|
||||||
$tabstring='';
|
|
||||||
$tabul=($this->menu_array[$i]['level'] - 1);
|
|
||||||
if ($tabul > 0)
|
|
||||||
{
|
|
||||||
for ($j=0; $j < $tabul; $j++)
|
|
||||||
{
|
|
||||||
$tabstring.=' ';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->menu_array[$i]['level'] == 0) {
|
|
||||||
if ($this->menu_array[$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";
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
print '<div class="menu_titre">'.$tabstring.'<font class="vmenudisabled">'.$this->menu_array[$i]['titre'].'</font></div>'."\n";
|
|
||||||
}
|
|
||||||
print '<div class="menu_top"></div>'."\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($this->menu_array[$i]['level'] > 0) {
|
|
||||||
print '<div class="menu_contenu">';
|
|
||||||
|
|
||||||
if ($this->menu_array[$i]['enabled'])
|
|
||||||
print $tabstring.'<a class="vsmenu" href="'.dol_buildpath($this->menu_array[$i]['url'],1).'">'.$this->menu_array[$i]['titre'].'</a><br>';
|
|
||||||
else
|
|
||||||
print $tabstring.'<font class="vsmenudisabled">'.$this->menu_array[$i]['titre'].'</font><br>';
|
|
||||||
|
|
||||||
print '</div>'."\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
// If next is a new block or end
|
|
||||||
if (empty($this->menu_array[$i+1]['level']))
|
|
||||||
{
|
|
||||||
print '<div class="menu_end"></div>'."\n";
|
|
||||||
print "</div>\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
?>
|
?>
|
||||||
@ -1271,13 +1271,13 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
|
|||||||
if (GETPOST('menu')) $top_menu=GETPOST('menu'); // menu=eldy_backoffice.php
|
if (GETPOST('menu')) $top_menu=GETPOST('menu'); // menu=eldy_backoffice.php
|
||||||
|
|
||||||
// Load the top menu manager (only if not already done)
|
// Load the top menu manager (only if not already done)
|
||||||
if (! class_exists('MenuTop'))
|
if (! class_exists('MenuManager'))
|
||||||
{
|
{
|
||||||
$menufound=0;
|
$menufound=0;
|
||||||
$dirmenus=array_merge(array("/core/menus/"),(array) $conf->modules_parts['menus']);
|
$dirmenus=array_merge(array("/core/menus/"),(array) $conf->modules_parts['menus']);
|
||||||
foreach($dirmenus as $dirmenu)
|
foreach($dirmenus as $dirmenu)
|
||||||
{
|
{
|
||||||
$menufound=dol_include_once($dirmenu."standard/".$top_menu);
|
$menufound=dol_include_once($dirmenu."standard/".$top_menu);
|
||||||
if ($menufound) break;
|
if ($menufound) break;
|
||||||
}
|
}
|
||||||
if (! $menufound) // If failed to include, we try with standard
|
if (! $menufound) // If failed to include, we try with standard
|
||||||
@ -1296,9 +1296,10 @@ function top_menu($head, $title='', $target='', $disablejs=0, $disablehead=0, $a
|
|||||||
print '<div id="tmenu_tooltip" class="tmenu">'."\n";
|
print '<div id="tmenu_tooltip" class="tmenu">'."\n";
|
||||||
|
|
||||||
// Show menu
|
// Show menu
|
||||||
$menutop = new MenuTop($db);
|
$dummy1=array();$dummy2=array();
|
||||||
|
$menutop = new MenuManager($db,$dummy1,$dummy2);
|
||||||
$menutop->atarget=$target;
|
$menutop->atarget=$target;
|
||||||
$menutop->showmenu(); // This contains a \n
|
$menutop->showmenu('top'); // This contains a \n
|
||||||
|
|
||||||
print "</div>\n";
|
print "</div>\n";
|
||||||
|
|
||||||
@ -1483,8 +1484,8 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me
|
|||||||
$left_menu=empty($conf->browser->phone)?$conf->top_menu:$conf->smart_menu;
|
$left_menu=empty($conf->browser->phone)?$conf->top_menu:$conf->smart_menu;
|
||||||
if (GETPOST('menu')) $left_menu=GETPOST('menu'); // menu=eldy_backoffice.php
|
if (GETPOST('menu')) $left_menu=GETPOST('menu'); // menu=eldy_backoffice.php
|
||||||
|
|
||||||
// Load the top menu manager (only if not already done)
|
// Load the menu manager (only if not already done)
|
||||||
if (! class_exists('MenuLeft'))
|
if (! class_exists('MenuManager'))
|
||||||
{
|
{
|
||||||
$menufound=0;
|
$menufound=0;
|
||||||
$dirmenus=array_merge(array("/core/menus/"),(array) $conf->modules_parts['menus']);
|
$dirmenus=array_merge(array("/core/menus/"),(array) $conf->modules_parts['menus']);
|
||||||
@ -1505,8 +1506,8 @@ function left_menu($menu_array_before, $helppagename='', $moresearchform='', $me
|
|||||||
|
|
||||||
print '<div class="vmenu">'."\n";
|
print '<div class="vmenu">'."\n";
|
||||||
|
|
||||||
$menuleft=new MenuLeft($db,$menu_array_before,$menu_array_after);
|
$menuleft=new MenuManager($db,$menu_array_before,$menu_array_after);
|
||||||
$menuleft->showmenu(); // output menu_array and menu found in database
|
$menuleft->showmenu('left'); // output menu_array and menu found in database
|
||||||
|
|
||||||
|
|
||||||
// Show other forms
|
// Show other forms
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user