dolibarr 19.0.3
Menubase Class Reference

Class to manage menu entries. More...

Public Member Functions

 __construct ($db, $menu_handler='')
 Constructor.
 
 create ($user=null)
 Create menu entry into database.
 
 update ($user=null, $notrigger=0)
 Update menu entry into database.
 
 fetch ($id, $user=null)
 Load object in memory from database.
 
 delete ($user)
 Delete object in database.
 
 initAsSpecimen ()
 Initialise an instance with random values.
 
 menuTopCharger ($mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu)
 Load tabMenu array with top menu entries found into database.
 
 menuLeftCharger ($newmenu, $mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu)
 Load entries found from database (and stored into $tabMenu) in $this->newmenu array.
 
 menuLoad ($mymainmenu, $myleftmenu, $type_user, $menu_handler, &$tabMenu)
 Load entries found in database into variable $tabMenu.
 

Private Member Functions

 recur ($tab, $pere, $level)
 Complete this->newmenu with menu entry found in $tab.
 

Detailed Description

Class to manage menu entries.

Definition at line 30 of file menubase.class.php.

Constructor & Destructor Documentation

◆ __construct()

Menubase::__construct ( $db,
$menu_handler = '' )

Constructor.

Parameters
DoliDB$dbDatabase handler
string$menu_handlerMenu handler

Definition at line 171 of file menubase.class.php.

Member Function Documentation

◆ create()

Menubase::create ( $user = null)

Create menu entry into database.

Parameters
User$userUser that create
Returns
int Return integer <0 if KO, Id of record if OK

Definition at line 184 of file menubase.class.php.

References dol_print_error(), dol_syslog(), position, type, and user.

◆ delete()

Menubase::delete ( $user)

Delete object in database.

Parameters
User$userUser that delete
Returns
int Return integer <0 if KO, >0 if OK

Definition at line 467 of file menubase.class.php.

References dol_syslog().

◆ fetch()

Menubase::fetch ( $id,
$user = null )

Load object in memory from database.

Parameters
int$idId object
User$userUser that load
Returns
int Return integer <0 if KO, >0 if OK

Definition at line 395 of file menubase.class.php.

References dol_syslog(), position, type, and user.

◆ initAsSpecimen()

Menubase::initAsSpecimen ( )

Initialise an instance with random values.

Used to build previews or test instances. id must be 0 if object instance is a specimen.

Returns
void

Definition at line 492 of file menubase.class.php.

References position, type, and user.

◆ menuLeftCharger()

Menubase::menuLeftCharger ( $newmenu,
$mymainmenu,
$myleftmenu,
$type_user,
$menu_handler,
& $tabMenu )

Load entries found from database (and stored into $tabMenu) in $this->newmenu array.

Warning: Entries in $tabMenu must have child after parent

Parameters
Menu$newmenuMenu array to complete (in most cases, it's empty, may be already initialized with some menu manager like eldy)
string$mymainmenuValue for mainmenu to filter menu to load (often $_SESSION["mainmenu"])
string$myleftmenuValue for leftmenu to filter menu to load (always '')
int$type_user0=Menu for backoffice, 1=Menu for front office
string$menu_handlerFilter on name of menu_handler used (auguria, eldy...)
array$tabMenuArray with menu entries already loaded
Returns
Menu Menu array for particular mainmenu value or full tabArray

Definition at line 554 of file menubase.class.php.

References dol_syslog(), and recur().

◆ menuLoad()

Menubase::menuLoad ( $mymainmenu,
$myleftmenu,
$type_user,
$menu_handler,
& $tabMenu )

Load entries found in database into variable $tabMenu.

Note that only "database menu entries" are loaded here, hardcoded will not be present into output.

Parameters
string$mymainmenuValue for mainmenu that defined mainmenu
string$myleftmenuValue for left that defined leftmenu
int$type_userLooks for menu entry for 0=Internal users, 1=External users
string$menu_handlerName of menu_handler used ('auguria', 'eldy'...)
array$tabMenuArray to store new entries found (in most cases, it's empty, but may be alreay filled)
Returns
int >0 if OK, <0 if KO

Definition at line 637 of file menubase.class.php.

References dol_print_error(), make_substitutions(), and verifCond().

◆ menuTopCharger()

Menubase::menuTopCharger ( $mymainmenu,
$myleftmenu,
$type_user,
$menu_handler,
& $tabMenu )

Load tabMenu array with top menu entries found into database.

Parameters
string$mymainmenuValue for mainmenu to filter menu to load (always '')
string$myleftmenuValue for leftmenu to filter menu to load (always '')
int$type_user0=Menu for backoffice, 1=Menu for front office
string$menu_handlerFilter on name of menu_handler used (auguria, eldy...)
array$tabMenuIf array with menu entries already loaded, we put this array here (in most cases, it's empty)
Returns
array Return array with menu entries for top menu

Definition at line 524 of file menubase.class.php.

◆ recur()

Menubase::recur ( $tab,
$pere,
$level )
private

Complete this->newmenu with menu entry found in $tab.

Parameters
array$tabTab array with all menu entries
int$pereId of parent
int$levelLevel
Returns
void

Definition at line 772 of file menubase.class.php.

References recur().

Referenced by menuLeftCharger(), and recur().

◆ update()

Menubase::update ( $user = null,
$notrigger = 0 )

Update menu entry into database.

Parameters
User$userUser that modify
int$notrigger0=no, 1=yes (no update trigger)
Returns
int Return integer <0 if KO, >0 if OK

Definition at line 330 of file menubase.class.php.

References dol_syslog(), position, type, and user.


The documentation for this class was generated from the following file: