SelfHelp WebApp  v2.0.6
A WebApp to Create WebApps for Studies in Human Sciences
Router Class Reference
Inheritance diagram for Router:

Public Member Functions

 __construct ($db, $basePath, $routes=array(), $matchTypes=array())
 
 get_asset_path ( $path)
 
 get_url ($url)
 
 is_active ( $route_name)
 
 has_route ($name)
 
 update_route ()
 

Public Attributes

 $route = NULL
 

Private Attributes

 $db
 

Detailed Description

An extension class to the altorouter library.

Constructor & Destructor Documentation

◆ __construct()

Router::__construct (   $db,
  $basePath,
  $routes = array(),
  $matchTypes = array() 
)

The constructor which calls the parent constructor.

Parameters
instance$dbThe instance of the service class PageDb
string$basePathThe path prefix.
array$routesThe array of existing routes.
array$matchTypesThe set of types to match.

Member Function Documentation

◆ get_asset_path()

Router::get_asset_path (   $path)

Get the path of an asset such that it matches with the base path.

Parameters
string$pathThe path to the asset.
Return values
stringThe modified asset path.

◆ get_url()

Router::get_url (   $url)

Returns an url given a router keyword. The keyword #back will generate the url of the last visited page or the home page if the last visited page is the current page or unknown. The keyword #self points to the current page.

Return values
stringThe generated url.
Here is the call graph for this function:

◆ has_route()

Router::has_route (   $name)

Checks whether the given route exists.

Parameters
string$nameThe name of the route
Return values
boolTrue if the route exists, false otherwise.

Referenced by get_url().

◆ is_active()

Router::is_active (   $route_name)

Check whther the given route is active.

Parameters
string$route_nameThe name of the route to check.
Return values
boolTrue if the given path is active, false otherwise.

◆ update_route()

Router::update_route ( )

Updates the route array.

Member Data Documentation

◆ $db

Router::$db
private

The instance of the service class PageDb.

Referenced by __construct().

◆ $route

Router::$route = NULL

The router array which holds the name, target, and parameters of a route.


The documentation for this class was generated from the following file: