Navigation
in package
Public navigation
Tags
Table of Contents
Properties
- $page : string|null
- $active : array<int, int>
- $data : array<int, array<string, mixed>>
- $db : SQL
- $defaults : array<string|int, int>
- $domains : array<string, mixed>
- $lang : int
- $modules : array<int, string>
- $open : int|null
- $private : bool
- $tree : array<int, array<int, int>>
Methods
- __construct() : mixed
- exist() : bool
- Check if section exists
- fetchIds() : void
- Preload additional records
- findActiveByType() : mixed
- It goes through the active sections and finds the given type
- findValue() : int|null
- Find section ID with a parameter of the given value
- get() : mixed
- Get value of selected parameter
- getActive() : array<string|int, int>
- Get active sections
- getChildIdByType() : int|null
- Returns the first child of the given type
- getChildrenIds() : array<int, int>
- Returns all descendants to a certain level (with the given type)
- getData() : array<string, mixed>
- Get info for selected record
- getDefaultDomain() : mixed|null
- Get default domain settings
- getFamilyIds() : array<int, mixed>
- Get all children optionally with specific place(s)
- getFileById() : string
- Returns class name of current presenter
- getFileByType() : string
- Returns class name of presenter based on identification
- getId() : int|null
- Get current section ID
- getIdWayByUrl() : array<int, int>
- Traverses the entire branch from the root to the required item and returns all ids of found items in the navigation table
- getLangId() : int
- Get current language ID
- getLangUrl() : string|null
- Get current language url part
- getLink() : string
- Generates a link according to the current navigation structure
- getName() : string|null
- Get section name
- getPage() : string|null
- Check if page is in use and remove it from path
- getParentByType() : int|null
- Return parent with chosen type
- getParentId() : int|null
- Return parent ID
- getReferer() : string|null
- Get http referer
- getRootId() : int|null
- Return root parent ID
- getUrl() : string
- Get url to selected (or current) section
- getUrlPath() : string
- Get path part of url
- isActive() : bool
- Is section open
- isRedirect() : bool
- Is section redirect
- parsePath() : bool
- Parse url and return bool about if all where found
- redirect() : void
- Redirect and terminate
- redirectByType() : void
- Redirect by type and terminate
- resetLang() : void
- Set language if lang can't be loaded from url
- set() : void
- Change value of selected parameter
- loadData() : void
- Load navigation structure
Properties
$page
public
string|null
$page
= null
Active page
$active
protected
array<int, int>
$active
= []
Current list of active sections
$data
protected
array<int, array<string, mixed>>
$data
= []
$db
protected
SQL
$db
$defaults
protected
array<string|int, int>
$defaults
= []
$domains
protected
array<string, mixed>
$domains
= []
List of domains or single current
$lang
protected
int
$lang
= 0
Active language in multilingual mode
$modules
protected
array<int, string>
$modules
List of module classes
$open
protected
int|null
$open
= null
Active section
$private
protected
bool
$private
= false
Access level
$tree
protected
array<int, array<int, int>>
$tree
= []
Navigation structure
Methods
__construct()
public
__construct(SQL $db[, array<string, int>|int|null $default = null ][, bool $private = false ]) : mixed
Parameters
- $db : SQL
- $default : array<string, int>|int|null = null
- $private : bool = false
exist()
Check if section exists
public
exist(int $id) : bool
Parameters
- $id : int
Return values
boolfetchIds()
Preload additional records
public
fetchIds(array<string|int, int> $ids) : void
Parameters
- $ids : array<string|int, int>
findActiveByType()
It goes through the active sections and finds the given type
public
findActiveByType(int $type[, bool $reverse = false ]) : mixed
Parameters
- $type : int
- $reverse : bool = false
findValue()
Find section ID with a parameter of the given value
public
findValue(int $parentId, string $para, string|int $value[, int $deep = 666 ]) : int|null
Parameters
- $parentId : int
- $para : string
- $value : string|int
- $deep : int = 666
Return values
int|nullget()
Get value of selected parameter
public
get(string $para[, int|null $id = null ]) : mixed
Parameters
- $para : string
- $id : int|null = null
getActive()
Get active sections
public
getActive() : array<string|int, int>
Return values
array<string|int, int>getChildIdByType()
Returns the first child of the given type
public
getChildIdByType(int $type[, int $parentId = 0 ][, int|null $access = null ]) : int|null
Parameters
- $type : int
- $parentId : int = 0
- $access : int|null = null
Return values
int|nullgetChildrenIds()
Returns all descendants to a certain level (with the given type)
public
getChildrenIds(int $parentId[, int $deep = 1 ][, int|null $type = null ][, int|null $access = null ]) : array<int, int>
Parameters
- $parentId : int
- $deep : int = 1
- $type : int|null = null
- $access : int|null = null
-
Access level
Return values
array<int, int>getData()
Get info for selected record
public
getData(int $id) : array<string, mixed>
Parameters
- $id : int
Tags
Return values
array<string, mixed>getDefaultDomain()
Get default domain settings
public
getDefaultDomain(string $domain) : mixed|null
Parameters
- $domain : string
Return values
mixed|nullgetFamilyIds()
Get all children optionally with specific place(s)
public
getFamilyIds(int $parentId[, string $para = 'name' ]) : array<int, mixed>
Parameters
- $parentId : int
- $para : string = 'name'
Return values
array<int, mixed>getFileById()
Returns class name of current presenter
public
getFileById(int $id) : string
Parameters
- $id : int
Return values
stringgetFileByType()
Returns class name of presenter based on identification
public
getFileByType(int $type) : string
Parameters
- $type : int
Return values
stringgetId()
Get current section ID
public
getId() : int|null
Return values
int|nullgetIdWayByUrl()
Traverses the entire branch from the root to the required item and returns all ids of found items in the navigation table
public
getIdWayByUrl(array<string|int, string> $path) : array<int, int>
Parameters
- $path : array<string|int, string>
Return values
array<int, int>getLangId()
Get current language ID
public
getLangId() : int
Return values
intgetLangUrl()
Get current language url part
public
getLangUrl() : string|null
Return values
string|nullgetLink()
Generates a link according to the current navigation structure
public
getLink(string $name[, int|true $id = true ][, string|null $page = null ][, array<string, mixed>|true|null $params = null ][, array<string, string>|null $attrs = null ]) : string
Parameters
- $name : string
- $id : int|true = true
- $page : string|null = null
- $params : array<string, mixed>|true|null = null
- $attrs : array<string, string>|null = null
Return values
stringgetName()
Get section name
public
getName([int|null $id = null ]) : string|null
Parameters
- $id : int|null = null
Return values
string|nullgetPage()
Check if page is in use and remove it from path
public
getPage(array<string|int, string> $path) : string|null
Parameters
- $path : array<string|int, string>
Return values
string|nullgetParentByType()
Return parent with chosen type
public
getParentByType(int $id, int $type) : int|null
Parameters
- $id : int
- $type : int
Return values
int|nullgetParentId()
Return parent ID
public
getParentId([int|null $id = null ]) : int|null
Parameters
- $id : int|null = null
Return values
int|nullgetReferer()
Get http referer
public
getReferer() : string|null
Return values
string|nullgetRootId()
Return root parent ID
public
getRootId([int|null $id = null ]) : int|null
Parameters
- $id : int|null = null
Return values
int|nullgetUrl()
Get url to selected (or current) section
public
getUrl([int|true $id = true ][, string|true|null $page = null ][, array<string, mixed>|true|null $params = null ][, bool $href = true ]) : string
Parameters
- $id : int|true = true
- $page : string|true|null = null
- $params : array<string, mixed>|true|null = null
- $href : bool = true
Return values
stringgetUrlPath()
Get path part of url
public
getUrlPath(int $id[, bool $full = false ]) : string
Parameters
- $id : int
- $full : bool = false
Return values
stringisActive()
Is section open
public
isActive(int $id) : bool
Parameters
- $id : int
Return values
boolisRedirect()
Is section redirect
public
isRedirect(int $id) : bool
Parameters
- $id : int
Return values
boolparsePath()
Parse url and return bool about if all where found
public
parsePath(array<string|int, string> $path[, string $domain = '' ][, bool $redirect = true ]) : bool
Parameters
- $path : array<string|int, string>
- $domain : string = ''
- $redirect : bool = true
Tags
Return values
boolredirect()
Redirect and terminate
public
redirect(string $url[, bool $permanent = false ]) : void
Parameters
- $url : string
- $permanent : bool = false
redirectByType()
Redirect by type and terminate
public
redirectByType(int $type[, int $parentId = 0 ][, array<string, mixed>|null $params = null ][, bool $permanent = false ]) : void
Parameters
- $type : int
- $parentId : int = 0
- $params : array<string, mixed>|null = null
- $permanent : bool = false
Tags
resetLang()
Set language if lang can't be loaded from url
public
resetLang() : void
set()
Change value of selected parameter
public
set(string $para, string $val[, int|null $id = null ]) : void
Parameters
- $para : string
- $val : string
- $id : int|null = null
loadData()
Load navigation structure
protected
loadData() : void