Differences Between: [Versions 400 and 403] [Versions 401 and 403] [Versions 402 and 403]
(no description)
File Size: | 1145 lines (52 kb) |
Included or required: | 0 times |
Referenced: | 0 times |
Includes or requires: | 0 files |
secondary:: (34 methods):
get_default_course_mapping()
get_default_module_mapping()
get_default_category_mapping()
get_default_category_more_menu_nodes()
get_default_course_more_menu_nodes()
get_default_module_more_menu_nodes()
get_default_admin_more_menu_nodes()
initialise()
get_node_with_first_action()
get_first_action_for_node()
add_external_nodes_to_secondary()
get_expected_course_admin_nodes()
load_course_navigation()
get_course_overflow_nodes()
nodes_match_current_url()
node_matches_key_string()
set_overflow_selected_node()
get_overflow_menu_data()
get_other_overflow_menu_data()
load_module_navigation()
load_category_navigation()
load_admin_navigation()
add_ordered_nodes()
load_remaining_nodes()
force_nodes_into_more_menu()
remove_unwanted_nodes()
create_menu_element()
get_whole_tree_flat()
does_menu_need_headings()
get_flat_nav_array()
get_headings_nav_array()
get_more_child_nodes()
format_node_text()
load_single_activity_course_navigation()
get_default_course_mapping() X-Ref |
Defines the default structure for the secondary nav in a course context. In a course context, we are curating nodes from the settingsnav and navigation objects. The following mapping construct specifies which object we are fetching it from, the type of the node, the key and in what order we want the node - defined as per the mockups. return: array |
get_default_module_mapping() X-Ref |
Defines the default structure for the secondary nav in a module context. In a module context, we are curating nodes from the settingsnav object. The following mapping construct specifies the type of the node, the key and in what order we want the node - defined as per the mockups. return: array |
get_default_category_mapping() X-Ref |
Defines the default structure for the secondary nav in a category context. In a category context, we are curating nodes from the settingsnav object. The following mapping construct specifies the type of the node, the key and in what order we want the node - defined as per the mockups. return: array |
get_default_category_more_menu_nodes() X-Ref |
Define the keys of the course secondary nav nodes that should be forced into the "more" menu by default. return: array |
get_default_course_more_menu_nodes() X-Ref |
Define the keys of the course secondary nav nodes that should be forced into the "more" menu by default. return: array |
get_default_module_more_menu_nodes() X-Ref |
Define the keys of the module secondary nav nodes that should be forced into the "more" menu by default. return: array |
get_default_admin_more_menu_nodes() X-Ref |
Define the keys of the admin secondary nav nodes that should be forced into the "more" menu by default. return: array |
initialise() X-Ref |
Initialise the view based navigation based on the current context. As part of the initial restructure, the secondary nav is only considered for the following pages: 1 - Site admin settings 2 - Course page - Does not include front_page which has the same context. 3 - Module page |
get_node_with_first_action(navigation_node $node, navigation_node $basenode) X-Ref |
Returns a node with the action being from the first found child node that has an action (Recursive). param: navigation_node $node The part of the node tree we are checking. param: navigation_node $basenode The very first node to be used for the return. return: navigation_node|null |
get_first_action_for_node(navigation_node $node) X-Ref |
Some nodes are containers only with no action. If this container has an action then nothing is done. If it does not have an action then a search is done through the children looking for the first node that has an action. This action is then given to the parent node that is initially provided as a parameter. param: navigation_node $node The navigation node that we want to ensure has an action tied to it. return: navigation_node The node intact with an action to use. |
add_external_nodes_to_secondary(navigation_node $node, navigation_node $basenode,?navigation_node $root = null, bool $forceadd = false) X-Ref |
Recursive call to add all custom navigation nodes to secondary param: navigation_node $node The node which should be added to secondary param: navigation_node $basenode The original parent node param: navigation_node|null $root The parent node nodes are to be added/removed to. param: bool $forceadd Whether or not to bypass the external action check and force add all nodes |
get_expected_course_admin_nodes() X-Ref |
Returns a list of all expected nodes in the course administration. return: array An array of keys for navigation nodes in the course administration. |
load_course_navigation(?navigation_node $rootnode = null) X-Ref |
Load the course secondary navigation. Since we are sourcing all the info from existing objects that already do the relevant checks, we don't do it again here. param: navigation_node|null $rootnode The node where the course navigation nodes should be added into as children. |
get_course_overflow_nodes(?navigation_node $rootnode = null) X-Ref |
Gets the overflow navigation nodes for the course administration category. param: navigation_node|null $rootnode The node from where the course overflow nodes should be obtained. return: navigation_node The course overflow nodes. |
nodes_match_current_url(navigation_node $node) X-Ref |
Recursively looks for a match to the current page url. param: navigation_node $node The node to look through. return: navigation_node|null The node that matches this page's url. |
node_matches_key_string(navigation_node $node, string $key) X-Ref |
Recursively search a node and its children for a node matching the key string $key. param: navigation_node $node the navigation node to check. param: string $key the key of the node to match. return: navigation_node|null node if found, otherwise null. |
set_overflow_selected_node(string $nodekey) X-Ref |
Force a specific node in the 'coursereuse' course overflow to be selected, based on the provided node key. Normally, the selected node is determined by matching the page URL to the node URL. E.g. The page 'backup/restorefile.php' will match the "Restore" node which has a registered URL of 'backup/restorefile.php' because the URLs match. This method allows a page to choose a specific node to match, which is useful in cases where the page knows its URL won't match the node it needs to reside under. I.e. this permits several pages to 'share' the same overflow node. When the page knows the PAGE->url won't match the node URL, the page can simply say "I want to match the 'XXX' node". E.g. - The $PAGE->url is 'backup/restore.php' (this page is used during restores but isn't the main landing page for a restore) - The 'Restore' node in the overflow has a key of 'restore' and will only match 'backup/restorefile.php' by default (the main restore landing page). - The backup/restore.php page calls: $PAGE->secondarynav->set_overflow_selected_node(new moodle_url('restore'); and when the page is loaded, the 'Restore' node be presented as the selected node. param: string $nodekey The string key of the overflow node to match. |
get_overflow_menu_data() X-Ref |
Returns a url_select object with overflow navigation nodes. This looks to see if the current page is within the course administration, or some other page that requires an overflow select object. return: url_select|null The overflow menu data. |
get_other_overflow_menu_data(navigation_node $activenode) X-Ref |
Gets overflow menu data for third party plugin settings. param: navigation_node $activenode The node to gather the children for to put into the overflow menu. return: url_select|null The overflow menu in a url_select object. |
load_module_navigation(settings_navigation $settingsnav, ?navigation_node $rootnode = null) X-Ref |
Get the module's secondary navigation. This is based on settings_nav and would include plugin nodes added via '_extend_settings_navigation'. It populates the tree based on the nav mockup If nodes change, we will have to explicitly call the callback again. param: settings_navigation $settingsnav The settings navigation object related to the module page param: navigation_node|null $rootnode The node where the module navigation nodes should be added into as children. |
load_category_navigation() X-Ref |
Load the course category navigation. |
load_admin_navigation() X-Ref |
Load the site admin navigation |
add_ordered_nodes(array $nodes, ?navigation_node $rootnode = null) X-Ref |
Adds the indexed nodes to the current view or a given node. The key should indicate it's position in the tree. Any sub nodes needs to be numbered appropriately, e.g. 3.1 would make the identified node be listed under #3 node. param: array $nodes An array of navigation nodes to be added. param: navigation_node|null $rootnode The node where the nodes should be added into as children. If not explicitly |
load_remaining_nodes(navigation_node $completenode, array $nodesmap,?navigation_node $rootnode = null) X-Ref |
Find the remaining nodes that need to be loaded into secondary based on the current context or a given node. param: navigation_node $completenode The original node that we are sourcing information from param: array $nodesmap The map used to populate secondary nav in the given context param: navigation_node|null $rootnode The node where the remaining nodes should be added into as children. If not |
force_nodes_into_more_menu(array $defaultmoremenunodes = [], ?int $maxdisplayednodes = null) X-Ref |
Force certain secondary navigation nodes to be displayed in the "more" menu. param: array $defaultmoremenunodes Array with navigation node keys of the pre-defined nodes that param: int|null $maxdisplayednodes The maximum limit of navigation nodes displayed in the secondary navigation |
remove_unwanted_nodes(navigation_node $node) X-Ref |
Recursively remove navigation nodes that should not be displayed in the secondary navigation. param: navigation_node $node The starting navigation node. |
create_menu_element(array $navigationnodes, bool $forceheadings = false) X-Ref |
Takes the given navigation nodes and searches for children and formats it all into an array in a format to be used by a url_select element. param: navigation_node[] $navigationnodes Navigation nodes to format into a menu. param: bool $forceheadings Whether the returned array should be forced to use headings. return: array|null A url select element for navigating through the navigation nodes. |
get_whole_tree_flat(navigation_node $navigationnode) X-Ref |
Recursively goes through the provided navigation node and returns a flat version. param: navigation_node $navigationnode The navigationnode. return: array The whole tree flat. |
does_menu_need_headings(navigation_node $navigationnode) X-Ref |
Checks to see if the provided navigation node has children and determines if we want headings for a url select element. param: navigation_node $navigationnode The navigation node we are checking. return: bool Whether we want headings or not. |
get_flat_nav_array(navigation_node $navigationnode) X-Ref |
Takes the navigation node and returns it in a flat fashion. This is not recursive. param: navigation_node $navigationnode The navigation node that we want to format into an array in a flat structure. return: array The flat navigation array. |
get_headings_nav_array(navigation_node $navigationnode) X-Ref |
For any navigation node that we have determined needs headings we return a more tree like array structure. param: navigation_node $navigationnode The navigation node to use for the formatted array structure. return: array The headings navigation array structure. |
get_more_child_nodes(navigation_node $node, array &$menublock) X-Ref |
Recursively goes and gets all children nodes. param: navigation_node $node The node to get the children of. param: array $menublock Used to put all child nodes in its own container. return: array The additional child nodes. |
format_node_text(navigation_node $navigationnode) X-Ref |
Returns the navigation node text in a string. param: navigation_node $navigationnode The navigationnode to return the text string of. return: string The navigation node text string. |
load_single_activity_course_navigation() X-Ref |
Load the single activity course secondary navigation. |