83 public function loadMenu($forcemainmenu =
'', $forceleftmenu =
'')
85 global $conf, $user, $langs;
88 if (GETPOSTISSET(
"mainmenu")) {
89 $_SESSION[
"mainmenu"] =
GETPOST(
"mainmenu",
'aZ09');
91 if (GETPOSTISSET(
"idmenu")) {
96 if (GETPOSTISSET(
"mainmenu")) {
98 $mainmenu =
GETPOST(
"mainmenu",
'aZ09');
99 $_SESSION[
"mainmenu"] = $mainmenu;
100 $_SESSION[
"leftmenuopened"] =
"";
103 $mainmenu = isset($_SESSION[
"mainmenu"]) ? $_SESSION[
"mainmenu"] :
'';
105 if (!empty($forcemainmenu)) {
106 $mainmenu = $forcemainmenu;
109 if (GETPOSTISSET(
"leftmenu")) {
111 $leftmenu =
GETPOST(
"leftmenu",
'aZ09');
112 $_SESSION[
"leftmenu"] = $leftmenu;
114 if ($_SESSION[
"leftmenuopened"] == $leftmenu) {
116 $_SESSION[
"leftmenuopened"] =
"";
118 $_SESSION[
"leftmenuopened"] = $leftmenu;
122 $leftmenu = isset($_SESSION[
"leftmenu"]) ? $_SESSION[
"leftmenu"] :
'';
124 if (!empty($forceleftmenu)) {
125 $leftmenu = $forceleftmenu;
128 require_once DOL_DOCUMENT_ROOT.
'/core/class/menubase.class.php';
130 $menuArbo =
new Menubase($this->db,
'eldy');
131 $menuArbo->menuLoad($mainmenu, $leftmenu, $this->type_user,
'eldy', $tabMenu);
132 $this->tabMenu = $tabMenu;
146 global $conf, $langs, $user;
148 require_once DOL_DOCUMENT_ROOT.
'/core/menus/standard/eldy.lib.php';
150 if ($this->type_user == 1) {
151 $conf->global->MAIN_SEARCHFORM_SOCIETE_DISABLED = 1;
152 $conf->global->MAIN_SEARCHFORM_CONTACT_DISABLED = 1;
155 require_once DOL_DOCUMENT_ROOT.
'/core/class/menu.class.php';
156 $this->menu =
new Menu();
159 if ($mode ==
'top') {
160 print_eldy_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 0, $mode);
162 if ($mode ==
'left') {
163 print_left_eldy_menu($this->db, $this->menu_array, $this->menu_array_after, $this->tabMenu, $this->menu, 0,
'',
'', $moredata, $this->type_user);
166 $conf->global->MAIN_SHOW_LOGO = 0;
167 if ($mode ==
'top') {
168 print_left_eldy_menu($this->db, $this->menu_array, $this->menu_array_after, $this->tabMenu, $this->menu, 0,
'',
'', $moredata, $this->type_user);
170 if ($mode ==
'left') {
171 print_eldy_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 0, $mode);
174 if ($mode ==
'topnb') {
175 print_eldy_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 1, $mode);
176 return $this->menu->getNbOfVisibleMenuEntries();
179 if ($mode ==
'jmobile') {
180 print_eldy_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 1, $mode);
184 $lastlevel = array();
185 print
'<!-- Generate menu list from menu handler '.$this->name.
' -->'.
"\n";
186 foreach ($this->menu->liste as $key => $val) {
187 print
'<ul class="ulmenu" data-inset="true">';
188 print
'<li class="lilevel0">';
190 if ($val[
'enabled'] == 1) {
191 $substitarray = array(
'__LOGIN__' => $user->login,
'__USER_ID__' => $user->id,
'__USER_SUPERVISOR_ID__' => $user->fk_user);
192 $substitarray[
'__USERID__'] = $user->id;
195 if (!preg_match(
'/^http/', $val[
'url'])) {
198 $relurl = $val[
'url'];
201 $canonurl = preg_replace(
'/\?.*$/',
'', $val[
'url']);
203 print
'<a class="alilevel0" href="#">';
206 if ($val[
'level'] == 0 && !empty($val[
'prefix'])) {
207 if (preg_match(
'/^fa\-[a-zA-Z0-9\-_]+$/', $val[
'prefix'])) {
208 print
'<span class="fas '.$val[
'prefix'].
' paddingright pictofixedwidth"></span>';
210 print str_replace(
'<span class="',
'<span class="paddingright pictofixedwidth ', $val[
'prefix']);
217 $tmpmainmenu = $val[
'mainmenu'];
218 $tmpleftmenu =
'all';
219 $submenu =
new Menu();
220 print_left_eldy_menu($this->db, $this->menu_array, $this->menu_array_after, $this->tabMenu, $submenu, 1, $tmpmainmenu, $tmpleftmenu,
null, $this->type_user);
228 $nexturl =
dol_buildpath(empty($submenu->liste[0][
'url']) ?
'' : $submenu->liste[0][
'url'], 1);
230 $canonrelurl = preg_replace(
'/\?.*$/',
'', $relurl);
231 $canonnexturl = preg_replace(
'/\?.*$/',
'', $nexturl);
236 if (($canonrelurl != $canonnexturl && !in_array($val[
'mainmenu'], array(
'tools')))
237 || (strpos($canonrelurl,
'/product/index.php') !==
false || strpos($canonrelurl,
'/compta/bank/list.php') !==
false)) {
239 print str_pad(
'', 1).
'<li class="lilevel1 ui-btn-icon-right ui-btn">';
240 print
'<a href="'.$relurl.
'">';
242 if ($val[
'level'] == 0) {
243 print
'<span class="fas fa-home fa-fw paddingright pictofixedwidth" aria-hidden="true"></span>';
246 if ($langs->trans(ucfirst($val[
'mainmenu']).
"Dashboard") == ucfirst($val[
'mainmenu']).
"Dashboard") {
247 if (in_array($val[
'mainmenu'], array(
'cashdesk',
'externalsite',
'website',
'collab',
'takepos'))) {
248 print $langs->trans(
"Access");
250 print $langs->trans(
"Dashboard");
253 print $langs->trans(ucfirst($val[
'mainmenu']).
"Dashboard");
272 $lastlevel2 = array();
273 foreach ($submenu->liste as $key2 => $val2) {
280 if ($val2[
'level'] > 0) {
281 $levelcursor = $val2[
'level'] - 1;
282 while ($levelcursor >= 0) {
283 if ($lastlevel2[$levelcursor] !=
'enabled') {
291 $substitarray = array(
'__LOGIN__' => $user->login,
'__USER_ID__' => $user->id,
'__USER_SUPERVISOR_ID__' => $user->fk_user);
292 $substitarray[
'__USERID__'] = $user->id;
295 if (!preg_match(
"/^(http:\/\/|https:\/\/)/i", $val2[
'url'])) {
298 $relurl2 = $val2[
'url'];
300 $canonurl2 = preg_replace(
'/\?.*$/',
'', $val2[
'url']);
302 if (in_array($canonurl2, array(
'/admin/index.php',
'/admin/tools/index.php',
'/core/tools.php'))) {
307 if (!$val2[
'enabled']) {
308 $disabled =
" vsmenudisabled";
312 print str_pad(
'', $val2[
'level'] + 1);
313 print
'<li class="lilevel'.($val2[
'level'] + 1);
314 if ($val2[
'level'] == 0) {
315 print
' ui-btn-icon-right ui-btn';
317 print $disabled.
'">';
319 if ($val2[
'enabled']) {
320 print
'<a href="'.$relurl2.
'"';
323 $lastlevel2[$val2[
'level']] =
'enabled';
325 print
'<a href="#" class="vsmenudisabled">';
326 $lastlevel2[$val2[
'level']] =
'greyed';
329 if ($val2[
'enabled']) {
330 $lastlevel2[$val2[
'level']] =
'enabled';
332 $lastlevel2[$val2[
'level']] =
'greyed';
337 if ($val2[
'level'] == 0 && !empty($val2[
'prefix'])) {
338 print $val2[
'prefix'];
341 print $val2[
'titre'];
351 if ($val[
'enabled'] == 2) {
352 print
'<span class="spanlilevel0 vsmenudisabled">';
355 if ($val[
'level'] == 0 && !empty($val[
'prefix'])) {
356 print $val[
'prefix'];
print_eldy_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout=0, $mode='')
Core function to output top menu eldy.
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...
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.