71 public function loadMenu($forcemainmenu =
'', $forceleftmenu =
'')
73 global $conf, $user, $langs;
76 if (GETPOSTISSET(
"mainmenu")) {
77 $_SESSION[
"mainmenu"] =
GETPOST(
"mainmenu",
'aZ09');
79 if (GETPOSTISSET(
"idmenu")) {
80 $_SESSION[
"idmenu"] =
GETPOST(
"idmenu",
'int');
84 if (GETPOSTISSET(
"mainmenu")) {
86 $mainmenu =
GETPOST(
"mainmenu",
'aZ09');
87 $_SESSION[
"mainmenu"] = $mainmenu;
88 $_SESSION[
"leftmenuopened"] =
"";
91 $mainmenu = isset($_SESSION[
"mainmenu"]) ? $_SESSION[
"mainmenu"] :
'';
93 if (!empty($forcemainmenu)) {
94 $mainmenu = $forcemainmenu;
97 if (GETPOSTISSET(
"leftmenu")) {
99 $leftmenu =
GETPOST(
"leftmenu",
'aZ09');
100 $_SESSION[
"leftmenu"] = $leftmenu;
102 if ($_SESSION[
"leftmenuopened"] == $leftmenu) {
104 $_SESSION[
"leftmenuopened"] =
"";
106 $_SESSION[
"leftmenuopened"] = $leftmenu;
110 $leftmenu = isset($_SESSION[
"leftmenu"]) ? $_SESSION[
"leftmenu"] :
'';
112 if (!empty($forceleftmenu)) {
113 $leftmenu = $forceleftmenu;
116 require_once DOL_DOCUMENT_ROOT.
'/core/class/menubase.class.php';
118 $menuArbo =
new Menubase($this->db,
'auguria');
119 $menuArbo->menuLoad($mainmenu, $leftmenu, $this->type_user,
'auguria', $tabMenu);
120 $this->tabMenu = $tabMenu;
137 global $conf, $langs, $user;
139 require_once DOL_DOCUMENT_ROOT.
'/core/menus/standard/auguria.lib.php';
141 if ($this->type_user == 1) {
142 $conf->global->MAIN_SEARCHFORM_SOCIETE_DISABLED = 1;
143 $conf->global->MAIN_SEARCHFORM_CONTACT_DISABLED = 1;
146 require_once DOL_DOCUMENT_ROOT.
'/core/class/menu.class.php';
147 $this->menu =
new Menu();
150 if ($mode ==
'top') {
151 print_auguria_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 0, $mode);
153 if ($mode ==
'left') {
154 print_left_auguria_menu($this->db, $this->menu_array, $this->menu_array_after, $this->tabMenu, $this->menu, 0,
'',
'', $moredata);
157 $conf->global->MAIN_SHOW_LOGO = 0;
158 if ($mode ==
'top') {
159 print_left_auguria_menu($this->db, $this->menu_array, $this->menu_array_after, $this->tabMenu, $this->menu, 0);
161 if ($mode ==
'left') {
162 print_auguria_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 0, $mode);
166 if ($mode ==
'topnb') {
167 print_auguria_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 1, $mode);
168 return $this->menu->getNbOfVisibleMenuEntries();
171 if ($mode ==
'jmobile') {
172 print_auguria_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 1, $mode);
176 $lastlevel = array();
178 print
'<!-- Generate menu list from menu handler '.$this->name.
' -->'.
"\n";
179 foreach ($this->menu->liste as $key => $val) {
180 print
'<ul class="ulmenu" data-inset="true">';
181 print
'<li class="lilevel0">';
182 if ($val[
'enabled'] == 1) {
183 $substitarray = array(
'__LOGIN__' => $user->login,
'__USER_ID__' => $user->id,
'__USER_SUPERVISOR_ID__' => $user->fk_user);
184 $substitarray[
'__USERID__'] = $user->id;
188 $canonurl = preg_replace(
'/\?.*$/',
'', $val[
'url']);
190 print
'<a class="alilevel0" href="#">';
193 if ($val[
'level'] == 0 && !empty($val[
'prefix'])) {
194 print str_replace(
'<span class="',
'<span class="paddingright pictofixedwidth ', $val[
'prefix']);
201 $tmpmainmenu = $val[
'mainmenu'];
202 $tmpleftmenu =
'all';
203 $submenu =
new Menu();
204 print_left_auguria_menu($this->db, $this->menu_array, $this->menu_array_after, $this->tabMenu, $submenu, 1, $tmpmainmenu, $tmpleftmenu);
205 if (!empty($submenu->liste[0][
'url'])) {
211 $canonrelurl = preg_replace(
'/\?.*$/',
'', $relurl);
212 $canonnexturl = preg_replace(
'/\?.*$/',
'', $nexturl);
216 if (($canonrelurl != $canonnexturl && !in_array($val[
'mainmenu'], array(
'tools')))
217 || (strpos($canonrelurl,
'/product/index.php') !==
false || strpos($canonrelurl,
'/compta/bank/list.php') !==
false)) {
219 print str_pad(
'', 1).
'<li class="lilevel1 ui-btn-icon-right ui-btn">';
220 print
'<a href="'.$relurl.
'">';
222 if ($val[
'level'] == 0) {
223 print
'<span class="fas fa-home fa-fw paddingright pictofixedwidth" aria-hidden="true"></span>';
226 if ($langs->trans(ucfirst($val[
'mainmenu']).
"Dashboard") == ucfirst($val[
'mainmenu']).
"Dashboard") {
227 if (in_array($val[
'mainmenu'], array(
'cashdesk',
'externalsite',
'website',
'collab',
'takepos'))) {
228 print $langs->trans(
"Access");
230 print $langs->trans(
"Dashboard");
233 print $langs->trans(ucfirst($val[
'mainmenu']).
"Dashboard");
239 if ($val[
'level'] == 0) {
240 if ($val[
'enabled']) {
241 $lastlevel[0] =
'enabled';
242 } elseif ($showmenu) {
243 $lastlevel[0] =
'greyed';
245 $lastlevel[0] =
'hidden';
249 $lastlevel2 = array();
250 foreach ($submenu->liste as $key2 => $val2) {
257 if ($val2[
'level'] > 0) {
258 $levelcursor = $val2[
'level'] - 1;
259 while ($levelcursor >= 0) {
260 if ($lastlevel2[$levelcursor] !=
'enabled') {
268 $substitarray = array(
'__LOGIN__' => $user->login,
'__USER_ID__' => $user->id,
'__USER_SUPERVISOR_ID__' => $user->fk_user);
269 $substitarray[
'__USERID__'] = $user->id;
272 if (!preg_match(
"/^(http:\/\/|https:\/\/)/i", $val2[
'url'])) {
275 $relurl2 = $val2[
'url'];
277 $canonurl2 = preg_replace(
'/\?.*$/',
'', $val2[
'url']);
279 if (in_array($canonurl2, array(
'/admin/index.php',
'/admin/tools/index.php',
'/core/tools.php'))) {
284 if (!$val2[
'enabled']) {
285 $disabled =
" vsmenudisabled";
288 print str_pad(
'', $val2[
'level'] + 1);
289 print
'<li class="lilevel'.($val2[
'level'] + 1);
290 if ($val2[
'level'] == 0) {
291 print
' ui-btn-icon-right ui-btn';
293 print $disabled.
'">';
295 if ($val2[
'enabled']) {
296 print
'<a href="'.$relurl2.
'"';
299 $lastlevel2[$val2[
'level']] =
'enabled';
301 print
'<a href="#" class="vsmenudisabled">';
302 $lastlevel2[$val2[
'level']] =
'greyed';
305 if ($val2[
'enabled']) {
306 $lastlevel2[$val2[
'level']] =
'enabled';
308 $lastlevel2[$val2[
'level']] =
'greyed';
312 if ($val2[
'level'] == 0 && !empty($val2[
'prefix'])) {
313 print $val2[
'prefix'];
315 print
'<i class="fa fa-does-not-exists fa-fw paddingright pictofixedwidth"></i>';
318 print $val2[
'titre'];
320 if ($val2[
'enabled']) {
332 if ($val[
'enabled'] == 2) {
333 print
'<span class="spanlilevel0 vsmenudisabled">';
336 if ($val[
'level'] == 0 && !empty($val[
'prefix'])) {
337 print $val[
'prefix'];