class Router

This class is responsible for routing between views.

Methods

static array
getMenu(string $menu)

Parses menu_acl.json file to determine menu contents depending on acl of user.

static bool
hasAccess(string $controller_name, string $action_name = "index")

Checks if user has access to a particular section of the site and grants access if that is the case.

static void
redirect(string $location, array $params = [])

Performs redirect operations.

static void
route()

Supports operations for routing. It parses the url to determine which page needs to be rendered. That path is parsed to determine the correct controller and action to use.

Details

at line 53
static array getMenu(string $menu)

Parses menu_acl.json file to determine menu contents depending on acl of user.

Parameters

string $menu

Name of menu acl file.

Return Value

array

The array of menu items.

at line 95
static bool hasAccess(string $controller_name, string $action_name = "index")

Checks if user has access to a particular section of the site and grants access if that is the case.

Parameters

string $controller_name

The name of the controller we want to test before granting the user access to a particular section of the site.

string $action_name

The name of the action the user wants to perform. The default value is "index".

Return Value

bool

$grantAccess True if we give access, otherwise false.

at line 163
static void redirect(string $location, array $params = [])

Performs redirect operations.

Parameters

string $location

The view where we will redirect the user.

array $params

The parameters for the action.

Return Value

void

at line 230
static void route()

Supports operations for routing. It parses the url to determine which page needs to be rendered. That path is parsed to determine the correct controller and action to use.

Return Value

void