dolibarr  7.0.0-beta
auguria.lib.php
Go to the documentation of this file.
1 <?php
2 /* Copyright (C) 2010-2013 Laurent Destailleur <eldy@users.sourceforge.net>
3  * Copyright (C) 2010-2012 Regis Houssin <regis.houssin@capnetworks.com>
4  *
5  * This program is free software; you can redistribute it and/or modify
6  * it under the terms of the GNU General Public License as published by
7  * the Free Software Foundation; either version 3 of the License, or
8  * (at your option) any later version.
9  *
10  * This program is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13  * GNU General Public License for more details.
14  *
15  * You should have received a copy of the GNU General Public License
16  * along with this program. If not, see <http://www.gnu.org/licenses/>.
17  * or see http://www.gnu.org/
18  */
19 
24 require_once DOL_DOCUMENT_ROOT.'/core/class/menubase.class.php';
25 
26 
27 
40 function print_auguria_menu($db,$atarget,$type_user,&$tabMenu,&$menu,$noout=0,$mode='')
41 {
42  global $user,$conf,$langs,$dolibarr_main_db_name;
43 
44  $mainmenu=$_SESSION["mainmenu"];
45  $leftmenu=$_SESSION["leftmenu"];
46 
47  $id='mainmenu';
48  $listofmodulesforexternal=explode(',',$conf->global->MAIN_MODULES_FOR_EXTERNAL);
49 
50  // Show personalized menus
51  $menuArbo = new Menubase($db,'auguria');
52  $newTabMenu = $menuArbo->menuTopCharger('', '', $type_user, 'auguria',$tabMenu);
53 
54  if (empty($noout)) print_start_menu_array_auguria();
55 
56  $usemenuhider = (GETPOST('testmenuhider','int') || ! empty($conf->global->MAIN_TESTMENUHIDER));
57 
58  // Show/Hide vertical menu
59  if ($mode != 'jmobile' && $mode != 'topnb' && $usemenuhider && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
60  {
61  $showmode=1;
62  $classname = 'class="tmenu menuhider"';
63  $idsel='menu';
64 
65  $menu->add('#', '', 0, $showmode, $atarget, "xxx", '', 0, $id, $idsel, $classname);
66  }
67 
68  $num = count($newTabMenu);
69  for($i = 0; $i < $num; $i++)
70  {
71  $idsel=(empty($newTabMenu[$i]['mainmenu'])?'none':$newTabMenu[$i]['mainmenu']);
72 
73  $showmode=dol_auguria_showmenu($type_user,$newTabMenu[$i],$listofmodulesforexternal);
74  if ($showmode == 1)
75  {
76  $substitarray = array('__LOGIN__' => $user->login, '__USER_ID__' => $user->id, '__USER_SUPERVISOR_ID__' => $user->fk_user);
77  $substitarray['__USERID__'] = $user->id; // For backward compatibility
78  $newTabMenu[$i]['url'] = make_substitutions($newTabMenu[$i]['url'], $substitarray);
79 
80  $url = $shorturl = $newTabMenu[$i]['url'];
81 
82  if (! preg_match("/^(http:\/\/|https:\/\/)/i",$newTabMenu[$i]['url']))
83  {
84  $tmp=explode('?',$newTabMenu[$i]['url'],2);
85  $url = $shorturl = $tmp[0];
86  $param = (isset($tmp[1])?$tmp[1]:'');
87 
88  // Complete param to force leftmenu to '' to close open menu when we click on a link with no leftmenu defined.
89  if ((! preg_match('/mainmenu/i',$param)) && (! preg_match('/leftmenu/i',$param)) && ! empty($newTabMenu[$i]['url']))
90  {
91  $param.=($param?'&':'').'mainmenu='.$newTabMenu[$i]['mainmenu'].'&leftmenu=';
92  }
93  if ((! preg_match('/mainmenu/i',$param)) && (! preg_match('/leftmenu/i',$param)) && empty($newTabMenu[$i]['url']))
94  {
95  $param.=($param?'&':'').'leftmenu=';
96  }
97  //$url.="idmenu=".$newTabMenu[$i]['rowid']; // Already done by menuLoad
98  $url = dol_buildpath($url,1).($param?'?'.$param:'');
99  //$shorturl = $shorturl.($param?'?'.$param:'');
100  $shorturl = $url;
101 
102  if (DOL_URL_ROOT) $shorturl = preg_replace('/^'.preg_quote(DOL_URL_ROOT,'/').'/','',$shorturl);
103  }
104 
105  // TODO Find a generic solution
106  if (preg_match('/search_project_user=__search_project_user__/', $shorturl))
107  {
108  $search_project_user = GETPOST('search_project_user','int');
109  if ($search_project_user) $shorturl=preg_replace('/search_project_user=__search_project_user__/', 'search_project_user='.$search_project_user, $shorturl);
110  else $shorturl=preg_replace('/search_project_user=__search_project_user__/', '', $shorturl);
111  }
112 
113  // Define the class (top menu selected or not)
114  if (! empty($_SESSION['idmenu']) && $newTabMenu[$i]['rowid'] == $_SESSION['idmenu']) $classname='class="tmenusel"';
115  else if (! empty($_SESSION["mainmenu"]) && $newTabMenu[$i]['mainmenu'] == $_SESSION["mainmenu"]) $classname='class="tmenusel"';
116  else $classname='class="tmenu"';
117  }
118  else if ($showmode == 2) $classname='class="tmenu"';
119 
120  $menu->add($shorturl, $newTabMenu[$i]['titre'], 0, $showmode, ($newTabMenu[$i]['target']?$newTabMenu[$i]['target']:$atarget), ($newTabMenu[$i]['mainmenu']?$newTabMenu[$i]['mainmenu']:$newTabMenu[$i]['rowid']), ($newTabMenu[$i]['leftmenu']?$newTabMenu[$i]['leftmenu']:''), $newTabMenu[$i]['position'], $id, $idsel, $classname);
121  }
122 
123  // Sort on position
124  $menu->liste = dol_sort_array($menu->liste, 'position');
125 
126  // Output menu entries
127  foreach($menu->liste as $menkey => $menuval)
128  {
129  if (empty($noout)) print_start_menu_entry_auguria($menuval['idsel'],$menuval['classname'],$menuval['enabled']);
130  if (empty($noout)) print_text_menu_entry_auguria($menuval['titre'], $menuval['enabled'], ($menuval['url']!='#'?DOL_URL_ROOT:'').$menuval['url'], $menuval['id'], $menuval['idsel'], $menuval['classname'], ($menuval['target']?$menuval['target']:$atarget));
131  if (empty($noout)) print_end_menu_entry_auguria($menuval['enabled']);
132  }
133 
134  $showmode=1;
135  if (empty($noout)) print_start_menu_entry_auguria('','class="tmenuend"',$showmode);
136  if (empty($noout)) print_end_menu_entry_auguria($showmode);
137 
138  if (empty($noout)) print_end_menu_array_auguria();
139 
140  print "\n";
141 
142  return 0;
143 }
144 
145 
152 {
153  global $conf;
154 
155  print '<div class="tmenudiv">';
156  print '<ul class="tmenu"'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)?'':' title="Top menu"').'>';
157 }
158 
167 function print_start_menu_entry_auguria($idsel,$classname,$showmode)
168 {
169  if ($showmode)
170  {
171  print '<li '.$classname.' id="mainmenutd_'.$idsel.'">';
172  print '<div class="tmenuleft tmenusep"></div><div class="tmenucenter">';
173  }
174 }
175 
188 function print_text_menu_entry_auguria($text, $showmode, $url, $id, $idsel, $classname, $atarget)
189 {
190  global $langs;
191 
192  if ($showmode == 1)
193  {
194  print '<a class="tmenuimage" tabindex="-1" href="'.$url.'"'.($atarget?' target="'.$atarget.'"':'').'>';
195  print '<div class="'.$id.' '.$idsel.' topmenuimage"><span class="'.$id.' tmenuimage" id="mainmenuspan_'.$idsel.'"></span></div>';
196  print '</a>';
197  print '<a '.$classname.' id="mainmenua_'.$idsel.'" href="'.$url.'"'.($atarget?' target="'.$atarget.'"':'').'>';
198  print '<span class="mainmenuaspan">';
199  print $text;
200  print '</span>';
201  print '</a>';
202  }
203  if ($showmode == 2)
204  {
205  print '<div class="'.$id.' '.$idsel.' topmenuimage tmenudisabled"><span class="'.$id.'" id="mainmenuspan_'.$idsel.'"></span></div>';
206  print '<a class="tmenudisabled" id="mainmenua_'.$idsel.'" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">';
207  print '<span class="mainmenuaspan">';
208  print $text;
209  print '</span>';
210  print '</a>';
211  }
212 }
213 
220 function print_end_menu_entry_auguria($showmode)
221 {
222  if ($showmode)
223  {
224  print '</div></li>';
225  }
226  print "\n";
227 }
228 
235 {
236  print '</ul>';
237  print '</div>';
238  print "\n";
239 }
240 
241 
242 
257 function print_left_auguria_menu($db,$menu_array_before,$menu_array_after,&$tabMenu,&$menu,$noout=0,$forcemainmenu='',$forceleftmenu='',$moredata=null)
258 {
259  global $user,$conf,$langs,$dolibarr_main_db_name,$mysoc;
260 
261  $newmenu = $menu;
262 
263  $mainmenu=($forcemainmenu?$forcemainmenu:$_SESSION["mainmenu"]);
264  $leftmenu=($forceleftmenu?'':(empty($_SESSION["leftmenu"])?'none':$_SESSION["leftmenu"]));
265 
266  $usemenuhider = (GETPOST('testmenuhider','int') || ! empty($conf->global->MAIN_TESTMENUHIDER));
267  global $usemenuhider;
268 
269  // Show logo company
270  if (empty($noout) && ! empty($conf->global->MAIN_SHOW_LOGO) && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
271  {
272  $mysoc->logo_mini=$conf->global->MAIN_INFO_SOCIETE_LOGO_MINI;
273  if (! empty($mysoc->logo_mini) && is_readable($conf->mycompany->dir_output.'/logos/thumbs/'.$mysoc->logo_mini))
274  {
275  $urllogo=DOL_URL_ROOT.'/viewimage.php?cache=1&amp;modulepart=mycompany&amp;file='.urlencode('thumbs/'.$mysoc->logo_mini);
276  }
277  else
278  {
279  $urllogo=DOL_URL_ROOT.'/theme/dolibarr_logo.png';
280  }
281  $title=$langs->trans("GoIntoSetupToChangeLogo");
282  print "\n".'<!-- Show logo on menu -->'."\n";
283  print '<div class="blockvmenuimpair blockvmenulogo">'."\n";
284  print '<div class="menu_titre" id="menu_titre_logo"></div>';
285  print '<div class="menu_top" id="menu_top_logo"></div>';
286  print '<div class="menu_contenu" id="menu_contenu_logo">';
287  print '<div class="center"><img title="'.dol_escape_htmltag($title).'" alt="" src="'.$urllogo.'" style="max-width: 70%"></div>'."\n";
288  print '</div>';
289  print '<div class="menu_end" id="menu_end_logo"></div>';
290  print '</div>'."\n";
291  }
292 
293  if (is_array($moredata) && ! empty($moredata['searchform'])) // searchform can contains select2 code or link to show old search form or link to switch on search page
294  {
295  print "\n";
296  print "<!-- Begin SearchForm -->\n";
297  print '<div id="blockvmenusearch" class="blockvmenusearch">'."\n";
298  print $moredata['searchform'];
299  print '</div>'."\n";
300  print "<!-- End SearchForm -->\n";
301  }
302 
303  if (is_array($moredata) && ! empty($moredata['bookmarks']))
304  {
305  print "\n";
306  print "<!-- Begin Bookmarks -->\n";
307  print '<div id="blockvmenubookmarks" class="blockvmenubookmarks">'."\n";
308  print $moredata['bookmarks'];
309  print '</div>'."\n";
310  print "<!-- End Bookmarks -->\n";
311  }
312 
313  // We update newmenu with entries found into database
314  $menuArbo = new Menubase($db,'auguria');
315  $newmenu = $menuArbo->menuLeftCharger($newmenu,$mainmenu,$leftmenu,($user->societe_id?1:0),'auguria',$tabMenu);
316 
317  // We update newmenu for special dynamic menus
318  if ($conf->banque->enabled && $user->rights->banque->lire && $mainmenu == 'bank') // Entry for each bank account
319  {
320  include_once DOL_DOCUMENT_ROOT.'/compta/bank/class/account.class.php'; // Required for to get Account::TYPE_CASH for example
321 
322  $sql = "SELECT rowid, label, courant, rappro, courant";
323  $sql.= " FROM ".MAIN_DB_PREFIX."bank_account";
324  $sql.= " WHERE entity = ".$conf->entity;
325  $sql.= " AND clos = 0";
326  $sql.= " ORDER BY label";
327 
328  $resql = $db->query($sql);
329  if ($resql)
330  {
331  $numr = $db->num_rows($resql);
332  $i = 0;
333 
334  if ($numr > 0) $newmenu->add('/compta/bank/list.php',$langs->trans("BankAccounts"),0,$user->rights->banque->lire);
335 
336  while ($i < $numr)
337  {
338  $objp = $db->fetch_object($resql);
339  $newmenu->add('/compta/bank/card.php?id='.$objp->rowid,$objp->label,1,$user->rights->banque->lire);
340  if ($objp->rappro && $objp->courant != Account::TYPE_CASH && empty($objp->clos)) // If not cash account and not closed and can be reconciliate
341  {
342  $newmenu->add('/compta/bank/bankentries_list.php?id='.$objp->rowid,$langs->trans("Conciliate"),2,$user->rights->banque->consolidate);
343  }
344  $i++;
345  }
346  }
347  else dol_print_error($db);
348  $db->free($resql);
349  }
350 
351  if (! empty($conf->accounting->enabled) && !empty($user->rights->accounting->mouvements->lire) && $mainmenu == 'accountancy') // Entry in accountancy journal for each bank account
352  {
353  $newmenu->add('',$langs->trans("Journalization"),0,$user->rights->accounting->comptarapport->lire,'','accountancy','accountancy');
354 
355  // Multi journal
356  $sql = "SELECT rowid, code, label, nature";
357  $sql.= " FROM ".MAIN_DB_PREFIX."accounting_journal";
358  $sql.= " WHERE entity = ".$conf->entity;
359  $sql.= " AND active = 1";
360  $sql.= " ORDER BY label DESC";
361 
362  $resql = $db->query($sql);
363  if ($resql)
364  {
365  $numr = $db->num_rows($resql);
366  $i = 0;
367 
368  if ($numr > 0)
369  {
370  while ($i < $numr)
371  {
372  $objp = $db->fetch_object($resql);
373 
374  $nature='';
375 
376  // Must match array $sourceList defined into journals_list.php
377  if ($objp->nature == 2 && ! empty($conf->facture->enabled)) $nature="sells";
378  if ($objp->nature == 3 && ! empty($conf->fournisseur->enabled)) $nature="purchases";
379  if ($objp->nature == 4 && ! empty($conf->banque->enabled)) $nature="bank";
380  if ($objp->nature == 5 && ! empty($conf->expensereport->enabled)) $nature="expensereports";
381  if ($objp->nature == 1) $nature="various";
382  if ($objp->nature == 9) $nature="hasnew";
383 
384  // To enable when page exists
385  if ($conf->global->MAIN_FEATURES_LEVEL >= 2)
386  {
387  if ($nature == 'various' || $nature == 'hasnew') $nature='';
388  }
389 
390  if ($nature)
391  {
392  if ($usemenuhider || empty($leftmenu) || preg_match('/accountancy/',$leftmenu)) $newmenu->add('/accountancy/journal/'.$nature.'journal.php?mainmenu=accountancy&leftmenu=accountancy_journal&id_journal='.$objp->rowid,dol_trunc($objp->label,25),2,$user->rights->accounting->comptarapport->lire);
393  }
394  $i++;
395  }
396  }
397  else
398  {
399  // Should not happend. Entries are added
400  $newmenu->add('',$langs->trans("NoJournalDefined"), 2, $user->rights->accounting->comptarapport->lire);
401  }
402  }
403  else dol_print_error($db);
404  $db->free($resql);
405 
406  /*
407  $sql = "SELECT rowid, label, accountancy_journal";
408  $sql.= " FROM ".MAIN_DB_PREFIX."bank_account";
409  $sql.= " WHERE entity = ".$conf->entity;
410  $sql.= " AND clos = 0";
411  $sql.= " ORDER BY label";
412 
413  $resql = $db->query($sql);
414  if ($resql)
415  {
416  $numr = $db->num_rows($resql);
417  $i = 0;
418 
419  if ($numr > 0)
420  while ($i < $numr)
421  {
422  $objp = $db->fetch_object($resql);
423  $newmenu->add('/accountancy/journal/bankjournal.php?id_account='.$objp->rowid, $langs->trans("Journal").' - '.$objp->label, 1, $user->rights->accounting->comptarapport->lire,'','accountancy','accountancy_journal');
424  $i++;
425  }
426  }
427  else dol_print_error($db);
428  $db->free($resql);
429 
430  // Add other journal
431  $newmenu->add("/accountancy/journal/sellsjournal.php?leftmenu=journal",$langs->trans("SellsJournal"),1,$user->rights->accounting->comptarapport->lire,'','accountancy','accountancy_journal');
432  $newmenu->add("/accountancy/journal/purchasesjournal.php?leftmenu=journal",$langs->trans("PurchasesJournal"),1,$user->rights->accounting->comptarapport->lire,'','accountancy','accountancy_journal');
433  $newmenu->add("/accountancy/journal/expensereportsjournal.php?leftmenu=journal",$langs->trans("ExpenseReportsJournal"),1,$user->rights->accounting->comptarapport->lire,'','accountancy','accountancy_journal');
434  */
435  }
436 
437  if ($conf->ftp->enabled && $mainmenu == 'ftp') // Entry for FTP
438  {
439  $MAXFTP=20;
440  $i=1;
441  while ($i <= $MAXFTP)
442  {
443  $paramkey='FTP_NAME_'.$i;
444  //print $paramkey;
445  if (! empty($conf->global->$paramkey))
446  {
447  $link="/ftp/index.php?idmenu=".$_SESSION["idmenu"]."&numero_ftp=".$i;
448 
449  $newmenu->add($link, dol_trunc($conf->global->$paramkey,24));
450  }
451  $i++;
452  }
453  }
454 
455 
456  // Build final $menu_array = $menu_array_before +$newmenu->liste + $menu_array_after
457  //var_dump($menu_array_before);exit;
458  //var_dump($menu_array_after);exit;
459  $menu_array=$newmenu->liste;
460  if (is_array($menu_array_before)) $menu_array=array_merge($menu_array_before, $menu_array);
461  if (is_array($menu_array_after)) $menu_array=array_merge($menu_array, $menu_array_after);
462  //var_dump($menu_array);exit;
463  if (! is_array($menu_array)) return 0;
464 
465  // Show menu
466  if (empty($noout))
467  {
468  $altok=0; $blockvmenuopened=false; $lastlevel0='';
469  $num=count($menu_array);
470  for ($i = 0; $i < $num; $i++) // Loop on each menu entry
471  {
472  $showmenu=true;
473  if (! empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED) && empty($menu_array[$i]['enabled'])) $showmenu=false;
474 
475  // Begin of new left menu block
476  if (empty($menu_array[$i]['level']) && $showmenu)
477  {
478  $altok++;
479  $blockvmenuopened=true;
480  $lastopened=true;
481  for($j = ($i + 1); $j < $num; $j++)
482  {
483  if (empty($menu_array[$j]['level'])) $lastopened=false;
484  }
485  if ($altok % 2 == 0)
486  {
487  print '<div class="blockvmenuimpair'.($lastopened?' blockvmenulast':'').($altok == 1 ? ' blockvmenufirst':'').'">'."\n";
488  }
489  else
490  {
491  print '<div class="blockvmenupair'.($lastopened?' blockvmenulast':'').($altok == 1 ? ' blockvmenufirst':'').'">'."\n";
492  }
493  }
494 
495  // Add tabulation
496  $tabstring='';
497  $tabul=($menu_array[$i]['level'] - 1);
498  if ($tabul > 0)
499  {
500  for ($j=0; $j < $tabul; $j++)
501  {
502  $tabstring.='&nbsp;&nbsp;&nbsp;';
503  }
504  }
505 
506  // $menu_array[$i]['url'] can be a relative url, a full external url. We try substitution
507  $substitarray = array('__LOGIN__' => $user->login, '__USER_ID__' => $user->id, '__USER_SUPERVISOR_ID__' => $user->fk_user);
508  $substitarray['__USERID__'] = $user->id; // For backward compatibility
509  $menu_array[$i]['url'] = make_substitutions($menu_array[$i]['url'], $substitarray);
510 
511  // Add mainmenu in GET url. This make to go back on correct menu even when using Back on browser.
512  $url=dol_buildpath($menu_array[$i]['url'],1);
513 
514  if (! preg_match('/mainmenu=/i',$menu_array[$i]['url']))
515  {
516  if (! preg_match('/\?/',$url)) $url.='?';
517  else $url.='&';
518  $url.='mainmenu='.$mainmenu;
519  }
520 
521  print '<!-- Process menu entry with mainmenu='.$menu_array[$i]['mainmenu'].', leftmenu='.$menu_array[$i]['leftmenu'].', level='.$menu_array[$i]['level'].' enabled='.$menu_array[$i]['enabled'].' -->'."\n";
522 
523  // Menu level 0
524  if ($menu_array[$i]['level'] == 0)
525  {
526  if ($menu_array[$i]['enabled']) // Enabled so visible
527  {
528  print '<div class="menu_titre">'.$tabstring.'<a class="vmenu" href="'.$url.'"'.($menu_array[$i]['target']?' target="'.$menu_array[$i]['target'].'"':'').'>'.$menu_array[$i]['titre'].'</a></div>';
529  $lastlevel0='enabled';
530  }
531  else if ($showmenu) // Not enabled but visible (so greyed)
532  {
533  print '<div class="menu_titre">'.$tabstring.'<font class="vmenudisabled">'.$menu_array[$i]['titre'].'</font></div>'."\n";
534  $lastlevel0='greyed';
535  }
536  else
537  {
538  $lastlevel0='hidden';
539  }
540  if ($showmenu)
541  {
542  print '<div class="menu_top"></div>'."\n";
543  }
544  }
545  // Menu level > 0
546  if ($menu_array[$i]['level'] > 0)
547  {
548  $cssmenu = '';
549  if ($menu_array[$i]['url']) $cssmenu = ' menu_contenu'.dol_string_nospecial(preg_replace('/\.php.*$/','',$menu_array[$i]['url']));
550 
551  if ($menu_array[$i]['enabled'] && $lastlevel0 == 'enabled') // Enabled so visible, except if parent was not enabled.
552  {
553  print '<div class="menu_contenu'.$cssmenu.'">'.$tabstring;
554  if ($menu_array[$i]['url']) print '<a class="vsmenu" href="'.$url.'"'.($menu_array[$i]['target']?' target="'.$menu_array[$i]['target'].'"':'').'>';
555  else print '<span class="vsmenu">';
556  print $menu_array[$i]['titre'];
557  if ($menu_array[$i]['url']) print '</a>';
558  else print '</span>';
559  // If title is not pure text and contains a table, no carriage return added
560  if (! strstr($menu_array[$i]['titre'],'<table')) print '<br>';
561  print '</div>'."\n";
562  }
563  else if ($showmenu && $lastlevel0 == 'enabled') // Not enabled but visible (so greyed), except if parent was not enabled.
564  {
565  print '<div class="menu_contenu'.$cssmenu.'">'.$tabstring.'<font class="vsmenudisabled vsmenudisabledmargin">'.$menu_array[$i]['titre'].'</font><br></div>'."\n";
566  }
567  }
568 
569  // If next is a new block or if there is nothing after
570  if (empty($menu_array[$i+1]['level'])) // End menu block
571  {
572  if ($showmenu)
573  print '<div class="menu_end"></div>'."\n";
574  if ($blockvmenuopened) { print '</div>'."\n"; $blockvmenuopened=false; }
575  }
576  }
577 
578  if ($altok) print '<div class="blockvmenuend"></div>'; // End menu block
579  }
580 
581  return count($menu_array);
582 }
583 
584 
593 function dol_auguria_showmenu($type_user, &$menuentry, &$listofmodulesforexternal)
594 {
595  global $conf;
596 
597  //print 'type_user='.$type_user.' module='.$menuentry['module'].' enabled='.$menuentry['enabled'].' perms='.$menuentry['perms'];
598  //print 'ok='.in_array($menuentry['module'], $listofmodulesforexternal);
599  if (empty($menuentry['enabled'])) return 0; // Entry disabled by condition
600  if ($type_user && $menuentry['module'])
601  {
602  $tmploops=explode('|',$menuentry['module']);
603  $found=0;
604  foreach($tmploops as $tmploop)
605  {
606  if (in_array($tmploop, $listofmodulesforexternal)) {
607  $found++; break;
608  }
609  }
610  if (! $found) return 0; // Entry is for menus all excluded to external users
611  }
612  if (! $menuentry['perms'] && $type_user) return 0; // No permissions and user is external
613  if (! $menuentry['perms'] && ! empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED)) return 0; // No permissions and option to hide when not allowed, even for internal user, is on
614  if (! $menuentry['perms']) return 2; // No permissions and user is external
615  return 1;
616 }
print_start_menu_entry_auguria($idsel, $classname, $showmode)
Output start menu entry.
dol_trunc($string, $size=40, $trunc='right', $stringencoding='UTF-8', $nodot=0, $display=0)
Truncate a string to a particular length adding '...' if string larger than length.
dol_sort_array(&$array, $index, $order='asc', $natsort=0, $case_sensitive=0, $keepindex=0)
Advanced sort array by second index function, which produces ascending (default) or descending output...
dol_auguria_showmenu($type_user, &$menuentry, &$listofmodulesforexternal)
Function to test if an entry is enabled or not.
Class to manage menu entries.
dol_print_error($db='', $error='', $errors=null)
Affiche message erreur system avec toutes les informations pour faciliter le diagnostic et la remonte...
dol_buildpath($path, $type=0, $returnemptyifnotfound=0)
Return path of url or filesystem.
dol_escape_htmltag($stringtoescape, $keepb=0, $keepn=0)
Returns text escaped for inclusion in HTML alt or title tags, or into values of HTML input fields...
GETPOST($paramname, $check='none', $method=0, $filter=NULL, $options=NULL, $noreplace=0)
Return value of a param into GET or POST supervariable.
print_text_menu_entry_auguria($text, $showmode, $url, $id, $idsel, $classname, $atarget)
Output menu entry.
print_start_menu_array_auguria()
Output start menu array.
if($_POST["cancel"]==$langs->trans("Cancel")&&!$id) if($action== 'setdatev'&&$user->rights->tax->charges->creer) if($action== 'add'&&$_POST["cancel"]<> $langs->trans("Cancel")) if($action== 'delete') $title
Actions.
Definition: card.php:183
const TYPE_CASH
Cash account.
print
Draft customers invoices.
Definition: index.php:91
if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if(!empty($conf->fournisseur->enabled)&&$user->rights->fournisseur->facture->lire) if(!empty($conf->don->enabled)&&$user->rights->societe->lire) if(!empty($conf->tax->enabled)&&$user->rights->tax->charges->lire) if(!empty($conf->facture->enabled)&&!empty($conf->commande->enabled)&&$user->rights->commande->lire &&empty($conf->global->WORKFLOW_DISABLE_CREATE_INVOICE_FROM_ORDER)) if(!empty($conf->facture->enabled)&&$user->rights->facture->lire) if(!empty($conf->fournisseur->enabled)&&$user->rights->fournisseur->facture->lire) $resql
Social contributions to pay.
Definition: index.php:1013
print_auguria_menu($db, $atarget, $type_user, &$tabMenu, &$menu, $noout=0, $mode='')
Core function to output top menu auguria.
Definition: auguria.lib.php:40
print_end_menu_entry_auguria($showmode)
Output end menu entry.
make_substitutions($text, $substitutionarray, $outputlangs=null)
Make substition into a text string, replacing keys with vals from $substitutionarray (oldval=>newval)...
print_end_menu_array_auguria()
Output menu array.
print_left_auguria_menu($db, $menu_array_before, $menu_array_after, &$tabMenu, &$menu, $noout=0, $forcemainmenu='', $forceleftmenu='', $moredata=null)
Core function to output left menu auguria.