Menu
in package
Creates public page menu
Tags
Table of Contents
Constants
Properties
- $data : array<int, array<string, string|int|null>>
- $db : SQL
- $nav : Navigation
- $tr : Translator
- $tree : array<int, array<int, array<int, int>>>
Methods
- __construct() : mixed
- getChildIdByType() : int|null
- Returns the first child of the given type
- getFamilyIds() : array<string|int, int>
- Returns descendants of selected parent
- getMenuId() : int|null
- Returns menu id of set section id
- renderBreadcrumb() : void
- Prints breadcrumb navigation
- renderDropdown() : void
- Prints selected navigation at level of selected parent to the <li> list
- renderList() : void
- Prints selected navigation at level of selected parent to the <li> list
- renderRow() : void
- Prints all descendants in a row
- getLink() : string
- Returns full a link or just name
- getLinkParams() : string
- Returns link href
- isActive() : bool
- Check if selected item is active
- isOpen() : bool
- Is menu item opened section
- loadData() : void
- Load data
- renderDropdownPanel() : void
- Prints Bootstrap dropdown menu
Constants
BOTTOM
public
int
BOTTOM
= 9
Universal generic for basic menu position - usage is based on website; HEADER is default
FOOTER
public
int
FOOTER
= 7
Universal generic for basic menu position - usage is based on website; HEADER is default
HEADER
public
int
HEADER
= 3
Universal generic for basic menu position - usage is based on website; HEADER is default
LANG
public
int
LANG
= 1
Universal generic for basic menu position - usage is based on website; HEADER is default
MOBIL
public
int
MOBIL
= 11
Universal generic for basic menu position - usage is based on website; HEADER is default
TOP
public
int
TOP
= 2
Universal generic for basic menu position - usage is based on website; HEADER is default
Properties
$data
protected
array<int, array<string, string|int|null>>
$data
= []
$db
protected
SQL
$db
$nav
protected
Navigation
$nav
$tr
protected
Translator
$tr
$tree
protected
array<int, array<int, array<int, int>>>
$tree
= []
Navigation structure
Methods
__construct()
public
__construct(SQL $db, Navigation $nav, Translator $tr) : mixed
Parameters
- $db : SQL
- $nav : Navigation
- $tr : Translator
getChildIdByType()
Returns the first child of the given type
public
getChildIdByType(int $type[, int $placeId = self::HEADER ][, int $parentId = 0 ][, int|null $access = null ]) : int|null
Parameters
- $type : int
- $placeId : int = self::HEADER
- $parentId : int = 0
- $access : int|null = null
Return values
int|nullgetFamilyIds()
Returns descendants of selected parent
public
getFamilyIds(int $parentId, int $placeId[, string $para = 'name' ]) : array<string|int, int>
Parameters
- $parentId : int
- $placeId : int
- $para : string = 'name'
Return values
array<string|int, int>getMenuId()
Returns menu id of set section id
public
getMenuId(int $navId[, int $placeId = self::HEADER ][, int $parentId = 0 ]) : int|null
Parameters
- $navId : int
- $placeId : int = self::HEADER
- $parentId : int = 0
Return values
int|nullrenderBreadcrumb()
Prints breadcrumb navigation
public
renderBreadcrumb([string $divider = ' > ' ][, bool $begin = false ][, int|null $showFrom = null ][, int|null $showTo = null ]) : void
Parameters
- $divider : string = ' > '
- $begin : bool = false
- $showFrom : int|null = null
- $showTo : int|null = null
renderDropdown()
Prints selected navigation at level of selected parent to the <li> list
public
renderDropdown(int $parentId[, int $placeId = self::HEADER ][, int $deep = 2 ][, bool $open = true ][, bool $allActive = true ][, string|null $ident = null ]) : void
Parameters
- $parentId : int
- $placeId : int = self::HEADER
- $deep : int = 2
- $open : bool = true
-
Show open section only
- $allActive : bool = true
- $ident : string|null = null
renderList()
Prints selected navigation at level of selected parent to the <li> list
public
renderList(int $parentId[, int $placeId = self::HEADER ][, array<string|int, string>|string $divider = '' ][, int $deep = 1 ][, bool $openOnly = false ][, bool $allActive = true ][, string|null $ident = null ]) : void
Parameters
- $parentId : int
- $placeId : int = self::HEADER
- $divider : array<string|int, string>|string = ''
- $deep : int = 1
- $openOnly : bool = false
-
Show open section only
- $allActive : bool = true
- $ident : string|null = null
renderRow()
Prints all descendants in a row
public
renderRow(int $parentId[, int $placeId = self::HEADER ][, string $divider = '' ][, bool $open = true ][, string|null $ident = null ]) : void
Parameters
- $parentId : int
-
Whose descendants should be listed
- $placeId : int = self::HEADER
- $divider : string = ''
- $open : bool = true
-
Should be displayed the open section
- $ident : string|null = null
getLink()
Returns full a link or just name
protected
getLink(int $id, string $name[, string $params = null ]) : string
Parameters
- $id : int
- $name : string
- $params : string = null
Return values
stringgetLinkParams()
Returns link href
protected
getLinkParams(int $id) : string
Parameters
- $id : int
Return values
stringisActive()
Check if selected item is active
protected
isActive(int $id) : bool
Parameters
- $id : int
Return values
boolisOpen()
Is menu item opened section
protected
isOpen(int $id) : bool
Parameters
- $id : int
Return values
boolloadData()
Load data
protected
loadData() : void
renderDropdownPanel()
Prints Bootstrap dropdown menu
protected
renderDropdownPanel(int $parentId, int $placeId, int $deep, bool $open, bool $allActive[, string|null $ident = null ]) : void
Parameters
- $parentId : int
- $placeId : int
- $deep : int
- $open : bool
- $allActive : bool
- $ident : string|null = null