44 global $user,
$conf, $langs, $mysoc;
45 global $dolibarr_main_db_name;
47 $mainmenu = (empty($_SESSION[
"mainmenu"]) ?
'' : $_SESSION[
"mainmenu"]);
48 $leftmenu = (empty($_SESSION[
"leftmenu"]) ?
'' : $_SESSION[
"leftmenu"]);
51 $listofmodulesforexternal = explode(
',',
getDolGlobalString(
'MAIN_MODULES_FOR_EXTERNAL'));
54 $menuArbo =
new Menubase($db,
'auguria');
55 $newTabMenu = $menuArbo->menuTopCharger(
'',
'', $type_user,
'auguria', $tabMenu);
56 '@phan-var-force array<array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,prefix:string}> $newTabMenu';
68 if ($mode !=
'jmobile' && $mode !=
'topnb' && $usemenuhider && !
getDolGlobalString(
'MAIN_OPTIMIZEFORTEXTBROWSER')) {
70 $classname =
'class="tmenu menuhider nohover"';
73 $menu->add(
'#', (
getDolGlobalInt(
'THEME_TOPMENU_DISABLE_IMAGE') == 1 ?
'<span class="fa fa-bars"></span>' :
''), 0, $showmode, $atarget,
"xxx",
'', 0,
$id, $idsel, $classname,
'<span class="fas fa-bars size12x"></span>');
76 $num = count($newTabMenu);
77 for ($i = 0; $i < $num; $i++) {
79 $idsel = (empty($newTabMenu[$i][
'mainmenu']) ?
'none' : $newTabMenu[$i][
'mainmenu']);
87 $url = $shorturl = $newTabMenu[$i][
'url'];
89 if (!preg_match(
"/^(http:\/\/|https:\/\/)/i", $newTabMenu[$i][
'url'])) {
90 $tmp = explode(
'?', $newTabMenu[$i][
'url'], 2);
91 $url = $shorturl = $tmp[0];
92 $param = (isset($tmp[1]) ? $tmp[1] :
'');
95 if ((!preg_match(
'/mainmenu/i', $param)) && (!preg_match(
'/leftmenu/i', $param)) && !empty($newTabMenu[$i][
'url'])) {
97 $param .= ($param ?
'&' :
'').
'mainmenu='.$newTabMenu[$i][
'mainmenu'].
'&leftmenu=';
99 if ((!preg_match(
'/mainmenu/i', $param)) && (!preg_match(
'/leftmenu/i', $param)) && empty($newTabMenu[$i][
'url'])) {
100 $param .= ($param ?
'&' :
'').
'leftmenu=';
108 $shorturl = preg_replace(
'/^'.preg_quote(DOL_URL_ROOT,
'/').
'/',
'', $shorturl);
113 '@phan-var-force array<array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,prefix:string}> $newTabMenu';
116 if (preg_match(
'/search_project_user=__search_project_user__/', $shorturl)) {
117 $search_project_user =
GETPOSTINT(
'search_project_user');
118 if ($search_project_user) {
119 $shorturl = preg_replace(
'/search_project_user=__search_project_user__/',
'search_project_user='.$search_project_user, $shorturl);
121 $shorturl = preg_replace(
'/search_project_user=__search_project_user__/',
'', $shorturl);
126 '@phan-var-force array<array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,prefix:string}> $newTabMenu';
129 if (!empty($_SESSION[
'idmenu']) && $newTabMenu[$i][
'rowid'] == $_SESSION[
'idmenu']) {
130 $classname =
'class="tmenusel"';
131 } elseif (!empty($_SESSION[
"mainmenu"]) && $newTabMenu[$i][
'mainmenu'] == $_SESSION[
"mainmenu"]) {
132 $classname =
'class="tmenusel"';
134 $classname =
'class="tmenu"';
136 } elseif ($showmode == 2) {
137 $classname =
'class="tmenu"';
142 $menu->add($shorturl, $newTabMenu[$i][
'titre'], 0, $showmode, ($newTabMenu[$i][
'target'] ? $newTabMenu[$i][
'target'] : $atarget), ($newTabMenu[$i][
'mainmenu'] ? $newTabMenu[$i][
'mainmenu'] : $newTabMenu[$i][
'rowid']), ($newTabMenu[$i][
'leftmenu'] ? $newTabMenu[$i][
'leftmenu'] :
''), $newTabMenu[$i][
'position'],
$id, $idsel, $classname, $newTabMenu[$i][
'prefix']);
152 $mysoc->logo_squarred_mini = (!
getDolGlobalString(
'MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI') ?
'' :
$conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI);
154 $logoContainerAdditionalClass =
'backgroundforcompanylogo';
156 $logoContainerAdditionalClass =
'';
159 if (!empty($mysoc->logo_squarred_mini) && is_readable(
$conf->mycompany->dir_output.
'/logos/thumbs/'.$mysoc->logo_squarred_mini)) {
160 $urllogo = DOL_URL_ROOT.
'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode(
'logos/thumbs/'.$mysoc->logo_squarred_mini);
166 $urllogo = DOL_URL_ROOT.
'/theme/dolibarr_512x512_white.png';
167 $logoContainerAdditionalClass =
'';
170 $title = $langs->trans(
"GoIntoSetupToChangeLogo");
172 print
"\n".
'<!-- Show logo on menu -->'.
"\n";
175 print
'<div class="center '.$logoContainerAdditionalClass.
' menulogocontainer"><img class="mycompany" title="'.
dol_escape_htmltag($title).
'" alt="" src="'.$urllogo.
'" style="max-width: 100px"></div>'.
"\n";
181 foreach ($menu->liste as $menuval) {
183 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), $menuval);
330function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$tabMenu, &$menu, $noout = 0, $forcemainmenu =
'', $forceleftmenu =
'', $moredata =
null, $type_user = 0)
332 global $user,
$conf, $langs, $hookmanager;
333 global $dolibarr_main_db_name, $mysoc;
337 $mainmenu = ($forcemainmenu ? $forcemainmenu : $_SESSION[
"mainmenu"]);
338 $leftmenu = ($forceleftmenu ?
'' : (empty($_SESSION[
"leftmenu"]) ?
'none' : $_SESSION[
"leftmenu"]));
340 global $usemenuhider;
343 if (is_array($moredata) && !empty($moredata[
'searchform'])) {
345 print
"<!-- Begin SearchForm -->\n";
346 print
'<div id="blockvmenusearch" class="blockvmenusearch">'.
"\n";
347 print $moredata[
'searchform'];
349 print
"<!-- End SearchForm -->\n";
352 if (is_array($moredata) && !empty($moredata[
'bookmarks'])) {
354 print
"<!-- Begin Bookmarks -->\n";
355 print
'<div id="blockvmenubookmarks" class="blockvmenubookmarks">'.
"\n";
356 print $moredata[
'bookmarks'];
358 print
"<!-- End Bookmarks -->\n";
364 $menuArbo =
new Menubase($db,
'auguria');
365 $newmenu = $menuArbo->menuLeftCharger($newmenu, $mainmenu, $leftmenu, ($user->socid ? 1 : 0),
'auguria', $tabMenu);
368 if (isModEnabled(
'bank') && $user->hasRight(
'banque',
'lire') && $mainmenu ==
'bank') {
369 include_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
371 $sql =
"SELECT rowid, label, courant, rappro, courant";
372 $sql .=
" FROM ".MAIN_DB_PREFIX.
"bank_account";
373 $sql .=
" WHERE entity = ".$conf->entity;
374 $sql .=
" AND clos = 0";
375 $sql .=
" ORDER BY label";
377 $resql = $db->query($sql);
379 $numr = $db->num_rows($resql);
383 $newmenu->add(
'/compta/bank/list.php?search_status=opened', $langs->trans(
"BankAccounts"), 0, $user->hasRight(
'banque',
'lire'));
387 $objp = $db->fetch_object($resql);
388 $newmenu->add(
'/compta/bank/card.php?id='.$objp->rowid, $objp->label, 1, $user->hasRight(
'banque',
'lire'));
390 $newmenu->add(
'/compta/bank/bankentries_list.php?id='.$objp->rowid, $langs->trans(
"Conciliate"), 2, $user->hasRight(
'banque',
'consolidate'));
400 if (isModEnabled(
'accounting') && $user->hasRight(
'accounting',
'comptarapport',
'lire') && $mainmenu ==
'accountancy') {
401 $newmenu->add(
'', $langs->trans(
"RegistrationInAccounting"), 1, $user->hasRight(
'accounting',
'comptarapport',
'lire'),
'',
'accountancy',
'accountancy_journal', 10);
404 $sql =
"SELECT rowid, code, label, nature";
405 $sql .=
" FROM ".MAIN_DB_PREFIX.
"accounting_journal";
406 $sql .=
" WHERE entity = ".$conf->entity;
407 $sql .=
" AND active = 1";
408 $sql .=
" ORDER BY label DESC";
410 $resql = $db->query($sql);
412 $numr = $db->num_rows($resql);
417 $objp = $db->fetch_object($resql);
422 if ($objp->nature == 2 && isModEnabled(
'invoice') && !
getDolGlobalString(
'ACCOUNTING_DISABLE_BINDING_ON_SALES')) {
425 if ($objp->nature == 3
426 && isModEnabled(
'supplier_invoice')
428 $nature =
"purchases";
430 if ($objp->nature == 4 && isModEnabled(
'bank')) {
433 if ($objp->nature == 5 && isModEnabled(
'expensereport') && !
getDolGlobalString(
'ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS')) {
434 $nature =
"expensereports";
436 if ($objp->nature == 1) {
439 if ($objp->nature == 8) {
440 $nature =
"inventory";
442 if ($objp->nature == 9) {
448 if ($nature ==
'hasnew' || $nature ==
'inventory') {
454 $langs->load(
'accountancy');
455 $journallabel = $langs->transnoentities($objp->label);
456 $newmenu->add(
'/accountancy/journal/'.$nature.
'journal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal='.$objp->rowid, $journallabel, 2, $user->hasRight(
'accounting',
'comptarapport',
'lire'));
462 $newmenu->add(
'', $langs->trans(
"NoJournalDefined"), 2, $user->hasRight(
'accounting',
'comptarapport',
'lire'));
470 if (isModEnabled(
'ftp') && $mainmenu ==
'ftp') {
473 while ($i <= $MAXFTP) {
474 $paramkey =
'FTP_NAME_'.$i;
477 $link =
"/ftp/index.php?idmenu=".$_SESSION[
"idmenu"].
"&numero_ftp=".$i;
489 $menu_array = $newmenu->liste;
490 if (is_array($menu_array_before)) {
491 $menu_array = array_merge($menu_array_before, $menu_array);
493 if (is_array($menu_array_after)) {
494 $menu_array = array_merge($menu_array, $menu_array_after);
497 if (!is_array($menu_array)) {
503 'mainmenu' => $mainmenu,
505 $hook_items = $menu_array;
506 $reshook = $hookmanager->executeHooks(
'menuLeftMenuItems', $parameters, $hook_items);
508 if (is_numeric($reshook)) {
509 if ($reshook == 0 && !empty($hookmanager->resArray)) {
510 $menu_array[] = $hookmanager->resArray;
511 } elseif ($reshook == 1) {
512 $menu_array = $hookmanager->resArray;
526 '@phan-var-force array<array{rowid:string,fk_menu:string,langs:string,enabled:int<0,2>,type:string,fk_mainmenu:string,fk_leftmenu:string,url:string,titre:string,perms:string,target:string,mainmenu:string,leftmenu:string,position:int,prefix:string,level:int}> $menu_array';
532 $blockvmenuopened =
false;
534 $num = count($menu_array);
535 foreach (array_keys($menu_array) as $i) {
537 if (
getDolGlobalString(
'MAIN_MENU_HIDE_UNAUTHORIZED') && empty($menu_array[$i][
'enabled'])) {
542 if (empty($menu_array[$i][
'level']) && $showmenu) {
544 $blockvmenuopened =
true;
546 for ($j = ($i + 1); $j < $num; $j++) {
547 if (empty($menu_array[$j][
'level'])) {
551 if ($altok % 2 == 0) {
552 print
'<div class="blockvmenu blockvmenuimpair'.$invert.($lastopened ?
' blockvmenulast' :
'').($altok == 1 ?
' blockvmenufirst' :
'').
'">'.
"\n";
554 print
'<div class="blockvmenu blockvmenupair'.$invert.($lastopened ?
' blockvmenulast' :
'').($altok == 1 ?
' blockvmenufirst' :
'').
'">'.
"\n";
560 $tabul = ($menu_array[$i][
'level'] - 1);
562 for ($j = 0; $j < $tabul; $j++) {
563 $tabstring .=
' ';
571 $url = $shorturl = $shorturlwithoutparam = $menu_array[$i][
'url'];
572 if (!preg_match(
"/^(http:\/\/|https:\/\/)/i", $menu_array[$i][
'url'])) {
573 $tmp = explode(
'?', $menu_array[$i][
'url'], 2);
574 $url = $shorturl = $tmp[0];
575 $param = (isset($tmp[1]) ? $tmp[1] :
'');
578 if ((!preg_match(
'/mainmenu/i', $param)) && (!preg_match(
'/leftmenu/i', $param)) && !empty($menu_array[$i][
'mainmenu'])) {
579 $param .= ($param ?
'&' :
'').
'mainmenu='.$menu_array[$i][
'mainmenu'].
'&leftmenu=';
581 if ((!preg_match(
'/mainmenu/i', $param)) && (!preg_match(
'/leftmenu/i', $param)) && empty($menu_array[$i][
'mainmenu'])) {
582 $param .= ($param ?
'&' :
'').
'leftmenu=';
586 $shorturlwithoutparam = $shorturl;
587 $shorturl .= ($param ?
'?'.$param :
'');
591 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'].
' prefix='.$menu_array[$i][
'prefix'].
' -->'.
"\n";
594 if ($menu_array[$i][
'level'] == 0) {
595 if ($menu_array[$i][
'enabled']) {
596 print
'<div class="menu_titre">'.$tabstring;
597 if ($shorturlwithoutparam) {
598 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'].
'"' :
'').
'>';
600 print
'<span class="vmenu">';
602 if (!empty($menu_array[$i][
'prefix'])) {
603 if (preg_match(
'/^fa\-[a-zA-Z0-9\-_]+$/', $menu_array[$i][
'prefix'])) {
604 print
'<span class="fas '.$menu_array[$i][
'prefix'].
' paddingright pictofixedwidth"></span>';
606 print $menu_array[$i][
'prefix'];
611 print $menu_array[$i][
'titre'];
612 if ($shorturlwithoutparam) {
618 $lastlevel0 =
'enabled';
619 } elseif ($showmenu) {
620 print
'<div class="menu_titre">'.$tabstring;
621 print
'<span class="vmenudisabled">';
622 if (!empty($menu_array[$i][
'prefix'])) {
623 print $menu_array[$i][
'prefix'];
625 print $menu_array[$i][
'titre'];
628 $lastlevel0 =
'greyed';
630 $lastlevel0 =
'hidden';
633 print
'<div class="menu_top"></div>'.
"\n";
638 if ($menu_array[$i][
'level'] > 0) {
640 if ($menu_array[$i][
'url']) {
641 $cssmenu =
' menu_contenu'.dol_string_nospecial(preg_replace(
'/\.php.*$/',
'', $menu_array[$i][
'url']));
644 if ($menu_array[$i][
'enabled'] && $lastlevel0 ==
'enabled') {
646 print
'<div class="menu_contenu'.$cssmenu.
'">';
648 if ($shorturlwithoutparam) {
649 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'].
'"' :
'').
'>';
651 print
'<span class="vsmenu" title="'.dol_escape_htmltag($menu_array[$i][
'titre']).
'">';
653 print $menu_array[$i][
'titre'];
654 if ($shorturlwithoutparam) {
660 if (!strstr($menu_array[$i][
'titre'],
'<table')) {
664 } elseif ($showmenu && $lastlevel0 ==
'enabled') {
666 print
'<div class="menu_contenu'.$cssmenu.
'">';
668 print
'<span class="spanlilevel0 vsmenudisabled vsmenudisabledmargin">'.$menu_array[$i][
'titre'].
'</span><br>';
674 if (empty($menu_array[$i + 1][
'level'])) {
676 print
'<div class="menu_end"></div>'.
"\n";
678 if ($blockvmenuopened) {
680 $blockvmenuopened =
false;
686 print
'<div class="blockvmenuend"></div>';
690 return count($menu_array);
print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$tabMenu, &$menu, $noout=0, $forcemainmenu='', $forceleftmenu='', $moredata=null, $type_user=0)
Core function to output left menu auguria Fill &$menu (example with $forcemainmenu='home' $forceleftm...