84 public function loadMenu($forcemainmenu =
'', $forceleftmenu =
'')
86 global $conf, $user, $langs;
89 if (GETPOSTISSET(
"mainmenu")) {
90 $_SESSION[
"mainmenu"] =
GETPOST(
"mainmenu",
'aZ09');
92 if (GETPOSTISSET(
"idmenu")) {
97 if (GETPOSTISSET(
"mainmenu")) {
99 $mainmenu =
GETPOST(
"mainmenu",
'aZ09');
100 $_SESSION[
"mainmenu"] = $mainmenu;
101 $_SESSION[
"leftmenuopened"] =
"";
104 $mainmenu = isset($_SESSION[
"mainmenu"]) ? $_SESSION[
"mainmenu"] :
'';
106 if (!empty($forcemainmenu)) {
107 $mainmenu = $forcemainmenu;
110 if (GETPOSTISSET(
"leftmenu")) {
112 $leftmenu =
GETPOST(
"leftmenu",
'aZ09');
113 $_SESSION[
"leftmenu"] = $leftmenu;
115 if ($_SESSION[
"leftmenuopened"] == $leftmenu) {
117 $_SESSION[
"leftmenuopened"] =
"";
119 $_SESSION[
"leftmenuopened"] = $leftmenu;
123 $leftmenu = isset($_SESSION[
"leftmenu"]) ? $_SESSION[
"leftmenu"] :
'';
125 if (!empty($forceleftmenu)) {
126 $leftmenu = $forceleftmenu;
129 require_once DOL_DOCUMENT_ROOT.
'/core/class/menubase.class.php';
131 $menuArbo =
new Menubase($this->db,
'auguria');
132 $menuArbo->menuLoad($mainmenu, $leftmenu, $this->type_user,
'auguria', $tabMenu);
133 $this->tabMenu = $tabMenu;
150 global $conf, $langs, $user;
152 require_once DOL_DOCUMENT_ROOT.
'/core/menus/standard/auguria.lib.php';
154 if ($this->type_user == 1) {
155 $conf->global->MAIN_SEARCHFORM_SOCIETE_DISABLED = 1;
156 $conf->global->MAIN_SEARCHFORM_CONTACT_DISABLED = 1;
159 require_once DOL_DOCUMENT_ROOT.
'/core/class/menu.class.php';
160 $this->menu =
new Menu();
163 if ($mode ==
'top') {
164 print_auguria_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 0, $mode);
166 if ($mode ==
'left') {
167 print_left_auguria_menu($this->db, $this->menu_array, $this->menu_array_after, $this->tabMenu, $this->menu, 0,
'',
'', $moredata);
170 $conf->global->MAIN_SHOW_LOGO = 0;
171 if ($mode ==
'top') {
172 print_left_auguria_menu($this->db, $this->menu_array, $this->menu_array_after, $this->tabMenu, $this->menu, 0);
174 if ($mode ==
'left') {
175 print_auguria_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 0, $mode);
179 if ($mode ==
'topnb') {
180 print_auguria_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 1, $mode);
181 return $this->menu->getNbOfVisibleMenuEntries();
184 if ($mode ==
'jmobile') {
185 print_auguria_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 1, $mode);
189 $lastlevel = array();
191 print
'<!-- Generate menu list from menu handler '.$this->name.
' -->'.
"\n";
192 foreach ($this->menu->liste as $key => $val) {
193 print
'<ul class="ulmenu" data-inset="true">';
194 print
'<li class="lilevel0">';
195 if ($val[
'enabled'] == 1) {
196 $substitarray = array(
'__LOGIN__' => $user->login,
'__USER_ID__' => $user->id,
'__USER_SUPERVISOR_ID__' => $user->fk_user);
197 $substitarray[
'__USERID__'] = $user->id;
201 $canonurl = preg_replace(
'/\?.*$/',
'', $val[
'url']);
203 print
'<a class="alilevel0" href="#">';
206 if ($val[
'level'] == 0 && !empty($val[
'prefix'])) {
207 print str_replace(
'<span class="',
'<span class="paddingright pictofixedwidth ', $val[
'prefix']);
214 $tmpmainmenu = $val[
'mainmenu'];
215 $tmpleftmenu =
'all';
216 $submenu =
new Menu();
217 print_left_auguria_menu($this->db, $this->menu_array, $this->menu_array_after, $this->tabMenu, $submenu, 1, $tmpmainmenu, $tmpleftmenu);
218 if (!empty($submenu->liste[0][
'url'])) {
224 $canonrelurl = preg_replace(
'/\?.*$/',
'', $relurl);
225 $canonnexturl = preg_replace(
'/\?.*$/',
'', $nexturl);
229 if (($canonrelurl != $canonnexturl && !in_array($val[
'mainmenu'], array(
'tools')))
230 || (strpos($canonrelurl,
'/product/index.php') !==
false || strpos($canonrelurl,
'/compta/bank/list.php') !==
false)) {
232 print str_pad(
'', 1).
'<li class="lilevel1 ui-btn-icon-right ui-btn">';
233 print
'<a href="'.$relurl.
'">';
235 if ($val[
'level'] == 0) {
236 print
'<span class="fas fa-home fa-fw paddingright pictofixedwidth" aria-hidden="true"></span>';
239 if ($langs->trans(ucfirst($val[
'mainmenu']).
"Dashboard") == ucfirst($val[
'mainmenu']).
"Dashboard") {
240 if (in_array($val[
'mainmenu'], array(
'cashdesk',
'externalsite',
'website',
'collab',
'takepos'))) {
241 print $langs->trans(
"Access");
243 print $langs->trans(
"Dashboard");
246 print $langs->trans(ucfirst($val[
'mainmenu']).
"Dashboard");
252 if ($val[
'level'] == 0) {
253 if ($val[
'enabled']) {
254 $lastlevel[0] =
'enabled';
255 } elseif ($showmenu) {
256 $lastlevel[0] =
'greyed';
258 $lastlevel[0] =
'hidden';
262 $lastlevel2 = array();
263 foreach ($submenu->liste as $key2 => $val2) {
270 if ($val2[
'level'] > 0) {
271 $levelcursor = $val2[
'level'] - 1;
272 while ($levelcursor >= 0) {
273 if ($lastlevel2[$levelcursor] !=
'enabled') {
281 $substitarray = array(
'__LOGIN__' => $user->login,
'__USER_ID__' => $user->id,
'__USER_SUPERVISOR_ID__' => $user->fk_user);
282 $substitarray[
'__USERID__'] = $user->id;
285 if (!preg_match(
"/^(http:\/\/|https:\/\/)/i", $val2[
'url'])) {
288 $relurl2 = $val2[
'url'];
290 $canonurl2 = preg_replace(
'/\?.*$/',
'', $val2[
'url']);
292 if (in_array($canonurl2, array(
'/admin/index.php',
'/admin/tools/index.php',
'/core/tools.php'))) {
297 if (!$val2[
'enabled']) {
298 $disabled =
" vsmenudisabled";
302 print str_pad(
'', $val2[
'level'] + 1);
303 print
'<li class="lilevel'.($val2[
'level'] + 1);
304 if ($val2[
'level'] == 0) {
305 print
' ui-btn-icon-right ui-btn';
307 print $disabled.
'">';
309 if ($val2[
'enabled']) {
310 print
'<a href="'.$relurl2.
'"';
313 $lastlevel2[$val2[
'level']] =
'enabled';
315 print
'<a href="#" class="vsmenudisabled">';
316 $lastlevel2[$val2[
'level']] =
'greyed';
319 if ($val2[
'enabled']) {
320 $lastlevel2[$val2[
'level']] =
'enabled';
322 $lastlevel2[$val2[
'level']] =
'greyed';
326 if ($val2[
'level'] == 0 && !empty($val2[
'prefix'])) {
327 print $val2[
'prefix'];
329 print
'<i class="fa fa-does-not-exists fa-fw paddingright pictofixedwidth"></i>';
332 print $val2[
'titre'];
342 if ($val[
'enabled'] == 2) {
343 print
'<span class="spanlilevel0 vsmenudisabled">';
346 if ($val[
'level'] == 0 && !empty($val[
'prefix'])) {
347 print $val[
'prefix'];