dolibarr  7.0.0-beta
Public Member Functions | Private Member Functions | List of all members
Menubase Class Reference

Class to manage menu entries. More...

Public Member Functions

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

Private Member Functions

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

Detailed Description

Class to manage menu entries.

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

Constructor & Destructor Documentation

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

Constructor.

Parameters
DoliDB$dbDatabase handler
string$menu_handlerMenu handler

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

Member Function Documentation

Menubase::create (   $user = null)

Create menu entry into database.

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

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

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

Menubase::delete (   $user)

Delete object in database.

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

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

References $resql, and dol_syslog().

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

Load object in memory from database.

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

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

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

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 354 of file menubase.class.php.

References position, type, and user.

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 416 of file menubase.class.php.

References dol_syslog(), and recur().

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 505 of file menubase.class.php.

References $resql, $title, dol_print_error(), dol_syslog(), make_substitutions(), and verifCond().

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 387 of file menubase.class.php.

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 644 of file menubase.class.php.

Referenced by menuLeftCharger().

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 <0 if KO, >0 if OK

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

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


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