Simplification of the code by separating the part given to menu processing
The goal: - A simplification of the code for easier maintenance is targeted - Separation of data to left menu display processing - Plan in the future to put the left menu data directly in the folders of the modules concerned and which will be loaded automatically by eldy.lib.php or eldy_menus.php (for example add a folder "menus/leftmenu.php" in the module "bank" => "bank/menus/leftmenu.php")... This greatly cleans up the code and makes the modules easier to maintain while also avoiding the massive use of hooks for external modules. - A reuse of the left menus in other corners of the ERP just by calling the function of the desired menu. - The code is much lighter! is more readable with easier display order modification!
This commit is contained in:
parent
a7cb3fa492
commit
dd9a350136
@ -676,68 +676,20 @@ function print_end_menu_array()
|
|||||||
print "\n";
|
print "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Core function to output left menu eldy
|
* Get left Menu HOME
|
||||||
* Fill &$menu (example with $forcemainmenu='home' $forceleftmenu='all', return left menu tree of Home)
|
|
||||||
*
|
*
|
||||||
* @param DoliDB $db Database handler
|
* @param string $mainmenu
|
||||||
* @param array $menu_array_before Table of menu entries to show before entries of menu handler (menu->liste filled with menu->add)
|
* @param Menu &$newmenu Object Menu to return back list of menu entries
|
||||||
* @param array $menu_array_after Table of menu entries to show after entries of menu handler (menu->liste filled with menu->add)
|
* @param string $usemenuhider
|
||||||
* @param array $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty)
|
* @param string $leftmenu
|
||||||
* @param Menu $menu Object Menu to return back list of menu entries
|
* @param int $type_user
|
||||||
* @param int $noout Disable output (Initialise &$menu only).
|
* @return void
|
||||||
* @param string $forcemainmenu 'x'=Force mainmenu to mainmenu='x'
|
|
||||||
* @param string $forceleftmenu 'all'=Force leftmenu to '' (= all). If value come being '', we change it to value in session and 'none' if not defined in session.
|
|
||||||
* @param array $moredata An array with more data to output
|
|
||||||
* @param int $type_user 0=Menu for backoffice, 1=Menu for front office
|
|
||||||
* @return int Nb of menu entries
|
|
||||||
*/
|
*/
|
||||||
function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabMenu, &$menu, $noout = 0, $forcemainmenu = '', $forceleftmenu = '', $moredata = null, $type_user = 0)
|
function get_left_menu_home($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0)
|
||||||
{
|
{
|
||||||
|
global $user, $conf, $langs;
|
||||||
|
|
||||||
global $user, $conf, $langs, $dolibarr_main_db_name, $mysoc, $hookmanager;
|
|
||||||
|
|
||||||
//var_dump($tabMenu);
|
|
||||||
|
|
||||||
$newmenu = $menu;
|
|
||||||
|
|
||||||
$mainmenu = ($forcemainmenu ? $forcemainmenu : $_SESSION["mainmenu"]);
|
|
||||||
$leftmenu = ($forceleftmenu ? '' : (empty($_SESSION["leftmenu"]) ? 'none' : $_SESSION["leftmenu"]));
|
|
||||||
|
|
||||||
$usemenuhider = 0;
|
|
||||||
|
|
||||||
if (is_array($moredata) && !empty($moredata['searchform'])) { // searchform can contains select2 code or link to show old search form or link to switch on search page
|
|
||||||
print "\n";
|
|
||||||
print "<!-- Begin SearchForm -->\n";
|
|
||||||
print '<div id="blockvmenusearch" class="blockvmenusearch">'."\n";
|
|
||||||
print $moredata['searchform'];
|
|
||||||
print '</div>'."\n";
|
|
||||||
print "<!-- End SearchForm -->\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
if (is_array($moredata) && !empty($moredata['bookmarks'])) {
|
|
||||||
print "\n";
|
|
||||||
print "<!-- Begin Bookmarks -->\n";
|
|
||||||
print '<div id="blockvmenubookmarks" class="blockvmenubookmarks">'."\n";
|
|
||||||
print $moredata['bookmarks'];
|
|
||||||
print '</div>'."\n";
|
|
||||||
print "<!-- End Bookmarks -->\n";
|
|
||||||
}
|
|
||||||
|
|
||||||
$substitarray = getCommonSubstitutionArray($langs, 0, null, null);
|
|
||||||
|
|
||||||
$listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* We update newmenu with entries found into database
|
|
||||||
* --------------------------------------------------
|
|
||||||
*/
|
|
||||||
if ($mainmenu) { // If this is empty, loading hard coded menu and loading personalised menu will fail
|
|
||||||
/*
|
|
||||||
* Menu HOME
|
|
||||||
*/
|
|
||||||
if ($mainmenu == 'home') {
|
if ($mainmenu == 'home') {
|
||||||
$langs->load("users");
|
$langs->load("users");
|
||||||
|
|
||||||
@ -841,11 +793,22 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
/*
|
* Get left Menu THIRDPARTIES
|
||||||
* Menu THIRDPARTIES
|
*
|
||||||
|
* @param string $mainmenu
|
||||||
|
* @param Menu &$newmenu Object Menu to return back list of menu entries
|
||||||
|
* @param string $usemenuhider
|
||||||
|
* @param string $leftmenu
|
||||||
|
* @param int $type_user
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
function get_left_menu_thridparties($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0)
|
||||||
|
{
|
||||||
|
global $user, $conf, $langs;
|
||||||
|
|
||||||
if ($mainmenu == 'companies') {
|
if ($mainmenu == 'companies') {
|
||||||
// Societes
|
// Societes
|
||||||
if (!empty($conf->societe->enabled)) {
|
if (!empty($conf->societe->enabled)) {
|
||||||
@ -935,10 +898,22 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
|
|||||||
$newmenu->add("/categories/index.php?leftmenu=catcontact&type=4", $langs->trans("ContactCategoriesShort"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat');
|
$newmenu->add("/categories/index.php?leftmenu=catcontact&type=4", $langs->trans("ContactCategoriesShort"), 1, $user->rights->categorie->lire, '', $mainmenu, 'cat');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Menu COMMERCIAL (propal, commande, supplier_proposal, supplier_order, contrat, ficheinter)
|
* Get left Menu COMMERCIAL (propal, commande, supplier_proposal, supplier_order, contrat, ficheinter)
|
||||||
|
*
|
||||||
|
* @param string $mainmenu
|
||||||
|
* @param Menu &$newmenu Object Menu to return back list of menu entries
|
||||||
|
* @param string $usemenuhider
|
||||||
|
* @param string $leftmenu
|
||||||
|
* @param int $type_user
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
function get_left_menu_commercial($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0)
|
||||||
|
{
|
||||||
|
global $user, $conf, $langs;
|
||||||
|
|
||||||
if ($mainmenu == 'commercial') {
|
if ($mainmenu == 'commercial') {
|
||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
|
|
||||||
@ -1039,11 +1014,22 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
|
|||||||
$newmenu->add("/fichinter/stats/index.php?leftmenu=ficheinter", $langs->trans("Statistics"), 1, $user->rights->ficheinter->lire);
|
$newmenu->add("/fichinter/stats/index.php?leftmenu=ficheinter", $langs->trans("Statistics"), 1, $user->rights->ficheinter->lire);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
/*
|
* Get left COMPTA-FINANCIAL
|
||||||
* Menu COMPTA-FINANCIAL
|
*
|
||||||
|
* @param string $mainmenu
|
||||||
|
* @param Menu &$newmenu Object Menu to return back list of menu entries
|
||||||
|
* @param string $usemenuhider
|
||||||
|
* @param string $leftmenu
|
||||||
|
* @param int $type_user
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
function get_left_menu_billing($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0)
|
||||||
|
{
|
||||||
|
global $user, $conf, $langs;
|
||||||
|
|
||||||
if ($mainmenu == 'billing') {
|
if ($mainmenu == 'billing') {
|
||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
|
|
||||||
@ -1209,10 +1195,23 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Menu COMPTA-FINANCIAL
|
* Get left COMPTA-FINANCIAL (accountancy)
|
||||||
|
*
|
||||||
|
* @param string $mainmenu
|
||||||
|
* @param Menu &$newmenu Object Menu to return back list of menu entries
|
||||||
|
* @param string $usemenuhider
|
||||||
|
* @param string $leftmenu
|
||||||
|
* @param int $type_user
|
||||||
|
* @param DB $db
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
function get_left_menu_accountancy($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0, $db)
|
||||||
|
{
|
||||||
|
global $user, $conf, $langs;
|
||||||
|
|
||||||
if ($mainmenu == 'accountancy') {
|
if ($mainmenu == 'accountancy') {
|
||||||
$langs->load("companies");
|
$langs->load("companies");
|
||||||
|
|
||||||
@ -1224,6 +1223,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
|
|||||||
// Configuration
|
// Configuration
|
||||||
$newmenu->add("/accountancy/index.php?leftmenu=accountancy_admin", $langs->trans("Setup"), 0, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin', 1, '', '', '', img_picto('', 'technic', 'class="paddingright pictofixedwidth"'));
|
$newmenu->add("/accountancy/index.php?leftmenu=accountancy_admin", $langs->trans("Setup"), 0, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin', 1, '', '', '', img_picto('', 'technic', 'class="paddingright pictofixedwidth"'));
|
||||||
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/', $leftmenu)) {
|
if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy_admin/', $leftmenu)) {
|
||||||
|
global $mysoc;
|
||||||
$newmenu->add("/accountancy/admin/index.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("General"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_general', 10);
|
$newmenu->add("/accountancy/admin/index.php?mainmenu=accountancy&leftmenu=accountancy_admin", $langs->trans("General"), 1, $user->rights->accounting->chartofaccount, '', $mainmenu, 'accountancy_admin_general', 10);
|
||||||
|
|
||||||
// Fiscal year - Not really yet used. In a future will lock some periods.
|
// Fiscal year - Not really yet used. In a future will lock some periods.
|
||||||
@ -1514,11 +1514,23 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Menu BANK
|
* Get left Menu BANK
|
||||||
|
*
|
||||||
|
* @param string $mainmenu
|
||||||
|
* @param Menu &$newmenu Object Menu to return back list of menu entries
|
||||||
|
* @param string $usemenuhider
|
||||||
|
* @param string $leftmenu
|
||||||
|
* @param int $type_user
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
function get_left_menu_bank($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0)
|
||||||
|
{
|
||||||
|
global $user, $conf, $langs;
|
||||||
|
|
||||||
if ($mainmenu == 'bank') {
|
if ($mainmenu == 'bank') {
|
||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
$langs->loadLangs(array("withdrawals", "banks", "bills", "categories"));
|
$langs->loadLangs(array("withdrawals", "banks", "bills", "categories"));
|
||||||
@ -1586,10 +1598,22 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
|
|||||||
$newmenu->add("/compta/cashcontrol/cashcontrol_list.php?action=list", $langs->trans("List"), 1, $permtomakecashfence);
|
$newmenu->add("/compta/cashcontrol/cashcontrol_list.php?action=list", $langs->trans("List"), 1, $permtomakecashfence);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Menu PRODUCTS-SERVICES
|
* Get left Menu PRODUCTS-SERVICES
|
||||||
|
*
|
||||||
|
* @param string $mainmenu
|
||||||
|
* @param Menu &$newmenu Object Menu to return back list of menu entries
|
||||||
|
* @param string $usemenuhider
|
||||||
|
* @param string $leftmenu
|
||||||
|
* @param int $type_user
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
function get_left_menu_products($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0)
|
||||||
|
{
|
||||||
|
global $user, $conf, $langs;
|
||||||
|
|
||||||
if ($mainmenu == 'products') {
|
if ($mainmenu == 'products') {
|
||||||
// Products
|
// Products
|
||||||
if (!empty($conf->product->enabled)) {
|
if (!empty($conf->product->enabled)) {
|
||||||
@ -1705,10 +1729,22 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
|
|||||||
$newmenu->add("/reception/stats/index.php?leftmenu=receptions", $langs->trans("Statistics"), 1, $user->rights->reception->lire);
|
$newmenu->add("/reception/stats/index.php?leftmenu=receptions", $langs->trans("Statistics"), 1, $user->rights->reception->lire);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Menu PRODUCTS-SERVICES MRP - GPAO
|
* Get left Menu PRODUCTS-SERVICES MRP - GPAO
|
||||||
|
*
|
||||||
|
* @param string $mainmenu
|
||||||
|
* @param Menu &$newmenu Object Menu to return back list of menu entries
|
||||||
|
* @param string $usemenuhider
|
||||||
|
* @param string $leftmenu
|
||||||
|
* @param int $type_user
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
function get_left_menu_mrp($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0)
|
||||||
|
{
|
||||||
|
global $user, $conf, $langs;
|
||||||
|
|
||||||
if ($mainmenu == 'mrp') {
|
if ($mainmenu == 'mrp') {
|
||||||
// BOM
|
// BOM
|
||||||
if (!empty($conf->bom->enabled) || !empty($conf->mrp->enabled)) {
|
if (!empty($conf->bom->enabled) || !empty($conf->mrp->enabled)) {
|
||||||
@ -1727,10 +1763,22 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
|
|||||||
$newmenu->add("/mrp/mo_list.php?leftmenu=mo", $langs->trans("List"), 1, $user->rights->mrp->read, '', $mainmenu, 'mo');
|
$newmenu->add("/mrp/mo_list.php?leftmenu=mo", $langs->trans("List"), 1, $user->rights->mrp->read, '', $mainmenu, 'mo');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Menu PROJECTS
|
* Get left Menu PROJECTS
|
||||||
|
*
|
||||||
|
* @param string $mainmenu
|
||||||
|
* @param Menu &$newmenu Object Menu to return back list of menu entries
|
||||||
|
* @param string $usemenuhider
|
||||||
|
* @param string $leftmenu
|
||||||
|
* @param int $type_user
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
function get_left_menu_projects($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0)
|
||||||
|
{
|
||||||
|
global $user, $conf, $langs;
|
||||||
|
|
||||||
if ($mainmenu == 'project') {
|
if ($mainmenu == 'project') {
|
||||||
if (!empty($conf->projet->enabled)) {
|
if (!empty($conf->projet->enabled)) {
|
||||||
$langs->load("projects");
|
$langs->load("projects");
|
||||||
@ -1742,6 +1790,7 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
|
|||||||
'perms'=>(!empty($user->rights->projet->lire)),
|
'perms'=>(!empty($user->rights->projet->lire)),
|
||||||
'module'=>'projet'
|
'module'=>'projet'
|
||||||
);
|
);
|
||||||
|
$listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL);
|
||||||
$showmode = isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal);
|
$showmode = isVisibleToUserType($type_user, $tmpentry, $listofmodulesforexternal);
|
||||||
|
|
||||||
$titleboth = $langs->trans("LeadsOrProjects");
|
$titleboth = $langs->trans("LeadsOrProjects");
|
||||||
@ -1788,10 +1837,22 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Menu HRM
|
* Get left Menu HRM
|
||||||
|
*
|
||||||
|
* @param string $mainmenu
|
||||||
|
* @param Menu &$newmenu Object Menu to return back list of menu entries
|
||||||
|
* @param string $usemenuhider
|
||||||
|
* @param string $leftmenu
|
||||||
|
* @param int $type_user
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
function get_left_menu_hrm($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0)
|
||||||
|
{
|
||||||
|
global $user, $conf, $langs;
|
||||||
|
|
||||||
if ($mainmenu == 'hrm') {
|
if ($mainmenu == 'hrm') {
|
||||||
// HRM module
|
// HRM module
|
||||||
if (!empty($conf->hrm->enabled)) {
|
if (!empty($conf->hrm->enabled)) {
|
||||||
@ -1883,11 +1944,22 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
/*
|
* Get left Menu TOOLS
|
||||||
* Menu TOOLS
|
*
|
||||||
|
* @param string $mainmenu
|
||||||
|
* @param Menu &$newmenu Object Menu to return back list of menu entries
|
||||||
|
* @param string $usemenuhider
|
||||||
|
* @param string $leftmenu
|
||||||
|
* @param int $type_user
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
function get_left_menu_tools($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0)
|
||||||
|
{
|
||||||
|
global $user, $conf, $langs;
|
||||||
|
|
||||||
if ($mainmenu == 'tools') {
|
if ($mainmenu == 'tools') {
|
||||||
if (empty($user->socid)) { // limit to internal users
|
if (empty($user->socid)) { // limit to internal users
|
||||||
$langs->load("mails");
|
$langs->load("mails");
|
||||||
@ -1913,10 +1985,22 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
|
|||||||
$newmenu->add("/imports/import.php?leftmenu=import", $langs->trans("NewImport"), 1, $user->rights->import->run);
|
$newmenu->add("/imports/import.php?leftmenu=import", $langs->trans("NewImport"), 1, $user->rights->import->run);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/**
|
||||||
* Menu MEMBERS
|
* Get left Menu MEMBERS
|
||||||
|
*
|
||||||
|
* @param string $mainmenu
|
||||||
|
* @param Menu &$newmenu Object Menu to return back list of menu entries
|
||||||
|
* @param string $usemenuhider
|
||||||
|
* @param string $leftmenu
|
||||||
|
* @param int $type_user
|
||||||
|
* @return void
|
||||||
*/
|
*/
|
||||||
|
function get_left_menu_members($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0)
|
||||||
|
{
|
||||||
|
global $user, $conf, $langs;
|
||||||
|
|
||||||
if ($mainmenu == 'members') {
|
if ($mainmenu == 'members') {
|
||||||
if (!empty($conf->adherent->enabled)) {
|
if (!empty($conf->adherent->enabled)) {
|
||||||
// Load translation files required by the page
|
// Load translation files required by the page
|
||||||
@ -1957,6 +2041,148 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
|
|||||||
$newmenu->add("/adherents/type.php?leftmenu=setup&mainmenu=members", $langs->trans("List"), 1, $user->rights->adherent->configurer);
|
$newmenu->add("/adherents/type.php?leftmenu=setup&mainmenu=members", $langs->trans("List"), 1, $user->rights->adherent->configurer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 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)
|
||||||
|
* @param array $tabMenu If array with menu entries already loaded, we put this array here (in most cases, it's empty)
|
||||||
|
* @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). If value come being '', we change it to value in session and 'none' if not defined in session.
|
||||||
|
* @param array $moredata An array with more data to output
|
||||||
|
* @param int $type_user 0=Menu for backoffice, 1=Menu for front office
|
||||||
|
* @return int Nb of menu entries
|
||||||
|
*/
|
||||||
|
function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabMenu, &$menu, $noout = 0, $forcemainmenu = '', $forceleftmenu = '', $moredata = null, $type_user = 0)
|
||||||
|
{
|
||||||
|
|
||||||
|
global $user, $conf, $langs, $hookmanager;
|
||||||
|
|
||||||
|
//var_dump($tabMenu);
|
||||||
|
|
||||||
|
$newmenu = $menu;
|
||||||
|
|
||||||
|
$mainmenu = ($forcemainmenu ? $forcemainmenu : $_SESSION["mainmenu"]);
|
||||||
|
$leftmenu = ($forceleftmenu ? '' : (empty($_SESSION["leftmenu"]) ? 'none' : $_SESSION["leftmenu"]));
|
||||||
|
|
||||||
|
$usemenuhider = 0;
|
||||||
|
|
||||||
|
if (is_array($moredata) && !empty($moredata['searchform'])) { // searchform can contains select2 code or link to show old search form or link to switch on search page
|
||||||
|
print "\n";
|
||||||
|
print "<!-- Begin SearchForm -->\n";
|
||||||
|
print '<div id="blockvmenusearch" class="blockvmenusearch">'."\n";
|
||||||
|
print $moredata['searchform'];
|
||||||
|
print '</div>'."\n";
|
||||||
|
print "<!-- End SearchForm -->\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (is_array($moredata) && !empty($moredata['bookmarks'])) {
|
||||||
|
print "\n";
|
||||||
|
print "<!-- Begin Bookmarks -->\n";
|
||||||
|
print '<div id="blockvmenubookmarks" class="blockvmenubookmarks">'."\n";
|
||||||
|
print $moredata['bookmarks'];
|
||||||
|
print '</div>'."\n";
|
||||||
|
print "<!-- End Bookmarks -->\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
$substitarray = getCommonSubstitutionArray($langs, 0, null, null);
|
||||||
|
|
||||||
|
$listofmodulesforexternal = explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* We update newmenu with entries found into database
|
||||||
|
* --------------------------------------------------
|
||||||
|
*/
|
||||||
|
if ($mainmenu) { // If this is empty, loading hard coded menu and loading personalised menu will fail
|
||||||
|
/*
|
||||||
|
* Menu HOME
|
||||||
|
*/
|
||||||
|
if ($mainmenu == 'home') {
|
||||||
|
get_left_menu_home($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Menu THIRDPARTIES
|
||||||
|
*/
|
||||||
|
if ($mainmenu == 'companies') {
|
||||||
|
get_left_menu_thridparties($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Menu COMMERCIAL (propal, commande, supplier_proposal, supplier_order, contrat, ficheinter)
|
||||||
|
*/
|
||||||
|
if ($mainmenu == 'commercial') {
|
||||||
|
get_left_menu_commercial($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Menu COMPTA-FINANCIAL
|
||||||
|
*/
|
||||||
|
if ($mainmenu == 'billing') {
|
||||||
|
get_left_menu_billing($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Menu COMPTA-FINANCIAL
|
||||||
|
*/
|
||||||
|
if ($mainmenu == 'accountancy') {
|
||||||
|
get_left_menu_accountancy($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user, $db);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Menu BANK
|
||||||
|
*/
|
||||||
|
if ($mainmenu == 'bank') {
|
||||||
|
get_left_menu_bank($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Menu PRODUCTS-SERVICES
|
||||||
|
*/
|
||||||
|
if ($mainmenu == 'products') {
|
||||||
|
get_left_menu_products($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Menu PRODUCTS-SERVICES MRP - GPAO
|
||||||
|
*/
|
||||||
|
if ($mainmenu == 'mrp') {
|
||||||
|
get_left_menu_mrp($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Menu PROJECTS
|
||||||
|
*/
|
||||||
|
if ($mainmenu == 'project') {
|
||||||
|
get_left_menu_projects($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Menu HRM
|
||||||
|
*/
|
||||||
|
if ($mainmenu == 'hrm') {
|
||||||
|
get_left_menu_hrm($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Menu TOOLS
|
||||||
|
*/
|
||||||
|
if ($mainmenu == 'tools') {
|
||||||
|
get_left_menu_tools($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Menu MEMBERS
|
||||||
|
*/
|
||||||
|
if ($mainmenu == 'members') {
|
||||||
|
get_left_menu_members($mainmenu, $newmenu, $usemenuhider, $leftmenu, $type_user);
|
||||||
|
}
|
||||||
|
|
||||||
// Add personalized menus and modules menus
|
// Add personalized menus and modules menus
|
||||||
//var_dump($newmenu->liste); //
|
//var_dump($newmenu->liste); //
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user