Sections
in package
Access to navigation records for administrative forms
Tags
Table of Contents
Properties
- $divider : string
- $db : SQL
- $filtered : array<string|int, mixed>|null
- $items : array<string|int, mixed>
- $langId : int
- $languages : array<string, array{id: int, name: string, url: string, type: int}>
- $loaded : bool|null
- $nav : AdminNavigation
- $user : UserSession
Methods
- __construct() : mixed
- getFilteredList() : array<string|int, string>|array<string|int, int>
- Get filtered list
- getLangId() : int
- Get language id or zero
- getLangsData() : array<string, array{id: int, name: string, url: string, type: int}>
- Get all info for languages
- getLanguages() : array<string|int, string>
- Get list of languages
- getList() : array<string|int, string>|array<string|int, int>
- Get $key=>$col array
- getNameById() : string|null
- Get section name
- getOptions() : array<string|int, mixed>
- Get array for InputSelect
- getRecordKeys() : array<string|int, mixed>
- Shortcut to get record (leaf) items in navigation
- getSectionKeys() : array<string|int, mixed>
- Shortcut to get trunk items in navigation
- buildStructure() : array<string|int, mixed>
- Build up navigation structure
- loadData() : void
- Load records
- setAllow() : void
- Setup which section is allowed for current user
- sortByName() : int
- Compare items for sorting by name
Properties
$divider
public
static string
$divider
= ' - '
$db
protected
SQL
$db
$filtered
protected
array<string|int, mixed>|null
$filtered
= null
$items
protected
array<string|int, mixed>
$items
= []
$langId
protected
int
$langId
= 0
$languages
protected
array<string, array{id: int, name: string, url: string, type: int}>
$languages
= []
$loaded
protected
bool|null
$loaded
= null
$nav
protected
AdminNavigation
$nav
$user
protected
UserSession
$user
Methods
__construct()
public
__construct(SQL $db, AdminNavigation $nav, UserSession $user) : mixed
Parameters
- $db : SQL
- $nav : AdminNavigation
- $user : UserSession
getFilteredList()
Get filtered list
public
getFilteredList([array<string|int, int>|null $types = null ][, bool|null $leaf = false ][, string $col = 'name' ][, bool $allow = true ][, bool $inFilter = true ]) : array<string|int, string>|array<string|int, int>
Parameters
- $types : array<string|int, int>|null = null
- $leaf : bool|null = false
- $col : string = 'name'
- $allow : bool = true
- $inFilter : bool = true
Return values
array<string|int, string>|array<string|int, int>getLangId()
Get language id or zero
public
getLangId() : int
Return values
intgetLangsData()
Get all info for languages
public
getLangsData() : array<string, array{id: int, name: string, url: string, type: int}>
Return values
array<string, array{id: int, name: string, url: string, type: int}>getLanguages()
Get list of languages
public
getLanguages([string $key = 'id' ]) : array<string|int, string>
Parameters
- $key : string = 'id'
Return values
array<string|int, string>getList()
Get $key=>$col array
public
getList([array<string|int, int>|null $types = null ][, bool|null $leaf = false ][, string $col = 'name' ][, bool $inFilter = true ][, bool $allow = true ]) : array<string|int, string>|array<string|int, int>
Parameters
- $types : array<string|int, int>|null = null
- $leaf : bool|null = false
- $col : string = 'name'
- $inFilter : bool = true
- $allow : bool = true
Return values
array<string|int, string>|array<string|int, int>getNameById()
Get section name
public
getNameById(int $id) : string|null
Parameters
- $id : int
Return values
string|nullgetOptions()
Get array for InputSelect
public
getOptions([array<string|int, int>|null $types = null ][, bool|null $leaf = false ][, int $deep = 0 ][, bool $allow = true ][, bool $inFilter = true ]) : array<string|int, mixed>
Parameters
- $types : array<string|int, int>|null = null
- $leaf : bool|null = false
- $deep : int = 0
- $allow : bool = true
- $inFilter : bool = true
Return values
array<string|int, mixed>getRecordKeys()
Shortcut to get record (leaf) items in navigation
public
getRecordKeys([array<string|int, int>|null $types = null ][, bool $allow = true ][, bool $inFilter = true ]) : array<string|int, mixed>
Parameters
- $types : array<string|int, int>|null = null
- $allow : bool = true
- $inFilter : bool = true
Return values
array<string|int, mixed>getSectionKeys()
Shortcut to get trunk items in navigation
public
getSectionKeys([array<string|int, int>|null $types = null ][, bool $allow = true ][, bool $inFilter = true ]) : array<string|int, mixed>
Parameters
- $types : array<string|int, int>|null = null
- $allow : bool = true
- $inFilter : bool = true
Return values
array<string|int, mixed>buildStructure()
Build up navigation structure
protected
buildStructure(int $parentId, array<string|int, mixed> $tree, array<string|int, mixed> $section) : array<string|int, mixed>
Parameters
- $parentId : int
- $tree : array<string|int, mixed>
- $section : array<string|int, mixed>
Return values
array<string|int, mixed>loadData()
Load records
protected
loadData([bool|null $leaf = false ]) : void
Parameters
- $leaf : bool|null = false
setAllow()
Setup which section is allowed for current user
protected
final setAllow(int $id, bool $sub, array<string|int, mixed> &$tree, array<string|int, mixed> &$section) : void
Parameters
- $id : int
- $sub : bool
- $tree : array<string|int, mixed>
- $section : array<string|int, mixed>
sortByName()
Compare items for sorting by name
protected
final sortByName(array<string, mixed> $a, array<string, mixed> $b) : int
Parameters
- $a : array<string, mixed>
- $b : array<string, mixed>