dolibarr/htdocs/core/class/menu.class.php

78 lines
2.1 KiB
PHP
Raw Normal View History

2004-10-20 23:06:45 +02:00
<?php
2006-12-04 19:31:18 +01:00
/* Copyright (C) 2002-2006 Rodolphe Quiedeville <rodolphe@quiedeville.org>
2008-03-30 20:39:07 +02:00
* Copyright (C) 2005-2008 Laurent Destailleur <eldy@users.sourceforge.net>
2009-07-28 00:48:05 +02:00
*
2002-05-09 16:57:48 +02:00
* 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
2011-08-01 01:45:11 +02:00
* along with this program. If not, see <http://www.gnu.org/licenses/>.
2002-05-09 16:57:48 +02:00
*/
/**
2010-04-28 12:02:54 +02:00
* \file htdocs/core/class/menu.class.php
2010-11-22 10:18:53 +01:00
* \ingroup core
2009-07-28 00:48:05 +02:00
* \brief Fichier de la classe de gestion du menu gauche
*/
2004-10-29 00:15:31 +02:00
/**
2009-07-28 00:48:05 +02:00
* \class Menu
* \brief Classe de gestion du menu gauche
*/
2002-05-09 16:57:48 +02:00
class Menu {
var $liste;
2002-05-09 16:57:48 +02:00
/**
2011-09-11 20:35:38 +02:00
* Constructor
*/
function Menu()
{
2009-07-28 00:48:05 +02:00
$this->liste = array();
}
2002-05-09 16:57:48 +02:00
/**
2009-06-06 04:50:59 +02:00
* \brief Vide l'objet menu de ces entrees
*/
function clear()
{
$this->liste = array();
}
2002-05-09 16:57:48 +02:00
/**
2009-07-28 00:48:05 +02:00
* \brief Add a menu entry
* \param url Url a suivre sur le clic
2009-06-06 04:50:59 +02:00
* \param titre Libelle menu a afficher
* \param level Niveau du menu a ajouter
* \param enabled Menu actif ou non
* \param target Target lien
*/
function add($url, $titre, $level=0, $enabled=1, $target='',$mainmenu='')
{
2011-09-17 21:49:50 +02:00
$i = count($this->liste);
$this->liste[$i]['url'] = $url;
$this->liste[$i]['titre'] = $titre;
$this->liste[$i]['level'] = $level;
$this->liste[$i]['enabled'] = $enabled;
$this->liste[$i]['target'] = $target;
$this->liste[$i]['mainmenu'] = $mainmenu;
}
2002-05-09 16:57:48 +02:00
2006-12-04 18:50:54 +01:00
/**
2009-07-28 00:48:05 +02:00
* \brief Remove a menu entry
2006-12-04 18:50:54 +01:00
*/
function remove_last()
2009-07-28 00:48:05 +02:00
{
2011-09-17 21:49:50 +02:00
if (count($this->liste) > 1) array_pop($this->liste);
2006-12-04 18:50:54 +01:00
}
2002-05-09 16:57:48 +02:00
}