43 global $user, $conf, $langs, $mysoc;
44 global $dolibarr_main_db_name;
46 $mainmenu = (empty($_SESSION[
"mainmenu"]) ?
'' : $_SESSION[
"mainmenu"]);
47 $leftmenu = (empty($_SESSION[
"leftmenu"]) ?
'' : $_SESSION[
"leftmenu"]);
50 $listofmodulesforexternal = explode(
',',
getDolGlobalString(
'MAIN_MODULES_FOR_EXTERNAL'));
53 $menuArbo =
new Menubase($db,
'auguria');
54 $newTabMenu = $menuArbo->menuTopCharger(
'',
'', $type_user,
'auguria', $tabMenu);
55 '@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';
67 if ($mode !=
'jmobile' && $mode !=
'topnb' && $usemenuhider && !
getDolGlobalString(
'MAIN_OPTIMIZEFORTEXTBROWSER')) {
69 $classname =
'class="tmenu menuhider nohover"';
72 $menu->add(
'#', (
getDolGlobalInt(
'THEME_TOPMENU_DISABLE_IMAGE') == 1 ?
'<span class="fa fa-bars"></span>' :
''), 0, $showmode, $atarget,
"xxx",
'', 0, $id, $idsel, $classname);
75 $num = count($newTabMenu);
76 for ($i = 0; $i < $num; $i++) {
78 $idsel = (empty($newTabMenu[$i][
'mainmenu']) ?
'none' : $newTabMenu[$i][
'mainmenu']);
87 $url = $shorturl = $newTabMenu[$i][
'url'];
88 if (!preg_match(
"/^(http:\/\/|https:\/\/)/i", $newTabMenu[$i][
'url'])) {
89 $tmp = explode(
'?', $newTabMenu[$i][
'url'], 2);
90 $url = $shorturl = $tmp[0];
91 $param = (isset($tmp[1]) ? $tmp[1] :
'');
94 if ((!preg_match(
'/mainmenu/i', $param)) && (!preg_match(
'/leftmenu/i', $param)) && !empty($newTabMenu[$i][
'url'])) {
96 $param .= ($param ?
'&' :
'').
'mainmenu='.$newTabMenu[$i][
'mainmenu'].
'&leftmenu=';
98 if ((!preg_match(
'/mainmenu/i', $param)) && (!preg_match(
'/leftmenu/i', $param)) && empty($newTabMenu[$i][
'url'])) {
99 $param .= ($param ?
'&' :
'').
'leftmenu=';
107 $shorturl = preg_replace(
'/^'.preg_quote(DOL_URL_ROOT,
'/').
'/',
'', $shorturl);
112 if (preg_match(
'/search_project_user=__search_project_user__/', $shorturl)) {
113 $search_project_user =
GETPOSTINT(
'search_project_user');
114 if ($search_project_user) {
115 $shorturl = preg_replace(
'/search_project_user=__search_project_user__/',
'search_project_user='.$search_project_user, $shorturl);
117 $shorturl = preg_replace(
'/search_project_user=__search_project_user__/',
'', $shorturl);
122 if (!empty($_SESSION[
'idmenu']) && $newTabMenu[$i][
'rowid'] == $_SESSION[
'idmenu']) {
123 $classname =
'class="tmenusel"';
124 } elseif (!empty($_SESSION[
"mainmenu"]) && $newTabMenu[$i][
'mainmenu'] == $_SESSION[
"mainmenu"]) {
125 $classname =
'class="tmenusel"';
127 $classname =
'class="tmenu"';
129 } elseif ($showmode == 2) {
130 $classname =
'class="tmenu"';
135 $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']);
145 $mysoc->logo_squarred_mini = (!
getDolGlobalString(
'MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI') ?
'' : $conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI);
147 $logoContainerAdditionalClass =
'backgroundforcompanylogo';
149 $logoContainerAdditionalClass =
'';
152 if (!empty($mysoc->logo_squarred_mini) && is_readable($conf->mycompany->dir_output.
'/logos/thumbs/'.$mysoc->logo_squarred_mini)) {
153 $urllogo = DOL_URL_ROOT.
'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode(
'logos/thumbs/'.$mysoc->logo_squarred_mini);
159 $urllogo = DOL_URL_ROOT.
'/theme/dolibarr_512x512_white.png';
160 $logoContainerAdditionalClass =
'';
163 $title = $langs->trans(
"GoIntoSetupToChangeLogo");
165 print
"\n".
'<!-- Show logo on menu -->'.
"\n";
168 print
'<div class="center '.$logoContainerAdditionalClass.
' menulogocontainer"><img class="mycompany" title="'.
dol_escape_htmltag($title).
'" alt="" src="'.$urllogo.
'" style="max-width: 100px"></div>'.
"\n";
174 foreach ($menu->liste as $menuval) {
176 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);
324function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$tabMenu, &$menu, $noout = 0, $forcemainmenu =
'', $forceleftmenu =
'', $moredata =
null, $type_user = 0)
326 global $user, $conf, $langs, $hookmanager;
327 global $dolibarr_main_db_name, $mysoc;
331 $mainmenu = ($forcemainmenu ? $forcemainmenu : $_SESSION[
"mainmenu"]);
332 $leftmenu = ($forceleftmenu ?
'' : (empty($_SESSION[
"leftmenu"]) ?
'none' : $_SESSION[
"leftmenu"]));
334 global $usemenuhider;
337 if (is_array($moredata) && !empty($moredata[
'searchform'])) {
339 print
"<!-- Begin SearchForm -->\n";
340 print
'<div id="blockvmenusearch" class="blockvmenusearch">'.
"\n";
341 print $moredata[
'searchform'];
343 print
"<!-- End SearchForm -->\n";
346 if (is_array($moredata) && !empty($moredata[
'bookmarks'])) {
348 print
"<!-- Begin Bookmarks -->\n";
349 print
'<div id="blockvmenubookmarks" class="blockvmenubookmarks">'.
"\n";
350 print $moredata[
'bookmarks'];
352 print
"<!-- End Bookmarks -->\n";
358 $menuArbo =
new Menubase($db,
'auguria');
359 $newmenu = $menuArbo->menuLeftCharger($newmenu, $mainmenu, $leftmenu, ($user->socid ? 1 : 0),
'auguria', $tabMenu);
362 if (isModEnabled(
'bank') && $user->hasRight(
'banque',
'lire') && $mainmenu ==
'bank') {
363 include_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
365 $sql =
"SELECT rowid, label, courant, rappro, courant";
366 $sql .=
" FROM ".MAIN_DB_PREFIX.
"bank_account";
367 $sql .=
" WHERE entity = ".$conf->entity;
368 $sql .=
" AND clos = 0";
369 $sql .=
" ORDER BY label";
371 $resql = $db->query($sql);
373 $numr = $db->num_rows($resql);
377 $newmenu->add(
'/compta/bank/list.php?search_status=opened', $langs->trans(
"BankAccounts"), 0, $user->hasRight(
'banque',
'lire'));
381 $objp = $db->fetch_object($resql);
382 $newmenu->add(
'/compta/bank/card.php?id='.$objp->rowid, $objp->label, 1, $user->hasRight(
'banque',
'lire'));
384 $newmenu->add(
'/compta/bank/bankentries_list.php?id='.$objp->rowid, $langs->trans(
"Conciliate"), 2, $user->hasRight(
'banque',
'consolidate'));
394 if (isModEnabled(
'accounting') && $user->hasRight(
'accounting',
'comptarapport',
'lire') && $mainmenu ==
'accountancy') {
395 $newmenu->add(
'', $langs->trans(
"RegistrationInAccounting"), 1, $user->hasRight(
'accounting',
'comptarapport',
'lire'),
'',
'accountancy',
'accountancy_journal', 10);
398 $sql =
"SELECT rowid, code, label, nature";
399 $sql .=
" FROM ".MAIN_DB_PREFIX.
"accounting_journal";
400 $sql .=
" WHERE entity = ".$conf->entity;
401 $sql .=
" AND active = 1";
402 $sql .=
" ORDER BY label DESC";
404 $resql = $db->query($sql);
406 $numr = $db->num_rows($resql);
411 $objp = $db->fetch_object($resql);
416 if ($objp->nature == 2 && isModEnabled(
'invoice') && !
getDolGlobalString(
'ACCOUNTING_DISABLE_BINDING_ON_SALES')) {
419 if ($objp->nature == 3
420 && isModEnabled(
'supplier_invoice')
422 $nature =
"purchases";
424 if ($objp->nature == 4 && isModEnabled(
'bank')) {
427 if ($objp->nature == 5 && isModEnabled(
'expensereport') && !
getDolGlobalString(
'ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS')) {
428 $nature =
"expensereports";
430 if ($objp->nature == 1) {
433 if ($objp->nature == 8) {
434 $nature =
"inventory";
436 if ($objp->nature == 9) {
442 if ($nature ==
'hasnew' || $nature ==
'inventory') {
448 $langs->load(
'accountancy');
449 $journallabel = $langs->transnoentities($objp->label);
450 $newmenu->add(
'/accountancy/journal/'.$nature.
'journal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal='.$objp->rowid, $journallabel, 2, $user->hasRight(
'accounting',
'comptarapport',
'lire'));
456 $newmenu->add(
'', $langs->trans(
"NoJournalDefined"), 2, $user->hasRight(
'accounting',
'comptarapport',
'lire'));
464 if (isModEnabled(
'ftp') && $mainmenu ==
'ftp') {
467 while ($i <= $MAXFTP) {
468 $paramkey =
'FTP_NAME_'.$i;
470 if (!empty($conf->global->$paramkey)) {
471 $link =
"/ftp/index.php?idmenu=".$_SESSION[
"idmenu"].
"&numero_ftp=".$i;
473 $newmenu->add($link,
dol_trunc($conf->global->$paramkey, 24));
483 $menu_array = $newmenu->liste;
484 if (is_array($menu_array_before)) {
485 $menu_array = array_merge($menu_array_before, $menu_array);
487 if (is_array($menu_array_after)) {
488 $menu_array = array_merge($menu_array, $menu_array_after);
491 if (!is_array($menu_array)) {
497 'mainmenu' => $mainmenu,
499 $hook_items = $menu_array;
500 $reshook = $hookmanager->executeHooks(
'menuLeftMenuItems', $parameters, $hook_items);
502 if (is_numeric($reshook)) {
503 if ($reshook == 0 && !empty($hookmanager->results)) {
504 $menu_array[] = $hookmanager->results;
505 } elseif ($reshook == 1) {
506 $menu_array = $hookmanager->results;
520 '@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';
526 $blockvmenuopened =
false;
528 $num = count($menu_array);
529 foreach (array_keys($menu_array) as $i) {
531 if (
getDolGlobalString(
'MAIN_MENU_HIDE_UNAUTHORIZED') && empty($menu_array[$i][
'enabled'])) {
536 if (empty($menu_array[$i][
'level']) && $showmenu) {
538 $blockvmenuopened =
true;
540 for ($j = ($i + 1); $j < $num; $j++) {
541 if (empty($menu_array[$j][
'level'])) {
545 if ($altok % 2 == 0) {
546 print
'<div class="blockvmenu blockvmenuimpair'.$invert.($lastopened ?
' blockvmenulast' :
'').($altok == 1 ?
' blockvmenufirst' :
'').
'">'.
"\n";
548 print
'<div class="blockvmenu blockvmenupair'.$invert.($lastopened ?
' blockvmenulast' :
'').($altok == 1 ?
' blockvmenufirst' :
'').
'">'.
"\n";
554 $tabul = ($menu_array[$i][
'level'] - 1);
556 for ($j = 0; $j < $tabul; $j++) {
557 $tabstring .=
' ';
565 $url = $shorturl = $shorturlwithoutparam = $menu_array[$i][
'url'];
566 if (!preg_match(
"/^(http:\/\/|https:\/\/)/i", $menu_array[$i][
'url'])) {
567 $tmp = explode(
'?', $menu_array[$i][
'url'], 2);
568 $url = $shorturl = $tmp[0];
569 $param = (isset($tmp[1]) ? $tmp[1] :
'');
572 if ((!preg_match(
'/mainmenu/i', $param)) && (!preg_match(
'/leftmenu/i', $param)) && !empty($menu_array[$i][
'mainmenu'])) {
573 $param .= ($param ?
'&' :
'').
'mainmenu='.$menu_array[$i][
'mainmenu'].
'&leftmenu=';
575 if ((!preg_match(
'/mainmenu/i', $param)) && (!preg_match(
'/leftmenu/i', $param)) && empty($menu_array[$i][
'mainmenu'])) {
576 $param .= ($param ?
'&' :
'').
'leftmenu=';
580 $shorturlwithoutparam = $shorturl;
581 $shorturl = $shorturl.($param ?
'?'.$param :
'');
585 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";
588 if ($menu_array[$i][
'level'] == 0) {
589 if ($menu_array[$i][
'enabled']) {
590 print
'<div class="menu_titre">'.$tabstring;
591 if ($shorturlwithoutparam) {
592 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'].
'"' :
'').
'>';
594 print
'<span class="vmenu">';
596 if (!empty($menu_array[$i][
'prefix'])) {
597 if (preg_match(
'/^fa\-[a-zA-Z0-9\-_]+$/', $menu_array[$i][
'prefix'])) {
598 print
'<span class="fas '.$menu_array[$i][
'prefix'].
' paddingright pictofixedwidth"></span>';
600 print $menu_array[$i][
'prefix'];
605 print $menu_array[$i][
'titre'];
606 if ($shorturlwithoutparam) {
612 $lastlevel0 =
'enabled';
613 } elseif ($showmenu) {
614 print
'<div class="menu_titre">'.$tabstring;
615 print
'<span class="vmenudisabled">';
616 if (!empty($menu_array[$i][
'prefix'])) {
617 print $menu_array[$i][
'prefix'];
619 print $menu_array[$i][
'titre'];
622 $lastlevel0 =
'greyed';
624 $lastlevel0 =
'hidden';
627 print
'<div class="menu_top"></div>'.
"\n";
632 if ($menu_array[$i][
'level'] > 0) {
634 if ($menu_array[$i][
'url']) {
635 $cssmenu =
' menu_contenu'.dol_string_nospecial(preg_replace(
'/\.php.*$/',
'', $menu_array[$i][
'url']));
638 if ($menu_array[$i][
'enabled'] && $lastlevel0 ==
'enabled') {
640 print
'<div class="menu_contenu'.$cssmenu.
'">';
642 if ($shorturlwithoutparam) {
643 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'].
'"' :
'').
'>';
645 print
'<span class="vsmenu" title="'.dol_escape_htmltag($menu_array[$i][
'titre']).
'">';
647 print $menu_array[$i][
'titre'];
648 if ($shorturlwithoutparam) {
654 if (!strstr($menu_array[$i][
'titre'],
'<table')) {
658 } elseif ($showmenu && $lastlevel0 ==
'enabled') {
660 print
'<div class="menu_contenu'.$cssmenu.
'">';
662 print
'<span class="spanlilevel0 vsmenudisabled vsmenudisabledmargin">'.$menu_array[$i][
'titre'].
'</span><br>';
668 if (empty($menu_array[$i + 1][
'level'])) {
670 print
'<div class="menu_end"></div>'.
"\n";
672 if ($blockvmenuopened) {
674 $blockvmenuopened =
false;
680 print
'<div class="blockvmenuend"></div>';
684 return count($menu_array);