* * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see . */ /** * \file htdocs/core/menus/standard/empty.php * \brief This is an example of an empty top menu handler */ /** * Class to manage empty menu */ class MenuManager { var $db; var $type_user=0; // Put 0 for internal users, 1 for external users var $atarget=""; // To store default target to use onto links var $menu; var $menu_array_after; /** * Constructor * * @param DoliDB $db Database handler * @param int $type_user Type of user */ function __construct($db, $type_user) { $this->type_user=$type_user; $this->db=$db; } /** * Load this->tabMenu * * @return void */ function loadMenu() { } /** * Show menu * * @param string $mode 'top', 'left', 'jmobile' * @return void */ function showmenu($mode) { global $user,$conf,$langs,$dolibarr_main_db_name; $id='mainmenu'; require_once DOL_DOCUMENT_ROOT.'/core/class/menu.class.php'; $this->menu=new Menu(); $res='ErrorBadParameterForMode'; $noout=0; if ($mode == 'jmobile') $noout=1; if ($mode == 'top' || $mode == 'jmobile') { if (empty($noout)) print_start_menu_array_empty(); // Home $showmode=1; $idsel='home'; $classname='class="tmenusel"'; if (empty($noout)) print_start_menu_entry_empty($idsel, $classname, $showmode); if (empty($noout)) print_text_menu_entry_empty($langs->trans("Home"), 1, dol_buildpath('/index.php',1).'?mainmenu=home&leftmenu=', $id, $idsel, $classname, $this->atarget); if (empty($noout)) print_end_menu_entry_empty($showmode); $this->menu->add(dol_buildpath('/index.php',1), $langs->trans("Home"), 0, $showmode, $this->atarget, 'home', ''); $showmode=1; if (empty($noout)) print_start_menu_entry_empty('','class="tmenuend"',$showmode); if (empty($noout)) print_end_menu_entry_empty($showmode); if (empty($noout)) print_end_menu_array_empty(); if ($mode == 'jmobile') { $this->topmenu=dol_clone($this->menu); unset($this->menu->liste); } } if ($mode == 'left' || $mode == 'jmobile') { // Put here left menu entries // ***** START ***** $langs->load("admin"); // Load translation file admin.lang $this->menu->add("/admin/index.php?leftmenu=setup", $langs->trans("Setup"),0); $this->menu->add("/admin/company.php", $langs->trans("MenuCompanySetup"),1); $this->menu->add("/admin/modules.php", $langs->trans("Modules"),1); $this->menu->add("/admin/menus.php", $langs->trans("Menus"),1); $this->menu->add("/admin/ihm.php", $langs->trans("GUISetup"),1); $this->menu->add("/admin/boxes.php", $langs->trans("Boxes"),1); $this->menu->add("/admin/delais.php",$langs->trans("Alerts"),1); $this->menu->add("/admin/proxy.php?mainmenu=home", $langs->trans("Security"),1); $this->menu->add("/admin/limits.php?mainmenu=home", $langs->trans("MenuLimits"),1); $this->menu->add("/admin/pdf.php?mainmenu=home", $langs->trans("PDF"),1); $this->menu->add("/admin/mails.php?mainmenu=home", $langs->trans("Emails"),1); $this->menu->add("/admin/sms.php?mainmenu=home", $langs->trans("SMS"),1); $this->menu->add("/admin/dict.php?mainmenu=home", $langs->trans("DictionnarySetup"),1); $this->menu->add("/admin/const.php?mainmenu=home", $langs->trans("OtherSetup"),1); // ***** END ***** // do not change code after this if (empty($noout)) { $alt=0; $num=count($this->menu->liste); for ($i = 0; $i < $num; $i++) { $alt++; if (empty($this->menu->liste[$i]['level'])) { if (($alt%2==0)) { print '
'."\n"; } else { print '
'."\n"; } } // Place tabulation $tabstring=''; $tabul=($this->menu->liste[$i]['level'] - 1); if ($tabul > 0) { for ($j=0; $j < $tabul; $j++) { $tabstring.='   '; } } if ($this->menu->liste[$i]['level'] == 0) { if ($this->menu->liste[$i]['enabled']) { print ''."\n"; } else { print ''."\n"; } print ''."\n"; } if ($this->menu->liste[$i]['level'] > 0) { print ''."\n"; } // If next is a new block or end if (empty($this->menu->liste[$i+1]['level'])) { print ''."\n"; print "
\n"; } } } if ($mode == 'jmobile') { $this->leftmenu=dol_clone($this->menu); unset($this->menu->liste); } } if ($mode == 'jmobile') { foreach($this->topmenu->liste as $key => $val) // $val['url','titre','level','enabled'=0|1|2,'target','mainmenu','leftmenu' { print ''."\n"; break; // Only first menu entry (so home) } } unset($this->menu); return $res; } } /** * Output menu entry * * @return void */ function print_start_menu_array_empty() { print '
'; print ''; print '
'; print "\n"; } ?>