diff --git a/htdocs/core/menus/standard/auguria.lib.php b/htdocs/core/menus/standard/auguria.lib.php index 66f4dac2a44..39e2150280e 100644 --- a/htdocs/core/menus/standard/auguria.lib.php +++ b/htdocs/core/menus/standard/auguria.lib.php @@ -39,10 +39,11 @@ require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php'; */ function print_auguria_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout = 0, $mode = '') { - global $user,$conf,$langs,$dolibarr_main_db_name; + global $user,$conf,$langs,$mysoc; + global $dolibarr_main_db_name; - $mainmenu=$_SESSION["mainmenu"]; - $leftmenu=$_SESSION["leftmenu"]; + $mainmenu=(empty($_SESSION["mainmenu"])?'':$_SESSION["mainmenu"]); + $leftmenu=(empty($_SESSION["leftmenu"])?'':$_SESSION["leftmenu"]); $id='mainmenu'; $listofmodulesforexternal=explode(',', $conf->global->MAIN_MODULES_FOR_EXTERNAL); @@ -53,17 +54,17 @@ function print_auguria_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout if (empty($noout)) print_start_menu_array_auguria(); - global $usemenuhider; - $usemenuhider = 1; + global $usemenuhider; + $usemenuhider = 1; - // Show/Hide vertical menu - if ($mode != 'jmobile' && $mode != 'topnb' && $usemenuhider && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) + // Show/Hide vertical menu. The hamburger icon for .menuhider action. + if ($mode != 'jmobile' && $mode != 'topnb' && $usemenuhider && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { $showmode=1; $classname = 'class="tmenu menuhider"'; $idsel='menu'; - $menu->add('#', '', 0, $showmode, $atarget, "xxx", '', 0, $id, $idsel, $classname); + $menu->add('#', (! empty($conf->global->THEME_TOPMENU_DISABLE_IMAGE) ? '' : ''), 0, $showmode, $atarget, "xxx", '', 0, $id, $idsel, $classname); } $num = count($newTabMenu); @@ -125,20 +126,44 @@ function print_auguria_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout $menu->liste = dol_sort_array($menu->liste, 'position'); // Output menu entries - foreach($menu->liste as $menkey => $menuval) + // Show logo company + if (empty($conf->global->MAIN_MENU_INVERT) && empty($noout) && ! empty($conf->global->MAIN_SHOW_LOGO) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) { - if (empty($noout)) print_start_menu_entry_auguria($menuval['idsel'], $menuval['classname'], $menuval['enabled']); - if (empty($noout)) print_text_menu_entry_auguria($menuval['titre'], $menuval['enabled'], ($menuval['url']!='#'?DOL_URL_ROOT:'').$menuval['url'], $menuval['id'], $menuval['idsel'], $menuval['classname'], ($menuval['target']?$menuval['target']:$atarget)); - if (empty($noout)) print_end_menu_entry_auguria($menuval['enabled']); + //$mysoc->logo_mini=(empty($conf->global->MAIN_INFO_SOCIETE_LOGO_MINI)?'':$conf->global->MAIN_INFO_SOCIETE_LOGO_MINI); + $mysoc->logo_squarred_mini=(empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI)?'':$conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI); + if (! empty($mysoc->logo_squarred_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_mini)) + { + $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_squarred_mini); + } + else + { + $urllogo=DOL_URL_ROOT.'/theme/dolibarr_logo_squarred.png'; + } + $title=$langs->trans("GoIntoSetupToChangeLogo"); + + print "\n".''."\n"; + print_start_menu_entry_auguria('companylogo', 'class="tmenu tmenucompanylogo"', 1); + + print ''."\n"; + + print_end_menu_entry_auguria(4); + } + + if (empty($noout)) { + foreach($menu->liste as $menuval) + { + print_start_menu_entry_auguria($menuval['idsel'], $menuval['classname'], $menuval['enabled']); + print_text_menu_entry_auguria($menuval['titre'], $menuval['enabled'], ($menuval['url']!='#'?DOL_URL_ROOT:'').$menuval['url'], $menuval['id'], $menuval['idsel'], $menuval['classname'], ($menuval['target']?$menuval['target']:$atarget)); + print_end_menu_entry_auguria($menuval['enabled']); + } } $showmode=1; - if (empty($noout)) print_start_menu_entry_auguria('', 'class="tmenuend"', $showmode); - if (empty($noout)) print_end_menu_entry_auguria($showmode); - - if (empty($noout)) print_end_menu_array_auguria(); - - print "\n"; + if (empty($noout)) { + print_start_menu_entry_auguria('', 'class="tmenuend"', $showmode); + print_end_menu_entry_auguria($showmode); + print_end_menu_array_auguria(); + } return 0; } @@ -193,16 +218,16 @@ function print_text_menu_entry_auguria($text, $showmode, $url, $id, $idsel, $cla if ($showmode == 1) { - print ''; + print ''; print '
'; print '
'; - print ''; + print ''; print ''; print $text; print ''; print ''; } - if ($showmode == 2) + elseif ($showmode == 2) { print '
'; print ''; @@ -244,17 +269,18 @@ function print_end_menu_array_auguria() /** * Core function to output left menu auguria + * 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 - * @param array $menu_array_after Table of menu entries to show after entries of menu 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) + * @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 - * @return int Nb of entries + * @return int Nb of menu entries */ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$tabMenu, &$menu, $noout = 0, $forcemainmenu = '', $forceleftmenu = '', $moredata = null) { @@ -268,35 +294,6 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t global $usemenuhider; $usemenuhider = 0; - // Show logo company - if (empty($noout) && ! empty($conf->global->MAIN_SHOW_LOGO) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) - { - $mysoc->logo_mini=(empty($conf->global->MAIN_INFO_SOCIETE_LOGO_MINI)?'':$conf->global->MAIN_INFO_SOCIETE_LOGO_MINI); - $mysoc->logo_squarred_mini=(empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI)?'':$conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI); - if (! empty($mysoc->logo_squarred_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_squarred_mini)) - { - $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_squarred_mini); - } - elseif (! empty($mysoc->logo_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini)) - { - $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode('logos/thumbs/'.$mysoc->logo_mini); - } - else - { - $urllogo=DOL_URL_ROOT.'/theme/dolibarr_logo_squarred.png'; - } - $title=$langs->trans("GoIntoSetupToChangeLogo"); - print "\n".''."\n"; - print ''."\n"; - } - 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"; @@ -355,9 +352,9 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t $db->free($resql); } - if (! empty($conf->accounting->enabled) && !empty($user->rights->accounting->mouvements->lire) && $mainmenu == 'accountancy') // Entry in accountancy journal for each bank account + if (! empty($conf->accounting->enabled) && !empty($user->rights->accounting->comptarapport->lire) && $mainmenu == 'accountancy') // Entry in accountancy journal for each bank account { - $newmenu->add('', $langs->trans("Journalization"), 0, $user->rights->accounting->comptarapport->lire, '', 'accountancy', 'accountancy'); + $newmenu->add('', $langs->trans("RegistrationInAccounting"), 1, $user->rights->accounting->comptarapport->lire, '', 'accountancy', 'accountancy'); // Multi journal $sql = "SELECT rowid, code, label, nature"; @@ -390,7 +387,7 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t if ($objp->nature == 9) $nature="hasnew"; // To enable when page exists - if (! empty($conf->global->ACCOUNTANCY_SHOW_DEVELOP_JOURNAL)) + if (empty($conf->global->ACCOUNTANCY_SHOW_DEVELOP_JOURNAL)) { if ($nature == 'various' || $nature == 'hasnew' || $nature == 'inventory') $nature=''; } @@ -399,7 +396,7 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t { $langs->load('accountancy'); $journallabel=$langs->transnoentities($objp->label); // Labels in this table are set by loading llx_accounting_abc.sql. Label can be 'ACCOUNTING_SELL_JOURNAL', 'InventoryJournal', ... - if (empty($leftmenu) || preg_match('/accountancy/', $leftmenu)) $newmenu->add('/accountancy/journal/'.$nature.'journal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal='.$objp->rowid, $journallabel, 2, $user->rights->accounting->comptarapport->lire); + $newmenu->add('/accountancy/journal/'.$nature.'journal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal='.$objp->rowid, $journallabel, 2, $user->rights->accounting->comptarapport->lire); } $i++; } @@ -444,7 +441,7 @@ function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$t */ } - if ($conf->ftp->enabled && $mainmenu == 'ftp') // Entry for FTP + if (! empty($conf->ftp->enabled) && $mainmenu == 'ftp') // Entry for FTP { $MAXFTP=20; $i=1; diff --git a/htdocs/core/menus/standard/auguria_menu.php b/htdocs/core/menus/standard/auguria_menu.php index c4622f2d6ee..b3c5814240c 100644 --- a/htdocs/core/menus/standard/auguria_menu.php +++ b/htdocs/core/menus/standard/auguria_menu.php @@ -111,15 +111,18 @@ class MenuManager $tabMenu=array(); $menuArbo = new Menubase($this->db, 'auguria'); $menuArbo->menuLoad($mainmenu, $leftmenu, $this->type_user, 'auguria', $tabMenu); - $this->tabMenu=$tabMenu; - } + //var_dump($tabMenu); + + //if ($forcemainmenu == 'all') { var_dump($this->tabMenu); exit; } + } /** * Show menu + * Menu defined in sql tables were stored into $this->tabMenu BEFORE this is called. * - * @param string $mode 'top', 'left', 'jmobile' (used to get full xml ul/li menu) + * @param string $mode 'top', 'topnb', 'left', 'jmobile' (used to get full xml ul/li menu) * @param array $moredata An array with more data to output * @return int 0 or nb of top menu entries if $mode = 'topnb' */ @@ -138,9 +141,18 @@ class MenuManager require_once DOL_DOCUMENT_ROOT.'/core/class/menu.class.php'; $this->menu=new Menu(); - if ($mode == 'top') print_auguria_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 0, $mode); - if ($mode == 'left') print_left_auguria_menu($this->db, $this->menu_array, $this->menu_array_after, $this->tabMenu, $this->menu, 0, '', '', $moredata); - + if (empty($conf->global->MAIN_MENU_INVERT)) + { + if ($mode == 'top') print_auguria_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 0, $mode); + if ($mode == 'left') print_left_auguria_menu($this->db, $this->menu_array, $this->menu_array_after, $this->tabMenu, $this->menu, 0, '', '', $moredata); + } + else + { + $conf->global->MAIN_SHOW_LOGO=0; + if ($mode == 'top') print_left_auguria_menu($this->db, $this->menu_array, $this->menu_array_after, $this->tabMenu, $this->menu, 0); + if ($mode == 'left') print_auguria_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 0, $mode); + } + if ($mode == 'topnb') { print_auguria_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 1, $mode); @@ -315,5 +327,8 @@ class MenuManager } unset($this->menu); + + //print 'xx'.$mode; + return 0; } } diff --git a/htdocs/core/menus/standard/eldy.lib.php b/htdocs/core/menus/standard/eldy.lib.php index 0bfc9f9b7b9..5d9a637de58 100644 --- a/htdocs/core/menus/standard/eldy.lib.php +++ b/htdocs/core/menus/standard/eldy.lib.php @@ -629,7 +629,7 @@ function print_end_menu_array() * @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 - * @return int nb of menu entries + * @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) { diff --git a/htdocs/core/menus/standard/eldy_menu.php b/htdocs/core/menus/standard/eldy_menu.php index d8a47d45c68..8389db029be 100644 --- a/htdocs/core/menus/standard/eldy_menu.php +++ b/htdocs/core/menus/standard/eldy_menu.php @@ -64,6 +64,8 @@ class MenuManager */ public function loadMenu($forcemainmenu = '', $forceleftmenu = '') { + global $conf, $user, $langs; + // On sauve en session le menu principal choisi if (isset($_GET["mainmenu"])) $_SESSION["mainmenu"]=$_GET["mainmenu"]; if (isset($_GET["idmenu"])) $_SESSION["idmenu"]=$_GET["idmenu"]; @@ -117,7 +119,7 @@ class MenuManager /** * Show menu. - * Module defined in sql tables were stored into $this->tabMenu BEFORE this is called. + * Menu defined in sql tables were stored into $this->tabMenu BEFORE this is called. * * @param string $mode 'top', 'topnb', 'left', 'jmobile' (used to get full xml ul/li menu) * @param array $moredata An array with more data to output