SelfHelp WebApp  v2.0.6
A WebApp to Create WebApps for Studies in Human Sciences
Navigation Class Reference

Public Member Functions

 __construct ($router, $db, $keyword, $root_id)
 
 get_navigation_items ()
 
 get_root_id ()
 
 get_current_id ()
 
 get_next_id ()
 
 get_page_keyword ()
 
 get_previous_id ()
 
 get_count ()
 
 section_id_exists ($id)
 
 set_current_index ($id)
 

Private Member Functions

 fetch_children ($id_section)
 

Private Attributes

 $db
 
 $router
 
 $keyword
 
 $items_tree
 
 $items_list
 
 $root_id
 
 $current_id
 
 $current_idx
 

Detailed Description

This class is used to prepare all data related to the navSection component such that the data can easily be displayed in the view of the component.

Constructor & Destructor Documentation

◆ __construct()

Navigation::__construct (   $router,
  $db,
  $keyword,
  $root_id 
)

The constructor.

Parameters
object$routerThe router instance is used to generate valid links.
object$dbThe db instance which grants access to the DB.
string$keywordThe identification name of the page.
int$root_idThe id of the root section.
Here is the call graph for this function:

Member Function Documentation

◆ fetch_children()

Navigation::fetch_children (   $id_section)
private

Fetches all navigation items from the database and assembles them hierarchically in an array. Further, items are added to list structure.

Parameters
int$id_sectionThe root item id.
Returns
array A hierarchical array with the fields 'id': the section id 'title': the section title 'children': the children of this section 'url': the target url

Referenced by __construct().

◆ get_count()

Navigation::get_count ( )

Gets the number of root navigation items.

Return values
intThe number of navigation items.

◆ get_current_id()

Navigation::get_current_id ( )

Gets the current navigation item id.

Return values
intThe current navigation item id.

◆ get_navigation_items()

Navigation::get_navigation_items ( )

Gets the hierarchical assembled navigation items.

Returns
array A hierarchical array. See NavSectionModel::fetch_children($id_section).

◆ get_next_id()

Navigation::get_next_id ( )

Gets the next navigation item id.

Return values
intThe next navigation item id or false if it does not exist.

◆ get_page_keyword()

Navigation::get_page_keyword ( )

Get the keyword of the navigation page.

Return values
stringThe keyword of the navigation page.

◆ get_previous_id()

Navigation::get_previous_id ( )

Gets the previous navigation item id.

Return values
intThe previous navigation item id or false if it does not exist.

◆ get_root_id()

Navigation::get_root_id ( )

Gets the root navigation item id.

Return values
intThe root navigation item id.

◆ section_id_exists()

Navigation::section_id_exists (   $id)

Returns true if a given section id can be found in the list of sections associated to the navigation page.

Parameters
int$idThe id to check.
Return values
boolTrue if the id exists, false otherwise.

◆ set_current_index()

Navigation::set_current_index (   $id)

Given the current id, set the current index of the flattened item list.

Parameters
int$idThe current navigation item id.

Member Data Documentation

◆ $current_id

Navigation::$current_id
private

The id of the currently selected navigation item.

Referenced by get_current_id().

◆ $current_idx

Navigation::$current_idx
private

The index of the currently selected navigation item.

◆ $db

Navigation::$db
private

The db instance which grants access to the DB.

Referenced by __construct().

◆ $items_list

Navigation::$items_list
private

A flat list of the navigation items.

◆ $items_tree

Navigation::$items_tree
private

A hierarchical list of the navigation items.

Referenced by get_navigation_items().

◆ $keyword

Navigation::$keyword
private

The identification name of the page.

Referenced by __construct(), and get_page_keyword().

◆ $root_id

Navigation::$root_id
private

The id of the root section.

Referenced by __construct(), and get_root_id().

◆ $router

Navigation::$router
private

The router instance is used to generate valid links.

Referenced by __construct().


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