public function extend_settings_navigation(settings_navigation $settingsnav, navigation_node $modulenode=null) {

        $this->ensure_isset(array('context', 'component'));

        $areas = $this->get_available_areas();

        if (empty($areas)) {
            // no money, no funny
            return;

        } else if (count($areas) == 1) {
            // make just a single node for the management screen
            $areatitle = reset($areas);
            $areaname  = key($areas);
            $this->set_area($areaname);
            $method = $this->get_active_method();
            $managementnode = $modulenode->add(get_string('gradingmanagement', 'core_grading'),
                $this->get_management_url(), settings_navigation::TYPE_CUSTOM);
            if ($method) {
                $controller = $this->get_controller($method);
                $controller->extend_settings_navigation($settingsnav, $managementnode);
            }

        } else {
            // make management screen node for each area
            $managementnode = $modulenode->add(get_string('gradingmanagement', 'core_grading'),
                null, settings_navigation::TYPE_CUSTOM);
            foreach ($areas as $areaname => $areatitle) {
                $this->set_area($areaname);
                $method = $this->get_active_method();
                $node = $managementnode->add($areatitle,
                    $this->get_management_url(), settings_navigation::TYPE_CUSTOM);
                if ($method) {
                    $controller = $this->get_controller($method);
                    $controller->extend_settings_navigation($settingsnav, $node);
                }
            }
        }
    }
public function extend_settings_navigation(settings_navigation $settingsnav, navigation_node $modulenode=null) {

        $this->ensure_isset(array('context', 'component'));

        $areas = $this->get_available_areas();

        if (empty($areas)) {
            // no money, no funny
            return;

        } else if (count($areas) == 1) {
            // make just a single node for the management screen
            $areatitle = reset($areas);
            $areaname  = key($areas);
            $this->set_area($areaname);
            $method = $this->get_active_method();
            $managementnode = $modulenode->add(get_string('gradingmanagement', 'core_grading'),
                $this->get_management_url(), settings_navigation::TYPE_CUSTOM);
            if ($method) {
                $controller = $this->get_controller($method);
                $controller->extend_settings_navigation($settingsnav, $managementnode);
            }

        } else {
            // make management screen node for each area
            $managementnode = $modulenode->add(get_string('gradingmanagement', 'core_grading'),
                null, settings_navigation::TYPE_CUSTOM);
            foreach ($areas as $areaname => $areatitle) {
                $this->set_area($areaname);
                $method = $this->get_active_method();
                $node = $managementnode->add($areatitle,
                    $this->get_management_url(), settings_navigation::TYPE_CUSTOM);
                if ($method) {
                    $controller = $this->get_controller($method);
                    $controller->extend_settings_navigation($settingsnav, $node);
                }
            }
        }
    }
public function extend_settings_navigation ( settings_navigation $ settingsnav , navigation_node $ modulenode = null ) { $ this -> ensure_isset ( array ( 'context' , 'component' ) ) ; $ areas = $ this -> get_available_areas ( ) ; if ( empty ( $ areas ) ) { // no money, no funny return ; } else if ( count ( $ areas ) == 1 ) { // make just a single node for the management screen $ areatitle = reset ( $ areas ) ; $ areaname = key ( $ areas ) ; $ this -> set_area ( $ areaname ) ; $ method = $ this -> get_active_method ( ) ; $ managementnode = $ modulenode -> add ( get_string ( 'gradingmanagement' , 'core_grading' ) , $ this -> get_management_url ( ) , settings_navigation :: TYPE_CUSTOM ) ; if ( $ method ) { $ controller = $ this -> get_controller ( $ method ) ; $ controller -> extend_settings_navigation ( $ settingsnav , $ managementnode ) ; } } else { // make management screen node for each area $ managementnode = $ modulenode -> add ( get_string ( 'gradingmanagement' , 'core_grading' ) , null , settings_navigation :: TYPE_CUSTOM ) ; foreach ( $ areas as $ areaname => $ areatitle ) { $ this -> set_area ( $ areaname ) ; $ method = $ this -> get_active_method ( ) ; $ node = $ managementnode -> add ( $ areatitle , $ this -> get_management_url ( ) , settings_navigation :: TYPE_CUSTOM ) ; if ( $ method ) { $ controller = $ this -> get_controller ( $ method ) ; $ controller -> extend_settings_navigation ( $ settingsnav , $ node ) ; } } } }
Extends the settings navigation with the grading settings

This function is called when the context for the page is an activity module with the
FEATURE_ADVANCED_GRADING and the user has the permission moodle/grade:managegradingforms.

@param settings_navigation $settingsnav {@link settings_navigation}
@param navigation_node $modulenode {@link navigation_node}
Extends the settings navigation with the grading settings