42 global $user, $conf, $langs, $mysoc;
43 global $dolibarr_main_db_name;
45 $mainmenu = (empty($_SESSION[
"mainmenu"]) ?
'' : $_SESSION[
"mainmenu"]);
46 $leftmenu = (empty($_SESSION[
"leftmenu"]) ?
'' : $_SESSION[
"leftmenu"]);
49 $listofmodulesforexternal = explode(
',',
getDolGlobalString(
'MAIN_MODULES_FOR_EXTERNAL'));
52 $menuArbo =
new Menubase($db,
'auguria');
53 $newTabMenu = $menuArbo->menuTopCharger(
'',
'', $type_user,
'auguria', $tabMenu);
65 if ($mode !=
'jmobile' && $mode !=
'topnb' && $usemenuhider && !
getDolGlobalString(
'MAIN_OPTIMIZEFORTEXTBROWSER')) {
67 $classname =
'class="tmenu menuhider nohover"';
70 $menu->add(
'#', (
getDolGlobalInt(
'THEME_TOPMENU_DISABLE_IMAGE') == 1 ?
'<span class="fa fa-bars"></span>' :
''), 0, $showmode, $atarget,
"xxx",
'', 0, $id, $idsel, $classname);
73 $num = count($newTabMenu);
74 for ($i = 0; $i < $num; $i++) {
76 $idsel = (empty($newTabMenu[$i][
'mainmenu']) ?
'none' : $newTabMenu[$i][
'mainmenu']);
85 $url = $shorturl = $newTabMenu[$i][
'url'];
86 if (!preg_match(
"/^(http:\/\/|https:\/\/)/i", $newTabMenu[$i][
'url'])) {
87 $tmp = explode(
'?', $newTabMenu[$i][
'url'], 2);
88 $url = $shorturl = $tmp[0];
89 $param = (isset($tmp[1]) ? $tmp[1] :
'');
92 if ((!preg_match(
'/mainmenu/i', $param)) && (!preg_match(
'/leftmenu/i', $param)) && !empty($newTabMenu[$i][
'url'])) {
93 $param .= ($param ?
'&' :
'').
'mainmenu='.$newTabMenu[$i][
'mainmenu'].
'&leftmenu=';
95 if ((!preg_match(
'/mainmenu/i', $param)) && (!preg_match(
'/leftmenu/i', $param)) && empty($newTabMenu[$i][
'url'])) {
96 $param .= ($param ?
'&' :
'').
'leftmenu=';
104 $shorturl = preg_replace(
'/^'.preg_quote(DOL_URL_ROOT,
'/').
'/',
'', $shorturl);
109 if (preg_match(
'/search_project_user=__search_project_user__/', $shorturl)) {
110 $search_project_user =
GETPOST(
'search_project_user',
'int');
111 if ($search_project_user) {
112 $shorturl = preg_replace(
'/search_project_user=__search_project_user__/',
'search_project_user='.$search_project_user, $shorturl);
114 $shorturl = preg_replace(
'/search_project_user=__search_project_user__/',
'', $shorturl);
119 if (!empty($_SESSION[
'idmenu']) && $newTabMenu[$i][
'rowid'] == $_SESSION[
'idmenu']) {
120 $classname =
'class="tmenusel"';
121 } elseif (!empty($_SESSION[
"mainmenu"]) && $newTabMenu[$i][
'mainmenu'] == $_SESSION[
"mainmenu"]) {
122 $classname =
'class="tmenusel"';
124 $classname =
'class="tmenu"';
126 } elseif ($showmode == 2) {
127 $classname =
'class="tmenu"';
132 $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']);
142 $mysoc->logo_squarred_mini = (!
getDolGlobalString(
'MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI') ?
'' : $conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI);
144 $logoContainerAdditionalClass =
'backgroundforcompanylogo';
146 $logoContainerAdditionalClass =
'';
149 if (!empty($mysoc->logo_squarred_mini) && is_readable($conf->mycompany->dir_output.
'/logos/thumbs/'.$mysoc->logo_squarred_mini)) {
150 $urllogo = DOL_URL_ROOT.
'/viewimage.php?cache=1&modulepart=mycompany&file='.urlencode(
'logos/thumbs/'.$mysoc->logo_squarred_mini);
156 $urllogo = DOL_URL_ROOT.
'/theme/dolibarr_512x512_white.png';
157 $logoContainerAdditionalClass =
'';
160 $title = $langs->trans(
"GoIntoSetupToChangeLogo");
162 print
"\n".
'<!-- Show logo on menu -->'.
"\n";
165 print
'<div class="center '.$logoContainerAdditionalClass.
' menulogocontainer"><img class="mycompany" title="'.
dol_escape_htmltag($title).
'" alt="" src="'.$urllogo.
'" style="max-width: 100px"></div>'.
"\n";
171 foreach ($menu->liste as $menuval) {
173 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);
323function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$tabMenu, &$menu, $noout = 0, $forcemainmenu =
'', $forceleftmenu =
'', $moredata =
null, $type_user = 0)
325 global $user, $conf, $langs, $hookmanager;
326 global $dolibarr_main_db_name, $mysoc;
330 $mainmenu = ($forcemainmenu ? $forcemainmenu : $_SESSION[
"mainmenu"]);
331 $leftmenu = ($forceleftmenu ?
'' : (empty($_SESSION[
"leftmenu"]) ?
'none' : $_SESSION[
"leftmenu"]));
333 global $usemenuhider;
336 if (is_array($moredata) && !empty($moredata[
'searchform'])) {
338 print
"<!-- Begin SearchForm -->\n";
339 print
'<div id="blockvmenusearch" class="blockvmenusearch">'.
"\n";
340 print $moredata[
'searchform'];
342 print
"<!-- End SearchForm -->\n";
345 if (is_array($moredata) && !empty($moredata[
'bookmarks'])) {
347 print
"<!-- Begin Bookmarks -->\n";
348 print
'<div id="blockvmenubookmarks" class="blockvmenubookmarks">'.
"\n";
349 print $moredata[
'bookmarks'];
351 print
"<!-- End Bookmarks -->\n";
357 $menuArbo =
new Menubase($db,
'auguria');
358 $newmenu = $menuArbo->menuLeftCharger($newmenu, $mainmenu, $leftmenu, ($user->socid ? 1 : 0),
'auguria', $tabMenu);
361 if (isModEnabled(
'banque') && $user->hasRight(
'banque',
'lire') && $mainmenu ==
'bank') {
362 include_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
364 $sql =
"SELECT rowid, label, courant, rappro, courant";
365 $sql .=
" FROM ".MAIN_DB_PREFIX.
"bank_account";
366 $sql .=
" WHERE entity = ".$conf->entity;
367 $sql .=
" AND clos = 0";
368 $sql .=
" ORDER BY label";
370 $resql = $db->query($sql);
372 $numr = $db->num_rows($resql);
376 $newmenu->add(
'/compta/bank/list.php', $langs->trans(
"BankAccounts"), 0, $user->hasRight(
'banque',
'lire'));
380 $objp = $db->fetch_object($resql);
381 $newmenu->add(
'/compta/bank/card.php?id='.$objp->rowid, $objp->label, 1, $user->hasRight(
'banque',
'lire'));
383 $newmenu->add(
'/compta/bank/bankentries_list.php?id='.$objp->rowid, $langs->trans(
"Conciliate"), 2, $user->hasRight(
'banque',
'consolidate'));
393 if (isModEnabled(
'accounting') && $user->hasRight(
'accounting',
'comptarapport',
'lire') && $mainmenu ==
'accountancy') {
394 $newmenu->add(
'', $langs->trans(
"RegistrationInAccounting"), 1, $user->hasRight(
'accounting',
'comptarapport',
'lire'),
'',
'accountancy',
'accountancy_journal', 10);
397 $sql =
"SELECT rowid, code, label, nature";
398 $sql .=
" FROM ".MAIN_DB_PREFIX.
"accounting_journal";
399 $sql .=
" WHERE entity = ".$conf->entity;
400 $sql .=
" AND active = 1";
401 $sql .=
" ORDER BY label DESC";
403 $resql = $db->query($sql);
405 $numr = $db->num_rows($resql);
410 $objp = $db->fetch_object($resql);
415 if ($objp->nature == 2 && isModEnabled(
'facture') && !
getDolGlobalString(
'ACCOUNTING_DISABLE_BINDING_ON_SALES')) {
418 if ($objp->nature == 3
419 && isModEnabled(
'supplier_invoice')
421 $nature =
"purchases";
423 if ($objp->nature == 4 && isModEnabled(
'banque')) {
426 if ($objp->nature == 5 && isModEnabled(
'expensereport') && !
getDolGlobalString(
'ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS')) {
427 $nature =
"expensereports";
429 if ($objp->nature == 1) {
432 if ($objp->nature == 8) {
433 $nature =
"inventory";
435 if ($objp->nature == 9) {
441 if ($nature ==
'hasnew' || $nature ==
'inventory') {
447 $langs->load(
'accountancy');
448 $journallabel = $langs->transnoentities($objp->label);
449 $newmenu->add(
'/accountancy/journal/'.$nature.
'journal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal='.$objp->rowid, $journallabel, 2, $user->hasRight(
'accounting',
'comptarapport',
'lire'));
455 $newmenu->add(
'', $langs->trans(
"NoJournalDefined"), 2, $user->hasRight(
'accounting',
'comptarapport',
'lire'));
463 if (isModEnabled(
'ftp') && $mainmenu ==
'ftp') {
466 while ($i <= $MAXFTP) {
467 $paramkey =
'FTP_NAME_'.$i;
469 if (!empty($conf->global->$paramkey)) {
470 $link =
"/ftp/index.php?idmenu=".$_SESSION[
"idmenu"].
"&numero_ftp=".$i;
472 $newmenu->add($link,
dol_trunc($conf->global->$paramkey, 24));
482 $menu_array = $newmenu->liste;
483 if (is_array($menu_array_before)) {
484 $menu_array = array_merge($menu_array_before, $menu_array);
486 if (is_array($menu_array_after)) {
487 $menu_array = array_merge($menu_array, $menu_array_after);
490 if (!is_array($menu_array)) {
496 'mainmenu' => $mainmenu,
498 $hook_items = $menu_array;
499 $reshook = $hookmanager->executeHooks(
'menuLeftMenuItems', $parameters, $hook_items);
501 if (is_numeric($reshook)) {
502 if ($reshook == 0 && !empty($hookmanager->results)) {
503 $menu_array[] = $hookmanager->results;
504 } elseif ($reshook == 1) {
505 $menu_array = $hookmanager->results;
521 $blockvmenuopened =
false;
523 $num = count($menu_array);
524 for ($i = 0; $i < $num; $i++) {
526 if (
getDolGlobalString(
'MAIN_MENU_HIDE_UNAUTHORIZED') && empty($menu_array[$i][
'enabled'])) {
531 if (empty($menu_array[$i][
'level']) && $showmenu) {
533 $blockvmenuopened =
true;
535 for ($j = ($i + 1); $j < $num; $j++) {
536 if (empty($menu_array[$j][
'level'])) {
540 if ($altok % 2 == 0) {
541 print
'<div class="blockvmenu blockvmenuimpair'.$invert.($lastopened ?
' blockvmenulast' :
'').($altok == 1 ?
' blockvmenufirst' :
'').
'">'.
"\n";
543 print
'<div class="blockvmenu blockvmenupair'.$invert.($lastopened ?
' blockvmenulast' :
'').($altok == 1 ?
' blockvmenufirst' :
'').
'">'.
"\n";
549 $tabul = ($menu_array[$i][
'level'] - 1);
551 for ($j = 0; $j < $tabul; $j++) {
552 $tabstring .=
' ';
560 $url = $shorturl = $shorturlwithoutparam = $menu_array[$i][
'url'];
561 if (!preg_match(
"/^(http:\/\/|https:\/\/)/i", $menu_array[$i][
'url'])) {
562 $tmp = explode(
'?', $menu_array[$i][
'url'], 2);
563 $url = $shorturl = $tmp[0];
564 $param = (isset($tmp[1]) ? $tmp[1] :
'');
567 if ((!preg_match(
'/mainmenu/i', $param)) && (!preg_match(
'/leftmenu/i', $param)) && !empty($menu_array[$i][
'mainmenu'])) {
568 $param .= ($param ?
'&' :
'').
'mainmenu='.$menu_array[$i][
'mainmenu'].
'&leftmenu=';
570 if ((!preg_match(
'/mainmenu/i', $param)) && (!preg_match(
'/leftmenu/i', $param)) && empty($menu_array[$i][
'mainmenu'])) {
571 $param .= ($param ?
'&' :
'').
'leftmenu=';
575 $shorturlwithoutparam = $shorturl;
576 $shorturl = $shorturl.($param ?
'?'.$param :
'');
580 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";
583 if ($menu_array[$i][
'level'] == 0) {
584 if ($menu_array[$i][
'enabled']) {
585 print
'<div class="menu_titre">'.$tabstring;
586 if ($shorturlwithoutparam) {
587 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'].
'"' :
'').
'>';
589 print
'<span class="vmenu">';
591 if (!empty($menu_array[$i][
'prefix'])) {
592 if (preg_match(
'/^fa\-[a-zA-Z0-9\-_]+$/', $menu_array[$i][
'prefix'])) {
593 print
'<span class="fas '.$menu_array[$i][
'prefix'].
' paddingright pictofixedwidth"></span>';
595 print $menu_array[$i][
'prefix'];
600 print $menu_array[$i][
'titre'];
601 if ($shorturlwithoutparam) {
607 $lastlevel0 =
'enabled';
608 } elseif ($showmenu) {
609 print
'<div class="menu_titre">'.$tabstring;
610 print
'<span class="vmenudisabled">';
611 if (!empty($menu_array[$i][
'prefix'])) {
612 print $menu_array[$i][
'prefix'];
614 print $menu_array[$i][
'titre'];
617 $lastlevel0 =
'greyed';
619 $lastlevel0 =
'hidden';
622 print
'<div class="menu_top"></div>'.
"\n";
627 if ($menu_array[$i][
'level'] > 0) {
629 if ($menu_array[$i][
'url']) {
630 $cssmenu =
' menu_contenu'.dol_string_nospecial(preg_replace(
'/\.php.*$/',
'', $menu_array[$i][
'url']));
633 if ($menu_array[$i][
'enabled'] && $lastlevel0 ==
'enabled') {
635 print
'<div class="menu_contenu'.$cssmenu.
'">';
637 if ($shorturlwithoutparam) {
638 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'].
'"' :
'').
'>';
640 print
'<span class="vsmenu" title="'.dol_escape_htmltag($menu_array[$i][
'titre']).
'">';
642 print $menu_array[$i][
'titre'];
643 if ($shorturlwithoutparam) {
649 if (!strstr($menu_array[$i][
'titre'],
'<table')) {
653 } elseif ($showmenu && $lastlevel0 ==
'enabled') {
655 print
'<div class="menu_contenu'.$cssmenu.
'">';
657 print
'<span class="spanlilevel0 vsmenudisabled vsmenudisabledmargin">'.$menu_array[$i][
'titre'].
'</span><br>';
663 if (empty($menu_array[$i + 1][
'level'])) {
665 print
'<div class="menu_end"></div>'.
"\n";
667 if ($blockvmenuopened) {
669 $blockvmenuopened =
false;
675 print
'<div class="blockvmenuend"></div>';
679 return count($menu_array);