Ajout des gestionnaires de menu "empty" pour exemple

This commit is contained in:
Laurent Destailleur 2006-08-17 22:33:10 +00:00
parent 306553fd53
commit 068e3ef30a
2 changed files with 203 additions and 0 deletions

View File

@ -0,0 +1,128 @@
<?php
/* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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 2 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/
/**
\file htdocs/includes/menus/barre_left/empty.php
\brief This is an example of an empty left menu handler
\version $Revision$
*/
/**
\class MenuLeftTop
\brief Class for left empty menu
*/
class MenuLeft {
var $require_top=array("empty"); // If this top menu handler must be used with a particular left menu handler
/**
* \brief Constructor
* \param db Dabatase handler
* \param menu_array Menu array that you will override in showmenu() function
*/
function MenuLeft($db,&$menu_array)
{
$this->db=$db;
$this->menu_array=$menu_array;
}
/**
* \brief Show menu
*/
function showmenu()
{
global $user,$conf,$langs,$dolibarr_main_db_name;
$newmenu = new Menu();
// Put here left menu entries
// ***** START *****
$langs->load("admin"); // Load translation file admin.lang
$newmenu->add(DOL_URL_ROOT."/admin/index.php?leftmenu=setup", $langs->trans("Setup"));
$newmenu->add_submenu(DOL_URL_ROOT."/admin/company.php", $langs->trans("MenuCompanySetup"));
$newmenu->add_submenu(DOL_URL_ROOT."/admin/modules.php", $langs->trans("Modules"));
$newmenu->add_submenu(DOL_URL_ROOT."/admin/ihm.php", $langs->trans("GUISetup"));
$newmenu->add_submenu(DOL_URL_ROOT."/admin/boxes.php", $langs->trans("Boxes"));
$newmenu->add_submenu(DOL_URL_ROOT."/admin/delais.php",$langs->trans("Alerts"));
$newmenu->add_submenu(DOL_URL_ROOT."/admin/triggers.php", $langs->trans("Triggers"));
$newmenu->add_submenu(DOL_URL_ROOT."/admin/perms.php", $langs->trans("Security"));
$newmenu->add_submenu(DOL_URL_ROOT."/admin/dict.php", $langs->trans("DictionnarySetup"));
$newmenu->add_submenu(DOL_URL_ROOT."/admin/const.php", $langs->trans("OtherSetup"));
// ***** END *****
// do not change code after this
// override menu_array by value array in $newmenu
$this->menu_array=$newmenu->liste;
$alt=0;
for ($i = 0 ; $i < sizeof($this->menu_array) ; $i++)
{
$alt++;
if ($this->menu_array[$i]['level']==0) {
if (($alt%2==0))
{
print '<div class="blockvmenuimpair">'."\n";
}
else
{
print '<div class="blockvmenupair">'."\n";
}
}
if ($this->menu_array[$i]['level']==0) {
if ($this->menu_array[$i]['enabled'])
print '<a class="vmenu" href="'.$this->menu_array[$i]['url'].'">'.$this->menu_array[$i]['titre'].'</a><br>';
else
print '<font class="vmenudisabled">'.$this->menu_array[$i]['titre'].'</font><br>';
}
if ($this->menu_array[$i]['level']==1) {
if ($this->menu_array[$i]['enabled'])
print '<a class="vsmenu" href="'.$this->menu_array[$i]['url'].'">'.$this->menu_array[$i]['titre'].'</a><br>';
else
print '<font class="vsmenudisabled">'.$this->menu_array[$i]['titre'].'</font><br>';
}
if ($this->menu_array[$i]['level']==2) {
if ($this->menu_array[$i]['enabled'])
print '&nbsp; &nbsp; <a class="vsmenu" href="'.$this->menu_array[$i]['url'].'">'.$this->menu_array[$i]['titre'].'</a><br>';
else
print '&nbsp; &nbsp; <font class="vsmenudisabled">'.$this->menu_array[$i]['titre'].'</font><br>';
}
if ($this->menu_array[$i]['level']==3) {
if ($this->menu_array[$i]['enabled'])
print '&nbsp; &nbsp; &nbsp; &nbsp; <a class="vsmenu" href="'.$this->menu_array[$i]['url'].'">'.$this->menu_array[$i]['titre'].'</a><br>';
else
print '&nbsp; &nbsp; &nbsp; &nbsp; <font class="vsmenudisabled">'.$this->menu_array[$i]['titre'].'</font><br>';
}
if ($i == (sizeof($this->menu_array)-1) || $this->menu_array[$i+1]['level']==0) {
print "</div>\n";
}
}
}
}
?>

View File

@ -0,0 +1,75 @@
<?php
/* Copyright (C) 2006 Laurent Destailleur <eldy@users.sourceforge.net>
*
* 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 2 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, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*
* $Id$
* $Source$
*/
/**
\file htdocs/includes/menus/barre_top/empty.php
\brief This is an example of an empty top menu handler
\version $Revision$
*/
/**
\class MenuTop
\brief Class for top empty menu
*/
class MenuTop {
var $require_left=array("empty"); // If this top menu handler must be used with a particular left menu handler
var $atarget=""; // To store arget to use in menu links
/**
* \brief Constructor
* \param db Dabatase handler
*/
function MenuTop($db)
{
global $langs;
$this->db=$db;
}
/**
* \brief Show menu
*/
function showmenu()
{
global $user,$conf,$langs,$dolibarr_main_db_name;;
print '<table class="tmenu"><tr class="tmenu">';
// Menu Home
print '<td class="tmenu"><a href="'.DOL_URL_ROOT.'/index.php?mainmenu=home">'.$langs->trans("Home").'</a></td>';
// Put here top menu entries
// ***** START *****
// print '<td class="tmenu"><a '.$class.' href="'.DOL_URL_ROOT.'/thepage1.php>My menu entry 1</a></td>';
// print '<td class="tmenu"><a '.$class.' href="'.DOL_URL_ROOT.'/thepage2.php>My menu entry 2</a></td>';
// ...
// ***** END *****
print '</tr></table>';
}
}
?>