95 public function loadMenu($forcemainmenu =
'', $forceleftmenu =
'')
97 global $conf, $user, $langs;
100 if (GETPOSTISSET(
"mainmenu")) {
101 $_SESSION[
"mainmenu"] =
GETPOST(
"mainmenu",
'aZ09');
103 if (GETPOSTISSET(
"idmenu")) {
108 if (GETPOSTISSET(
"mainmenu")) {
110 $mainmenu =
GETPOST(
"mainmenu",
'aZ09');
111 $_SESSION[
"mainmenu"] = $mainmenu;
112 $_SESSION[
"leftmenuopened"] =
"";
115 $mainmenu = isset($_SESSION[
"mainmenu"]) ? $_SESSION[
"mainmenu"] :
'';
117 if (!empty($forcemainmenu)) {
118 $mainmenu = $forcemainmenu;
121 if (GETPOSTISSET(
"leftmenu")) {
123 $leftmenu =
GETPOST(
"leftmenu",
'aZ09');
124 $_SESSION[
"leftmenu"] = $leftmenu;
126 if ($_SESSION[
"leftmenuopened"] == $leftmenu) {
128 $_SESSION[
"leftmenuopened"] =
"";
130 $_SESSION[
"leftmenuopened"] = $leftmenu;
134 $leftmenu = isset($_SESSION[
"leftmenu"]) ? $_SESSION[
"leftmenu"] :
'';
136 if (!empty($forceleftmenu)) {
137 $leftmenu = $forceleftmenu;
140 require_once DOL_DOCUMENT_ROOT.
'/core/class/menubase.class.php';
142 $menuArbo =
new Menubase($this->db,
'auguria');
143 $menuArbo->menuLoad($mainmenu, $leftmenu, $this->type_user,
'auguria', $tabMenu);
144 $this->tabMenu = $tabMenu;
161 global $conf, $langs, $user;
163 require_once DOL_DOCUMENT_ROOT.
'/core/menus/standard/auguria.lib.php';
165 if ($this->type_user == 1) {
166 $conf->global->MAIN_SEARCHFORM_SOCIETE_DISABLED = 1;
167 $conf->global->MAIN_SEARCHFORM_CONTACT_DISABLED = 1;
170 require_once DOL_DOCUMENT_ROOT.
'/core/class/menu.class.php';
171 $this->menu =
new Menu();
174 if ($mode ==
'top') {
175 print_auguria_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 0, $mode);
177 if ($mode ==
'left') {
178 print_left_auguria_menu($this->db, $this->menu_array, $this->menu_array_after, $this->tabMenu, $this->menu, 0,
'',
'', $moredata);
181 $conf->global->MAIN_SHOW_LOGO = 0;
182 if ($mode ==
'top') {
183 print_left_auguria_menu($this->db, $this->menu_array, $this->menu_array_after, $this->tabMenu, $this->menu, 0);
185 if ($mode ==
'left') {
186 print_auguria_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 0, $mode);
190 if ($mode ==
'topnb') {
191 print_auguria_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 1, $mode);
192 return $this->menu->getNbOfVisibleMenuEntries();
195 if ($mode ==
'jmobile') {
196 print_auguria_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 1, $mode);
200 $lastlevel = array();
202 print
'<!-- Generate menu list from menu handler '.$this->name.
' -->'.
"\n";
203 foreach ($this->menu->liste as $key => $val) {
204 print
'<ul class="ulmenu" data-inset="true">';
205 print
'<li class="lilevel0">';
206 if ($val[
'enabled'] == 1) {
207 $substitarray = array(
'__LOGIN__' => $user->login,
'__USER_ID__' => $user->id,
'__USER_SUPERVISOR_ID__' => $user->fk_user);
208 $substitarray[
'__USERID__'] = $user->id;
212 $canonurl = preg_replace(
'/\?.*$/',
'', $val[
'url']);
214 print
'<a class="alilevel0" href="#">';
217 if ($val[
'level'] == 0 && !empty($val[
'prefix'])) {
218 print str_replace(
'<span class="',
'<span class="paddingright pictofixedwidth ', $val[
'prefix']);
225 $tmpmainmenu = $val[
'mainmenu'];
226 $tmpleftmenu =
'all';
227 $submenu =
new Menu();
228 print_left_auguria_menu($this->db, $this->menu_array, $this->menu_array_after, $this->tabMenu, $submenu, 1, $tmpmainmenu, $tmpleftmenu);
229 if (!empty($submenu->liste[0][
'url'])) {
235 $canonrelurl = preg_replace(
'/\?.*$/',
'', $relurl);
236 $canonnexturl = preg_replace(
'/\?.*$/',
'', $nexturl);
240 if (($canonrelurl != $canonnexturl && !in_array($val[
'mainmenu'], array(
'tools')))
241 || (strpos($canonrelurl,
'/product/index.php') !==
false || strpos($canonrelurl,
'/compta/bank/list.php') !==
false)) {
243 print str_pad(
'', 1).
'<li class="lilevel1 ui-btn-icon-right ui-btn">';
244 print
'<a href="'.$relurl.
'">';
246 if ($val[
'level'] == 0) {
247 print
'<span class="fas fa-home fa-fw paddingright pictofixedwidth" aria-hidden="true"></span>';
250 if ($langs->trans(ucfirst($val[
'mainmenu']).
"Dashboard") == ucfirst($val[
'mainmenu']).
"Dashboard") {
251 if (in_array($val[
'mainmenu'], array(
'cashdesk',
'externalsite',
'website',
'collab',
'takepos'))) {
252 print $langs->trans(
"Access");
254 print $langs->trans(
"Dashboard");
257 print $langs->trans(ucfirst($val[
'mainmenu']).
"Dashboard");
263 if ($val[
'level'] == 0) {
264 if ($val[
'enabled']) {
265 $lastlevel[0] =
'enabled';
266 } elseif ($showmenu) {
267 $lastlevel[0] =
'greyed';
269 $lastlevel[0] =
'hidden';
273 $lastlevel2 = array();
274 foreach ($submenu->liste as $key2 => $val2) {
281 if ($val2[
'level'] > 0) {
282 $levelcursor = $val2[
'level'] - 1;
283 while ($levelcursor >= 0) {
285 if ($lastlevel2[$levelcursor] !=
'enabled') {
293 $substitarray = array(
'__LOGIN__' => $user->login,
'__USER_ID__' => $user->id,
'__USER_SUPERVISOR_ID__' => $user->fk_user);
294 $substitarray[
'__USERID__'] = $user->id;
297 if (!preg_match(
"/^(http:\/\/|https:\/\/)/i", $val2[
'url'])) {
300 $relurl2 = $val2[
'url'];
302 $canonurl2 = preg_replace(
'/\?.*$/',
'', $val2[
'url']);
304 if (in_array($canonurl2, array(
'/admin/index.php',
'/admin/tools/index.php',
'/core/tools.php'))) {
309 if (!$val2[
'enabled']) {
310 $disabled =
" vsmenudisabled";
314 print str_pad(
'', $val2[
'level'] + 1);
315 print
'<li class="lilevel'.($val2[
'level'] + 1);
316 if ($val2[
'level'] == 0) {
317 print
' ui-btn-icon-right ui-btn';
319 print $disabled.
'">';
321 if ($val2[
'enabled']) {
322 print
'<a href="'.$relurl2.
'"';
325 $lastlevel2[$val2[
'level']] =
'enabled';
327 print
'<a href="#" class="vsmenudisabled">';
328 $lastlevel2[$val2[
'level']] =
'greyed';
331 if ($val2[
'enabled']) {
332 $lastlevel2[$val2[
'level']] =
'enabled';
334 $lastlevel2[$val2[
'level']] =
'greyed';
338 if ($val2[
'level'] == 0 && !empty($val2[
'prefix'])) {
339 print $val2[
'prefix'];
341 print
'<i class="fa fa-does-not-exists fa-fw paddingright pictofixedwidth"></i>';
344 print $val2[
'titre'];
354 if ($val[
'enabled'] == 2) {
355 print
'<span class="spanlilevel0 vsmenudisabled">';
358 if ($val[
'level'] == 0 && !empty($val[
'prefix'])) {
359 print $val[
'prefix'];