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(
',', $conf->global->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 && empty($conf->global->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);
140 if (empty($conf->global->MAIN_MENU_INVERT) && empty($noout) && !empty($conf->global->MAIN_SHOW_LOGO) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)) {
142 $mysoc->logo_squarred_mini = (empty($conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI) ?
'' : $conf->global->MAIN_INFO_SOCIETE_LOGO_SQUARRED_MINI);
144 $logoContainerAdditionalClass =
'backgroundforcompanylogo';
145 if (!empty($conf->global->MAIN_INFO_SOCIETE_LOGO_NO_BACKGROUND)) {
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));
307function print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$tabMenu, &$menu, $noout = 0, $forcemainmenu =
'', $forceleftmenu =
'', $moredata =
null, $type_user = 0)
309 global $user, $conf, $langs, $hookmanager;
310 global $dolibarr_main_db_name, $mysoc;
314 $mainmenu = ($forcemainmenu ? $forcemainmenu : $_SESSION[
"mainmenu"]);
315 $leftmenu = ($forceleftmenu ?
'' : (empty($_SESSION[
"leftmenu"]) ?
'none' : $_SESSION[
"leftmenu"]));
317 global $usemenuhider;
320 if (is_array($moredata) && !empty($moredata[
'searchform'])) {
322 print
"<!-- Begin SearchForm -->\n";
323 print
'<div id="blockvmenusearch" class="blockvmenusearch">'.
"\n";
324 print $moredata[
'searchform'];
326 print
"<!-- End SearchForm -->\n";
329 if (is_array($moredata) && !empty($moredata[
'bookmarks'])) {
331 print
"<!-- Begin Bookmarks -->\n";
332 print
'<div id="blockvmenubookmarks" class="blockvmenubookmarks">'.
"\n";
333 print $moredata[
'bookmarks'];
335 print
"<!-- End Bookmarks -->\n";
341 $menuArbo =
new Menubase($db,
'auguria');
342 $newmenu = $menuArbo->menuLeftCharger($newmenu, $mainmenu, $leftmenu, ($user->socid ? 1 : 0),
'auguria', $tabMenu);
345 if (isModEnabled(
'banque') && $user->hasRight(
'banque',
'lire') && $mainmenu ==
'bank') {
346 include_once DOL_DOCUMENT_ROOT.
'/compta/bank/class/account.class.php';
348 $sql =
"SELECT rowid, label, courant, rappro, courant";
349 $sql .=
" FROM ".MAIN_DB_PREFIX.
"bank_account";
350 $sql .=
" WHERE entity = ".$conf->entity;
351 $sql .=
" AND clos = 0";
352 $sql .=
" ORDER BY label";
354 $resql = $db->query($sql);
356 $numr = $db->num_rows($resql);
360 $newmenu->add(
'/compta/bank/list.php', $langs->trans(
"BankAccounts"), 0, $user->rights->banque->lire);
364 $objp = $db->fetch_object($resql);
365 $newmenu->add(
'/compta/bank/card.php?id='.$objp->rowid, $objp->label, 1, $user->rights->banque->lire);
367 $newmenu->add(
'/compta/bank/bankentries_list.php?id='.$objp->rowid, $langs->trans(
"Conciliate"), 2, $user->rights->banque->consolidate);
377 if (isModEnabled(
'accounting') && $user->hasRight(
'accounting',
'comptarapport',
'lire') && $mainmenu ==
'accountancy') {
378 $newmenu->add(
'', $langs->trans(
"RegistrationInAccounting"), 1, $user->hasRight(
'accounting',
'comptarapport',
'lire'),
'',
'accountancy',
'accountancy_journal', 10);
381 $sql =
"SELECT rowid, code, label, nature";
382 $sql .=
" FROM ".MAIN_DB_PREFIX.
"accounting_journal";
383 $sql .=
" WHERE entity = ".$conf->entity;
384 $sql .=
" AND active = 1";
385 $sql .=
" ORDER BY label DESC";
387 $resql = $db->query($sql);
389 $numr = $db->num_rows($resql);
394 $objp = $db->fetch_object($resql);
399 if ($objp->nature == 2 && isModEnabled(
'facture') && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_SALES)) {
402 if ($objp->nature == 3
403 && isModEnabled(
'supplier_invoice')
404 && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_PURCHASES)) {
405 $nature =
"purchases";
407 if ($objp->nature == 4 && isModEnabled(
'banque')) {
410 if ($objp->nature == 5 && isModEnabled(
'expensereport') && empty($conf->global->ACCOUNTING_DISABLE_BINDING_ON_EXPENSEREPORTS)) {
411 $nature =
"expensereports";
413 if ($objp->nature == 1) {
416 if ($objp->nature == 8) {
417 $nature =
"inventory";
419 if ($objp->nature == 9) {
424 if (empty($conf->global->ACCOUNTANCY_SHOW_DEVELOP_JOURNAL)) {
425 if ($nature ==
'hasnew' || $nature ==
'inventory') {
431 $langs->load(
'accountancy');
432 $journallabel = $langs->transnoentities($objp->label);
433 $newmenu->add(
'/accountancy/journal/'.$nature.
'journal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal='.$objp->rowid, $journallabel, 2, $user->hasRight(
'accounting',
'comptarapport',
'lire'));
439 $newmenu->add(
'', $langs->trans(
"NoJournalDefined"), 2, $user->hasRight(
'accounting',
'comptarapport',
'lire'));
447 if (isModEnabled(
'ftp') && $mainmenu ==
'ftp') {
450 while ($i <= $MAXFTP) {
451 $paramkey =
'FTP_NAME_'.$i;
453 if (!empty($conf->global->$paramkey)) {
454 $link =
"/ftp/index.php?idmenu=".$_SESSION[
"idmenu"].
"&numero_ftp=".$i;
456 $newmenu->add($link,
dol_trunc($conf->global->$paramkey, 24));
466 $menu_array = $newmenu->liste;
467 if (is_array($menu_array_before)) {
468 $menu_array = array_merge($menu_array_before, $menu_array);
470 if (is_array($menu_array_after)) {
471 $menu_array = array_merge($menu_array, $menu_array_after);
474 if (!is_array($menu_array)) {
480 'mainmenu' => $mainmenu,
482 $hook_items = $menu_array;
483 $reshook = $hookmanager->executeHooks(
'menuLeftMenuItems', $parameters, $hook_items);
485 if (is_numeric($reshook)) {
486 if ($reshook == 0 && !empty($hookmanager->results)) {
487 $menu_array[] = $hookmanager->results;
488 } elseif ($reshook == 1) {
489 $menu_array = $hookmanager->results;
502 $invert = empty($conf->global->MAIN_MENU_INVERT) ?
"" :
"invert";
505 $blockvmenuopened =
false;
507 $num = count($menu_array);
508 for ($i = 0; $i < $num; $i++) {
510 if (!empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED) && empty($menu_array[$i][
'enabled'])) {
515 if (empty($menu_array[$i][
'level']) && $showmenu) {
517 $blockvmenuopened =
true;
519 for ($j = ($i + 1); $j < $num; $j++) {
520 if (empty($menu_array[$j][
'level'])) {
524 if ($altok % 2 == 0) {
525 print
'<div class="blockvmenu blockvmenuimpair'.$invert.($lastopened ?
' blockvmenulast' :
'').($altok == 1 ?
' blockvmenufirst' :
'').
'">'.
"\n";
527 print
'<div class="blockvmenu blockvmenupair'.$invert.($lastopened ?
' blockvmenulast' :
'').($altok == 1 ?
' blockvmenufirst' :
'').
'">'.
"\n";
533 $tabul = ($menu_array[$i][
'level'] - 1);
535 for ($j = 0; $j < $tabul; $j++) {
536 $tabstring .=
' ';
544 $url = $shorturl = $shorturlwithoutparam = $menu_array[$i][
'url'];
545 if (!preg_match(
"/^(http:\/\/|https:\/\/)/i", $menu_array[$i][
'url'])) {
546 $tmp = explode(
'?', $menu_array[$i][
'url'], 2);
547 $url = $shorturl = $tmp[0];
548 $param = (isset($tmp[1]) ? $tmp[1] :
'');
551 if ((!preg_match(
'/mainmenu/i', $param)) && (!preg_match(
'/leftmenu/i', $param)) && !empty($menu_array[$i][
'mainmenu'])) {
552 $param .= ($param ?
'&' :
'').
'mainmenu='.$menu_array[$i][
'mainmenu'].
'&leftmenu=';
554 if ((!preg_match(
'/mainmenu/i', $param)) && (!preg_match(
'/leftmenu/i', $param)) && empty($menu_array[$i][
'mainmenu'])) {
555 $param .= ($param ?
'&' :
'').
'leftmenu=';
559 $shorturlwithoutparam = $shorturl;
560 $shorturl = $shorturl.($param ?
'?'.$param :
'');
564 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";
567 if ($menu_array[$i][
'level'] == 0) {
568 if ($menu_array[$i][
'enabled']) {
569 print
'<div class="menu_titre">'.$tabstring;
570 if ($shorturlwithoutparam) {
571 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'].
'"' :
'').
'>';
573 print
'<span class="vmenu">';
575 print ($menu_array[$i][
'prefix'] ? $menu_array[$i][
'prefix'] :
'').$menu_array[$i][
'titre'];
576 if ($shorturlwithoutparam) {
582 $lastlevel0 =
'enabled';
583 } elseif ($showmenu) {
584 print
'<div class="menu_titre">'.$tabstring;
585 print
'<span class="vmenudisabled">';
586 print ($menu_array[$i][
'prefix'] ? $menu_array[$i][
'prefix'] :
'').$menu_array[$i][
'titre'];
589 $lastlevel0 =
'greyed';
591 $lastlevel0 =
'hidden';
594 print
'<div class="menu_top"></div>'.
"\n";
599 if ($menu_array[$i][
'level'] > 0) {
601 if ($menu_array[$i][
'url']) {
602 $cssmenu =
' menu_contenu'.dol_string_nospecial(preg_replace(
'/\.php.*$/',
'', $menu_array[$i][
'url']));
605 if ($menu_array[$i][
'enabled'] && $lastlevel0 ==
'enabled') {
607 print
'<div class="menu_contenu'.$cssmenu.
'">';
609 if ($shorturlwithoutparam) {
610 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'].
'"' :
'').
'>';
612 print
'<span class="vsmenu" title="'.dol_escape_htmltag($menu_array[$i][
'titre']).
'">';
614 print $menu_array[$i][
'titre'];
615 if ($shorturlwithoutparam) {
621 if (!strstr($menu_array[$i][
'titre'],
'<table')) {
625 } elseif ($showmenu && $lastlevel0 ==
'enabled') {
627 print
'<div class="menu_contenu'.$cssmenu.
'">';
629 print
'<span class="spanlilevel0 vsmenudisabled vsmenudisabledmargin">'.$menu_array[$i][
'titre'].
'</span><br>';
635 if (empty($menu_array[$i + 1][
'level'])) {
637 print
'<div class="menu_end"></div>'.
"\n";
639 if ($blockvmenuopened) {
641 $blockvmenuopened =
false;
647 print
'<div class="blockvmenuend"></div>';
651 return count($menu_array);