94 public function loadMenu($forcemainmenu =
'', $forceleftmenu =
'')
96 global $conf, $user, $langs;
99 if (GETPOSTISSET(
"mainmenu")) {
100 $_SESSION[
"mainmenu"] =
GETPOST(
"mainmenu",
'aZ09');
102 if (GETPOSTISSET(
"idmenu")) {
107 if (GETPOSTISSET(
"mainmenu")) {
109 $mainmenu =
GETPOST(
"mainmenu",
'aZ09');
110 $_SESSION[
"mainmenu"] = $mainmenu;
111 $_SESSION[
"leftmenuopened"] =
"";
114 $mainmenu = isset($_SESSION[
"mainmenu"]) ? $_SESSION[
"mainmenu"] :
'';
116 if (!empty($forcemainmenu)) {
117 $mainmenu = $forcemainmenu;
120 if (GETPOSTISSET(
"leftmenu")) {
122 $leftmenu =
GETPOST(
"leftmenu",
'aZ09');
123 $_SESSION[
"leftmenu"] = $leftmenu;
125 if ($_SESSION[
"leftmenuopened"] == $leftmenu) {
127 $_SESSION[
"leftmenuopened"] =
"";
129 $_SESSION[
"leftmenuopened"] = $leftmenu;
133 $leftmenu = isset($_SESSION[
"leftmenu"]) ? $_SESSION[
"leftmenu"] :
'';
135 if (!empty($forceleftmenu)) {
136 $leftmenu = $forceleftmenu;
139 require_once DOL_DOCUMENT_ROOT.
'/core/class/menubase.class.php';
141 $menuArbo =
new Menubase($this->db,
'eldy');
142 $menuArbo->menuLoad($mainmenu, $leftmenu, $this->type_user,
'eldy', $tabMenu);
143 $this->tabMenu = $tabMenu;
157 global $conf, $langs, $user;
159 require_once DOL_DOCUMENT_ROOT.
'/core/menus/standard/eldy.lib.php';
161 if ($this->type_user == 1) {
162 $conf->global->MAIN_SEARCHFORM_SOCIETE_DISABLED = 1;
163 $conf->global->MAIN_SEARCHFORM_CONTACT_DISABLED = 1;
166 require_once DOL_DOCUMENT_ROOT.
'/core/class/menu.class.php';
167 $this->menu =
new Menu();
170 if ($mode ==
'top') {
171 print_eldy_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 0, $mode);
173 if ($mode ==
'left') {
174 print_left_eldy_menu($this->db, $this->menu_array, $this->menu_array_after, $this->tabMenu, $this->menu, 0,
'',
'', $moredata, $this->type_user);
176 if ($mode ==
'leftdropdown') {
178 $leftmenudropdown =
print_left_eldy_menu($this->db, $this->menu_array, $this->menu_array_after, $this->tabMenu, $this->menu, 1,
'',
'', $moredata, $this->type_user);
181 $conf->global->MAIN_SHOW_LOGO = 0;
182 if ($mode ==
'top') {
183 print_left_eldy_menu($this->db, $this->menu_array, $this->menu_array_after, $this->tabMenu, $this->menu, 0,
'',
'', $moredata, $this->type_user);
185 if ($mode ==
'left') {
186 print_eldy_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 0, $mode);
189 if ($mode ==
'topnb') {
190 print_eldy_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 1, $mode);
191 return $this->menu->getNbOfVisibleMenuEntries();
194 if ($mode ==
'jmobile') {
195 print_eldy_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 1, $mode);
199 $lastlevel = array();
200 print
'<!-- Generate menu list from menu handler '.$this->name.
' -->'.
"\n";
201 foreach ($this->menu->liste as $key => $val) {
202 print
'<ul class="ulmenu" data-inset="true">';
203 print
'<li class="lilevel0">';
205 if ($val[
'enabled'] == 1) {
206 $substitarray = array(
'__LOGIN__' => $user->login,
'__USER_ID__' => $user->id,
'__USER_SUPERVISOR_ID__' => $user->fk_user);
207 $substitarray[
'__USERID__'] = $user->id;
210 if (!preg_match(
'/^http/', $val[
'url'])) {
213 $relurl = $val[
'url'];
216 $canonurl = preg_replace(
'/\?.*$/',
'', $val[
'url']);
218 print
'<a class="alilevel0" href="#">';
221 if ($val[
'level'] == 0 && !empty($val[
'prefix'])) {
222 if (preg_match(
'/^fa\-[a-zA-Z0-9\-_]+$/', $val[
'prefix'])) {
223 print
'<span class="fas '.$val[
'prefix'].
' paddingright pictofixedwidth"></span>';
225 print str_replace(
'<span class="',
'<span class="paddingright pictofixedwidth ', $val[
'prefix']);
232 $tmpmainmenu = $val[
'mainmenu'];
233 $tmpleftmenu =
'all';
234 $submenu =
new Menu();
235 print_left_eldy_menu($this->db, $this->menu_array, $this->menu_array_after, $this->tabMenu, $submenu, 1, $tmpmainmenu, $tmpleftmenu,
null, $this->type_user);
243 $nexturl =
dol_buildpath(empty($submenu->liste[0][
'url']) ?
'' : $submenu->liste[0][
'url'], 1);
245 $canonrelurl = preg_replace(
'/\?.*$/',
'', $relurl);
246 $canonnexturl = preg_replace(
'/\?.*$/',
'', $nexturl);
251 if (($canonrelurl != $canonnexturl && !in_array($val[
'mainmenu'], array(
'tools')))
252 || (strpos($canonrelurl,
'/product/index.php') !==
false || strpos($canonrelurl,
'/compta/bank/list.php') !==
false)) {
254 print str_pad(
'', 1).
'<li class="lilevel1 ui-btn-icon-right ui-btn">';
255 print
'<a href="'.$relurl.
'">';
257 if ($val[
'level'] == 0) {
258 print
'<span class="fas fa-home fa-fw paddingright pictofixedwidth" aria-hidden="true"></span>';
261 if ($langs->trans(ucfirst($val[
'mainmenu']).
"Dashboard") == ucfirst($val[
'mainmenu']).
"Dashboard") {
262 if (in_array($val[
'mainmenu'], array(
'cashdesk',
'externalsite',
'website',
'collab',
'takepos'))) {
263 print $langs->trans(
"Access");
265 print $langs->trans(
"Dashboard");
268 print $langs->trans(ucfirst($val[
'mainmenu']).
"Dashboard");
287 $lastlevel2 = array();
288 '@phan-var-force array<string> $lastlevel2';
289 foreach ($submenu->liste as $key2 => $val2) {
296 if ($val2[
'level'] > 0) {
297 $levelcursor = $val2[
'level'] - 1;
298 while ($levelcursor >= 0) {
299 if ($lastlevel2[$levelcursor] !=
'enabled') {
307 $substitarray = array(
'__LOGIN__' => $user->login,
'__USER_ID__' => $user->id,
'__USER_SUPERVISOR_ID__' => $user->fk_user);
308 $substitarray[
'__USERID__'] = $user->id;
311 if (!preg_match(
"/^(http:\/\/|https:\/\/)/i", $val2[
'url'])) {
314 $relurl2 = $val2[
'url'];
316 $canonurl2 = preg_replace(
'/\?.*$/',
'', $val2[
'url']);
318 if (in_array($canonurl2, array(
'/admin/index.php',
'/admin/tools/index.php',
'/core/tools.php'))) {
323 if (!$val2[
'enabled']) {
324 $disabled =
" vsmenudisabled";
328 print str_pad(
'', $val2[
'level'] + 1);
329 print
'<li class="lilevel'.($val2[
'level'] + 1);
330 if ($val2[
'level'] == 0) {
331 print
' ui-btn-icon-right ui-btn';
333 print $disabled.
'">';
335 if ($val2[
'enabled']) {
336 print
'<a href="'.$relurl2.
'"';
339 $lastlevel2[$val2[
'level']] =
'enabled';
341 print
'<a href="#" class="vsmenudisabled">';
342 $lastlevel2[$val2[
'level']] =
'greyed';
345 if ($val2[
'enabled']) {
346 $lastlevel2[$val2[
'level']] =
'enabled';
348 $lastlevel2[$val2[
'level']] =
'greyed';
353 if ($val2[
'level'] == 0 && !empty($val2[
'prefix'])) {
354 print $val2[
'prefix'];
357 print $val2[
'titre'];
367 if ($val[
'enabled'] == 2) {
368 print
'<span class="spanlilevel0 vsmenudisabled">';
371 if ($val[
'level'] == 0 && !empty($val[
'prefix'])) {
372 print $val[
'prefix'];
print_left_eldy_menu($db, $menu_array_before, $menu_array_after, &$tabMenu, &$menu, $noout=0, $forcemainmenu='', $forceleftmenu='', $moredata=null, $type_user=0)
Core function to output left menu eldy Fill &$menu (example with $forcemainmenu='home' $forceleftmenu...