70 public function loadMenu($forcemainmenu =
'', $forceleftmenu =
'')
72 global $conf, $user, $langs;
75 if (GETPOSTISSET(
"mainmenu")) {
76 $_SESSION[
"mainmenu"] =
GETPOST(
"mainmenu",
'aZ09');
78 if (GETPOSTISSET(
"idmenu")) {
79 $_SESSION[
"idmenu"] =
GETPOST(
"idmenu",
'int');
83 if (GETPOSTISSET(
"mainmenu")) {
85 $mainmenu =
GETPOST(
"mainmenu",
'aZ09');
86 $_SESSION[
"mainmenu"] = $mainmenu;
87 $_SESSION[
"leftmenuopened"] =
"";
90 $mainmenu = isset($_SESSION[
"mainmenu"]) ? $_SESSION[
"mainmenu"] :
'';
92 if (!empty($forcemainmenu)) {
93 $mainmenu = $forcemainmenu;
96 if (GETPOSTISSET(
"leftmenu")) {
98 $leftmenu =
GETPOST(
"leftmenu",
'aZ09');
99 $_SESSION[
"leftmenu"] = $leftmenu;
101 if ($_SESSION[
"leftmenuopened"] == $leftmenu) {
103 $_SESSION[
"leftmenuopened"] =
"";
105 $_SESSION[
"leftmenuopened"] = $leftmenu;
109 $leftmenu = isset($_SESSION[
"leftmenu"]) ? $_SESSION[
"leftmenu"] :
'';
111 if (!empty($forceleftmenu)) {
112 $leftmenu = $forceleftmenu;
115 require_once DOL_DOCUMENT_ROOT.
'/core/class/menubase.class.php';
117 $menuArbo =
new Menubase($this->db,
'eldy');
118 $menuArbo->menuLoad($mainmenu, $leftmenu, $this->type_user,
'eldy', $tabMenu);
119 $this->tabMenu = $tabMenu;
136 global $conf, $langs, $user;
140 require_once DOL_DOCUMENT_ROOT.
'/core/menus/standard/eldy.lib.php';
142 if ($this->type_user == 1) {
143 $conf->global->MAIN_SEARCHFORM_SOCIETE_DISABLED = 1;
144 $conf->global->MAIN_SEARCHFORM_CONTACT_DISABLED = 1;
147 require_once DOL_DOCUMENT_ROOT.
'/core/class/menu.class.php';
148 $this->menu =
new Menu();
151 if ($mode ==
'top') {
152 print_eldy_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 0, $mode);
154 if ($mode ==
'left') {
155 print_left_eldy_menu($this->db, $this->menu_array, $this->menu_array_after, $this->tabMenu, $this->menu, 0,
'',
'', $moredata, $this->type_user);
158 $conf->global->MAIN_SHOW_LOGO = 0;
159 if ($mode ==
'top') {
160 print_left_eldy_menu($this->db, $this->menu_array, $this->menu_array_after, $this->tabMenu, $this->menu, 0,
'',
'', $moredata, $this->type_user);
162 if ($mode ==
'left') {
163 print_eldy_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 0, $mode);
166 if ($mode ==
'topnb') {
167 print_eldy_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_eldy_menu($this->db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 1, $mode);
176 $lastlevel = array();
177 print
'<!-- Generate menu list from menu handler '.$this->name.
' -->'.
"\n";
178 foreach ($this->menu->liste as $key => $val) {
179 print
'<ul class="ulmenu" data-inset="true">';
180 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;
187 if (!preg_match(
'/^http/', $val[
'url'])) {
190 $relurl = $val[
'url'];
193 $canonurl = preg_replace(
'/\?.*$/',
'', $val[
'url']);
195 print
'<a class="alilevel0" href="#">';
198 if ($val[
'level'] == 0 && !empty($val[
'prefix'])) {
199 print str_replace(
'<span class="',
'<span class="paddingright pictofixedwidth ', $val[
'prefix']);
206 $tmpmainmenu = $val[
'mainmenu'];
207 $tmpleftmenu =
'all';
208 $submenu =
new Menu();
209 print_left_eldy_menu($this->db, $this->menu_array, $this->menu_array_after, $this->tabMenu, $submenu, 1, $tmpmainmenu, $tmpleftmenu,
null, $this->type_user);
217 $nexturl =
dol_buildpath(empty($submenu->liste[0][
'url']) ?
'' : $submenu->liste[0][
'url'], 1);
219 $canonrelurl = preg_replace(
'/\?.*$/',
'', $relurl);
220 $canonnexturl = preg_replace(
'/\?.*$/',
'', $nexturl);
225 if (($canonrelurl != $canonnexturl && !in_array($val[
'mainmenu'], array(
'tools')))
226 || (strpos($canonrelurl,
'/product/index.php') !==
false || strpos($canonrelurl,
'/compta/bank/list.php') !==
false)) {
228 print str_pad(
'', 1).
'<li class="lilevel1 ui-btn-icon-right ui-btn">';
229 print
'<a href="'.$relurl.
'">';
231 if ($val[
'level'] == 0) {
232 print
'<span class="fas fa-home fa-fw paddingright pictofixedwidth" aria-hidden="true"></span>';
235 if ($langs->trans(ucfirst($val[
'mainmenu']).
"Dashboard") == ucfirst($val[
'mainmenu']).
"Dashboard") {
236 if (in_array($val[
'mainmenu'], array(
'cashdesk',
'externalsite',
'website',
'collab',
'takepos'))) {
237 print $langs->trans(
"Access");
239 print $langs->trans(
"Dashboard");
242 print $langs->trans(ucfirst($val[
'mainmenu']).
"Dashboard");
261 $lastlevel2 = array();
262 foreach ($submenu->liste as $key2 => $val2) {
269 if ($val2[
'level'] > 0) {
270 $levelcursor = $val2[
'level'] - 1;
271 while ($levelcursor >= 0) {
272 if ($lastlevel2[$levelcursor] !=
'enabled') {
280 $substitarray = array(
'__LOGIN__' => $user->login,
'__USER_ID__' => $user->id,
'__USER_SUPERVISOR_ID__' => $user->fk_user);
281 $substitarray[
'__USERID__'] = $user->id;
284 if (!preg_match(
"/^(http:\/\/|https:\/\/)/i", $val2[
'url'])) {
287 $relurl2 = $val2[
'url'];
289 $canonurl2 = preg_replace(
'/\?.*$/',
'', $val2[
'url']);
291 if (in_array($canonurl2, array(
'/admin/index.php',
'/admin/tools/index.php',
'/core/tools.php'))) {
296 if (!$val2[
'enabled']) {
297 $disabled =
" vsmenudisabled";
300 print str_pad(
'', $val2[
'level'] + 1);
301 print
'<li class="lilevel'.($val2[
'level'] + 1);
302 if ($val2[
'level'] == 0) {
303 print
' ui-btn-icon-right ui-btn';
305 print $disabled.
'">';
307 if ($val2[
'enabled']) {
308 print
'<a href="'.$relurl2.
'"';
311 $lastlevel2[$val2[
'level']] =
'enabled';
313 print
'<a href="#" class="vsmenudisabled">';
314 $lastlevel2[$val2[
'level']] =
'greyed';
317 if ($val2[
'enabled']) {
318 $lastlevel2[$val2[
'level']] =
'enabled';
320 $lastlevel2[$val2[
'level']] =
'greyed';
325 if ($val2[
'level'] == 0 && !empty($val2[
'prefix'])) {
326 print $val2[
'prefix'];
329 print $val2[
'titre'];
331 if ($val2[
'enabled']) {
343 if ($val[
'enabled'] == 2) {
344 print
'<span class="spanlilevel0 vsmenudisabled">';
347 if ($val[
'level'] == 0 && !empty($val[
'prefix'])) {
348 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.