37 public $name =
"eldy";
40 public $menu_array_after;
53 $this->type_user = $type_user;
65 public function loadMenu($forcemainmenu =
'', $forceleftmenu =
'')
67 global $conf, $user, $langs;
71 $_SESSION[
"mainmenu"] =
GETPOST(
"mainmenu",
'aZ09');
74 $_SESSION[
"idmenu"] =
GETPOST(
"idmenu",
'int');
80 $mainmenu =
GETPOST(
"mainmenu",
'aZ09');
81 $_SESSION[
"mainmenu"] = $mainmenu;
82 $_SESSION[
"leftmenuopened"] =
"";
85 $mainmenu = isset($_SESSION[
"mainmenu"]) ? $_SESSION[
"mainmenu"] :
'';
87 if (!empty($forcemainmenu)) {
88 $mainmenu = $forcemainmenu;
93 $leftmenu =
GETPOST(
"leftmenu",
'aZ09');
94 $_SESSION[
"leftmenu"] = $leftmenu;
96 if ($_SESSION[
"leftmenuopened"] == $leftmenu) {
98 $_SESSION[
"leftmenuopened"] =
"";
100 $_SESSION[
"leftmenuopened"] = $leftmenu;
104 $leftmenu = isset($_SESSION[
"leftmenu"]) ? $_SESSION[
"leftmenu"] :
'';
106 if (!empty($forceleftmenu)) {
107 $leftmenu = $forceleftmenu;
110 require_once DOL_DOCUMENT_ROOT.
'/core/class/menubase.class.php';
113 $menuArbo->menuLoad($mainmenu, $leftmenu, $this->type_user,
'eldy', $tabMenu);
114 $this->tabMenu = $tabMenu;
131 global $conf, $langs, $user;
135 require_once DOL_DOCUMENT_ROOT.
'/core/menus/standard/eldy.lib.php';
137 if ($this->type_user == 1) {
138 $conf->global->MAIN_SEARCHFORM_SOCIETE_DISABLED = 1;
139 $conf->global->MAIN_SEARCHFORM_CONTACT_DISABLED = 1;
142 require_once DOL_DOCUMENT_ROOT.
'/core/class/menu.class.php';
143 $this->menu =
new Menu();
145 if (empty($conf->global->MAIN_MENU_INVERT)) {
146 if ($mode ==
'top') {
147 print_eldy_menu($this->
db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 0, $mode);
149 if ($mode ==
'left') {
150 print_left_eldy_menu($this->
db, $this->menu_array, $this->menu_array_after, $this->tabMenu, $this->menu, 0,
'',
'', $moredata, $this->type_user);
153 $conf->global->MAIN_SHOW_LOGO = 0;
154 if ($mode ==
'top') {
155 print_left_eldy_menu($this->
db, $this->menu_array, $this->menu_array_after, $this->tabMenu, $this->menu, 0,
'',
'', $moredata, $this->type_user);
157 if ($mode ==
'left') {
158 print_eldy_menu($this->
db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 0, $mode);
161 if ($mode ==
'topnb') {
162 print_eldy_menu($this->
db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 1, $mode);
163 return $this->menu->getNbOfVisibleMenuEntries();
166 if ($mode ==
'jmobile') {
167 print_eldy_menu($this->
db, $this->atarget, $this->type_user, $this->tabMenu, $this->menu, 1, $mode);
171 $lastlevel = array();
172 print
'<!-- Generate menu list from menu handler '.$this->name.
' -->'.
"\n";
173 foreach ($this->menu->liste as $key => $val) {
174 print
'<ul class="ulmenu" data-inset="true">';
175 print
'<li class="lilevel0">';
177 if ($val[
'enabled'] == 1) {
178 $substitarray = array(
'__LOGIN__' => $user->login,
'__USER_ID__' => $user->id,
'__USER_SUPERVISOR_ID__' => $user->fk_user);
179 $substitarray[
'__USERID__'] = $user->id;
183 $canonurl = preg_replace(
'/\?.*$/',
'', $val[
'url']);
185 print
'<a class="alilevel0" href="#">';
188 if ($val[
'level'] == 0 && !empty($val[
'prefix'])) {
189 print $val[
'prefix'];
196 $tmpmainmenu = $val[
'mainmenu'];
197 $tmpleftmenu =
'all';
198 $submenu =
new Menu();
199 print_left_eldy_menu($this->
db, $this->menu_array, $this->menu_array_after, $this->tabMenu, $submenu, 1, $tmpmainmenu, $tmpleftmenu,
null, $this->type_user);
209 $canonrelurl = preg_replace(
'/\?.*$/',
'', $relurl);
210 $canonnexturl = preg_replace(
'/\?.*$/',
'', $nexturl);
215 if (($canonrelurl != $canonnexturl && !in_array($val[
'mainmenu'], array(
'tools')))
216 || (strpos($canonrelurl,
'/product/index.php') !==
false || strpos($canonrelurl,
'/compta/bank/list.php') !==
false)) {
218 print str_pad(
'', 1).
'<li class="lilevel1 ui-btn-icon-right ui-btn">';
219 print
'<a href="'.$relurl.
'">';
221 if ($val[
'level'] == 0) {
222 print
'<span class="fa fa-home fa-fw paddingright pictofixedwidth" aria-hidden="true"></span>';
225 if ($langs->trans(ucfirst($val[
'mainmenu']).
"Dashboard") == ucfirst($val[
'mainmenu']).
"Dashboard") {
226 if (in_array($val[
'mainmenu'], array(
'cashdesk',
'externalsite',
'website',
'collab',
'takepos'))) {
227 print $langs->trans(
"Access");
229 print $langs->trans(
"Dashboard");
232 print $langs->trans(ucfirst($val[
'mainmenu']).
"Dashboard");
251 $lastlevel2 = array();
252 foreach ($submenu->liste as $key2 => $val2) {
254 if (!empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED) && empty($val2[
'enabled'])) {
259 if ($val2[
'level'] > 0) {
260 $levelcursor = $val2[
'level'] - 1;
261 while ($levelcursor >= 0) {
262 if ($lastlevel2[$levelcursor] !=
'enabled') {
270 $substitarray = array(
'__LOGIN__' => $user->login,
'__USER_ID__' => $user->id,
'__USER_SUPERVISOR_ID__' => $user->fk_user);
271 $substitarray[
'__USERID__'] = $user->id;
274 if (!preg_match(
"/^(http:\/\/|https:\/\/)/i", $val2[
'url'])) {
277 $relurl2 = $val2[
'url'];
279 $canonurl2 = preg_replace(
'/\?.*$/',
'', $val2[
'url']);
281 if (in_array($canonurl2, array(
'/admin/index.php',
'/admin/tools/index.php',
'/core/tools.php'))) {
286 if (!$val2[
'enabled']) {
287 $disabled =
" vsmenudisabled";
290 print str_pad(
'', $val2[
'level'] + 1);
291 print
'<li class="lilevel'.($val2[
'level'] + 1);
292 if ($val2[
'level'] == 0) {
293 print
' ui-btn-icon-right ui-btn';
295 print $disabled.
'">';
297 if ($val2[
'enabled']) {
298 print
'<a href="'.$relurl2.
'"';
301 $lastlevel2[$val2[
'level']] =
'enabled';
304 print
'<a href="#" class="vsmenudisabled">';
305 $lastlevel2[$val2[
'level']] =
'greyed';
308 if ($val2[
'enabled']) {
309 $lastlevel2[$val2[
'level']] =
'enabled';
311 $lastlevel2[$val2[
'level']] =
'greyed';
316 if ($val2[
'level'] == 0 && !empty($val2[
'prefix'])) {
317 print $val2[
'prefix'];
320 print $val2[
'titre'];
322 if ($val2[
'enabled']) {
334 if ($val[
'enabled'] == 2) {
335 print
'<span class="spanlilevel0 vsmenudisabled">';
338 if ($val[
'level'] == 0 && !empty($val[
'prefix'])) {
339 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...
make_substitutions($text, $substitutionarray, $outputlangs=null, $converttextinhtmlifnecessary=0)
Make substitution into a text string, replacing keys with vals from $substitutionarray (oldval=>newva...
GETPOST($paramname, $check='alphanohtml', $method=0, $filter=null, $options=null, $noreplace=0)
Return value of a param into GET or POST supervariable.
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
GETPOSTISSET($paramname)
Return true if we are in a context of submitting the parameter $paramname from a POST of a form.
$conf db
API class for accounts.