MenuManager
in package
Manage the use of the Facturascripts menu.
Tags
Table of Contents
- $menu : array<string|int, MenuItem>
- Contains the structure of the menu for the user.
- $menuActive : bool
- True when there is a menu active. Only for optimization purpose.
- $menuPageActive : Page
- Stores active page to use when reload.
- $pageModel : Page
- Controller associated with the page
- $user : User|false
- User for whom the menu has been created.
- getMenu() : array<string|int, mixed>
- Returns the user's menu, the set of pages to which he has access.
- init() : mixed
- Call only when you have connected to the database.
- reload() : mixed
- Reloads menu from database.
- removeOld() : mixed
- Removes all pages not present in $currentPaneNames.
- selectPage() : mixed
- Mark menu and menuitem as selected, and updates the data in the Page model based on the data in the getPageData() of the controller.
- setUser() : mixed
- Assign the user to load their menu.
- getUserAccess() : array<string|int, RoleAccess>
- Returns all access data from the user.
- loadPages() : array<string|int, Page>
- Load the list of pages for the user.
- loadUserMenu() : array<string|int, mixed>
- Load the menu structure for the user.
- pageNeedSave() : bool
- Returns if the page should be saved.
- setActiveMenu() : mixed
- Set the active menu.
- setActiveMenuItem() : mixed
- Assign active menu item.
- sortMenu() : array<string|int, mixed>
- Sorts menu and submenus by title.
Properties
$menu
Contains the structure of the menu for the user.
private
static array<string|int, MenuItem>
$menu
$menuActive
True when there is a menu active. Only for optimization purpose.
private
static bool
$menuActive
$menuPageActive
Stores active page to use when reload.
private
static Page
$menuPageActive
$pageModel
Controller associated with the page
private
static Page
$pageModel
$user
User for whom the menu has been created.
private
static User|false
$user
= false
Methods
getMenu()
Returns the user's menu, the set of pages to which he has access.
public
getMenu() : array<string|int, mixed>
Return values
array<string|int, mixed> —init()
Call only when you have connected to the database.
public
init() : mixed
Return values
mixed —reload()
Reloads menu from database.
public
reload() : mixed
Return values
mixed —removeOld()
Removes all pages not present in $currentPaneNames.
public
removeOld(array<string|int, string> $currentPageNames) : mixed
Parameters
- $currentPageNames : array<string|int, string>
Return values
mixed —selectPage()
Mark menu and menuitem as selected, and updates the data in the Page model based on the data in the getPageData() of the controller.
public
selectPage(array<string|int, mixed> $pageData) : mixed
Parameters
- $pageData : array<string|int, mixed>
Return values
mixed —setUser()
Assign the user to load their menu.
public
setUser(User|false $user) : mixed
Parameters
- $user : User|false
Return values
mixed —getUserAccess()
Returns all access data from the user.
private
getUserAccess(User|false $user) : array<string|int, RoleAccess>
Parameters
- $user : User|false
Return values
array<string|int, RoleAccess> —loadPages()
Load the list of pages for the user.
private
loadPages() : array<string|int, Page>
Return values
array<string|int, Page> —loadUserMenu()
Load the menu structure for the user.
private
loadUserMenu() : array<string|int, mixed>
Return values
array<string|int, mixed> —pageNeedSave()
Returns if the page should be saved.
private
pageNeedSave(Page $pageModel, array<string|int, mixed> $pageData) : bool
Parameters
- $pageModel : Page
- $pageData : array<string|int, mixed>
Return values
bool —setActiveMenu()
Set the active menu.
private
setActiveMenu(Page $pageModel) : mixed
Parameters
- $pageModel : Page
Return values
mixed —setActiveMenuItem()
Assign active menu item.
private
setActiveMenuItem(array<string|int, MenuItem> &$menu, Page $pageModel) : mixed
Parameters
Return values
mixed —sortMenu()
Sorts menu and submenus by title.
private
sortMenu(array<string|int, mixed> &$result) : array<string|int, mixed>
Parameters
- $result : array<string|int, mixed>