empty.php 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607
  1. <?php
  2. /* Copyright (C) 2006-2013 Laurent Destailleur <eldy@users.sourceforge.net>
  3. *
  4. * This program is free software; you can redistribute it and/or modify
  5. * it under the terms of the GNU General Public License as published by
  6. * the Free Software Foundation; either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This program is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU General Public License
  15. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. /**
  18. * \file htdocs/core/menus/standard/empty.php
  19. * \brief This is an example of an empty top menu handler
  20. */
  21. /**
  22. * Class to manage empty menu
  23. */
  24. class MenuManager
  25. {
  26. /**
  27. * @var DoliDB Database handler.
  28. */
  29. public $db;
  30. var $type_user=0; // Put 0 for internal users, 1 for external users
  31. var $atarget=""; // To store default target to use onto links
  32. var $menu;
  33. var $menu_array_after;
  34. /**
  35. * Constructor
  36. *
  37. * @param DoliDB $db Database handler
  38. * @param int $type_user Type of user
  39. */
  40. function __construct($db, $type_user)
  41. {
  42. $this->type_user=$type_user;
  43. $this->db=$db;
  44. }
  45. /**
  46. * Load this->tabMenu
  47. *
  48. * @return void
  49. */
  50. function loadMenu()
  51. {
  52. }
  53. /**
  54. * Show menu
  55. *
  56. * @param string $mode 'top', 'left', 'jmobile'
  57. * @param array $moredata An array with more data to output
  58. * @return int 0 or nb of top menu entries if $mode = 'topnb'
  59. */
  60. function showmenu($mode, $moredata=null)
  61. {
  62. global $user,$conf,$langs,$dolibarr_main_db_name;
  63. $id='mainmenu';
  64. require_once DOL_DOCUMENT_ROOT.'/core/class/menu.class.php';
  65. $this->menu=new Menu();
  66. $res='ErrorBadParameterForMode';
  67. $noout=0;
  68. //if ($mode == 'jmobile') $noout=1;
  69. if ($mode == 'topnb')
  70. {
  71. return 1;
  72. }
  73. if ($mode == 'top')
  74. {
  75. if (empty($noout)) print_start_menu_array_empty();
  76. $usemenuhider = (GETPOST('testmenuhider','int') || ! empty($conf->global->MAIN_TESTMENUHIDER));
  77. // Show/Hide vertical menu
  78. if ($mode != 'jmobile' && $mode != 'topnb' && $usemenuhider && empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER))
  79. {
  80. $showmode=1;
  81. $classname = 'class="tmenu menuhider"';
  82. $idsel='menu';
  83. $this->menu->add('#', '', 0, $showmode, $atarget, "xxx", '', 0, $id, $idsel, $classname);
  84. }
  85. // Home
  86. $showmode=1;
  87. $classname='class="tmenusel"';
  88. $idsel='home';
  89. $this->menu->add('/index.php', $langs->trans("Home"), 0, $showmode, $this->atarget, 'home', '', 10, $id, $idsel, $classname);
  90. // Sort on position
  91. $this->menu->liste = dol_sort_array($this->menu->liste, 'position');
  92. // Output menu entries
  93. foreach($this->menu->liste as $menkey => $menuval)
  94. {
  95. if (empty($noout)) print_start_menu_entry_empty($menuval['idsel'],$menuval['classname'],$menuval['enabled']);
  96. if (empty($noout)) print_text_menu_entry_empty($menuval['titre'], $menuval['enabled'], ($menuval['url']!='#'?DOL_URL_ROOT:'').$menuval['url'], $menuval['id'], $menuval['idsel'], $menuval['classname'], ($menuval['target']?$menuval['target']:$atarget));
  97. if (empty($noout)) print_end_menu_entry_empty($menuval['enabled']);
  98. }
  99. $showmode=1;
  100. if (empty($noout)) print_start_menu_entry_empty('','class="tmenuend"',$showmode);
  101. if (empty($noout)) print_end_menu_entry_empty($showmode);
  102. if (empty($noout)) print_end_menu_array_empty();
  103. if ($mode == 'jmobile')
  104. {
  105. $this->topmenu = clone $this->menu;
  106. unset($this->menu->liste);
  107. }
  108. }
  109. if ($mode == 'jmobile') // Used to get menu in xml ul/li
  110. {
  111. // Home
  112. $showmode=1;
  113. $classname='class="tmenusel"';
  114. $idsel='home';
  115. $this->menu->add('/index.php', $langs->trans("Home"), 0, $showmode, $this->atarget, 'home', '', 10, $id, $idsel, $classname);
  116. // $this->menu->liste is top menu
  117. //var_dump($this->menu->liste);exit;
  118. $lastlevel = array();
  119. print '<!-- Generate menu list from menu handler '.$this->name.' -->'."\n";
  120. foreach($this->menu->liste as $key => $val) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu'
  121. {
  122. print '<ul class="ulmenu" data-inset="true">';
  123. print '<li class="lilevel0">';
  124. $substitarray = array('__LOGIN__' => $user->login, '__USER_ID__' => $user->id, '__USER_SUPERVISOR_ID__' => $user->fk_user);
  125. $substitarray['__USERID__'] = $user->id; // For backward compatibility
  126. $val['url'] = make_substitutions($val['url'], $substitarray);
  127. if ($val['enabled'] == 1)
  128. {
  129. $relurl=dol_buildpath($val['url'],1);
  130. $canonurl=preg_replace('/\?.*$/','',$val['url']);
  131. print '<a class="alilevel0" href="#">';
  132. // Add font-awesome
  133. if ($val['level'] == 0 && $val['mainmenu'] == 'home') print '<span class="fa fa-home fa-fw paddingright" aria-hidden="true"></span>';
  134. print $val['titre'];
  135. print '</a>'."\n";
  136. // Search submenu fot this mainmenu entry
  137. $tmpmainmenu=$val['mainmenu'];
  138. $tmpleftmenu='all';
  139. $submenu=new Menu();
  140. $langs->load("admin"); // Load translation file admin.lang
  141. $submenu->add("/admin/index.php?leftmenu=setup", $langs->trans("Setup"),0);
  142. $submenu->add("/admin/company.php", $langs->trans("MenuCompanySetup"),1);
  143. $submenu->add("/admin/modules.php", $langs->trans("Modules"),1);
  144. $submenu->add("/admin/menus.php", $langs->trans("Menus"),1);
  145. $submenu->add("/admin/ihm.php", $langs->trans("GUISetup"),1);
  146. $submenu->add("/admin/translation.php?mainmenu=home", $langs->trans("Translation"),1);
  147. $submenu->add("/admin/defaultvalues.php?mainmenu=home", $langs->trans("DefaultValues"),1);
  148. $submenu->add("/admin/boxes.php", $langs->trans("Boxes"),1);
  149. $submenu->add("/admin/delais.php",$langs->trans("Alerts"),1);
  150. $submenu->add("/admin/proxy.php?mainmenu=home", $langs->trans("Security"),1);
  151. $submenu->add("/admin/limits.php?mainmenu=home", $langs->trans("MenuLimits"),1);
  152. $submenu->add("/admin/pdf.php?mainmenu=home", $langs->trans("PDF"),1);
  153. $submenu->add("/admin/mails.php?mainmenu=home", $langs->trans("Emails"),1);
  154. $submenu->add("/admin/sms.php?mainmenu=home", $langs->trans("SMS"),1);
  155. $submenu->add("/admin/dict.php?mainmenu=home", $langs->trans("DictionarySetup"),1);
  156. $submenu->add("/admin/const.php?mainmenu=home", $langs->trans("OtherSetup"),1);
  157. //if ($tmpmainmenu.'-'.$tmpleftmenu == 'home-all') { var_dump($submenu); exit; }
  158. //if ($tmpmainmenu=='accountancy') { var_dump($submenu->liste); exit; }
  159. $nexturl=dol_buildpath($submenu->liste[0]['url'],1);
  160. $canonrelurl=preg_replace('/\?.*$/','',$relurl);
  161. $canonnexturl=preg_replace('/\?.*$/','',$nexturl);
  162. //var_dump($canonrelurl);
  163. //var_dump($canonnexturl);
  164. print '<ul>'."\n";
  165. if (($canonrelurl != $canonnexturl && ! in_array($val['mainmenu'],array('tools')))
  166. || (strpos($canonrelurl,'/product/index.php') !== false || strpos($canonrelurl,'/compta/bank/list.php') !== false))
  167. {
  168. // We add sub entry
  169. print str_pad('',1).'<li class="lilevel1 ui-btn-icon-right ui-btn">'; // ui-btn to highlight on clic
  170. print '<a href="'.$relurl.'">';
  171. if ($langs->trans(ucfirst($val['mainmenu'])."Dashboard") == ucfirst($val['mainmenu'])."Dashboard") // No translation
  172. {
  173. if (in_array($val['mainmenu'], array('cashdesk', 'websites'))) print $langs->trans("Access");
  174. else print $langs->trans("Dashboard");
  175. }
  176. else print $langs->trans(ucfirst($val['mainmenu'])."Dashboard");
  177. print '</a>';
  178. print '</li>'."\n";
  179. }
  180. if ($val['level']==0)
  181. {
  182. if ($val['enabled'])
  183. {
  184. $lastlevel[0]='enabled';
  185. }
  186. else if ($showmenu) // Not enabled but visible (so greyed)
  187. {
  188. $lastlevel[0]='greyed';
  189. }
  190. else
  191. {
  192. $lastlevel[0]='hidden';
  193. }
  194. }
  195. $lastlevel2 = array();
  196. foreach($submenu->liste as $key2 => $val2) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu'
  197. {
  198. $showmenu=true;
  199. if (! empty($conf->global->MAIN_MENU_HIDE_UNAUTHORIZED) && empty($val2['enabled'])) $showmenu=false;
  200. // If at least one parent is not enabled, we do not show any menu of all children
  201. if ($val2['level'] > 0)
  202. {
  203. $levelcursor = $val2['level']-1;
  204. while ($levelcursor >= 0)
  205. {
  206. if ($lastlevel2[$levelcursor] != 'enabled') $showmenu=false;
  207. $levelcursor--;
  208. }
  209. }
  210. if ($showmenu) // Visible (option to hide when not allowed is off or allowed)
  211. {
  212. $substitarray = array('__LOGIN__' => $user->login, '__USER_ID__' => $user->id, '__USER_SUPERVISOR_ID__' => $user->fk_user);
  213. $substitarray['__USERID__'] = $user->id; // For backward compatibility
  214. $val2['url'] = make_substitutions($val2['url'], $substitarray);
  215. $relurl2=dol_buildpath($val2['url'],1);
  216. $canonurl2=preg_replace('/\?.*$/','',$val2['url']);
  217. //var_dump($val2['url'].' - '.$canonurl2.' - '.$val2['level']);
  218. if (in_array($canonurl2,array('/admin/index.php','/admin/tools/index.php','/core/tools.php'))) $relurl2='';
  219. $disabled='';
  220. if (! $val2['enabled'])
  221. {
  222. $disabled=" vsmenudisabled";
  223. }
  224. print str_pad('',$val2['level']+1);
  225. print '<li class="lilevel'.($val2['level']+1);
  226. if ($val2['level']==0) print ' ui-btn-icon-right ui-btn'; // ui-btn to highlight on clic
  227. print $disabled.'">'; // ui-btn to highlight on clic
  228. if ($relurl2)
  229. {
  230. if ($val2['enabled']) // Allowed
  231. {
  232. print '<a href="'.$relurl2.'"';
  233. //print ' data-ajax="false"';
  234. print '>';
  235. $lastlevel2[$val2['level']]='enabled';
  236. }
  237. else // Not allowed but visible (greyed)
  238. {
  239. print '<a href="#" class="vsmenudisabled">';
  240. $lastlevel2[$val2['level']]='greyed';
  241. }
  242. }
  243. else
  244. {
  245. if ($val2['enabled']) // Allowed
  246. {
  247. $lastlevel2[$val2['level']]='enabled';
  248. }
  249. else
  250. {
  251. $lastlevel2[$val2['level']]='greyed';
  252. }
  253. }
  254. //var_dump($val2['level']);
  255. //var_dump($lastlevel2);
  256. print $val2['titre'];
  257. if ($relurl2)
  258. {
  259. if ($val2['enabled']) // Allowed
  260. print '</a>';
  261. else
  262. print '</a>';
  263. }
  264. print '</li>'."\n";
  265. }
  266. }
  267. //var_dump($submenu);
  268. print '</ul>';
  269. }
  270. if ($val['enabled'] == 2)
  271. {
  272. print '<font class="vsmenudisabled">'.$val['titre'].'</font>';
  273. }
  274. print '</li>';
  275. print '</ul>'."\n";
  276. }
  277. }
  278. if ($mode == 'left')
  279. {
  280. // Put here left menu entries
  281. // ***** START *****
  282. $langs->load("admin"); // Load translation file admin.lang
  283. $this->menu->add("/admin/index.php?leftmenu=setup", $langs->trans("Setup"),0);
  284. $this->menu->add("/admin/company.php", $langs->trans("MenuCompanySetup"),1);
  285. $this->menu->add("/admin/modules.php", $langs->trans("Modules"),1);
  286. $this->menu->add("/admin/menus.php", $langs->trans("Menus"),1);
  287. $this->menu->add("/admin/ihm.php", $langs->trans("GUISetup"),1);
  288. $this->menu->add("/admin/translation.php?mainmenu=home", $langs->trans("Translation"),1);
  289. $this->menu->add("/admin/defaultvalues.php?mainmenu=home", $langs->trans("DefaultValues"),1);
  290. $this->menu->add("/admin/boxes.php", $langs->trans("Boxes"),1);
  291. $this->menu->add("/admin/delais.php",$langs->trans("Alerts"),1);
  292. $this->menu->add("/admin/proxy.php?mainmenu=home", $langs->trans("Security"),1);
  293. $this->menu->add("/admin/limits.php?mainmenu=home", $langs->trans("MenuLimits"),1);
  294. $this->menu->add("/admin/pdf.php?mainmenu=home", $langs->trans("PDF"),1);
  295. $this->menu->add("/admin/mails.php?mainmenu=home", $langs->trans("Emails"),1);
  296. $this->menu->add("/admin/sms.php?mainmenu=home", $langs->trans("SMS"),1);
  297. $this->menu->add("/admin/dict.php?mainmenu=home", $langs->trans("DictionarySetup"),1);
  298. $this->menu->add("/admin/const.php?mainmenu=home", $langs->trans("OtherSetup"),1);
  299. // ***** END *****
  300. // do not change code after this
  301. if (empty($noout))
  302. {
  303. $alt=0; $altok=0; $blockvmenuopened=false;
  304. $num=count($this->menu->liste);
  305. for ($i = 0; $i < $num; $i++)
  306. {
  307. $alt++;
  308. if (empty($this->menu->liste[$i]['level']))
  309. {
  310. $altok++;
  311. $blockvmenuopened=true;
  312. $lastopened=true;
  313. for($j = ($i + 1); $j < $num; $j++)
  314. {
  315. if (empty($menu_array[$j]['level'])) $lastopened=false;
  316. }
  317. $alt = 0; // For menu manager "empty", we force to not have blockvmenufirst defined
  318. $lastopened = 1; // For menu manager "empty", we force to not have blockvmenulast defined
  319. if (($alt%2==0))
  320. {
  321. print '<div class="blockvmenub lockvmenuimpair blockvmenuunique'.($lastopened?' blockvmenulast':'').($alt == 1 ? ' blockvmenufirst':'').'">'."\n";
  322. }
  323. else
  324. {
  325. print '<div class="blockvmenu blockvmenupair blockvmenuunique'.($lastopened?' blockvmenulast':'').($alt == 1 ? ' blockvmenufirst':'').'">'."\n";
  326. }
  327. }
  328. // Add tabulation
  329. $tabstring='';
  330. $tabul=($this->menu->liste[$i]['level'] - 1);
  331. if ($tabul > 0)
  332. {
  333. for ($j=0; $j < $tabul; $j++)
  334. {
  335. $tabstring.='&nbsp; &nbsp;';
  336. }
  337. }
  338. if ($this->menu->liste[$i]['level'] == 0) {
  339. if ($this->menu->liste[$i]['enabled'])
  340. {
  341. print '<div class="menu_titre">'.$tabstring.'<a class="vmenu" href="'.dol_buildpath($this->menu->liste[$i]['url'],1).'"'.($this->menu->liste[$i]['target']?' target="'.$this->menu->liste[$i]['target'].'"':'').'>'.$this->menu->liste[$i]['titre'].'</a></div>'."\n";
  342. }
  343. else
  344. {
  345. print '<div class="menu_titre">'.$tabstring.'<font class="vmenudisabled">'.$this->menu->liste[$i]['titre'].'</font></div>'."\n";
  346. }
  347. print '<div class="menu_top"></div>'."\n";
  348. }
  349. if ($this->menu->liste[$i]['level'] > 0)
  350. {
  351. $cssmenu = '';
  352. if ($this->menu->liste[$i]['url']) $cssmenu = ' menu_contenu'.dol_string_nospecial(preg_replace('/\.php.*$/','',$this->menu->liste[$i]['url']));
  353. print '<div class="menu_contenu'.$cssmenu.'">';
  354. if ($this->menu->liste[$i]['enabled'])
  355. {
  356. print $tabstring;
  357. if ($this->menu->liste[$i]['url']) print '<a class="vsmenu" href="'.dol_buildpath($this->menu->liste[$i]['url'],1).'"'.($this->menu->liste[$i]['target']?' target="'.$this->menu->liste[$i]['target'].'"':'').'>';
  358. else print '<span class="vsmenu">';
  359. if ($this->menu->liste[$i]['url']) print $this->menu->liste[$i]['titre'].'</a>';
  360. else print '</span>';
  361. }
  362. else
  363. {
  364. print $tabstring.'<font class="vsmenudisabled vsmenudisabledmargin">'.$this->menu->liste[$i]['titre'].'</font>';
  365. }
  366. // If title is not pure text and contains a table, no carriage return added
  367. if (! strstr($this->menu->liste[$i]['titre'],'<table')) print '<br>';
  368. print '</div>'."\n";
  369. }
  370. // If next is a new block or end
  371. if (empty($this->menu->liste[$i+1]['level']))
  372. {
  373. print '<div class="menu_end"></div>'."\n";
  374. print "</div>\n";
  375. }
  376. }
  377. if ($altok) print '<div class="blockvmenuend"></div>';
  378. }
  379. if ($mode == 'jmobile')
  380. {
  381. $this->leftmenu = clone $this->menu;
  382. unset($this->menu->liste);
  383. }
  384. }
  385. /*
  386. if ($mode == 'jmobile')
  387. {
  388. foreach($this->menu->liste as $key => $val) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu'
  389. {
  390. print '<ul class="ulmenu" data-inset="true">';
  391. print '<li class="lilevel0">';
  392. $substitarray = array('__LOGIN__' => $user->login, '__USER_ID__' => $user->id, '__USER_SUPERVISOR_ID__' => $user->fk_user);
  393. $substitarray['__USERID__'] = $user->id; // For backward compatibility
  394. $val['url'] = make_substitutions($val['url'], $substitarray);
  395. if ($val['enabled'] == 1)
  396. {
  397. $relurl=dol_buildpath($val['url'],1);
  398. print '<a href="#">'.$val['titre'].'</a>'."\n";
  399. // Search submenu fot this entry
  400. $tmpmainmenu=$val['mainmenu'];
  401. $tmpleftmenu='all';
  402. //$submenu=new Menu();
  403. //$res=print_left_eldy_menu($this->db,$this->menu_array,$this->menu_array_after,$this->tabMenu,$submenu,1,$tmpmainmenu,$tmpleftmenu);
  404. //$nexturl=dol_buildpath($submenu->liste[0]['url'],1);
  405. $submenu=$this->leftmenu;
  406. $canonrelurl=preg_replace('/\?.*$/','',$relurl);
  407. $canonnexturl=preg_replace('/\?.*$/','',$nexturl);
  408. //var_dump($canonrelurl);
  409. //var_dump($canonnexturl);
  410. print '<ul>';
  411. if ($canonrelurl != $canonnexturl && ! in_array($val['mainmenu'],array('home','tools')))
  412. {
  413. // We add sub entry
  414. print '<li><a href="'.$relurl.'">'.$langs->trans("MainArea").'-'.$val['titre'].'</a></li>'."\n";
  415. }
  416. foreach($submenu->liste as $key2 => $val2) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu'
  417. {
  418. $substitarray = array('__LOGIN__' => $user->login, '__USER_ID__' => $user->id, '__USER_SUPERVISOR_ID__' => $user->fk_user);
  419. $substitarray['__USERID__'] = $user->id; // For backward compatibility
  420. $val2['url'] = make_substitutions($val2['url'], $substitarray);
  421. $relurl2=dol_buildpath($val2['url'],1);
  422. //var_dump($val2);
  423. print '<li><a href="'.$relurl2.'">'.$val2['titre'].'</a></li>'."\n";
  424. }
  425. //var_dump($submenu);
  426. print '</ul>';
  427. }
  428. if ($val['enabled'] == 2)
  429. {
  430. print '<font class="vsmenudisabled">'.$val['titre'].'</font>';
  431. }
  432. print '</li>';
  433. print '</ul>'."\n";
  434. break; // Only first menu entry (so home)
  435. }
  436. }
  437. */
  438. unset($this->menu);
  439. return $res;
  440. }
  441. }
  442. /**
  443. * Output menu entry
  444. *
  445. * @return void
  446. */
  447. function print_start_menu_array_empty()
  448. {
  449. global $conf;
  450. print '<div class="tmenudiv">';
  451. print '<ul class="tmenu"'.(empty($conf->global->MAIN_OPTIMIZEFORTEXTBROWSER)?'':' title="Top menu"').'>';
  452. }
  453. /**
  454. * Output start menu entry
  455. *
  456. * @param string $idsel Text
  457. * @param string $classname String to add a css class
  458. * @param int $showmode 0 = hide, 1 = allowed or 2 = not allowed
  459. * @return void
  460. */
  461. function print_start_menu_entry_empty($idsel,$classname,$showmode)
  462. {
  463. if ($showmode)
  464. {
  465. print '<li '.$classname.' id="mainmenutd_'.$idsel.'">';
  466. //print '<div class="tmenuleft tmenusep"></div>';
  467. print '<div class="tmenucenter">';
  468. }
  469. }
  470. /**
  471. * Output menu entry
  472. *
  473. * @param string $text Text
  474. * @param int $showmode 1 or 2
  475. * @param string $url Url
  476. * @param string $id Id
  477. * @param string $idsel Id sel
  478. * @param string $classname Class name
  479. * @param string $atarget Target
  480. * @return void
  481. */
  482. function print_text_menu_entry_empty($text, $showmode, $url, $id, $idsel, $classname, $atarget)
  483. {
  484. global $conf,$langs;
  485. if ($showmode == 1)
  486. {
  487. print '<a class="tmenuimage" tabindex="-1" href="'.$url.'"'.($atarget?' target="'.$atarget.'"':'').'>';
  488. print '<div class="'.$id.' '.$idsel.'"><span class="'.$id.' tmenuimage" id="mainmenuspan_'.$idsel.'"></span></div>';
  489. print '</a>';
  490. print '<a '.$classname.' id="mainmenua_'.$idsel.'" href="'.$url.'"'.($atarget?' target="'.$atarget.'"':'').'>';
  491. print '<span class="mainmenuaspan">';
  492. print $text;
  493. print '</span>';
  494. print '</a>';
  495. }
  496. if ($showmode == 2)
  497. {
  498. print '<div class="'.$id.' '.$idsel.' tmenudisabled"><span class="'.$id.'" id="mainmenuspan_'.$idsel.'"></span></div>';
  499. print '<a class="tmenudisabled" id="mainmenua_'.$idsel.'" href="#" title="'.dol_escape_htmltag($langs->trans("NotAllowed")).'">';
  500. }
  501. }
  502. /**
  503. * Output end menu entry
  504. *
  505. * @param int $showmode 0 = hide, 1 = allowed or 2 = not allowed
  506. * @return void
  507. */
  508. function print_end_menu_entry_empty($showmode)
  509. {
  510. if ($showmode)
  511. {
  512. print '</div></li>';
  513. print "\n";
  514. }
  515. }
  516. /**
  517. * Output menu array
  518. *
  519. * @return void
  520. */
  521. function print_end_menu_array_empty()
  522. {
  523. print '</ul>';
  524. print '</div>';
  525. print "\n";
  526. }