Merge pull request #20252 from wdammak/patch-47
Simplification of the code by separating the part given to menu proce…
This commit is contained in:
commit
c6338e0de0
@ -676,8 +676,6 @@ function print_end_menu_array()
|
|||||||
print "\n";
|
print "\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Core function to output left menu eldy
|
* Core function to output left menu eldy
|
||||||
* Fill &$menu (example with $forcemainmenu='home' $forceleftmenu='all', return left menu tree of Home)
|
* Fill &$menu (example with $forcemainmenu='home' $forceleftmenu='all', return left menu tree of Home)
|
||||||
@ -697,7 +695,7 @@ function print_end_menu_array()
|
|||||||
function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabMenu, &$menu, $noout = 0, $forcemainmenu = '', $forceleftmenu = '', $moredata = null, $type_user = 0)
|
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, $dolibarr_main_db_name, $mysoc, $hookmanager;
|
global $user, $conf, $langs, $hookmanager;
|
||||||
|
|
||||||
//var_dump($tabMenu);
|
//var_dump($tabMenu);
|
||||||
|
|
||||||
@ -738,6 +736,327 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
|
|||||||
/*
|
/*
|
||||||
* Menu HOME
|
* 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
|
||||||
|
//var_dump($newmenu->liste); //
|
||||||
|
$menuArbo = new Menubase($db, 'eldy');
|
||||||
|
$newmenu = $menuArbo->menuLeftCharger($newmenu, $mainmenu, $leftmenu, (empty($user->socid) ? 0 : 1), 'eldy', $tabMenu);
|
||||||
|
//var_dump($newmenu->liste); //
|
||||||
|
|
||||||
|
if (!empty($conf->ftp->enabled) && $mainmenu == 'ftp') { // Entry for FTP
|
||||||
|
$MAXFTP = 20;
|
||||||
|
$i = 1;
|
||||||
|
while ($i <= $MAXFTP) {
|
||||||
|
$paramkey = 'FTP_NAME_'.$i;
|
||||||
|
//print $paramkey;
|
||||||
|
if (!empty($conf->global->$paramkey)) {
|
||||||
|
$link = "/ftp/index.php?idmenu=".$_SESSION["idmenu"]."&numero_ftp=".$i;
|
||||||
|
$newmenu->add($link, dol_trunc($conf->global->$paramkey, 24));
|
||||||
|
}
|
||||||
|
$i++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//var_dump($tabMenu); //
|
||||||
|
//var_dump($newmenu->liste);
|
||||||
|
|
||||||
|
// Build final $menu_array = $menu_array_before +$newmenu->liste + $menu_array_after
|
||||||
|
//var_dump($menu_array_before);exit;
|
||||||
|
//var_dump($menu_array_after);exit;
|
||||||
|
$menu_array = $newmenu->liste;
|
||||||
|
if (is_array($menu_array_before)) {
|
||||||
|
$menu_array = array_merge($menu_array_before, $menu_array);
|
||||||
|
}
|
||||||
|
if (is_array($menu_array_after)) {
|
||||||
|
$menu_array = array_merge($menu_array, $menu_array_after);
|
||||||
|
}
|
||||||
|
//var_dump($menu_array);exit;
|
||||||
|
if (!is_array($menu_array)) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Allow the $menu_array of the menu to be manipulated by modules
|
||||||
|
$parameters = array(
|
||||||
|
'mainmenu' => $mainmenu,
|
||||||
|
);
|
||||||
|
$hook_items = $menu_array;
|
||||||
|
$reshook = $hookmanager->executeHooks('menuLeftMenuItems', $parameters, $hook_items); // Note that $action and $object may have been modified by some hooks
|
||||||
|
|
||||||
|
if (is_numeric($reshook)) {
|
||||||
|
if ($reshook == 0 && !empty($hookmanager->results)) {
|
||||||
|
$menu_array[] = $hookmanager->results; // add
|
||||||
|
} elseif ($reshook == 1) {
|
||||||
|
$menu_array = $hookmanager->results; // replace
|
||||||
|
}
|
||||||
|
|
||||||
|
// @todo Sort menu items by 'position' value
|
||||||
|
// $position = array();
|
||||||
|
// foreach ($menu_array as $key => $row) {
|
||||||
|
// $position[$key] = $row['position'];
|
||||||
|
// }
|
||||||
|
// array_multisort($position, SORT_ASC, $menu_array);
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO Use the position property in menu_array to reorder the $menu_array
|
||||||
|
//var_dump($menu_array);
|
||||||
|
/*$new_menu_array = array();
|
||||||
|
$level=0; $cusor=0; $position=0;
|
||||||
|
$nbentry = count($menu_array);
|
||||||
|
while (findNextEntryForLevel($menu_array, $cursor, $position, $level))
|
||||||
|
{
|
||||||
|
|
||||||
|
$cursor++;
|
||||||
|
}*/
|
||||||
|
|
||||||
|
// Show menu
|
||||||
|
$invert = empty($conf->global->MAIN_MENU_INVERT) ? "" : "invert";
|
||||||
|
if (empty($noout)) {
|
||||||
|
$altok = 0;
|
||||||
|
$blockvmenuopened = false;
|
||||||
|
$lastlevel0 = '';
|
||||||
|
$num = count($menu_array);
|
||||||
|
for ($i = 0; $i < $num; $i++) { // Loop on each menu entry
|
||||||
|
$showmenu = true;
|
||||||
|
if (!empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED) && empty($menu_array[$i]['enabled'])) {
|
||||||
|
$showmenu = false;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Begin of new left menu block
|
||||||
|
if (empty($menu_array[$i]['level']) && $showmenu) {
|
||||||
|
$altok++;
|
||||||
|
$blockvmenuopened = true;
|
||||||
|
$lastopened = true;
|
||||||
|
for ($j = ($i + 1); $j < $num; $j++) {
|
||||||
|
if (empty($menu_array[$j]['level'])) {
|
||||||
|
$lastopened = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ($altok % 2 == 0) {
|
||||||
|
print '<div class="blockvmenu blockvmenuimpair'.$invert.($lastopened ? ' blockvmenulast' : '').($altok == 1 ? ' blockvmenufirst' : '').'">'."\n";
|
||||||
|
} else {
|
||||||
|
print '<div class="blockvmenu blockvmenupair'.$invert.($lastopened ? ' blockvmenulast' : '').($altok == 1 ? ' blockvmenufirst' : '').'">'."\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add tabulation
|
||||||
|
$tabstring = '';
|
||||||
|
$tabul = ($menu_array[$i]['level'] - 1);
|
||||||
|
if ($tabul > 0) {
|
||||||
|
for ($j = 0; $j < $tabul; $j++) {
|
||||||
|
$tabstring .= ' ';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// $menu_array[$i]['url'] can be a relative url, a full external url. We try substitution
|
||||||
|
|
||||||
|
$menu_array[$i]['url'] = make_substitutions($menu_array[$i]['url'], $substitarray);
|
||||||
|
|
||||||
|
$url = $shorturl = $shorturlwithoutparam = $menu_array[$i]['url'];
|
||||||
|
if (!preg_match("/^(http:\/\/|https:\/\/)/i", $menu_array[$i]['url'])) {
|
||||||
|
$tmp = explode('?', $menu_array[$i]['url'], 2);
|
||||||
|
$url = $shorturl = $tmp[0];
|
||||||
|
$param = (isset($tmp[1]) ? $tmp[1] : ''); // params in url of the menu link
|
||||||
|
|
||||||
|
// Complete param to force leftmenu to '' to close open menu when we click on a link with no leftmenu defined.
|
||||||
|
if ((!preg_match('/mainmenu/i', $param)) && (!preg_match('/leftmenu/i', $param)) && !empty($menu_array[$i]['mainmenu'])) {
|
||||||
|
$param .= ($param ? '&' : '').'mainmenu='.$menu_array[$i]['mainmenu'].'&leftmenu=';
|
||||||
|
}
|
||||||
|
if ((!preg_match('/mainmenu/i', $param)) && (!preg_match('/leftmenu/i', $param)) && empty($menu_array[$i]['mainmenu'])) {
|
||||||
|
$param .= ($param ? '&' : '').'leftmenu=';
|
||||||
|
}
|
||||||
|
//$url.="idmenu=".$menu_array[$i]['rowid']; // Already done by menuLoad
|
||||||
|
$url = dol_buildpath($url, 1).($param ? '?'.$param : '');
|
||||||
|
$shorturlwithoutparam = $shorturl;
|
||||||
|
$shorturl = $shorturl.($param ? '?'.$param : '');
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
print '<!-- Process menu entry with mainmenu='.$menu_array[$i]['mainmenu'].', leftmenu='.$menu_array[$i]['leftmenu'].', level='.$menu_array[$i]['level'].' enabled='.$menu_array[$i]['enabled'].', position='.$menu_array[$i]['position'].' -->'."\n";
|
||||||
|
|
||||||
|
// Menu level 0
|
||||||
|
if ($menu_array[$i]['level'] == 0) {
|
||||||
|
if ($menu_array[$i]['enabled']) { // Enabled so visible
|
||||||
|
print '<div class="menu_titre">'.$tabstring;
|
||||||
|
if ($shorturlwithoutparam) {
|
||||||
|
print '<a class="vmenu" title="'.dol_escape_htmltag(dol_string_nohtmltag($menu_array[$i]['titre'])).'" href="'.$url.'"'.($menu_array[$i]['target'] ? ' target="'.$menu_array[$i]['target'].'"' : '').'>';
|
||||||
|
} else {
|
||||||
|
print '<span class="vmenu">';
|
||||||
|
}
|
||||||
|
print ($menu_array[$i]['prefix'] ? $menu_array[$i]['prefix'] : '').$menu_array[$i]['titre'];
|
||||||
|
if ($shorturlwithoutparam) {
|
||||||
|
print '</a>';
|
||||||
|
} else {
|
||||||
|
print '</span>';
|
||||||
|
}
|
||||||
|
print '</div>'."\n";
|
||||||
|
$lastlevel0 = 'enabled';
|
||||||
|
} elseif ($showmenu) { // Not enabled but visible (so greyed)
|
||||||
|
print '<div class="menu_titre">'.$tabstring;
|
||||||
|
print '<span class="vmenudisabled">';
|
||||||
|
print ($menu_array[$i]['prefix'] ? $menu_array[$i]['prefix'] : '').$menu_array[$i]['titre'];
|
||||||
|
print '</span>';
|
||||||
|
print '</div>'."\n";
|
||||||
|
$lastlevel0 = 'greyed';
|
||||||
|
} else {
|
||||||
|
$lastlevel0 = 'hidden';
|
||||||
|
}
|
||||||
|
if ($showmenu) {
|
||||||
|
print '<div class="menu_top"></div>'."\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Menu level > 0
|
||||||
|
if ($menu_array[$i]['level'] > 0) {
|
||||||
|
$cssmenu = '';
|
||||||
|
if ($menu_array[$i]['url']) {
|
||||||
|
$cssmenu = ' menu_contenu'.dol_string_nospecial(preg_replace('/\.php.*$/', '', $menu_array[$i]['url']));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($menu_array[$i]['enabled'] && $lastlevel0 == 'enabled') {
|
||||||
|
// Enabled so visible, except if parent was not enabled.
|
||||||
|
print '<div class="menu_contenu'.$cssmenu.'">';
|
||||||
|
print $tabstring;
|
||||||
|
if ($shorturlwithoutparam) {
|
||||||
|
print '<a class="vsmenu" title="'.dol_escape_htmltag(dol_string_nohtmltag($menu_array[$i]['titre'])).'" href="'.$url.'"'.($menu_array[$i]['target'] ? ' target="'.$menu_array[$i]['target'].'"' : '').'>';
|
||||||
|
} else {
|
||||||
|
print '<span class="vsmenu" title="'.dol_escape_htmltag($menu_array[$i]['titre']).'">';
|
||||||
|
}
|
||||||
|
print $menu_array[$i]['titre'];
|
||||||
|
if ($shorturlwithoutparam) {
|
||||||
|
print '</a>';
|
||||||
|
} else {
|
||||||
|
print '</span>';
|
||||||
|
}
|
||||||
|
// If title is not pure text and contains a table, no carriage return added
|
||||||
|
if (!strstr($menu_array[$i]['titre'], '<table')) {
|
||||||
|
print '<br>';
|
||||||
|
}
|
||||||
|
print '</div>'."\n";
|
||||||
|
} elseif ($showmenu && $lastlevel0 == 'enabled') {
|
||||||
|
// Not enabled but visible (so greyed), except if parent was not enabled.
|
||||||
|
print '<div class="menu_contenu'.$cssmenu.'">';
|
||||||
|
print $tabstring;
|
||||||
|
print '<span class="vsmenudisabled vsmenudisabledmargin">'.$menu_array[$i]['titre'].'</span><br>';
|
||||||
|
print '</div>'."\n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// If next is a new block or if there is nothing after
|
||||||
|
if (empty($menu_array[$i + 1]['level'])) { // End menu block
|
||||||
|
if ($showmenu) {
|
||||||
|
print '<div class="menu_end"></div>'."\n";
|
||||||
|
}
|
||||||
|
if ($blockvmenuopened) {
|
||||||
|
print '</div>'."\n";
|
||||||
|
$blockvmenuopened = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($altok) {
|
||||||
|
print '<div class="blockvmenuend"></div>'; // End menu block
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return count($menu_array);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get left Menu HOME
|
||||||
|
*
|
||||||
|
* @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_home($mainmenu, &$newmenu, $usemenuhider = 1, $leftmenu = 'none', $type_user = 0)
|
||||||
|
{
|
||||||
|
global $user, $conf, $langs;
|
||||||
|
|
||||||
if ($mainmenu == 'home') {
|
if ($mainmenu == 'home') {
|
||||||
$langs->load("users");
|
$langs->load("users");
|
||||||
|
|
||||||
@ -841,11 +1160,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 +1265,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 +1381,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 +1562,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 +1590,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 +1881,22 @@ function print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabM
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
/*
|
* Get left Menu BANK
|
||||||
* 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 +1964,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 +2095,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 +2129,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 +2156,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 +2203,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 +2310,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 +2351,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,228 +2407,4 @@ 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add personalized menus and modules menus
|
|
||||||
//var_dump($newmenu->liste); //
|
|
||||||
$menuArbo = new Menubase($db, 'eldy');
|
|
||||||
$newmenu = $menuArbo->menuLeftCharger($newmenu, $mainmenu, $leftmenu, (empty($user->socid) ? 0 : 1), 'eldy', $tabMenu);
|
|
||||||
//var_dump($newmenu->liste); //
|
|
||||||
|
|
||||||
if (!empty($conf->ftp->enabled) && $mainmenu == 'ftp') { // Entry for FTP
|
|
||||||
$MAXFTP = 20;
|
|
||||||
$i = 1;
|
|
||||||
while ($i <= $MAXFTP) {
|
|
||||||
$paramkey = 'FTP_NAME_'.$i;
|
|
||||||
//print $paramkey;
|
|
||||||
if (!empty($conf->global->$paramkey)) {
|
|
||||||
$link = "/ftp/index.php?idmenu=".$_SESSION["idmenu"]."&numero_ftp=".$i;
|
|
||||||
$newmenu->add($link, dol_trunc($conf->global->$paramkey, 24));
|
|
||||||
}
|
|
||||||
$i++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
//var_dump($tabMenu); //
|
|
||||||
//var_dump($newmenu->liste);
|
|
||||||
|
|
||||||
// Build final $menu_array = $menu_array_before +$newmenu->liste + $menu_array_after
|
|
||||||
//var_dump($menu_array_before);exit;
|
|
||||||
//var_dump($menu_array_after);exit;
|
|
||||||
$menu_array = $newmenu->liste;
|
|
||||||
if (is_array($menu_array_before)) {
|
|
||||||
$menu_array = array_merge($menu_array_before, $menu_array);
|
|
||||||
}
|
|
||||||
if (is_array($menu_array_after)) {
|
|
||||||
$menu_array = array_merge($menu_array, $menu_array_after);
|
|
||||||
}
|
|
||||||
//var_dump($menu_array);exit;
|
|
||||||
if (!is_array($menu_array)) {
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Allow the $menu_array of the menu to be manipulated by modules
|
|
||||||
$parameters = array(
|
|
||||||
'mainmenu' => $mainmenu,
|
|
||||||
);
|
|
||||||
$hook_items = $menu_array;
|
|
||||||
$reshook = $hookmanager->executeHooks('menuLeftMenuItems', $parameters, $hook_items); // Note that $action and $object may have been modified by some hooks
|
|
||||||
|
|
||||||
if (is_numeric($reshook)) {
|
|
||||||
if ($reshook == 0 && !empty($hookmanager->results)) {
|
|
||||||
$menu_array[] = $hookmanager->results; // add
|
|
||||||
} elseif ($reshook == 1) {
|
|
||||||
$menu_array = $hookmanager->results; // replace
|
|
||||||
}
|
|
||||||
|
|
||||||
// @todo Sort menu items by 'position' value
|
|
||||||
// $position = array();
|
|
||||||
// foreach ($menu_array as $key => $row) {
|
|
||||||
// $position[$key] = $row['position'];
|
|
||||||
// }
|
|
||||||
// array_multisort($position, SORT_ASC, $menu_array);
|
|
||||||
}
|
|
||||||
|
|
||||||
// TODO Use the position property in menu_array to reorder the $menu_array
|
|
||||||
//var_dump($menu_array);
|
|
||||||
/*$new_menu_array = array();
|
|
||||||
$level=0; $cusor=0; $position=0;
|
|
||||||
$nbentry = count($menu_array);
|
|
||||||
while (findNextEntryForLevel($menu_array, $cursor, $position, $level))
|
|
||||||
{
|
|
||||||
|
|
||||||
$cursor++;
|
|
||||||
}*/
|
|
||||||
|
|
||||||
// Show menu
|
|
||||||
$invert = empty($conf->global->MAIN_MENU_INVERT) ? "" : "invert";
|
|
||||||
if (empty($noout)) {
|
|
||||||
$altok = 0;
|
|
||||||
$blockvmenuopened = false;
|
|
||||||
$lastlevel0 = '';
|
|
||||||
$num = count($menu_array);
|
|
||||||
for ($i = 0; $i < $num; $i++) { // Loop on each menu entry
|
|
||||||
$showmenu = true;
|
|
||||||
if (!empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED) && empty($menu_array[$i]['enabled'])) {
|
|
||||||
$showmenu = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Begin of new left menu block
|
|
||||||
if (empty($menu_array[$i]['level']) && $showmenu) {
|
|
||||||
$altok++;
|
|
||||||
$blockvmenuopened = true;
|
|
||||||
$lastopened = true;
|
|
||||||
for ($j = ($i + 1); $j < $num; $j++) {
|
|
||||||
if (empty($menu_array[$j]['level'])) {
|
|
||||||
$lastopened = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ($altok % 2 == 0) {
|
|
||||||
print '<div class="blockvmenu blockvmenuimpair'.$invert.($lastopened ? ' blockvmenulast' : '').($altok == 1 ? ' blockvmenufirst' : '').'">'."\n";
|
|
||||||
} else {
|
|
||||||
print '<div class="blockvmenu blockvmenupair'.$invert.($lastopened ? ' blockvmenulast' : '').($altok == 1 ? ' blockvmenufirst' : '').'">'."\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add tabulation
|
|
||||||
$tabstring = '';
|
|
||||||
$tabul = ($menu_array[$i]['level'] - 1);
|
|
||||||
if ($tabul > 0) {
|
|
||||||
for ($j = 0; $j < $tabul; $j++) {
|
|
||||||
$tabstring .= ' ';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// $menu_array[$i]['url'] can be a relative url, a full external url. We try substitution
|
|
||||||
|
|
||||||
$menu_array[$i]['url'] = make_substitutions($menu_array[$i]['url'], $substitarray);
|
|
||||||
|
|
||||||
$url = $shorturl = $shorturlwithoutparam = $menu_array[$i]['url'];
|
|
||||||
if (!preg_match("/^(http:\/\/|https:\/\/)/i", $menu_array[$i]['url'])) {
|
|
||||||
$tmp = explode('?', $menu_array[$i]['url'], 2);
|
|
||||||
$url = $shorturl = $tmp[0];
|
|
||||||
$param = (isset($tmp[1]) ? $tmp[1] : ''); // params in url of the menu link
|
|
||||||
|
|
||||||
// Complete param to force leftmenu to '' to close open menu when we click on a link with no leftmenu defined.
|
|
||||||
if ((!preg_match('/mainmenu/i', $param)) && (!preg_match('/leftmenu/i', $param)) && !empty($menu_array[$i]['mainmenu'])) {
|
|
||||||
$param .= ($param ? '&' : '').'mainmenu='.$menu_array[$i]['mainmenu'].'&leftmenu=';
|
|
||||||
}
|
|
||||||
if ((!preg_match('/mainmenu/i', $param)) && (!preg_match('/leftmenu/i', $param)) && empty($menu_array[$i]['mainmenu'])) {
|
|
||||||
$param .= ($param ? '&' : '').'leftmenu=';
|
|
||||||
}
|
|
||||||
//$url.="idmenu=".$menu_array[$i]['rowid']; // Already done by menuLoad
|
|
||||||
$url = dol_buildpath($url, 1).($param ? '?'.$param : '');
|
|
||||||
$shorturlwithoutparam = $shorturl;
|
|
||||||
$shorturl = $shorturl.($param ? '?'.$param : '');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
print '<!-- Process menu entry with mainmenu='.$menu_array[$i]['mainmenu'].', leftmenu='.$menu_array[$i]['leftmenu'].', level='.$menu_array[$i]['level'].' enabled='.$menu_array[$i]['enabled'].', position='.$menu_array[$i]['position'].' -->'."\n";
|
|
||||||
|
|
||||||
// Menu level 0
|
|
||||||
if ($menu_array[$i]['level'] == 0) {
|
|
||||||
if ($menu_array[$i]['enabled']) { // Enabled so visible
|
|
||||||
print '<div class="menu_titre">'.$tabstring;
|
|
||||||
if ($shorturlwithoutparam) {
|
|
||||||
print '<a class="vmenu" title="'.dol_escape_htmltag(dol_string_nohtmltag($menu_array[$i]['titre'])).'" href="'.$url.'"'.($menu_array[$i]['target'] ? ' target="'.$menu_array[$i]['target'].'"' : '').'>';
|
|
||||||
} else {
|
|
||||||
print '<span class="vmenu">';
|
|
||||||
}
|
|
||||||
print ($menu_array[$i]['prefix'] ? $menu_array[$i]['prefix'] : '').$menu_array[$i]['titre'];
|
|
||||||
if ($shorturlwithoutparam) {
|
|
||||||
print '</a>';
|
|
||||||
} else {
|
|
||||||
print '</span>';
|
|
||||||
}
|
|
||||||
print '</div>'."\n";
|
|
||||||
$lastlevel0 = 'enabled';
|
|
||||||
} elseif ($showmenu) { // Not enabled but visible (so greyed)
|
|
||||||
print '<div class="menu_titre">'.$tabstring;
|
|
||||||
print '<span class="vmenudisabled">';
|
|
||||||
print ($menu_array[$i]['prefix'] ? $menu_array[$i]['prefix'] : '').$menu_array[$i]['titre'];
|
|
||||||
print '</span>';
|
|
||||||
print '</div>'."\n";
|
|
||||||
$lastlevel0 = 'greyed';
|
|
||||||
} else {
|
|
||||||
$lastlevel0 = 'hidden';
|
|
||||||
}
|
|
||||||
if ($showmenu) {
|
|
||||||
print '<div class="menu_top"></div>'."\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Menu level > 0
|
|
||||||
if ($menu_array[$i]['level'] > 0) {
|
|
||||||
$cssmenu = '';
|
|
||||||
if ($menu_array[$i]['url']) {
|
|
||||||
$cssmenu = ' menu_contenu'.dol_string_nospecial(preg_replace('/\.php.*$/', '', $menu_array[$i]['url']));
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($menu_array[$i]['enabled'] && $lastlevel0 == 'enabled') {
|
|
||||||
// Enabled so visible, except if parent was not enabled.
|
|
||||||
print '<div class="menu_contenu'.$cssmenu.'">';
|
|
||||||
print $tabstring;
|
|
||||||
if ($shorturlwithoutparam) {
|
|
||||||
print '<a class="vsmenu" title="'.dol_escape_htmltag(dol_string_nohtmltag($menu_array[$i]['titre'])).'" href="'.$url.'"'.($menu_array[$i]['target'] ? ' target="'.$menu_array[$i]['target'].'"' : '').'>';
|
|
||||||
} else {
|
|
||||||
print '<span class="vsmenu" title="'.dol_escape_htmltag($menu_array[$i]['titre']).'">';
|
|
||||||
}
|
|
||||||
print $menu_array[$i]['titre'];
|
|
||||||
if ($shorturlwithoutparam) {
|
|
||||||
print '</a>';
|
|
||||||
} else {
|
|
||||||
print '</span>';
|
|
||||||
}
|
|
||||||
// If title is not pure text and contains a table, no carriage return added
|
|
||||||
if (!strstr($menu_array[$i]['titre'], '<table')) {
|
|
||||||
print '<br>';
|
|
||||||
}
|
|
||||||
print '</div>'."\n";
|
|
||||||
} elseif ($showmenu && $lastlevel0 == 'enabled') {
|
|
||||||
// Not enabled but visible (so greyed), except if parent was not enabled.
|
|
||||||
print '<div class="menu_contenu'.$cssmenu.'">';
|
|
||||||
print $tabstring;
|
|
||||||
print '<span class="vsmenudisabled vsmenudisabledmargin">'.$menu_array[$i]['titre'].'</span><br>';
|
|
||||||
print '</div>'."\n";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// If next is a new block or if there is nothing after
|
|
||||||
if (empty($menu_array[$i + 1]['level'])) { // End menu block
|
|
||||||
if ($showmenu) {
|
|
||||||
print '<div class="menu_end"></div>'."\n";
|
|
||||||
}
|
|
||||||
if ($blockvmenuopened) {
|
|
||||||
print '</div>'."\n";
|
|
||||||
$blockvmenuopened = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if ($altok) {
|
|
||||||
print '<div class="blockvmenuend"></div>'; // End menu block
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return count($menu_array);
|
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user