Navigation extends AppModel
Handles navigation.
Table of Contents
Properties
| $base_uris |
Methods
| __construct() | Initialize Navigation |
| add() | Adds a new navigation item |
| baseUri() | Adds a URI referenced by its label |
| delete() | Deletes existing actions |
| getAll() | Gets a list of navigation items matching the given filters |
| getCompany() | Retrieves the navigation for company settings |
| getPluginNav() | Returns all plugin navigation for the requested location |
| getPrimary() | Retrieves the primary navigation |
| getPrimaryClient() | Retrieves the primary navigation for the client interface |
| getPrimaryPublic() | Retrieves the navigation for unauthenticated clients |
| getSearchOptions() | Fetches all search options available to the current company |
| getSystem() | Retrieves the navigation for system settings |
| getBaseUri() | Retrieves the base URI matching the given label. |
| getElementBaseUri() | Retrieves the base URI to use for a navigation element. |
| getNavItems() | Retrieves the navigation for unauthenticated clients |
| getNavRecord() | |
| getRules() | Rules to validate when adding or editing a navigation item |
Methods
__construct()
Initialize Navigation
public
__construct() : mixed
add()
Adds a new navigation item
public
add(array<string|int, mixed> $vars) : int
Parameters
- $vars : array<string|int, mixed>
-
An array of navigation item info including:
- action_id The ID of the action linked to this navigation item
- order The order index used to determine the order in which navigation items are displayed (optional, highest index + 1 by default)
- parent_id The ID of the navigation item under which to display this navigation item (optional, null by default)
- parent_url The URL by which to determine which navigation item to display this one under (optional)
Return values
int —The ID for this navigation item, void on error
baseUri()
Adds a URI referenced by its label
public
baseUri(string $label, string $uri) : this
Parameters
- $label : string
-
The unique label to set for the URI
- $uri : string
-
The URI
Return values
thisdelete()
Deletes existing actions
public
delete([array<string|int, mixed> $filters = [] ]) : mixed
Parameters
- $filters : array<string|int, mixed> = []
-
A list of parameters by which to filter the results, including:
- company_id The ID of the company for which to delete action
- url The URL of the navigation item's action
- location The location in which an action is allowed to be displayed
- plugin_id The ID of the plugin for which to delete action
- parent_id The ID of the parent nav for which to delete subitems
getAll()
Gets a list of navigation items matching the given filters
public
getAll(array<string|int, mixed> $filters[, array<string|int, mixed> $order = ['navigation_items.order' => 'ASC'] ]) : array<string|int, mixed>
Parameters
- $filters : array<string|int, mixed>
-
A list of parameters by which to filter the results, including:
- action_id The ID of the action to which the navigation item is attached
- company_id The ID of the company for which the navigation item is display
- plugin_id The ID of the plugin for which the navigation item was created
- url The URL of the navigation item's action
- location The location in which an action is allowed to be displayed
- child Whether to fetch navigation items with parents (true to fetch child items, false to fetch parent items)
- $order : array<string|int, mixed> = ['navigation_items.order' => 'ASC']
-
The sort and order conditions (e.g. array('sort_field'=>"ASC"), optional)
Return values
array<string|int, mixed> —A partial record object used to fetch navigation items and their actions from the database
getCompany()
Retrieves the navigation for company settings
public
getCompany(string $base_uri) : array<string|int, mixed>
Parameters
- $base_uri : string
-
The base_uri for the currently logged in user
Return values
array<string|int, mixed> —A numerically-indexed array of the company settings navigation where each element contains an array which includes:
- name The name of the element
- class The CSS class name for the element
- uri The URI for the element
- children An array of child elements which follow the same indexes as above
getPluginNav()
Returns all plugin navigation for the requested location
public
getPluginNav(string $location) : array<string|int, mixed>
Parameters
- $location : string
-
The location to fetch plugin navigation for
Return values
array<string|int, mixed> —An array of plugin navigation
getPrimary()
Retrieves the primary navigation
public
getPrimary(string $base_uri) : array<string|int, mixed>
Parameters
- $base_uri : string
-
The base_uri for the currently logged in user
Return values
array<string|int, mixed> —An array of main navigation elements in key/value pairs where each key is the URI and each value is an array representing that element including:
- name The name of the link
- active True if the element is active
- sub An array of subnav elements (optional) following the same indexes as above
getPrimaryClient()
Retrieves the primary navigation for the client interface
public
getPrimaryClient(string $base_uri) : array<string|int, mixed>
Parameters
- $base_uri : string
-
The base_uri for the currently logged in user
Return values
array<string|int, mixed> —An array of main navigation elements in key/value pairs where each key is the URI and each value is an array representing that element including:
- name The name of the link
- active True if the element is active
- sub An array of subnav elements (optional) following the same indexes as above
getPrimaryPublic()
Retrieves the navigation for unauthenticated clients
public
getPrimaryPublic(string $base_uri, string $base_user_uri) : array<string|int, mixed>
Parameters
- $base_uri : string
-
The base_uri for the user not logged in
- $base_user_uri : string
-
The base_uri for a logged in user
Return values
array<string|int, mixed> —An array of main navigation elements in key/value pairs where each key is the URI and each value is an array representing that element including:
- name The name of the link
- active True if the element is active
- sub An array of subnav elements (optional) following the same indexes as above
getSearchOptions()
Fetches all search options available to the current company
public
getSearchOptions([string $base_uri = null ]) : array<string|int, mixed>
Parameters
- $base_uri : string = null
-
The base_uri for the currently logged in user
Return values
array<string|int, mixed> —An array of search items in key/value pairs, where each key is the search type and each value is the language for the search type
getSystem()
Retrieves the navigation for system settings
public
getSystem(string $base_uri) : array<string|int, mixed>
Parameters
- $base_uri : string
-
The base_uri for the currently logged in user
Return values
array<string|int, mixed> —A numerically-indexed array of the system settings navigation where each element contains an array which includes:
- name The name of the element
- class The CSS class name for the element
- uri The URI for the element
- children An array of child elements which follow the same indexes as above
getBaseUri()
Retrieves the base URI matching the given label.
private
getBaseUri(string $label) : string
If not found, returns back the given label.
Parameters
- $label : string
-
The base URI label
Return values
string —The base URI
getElementBaseUri()
Retrieves the base URI to use for a navigation element.
private
getElementBaseUri(string $base_uri[, string $element_base_uri = null ]) : string
Defaults to $base_uri if the element's base URI is unknown.
Parameters
- $base_uri : string
-
The current base URI
- $element_base_uri : string = null
-
The element's defined base URI
Return values
string —The base URI for the current element
getNavItems()
Retrieves the navigation for unauthenticated clients
private
getNavItems(string $base_uri, mixed $location) : array<string|int, mixed>
Parameters
- $base_uri : string
-
The base_uri for the user
- $location : mixed
Return values
array<string|int, mixed> —An array of main navigation elements in key/value pairs where each key is the URI and each value is an array representing that element including:
- name The name of the link
- active True if the element is active
- sub An array of subnav elements (optional) following the same indexes as above
getNavRecord()
private
getNavRecord(array<string|int, mixed> $filters[, array<string|int, mixed> $order = ['navigation_items.order' => 'ASC'] ]) : Record
Parameters
- $filters : array<string|int, mixed>
-
A list of parameters by which to filter the results, including:
- action_id The ID of the action to which the navigation item is attached
- company_id The ID of the company for which the navigation item is display
- plugin_id The ID of the plugin for which the navigation item was created
- url The URL of the navigation item's action
- location The location in which an action is allowed to be displayed
- child Whether to fetch navigation items with parents (true to fetch child items, false to fetch parent items)
- $order : array<string|int, mixed> = ['navigation_items.order' => 'ASC']
-
The sort and order conditions (e.g. array('sort_field'=>"ASC"), optional)
Return values
Record —A partial record object used to fetch navigation items and their actions from the database
getRules()
Rules to validate when adding or editing a navigation item
private
getRules([array<string|int, mixed> $vars = [] ][, bool $edit = false ]) : array<string|int, mixed>
Parameters
- $vars : array<string|int, mixed> = []
-
An array of input fields to validate against
- action_id The ID of the action linked to this navigation item
- order The order index used to determine the order in which navigation items are displayed (optional, highest index + 1 by default)
- parent_id The ID of the navigation item under which to display this navigation item (optional, null by default)
- parent_url The URL by which to determine which navigation item to display this one under (optional)
- $edit : bool = false
-
Whether or not it's an edit (optional)
Return values
array<string|int, mixed> —Rules to validate