Skip to content

Commit

Permalink
Improved integration into the settings block
Browse files Browse the repository at this point in the history
  • Loading branch information
mudrd8mz committed Oct 16, 2011
1 parent 03d448e commit 8168299
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
13 changes: 11 additions & 2 deletions grade/grading/lib.php
Original file line number Diff line number Diff line change
Expand Up @@ -313,6 +313,15 @@ public function extend_settings_navigation(settings_navigation $settingsnav, nav
return;
}

if ($PAGE->url->compare(new moodle_url('/grade/grading/management.php'), URL_MATCH_BASE)) {
// we are already at the management page, do not produce link to ourselves
// (because of the returnurl)
$managementurl = null;
} else {
$managementurl = $this->get_management_url($PAGE->url);
}
$managementnode = $modulenode->add(get_string('gradingmanagement', 'core_grading'), $managementurl, settings_navigation::TYPE_CUSTOM);

foreach ($areas as $areaname => $areatitle) {
$this->set_area($areaname);
$method = $this->get_active_method();
Expand All @@ -324,10 +333,10 @@ public function extend_settings_navigation(settings_navigation $settingsnav, nav

if (count($areas) > 1) {
// if the module supports multiple gradable areas, make a node for each of them
$node = $modulenode->add(get_string('gradinginarea', 'core_grading', $areatitle), null, settings_navigation::NODETYPE_BRANCH);
$node = $managementnode->add(get_string('gradinginarea', 'core_grading', $areatitle), null, settings_navigation::NODETYPE_BRANCH);
} else {
// otherwise put the items directly into the module's node
$node = $modulenode;
$node = $managementnode;
}

$controller = $this->get_controller($method);
Expand Down
1 change: 1 addition & 0 deletions lang/en/grading.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@
$string['exc_gradingformelement'] = 'Unable to instantiate grading form element';
$string['formnotavailable'] = 'Advanced grading method was selected to use but the grading form is not available yet. You may need to define it first via a link in the Settings block.';
$string['gradinginarea'] = 'Grading ({$a})';
$string['gradingmanagement'] = 'Advanced grading';
$string['gradingmethod'] = 'Grading method';
$string['gradingmethods'] = 'Grading methods';
$string['gradingmethodnone'] = 'Simple direct grading';
Expand Down

0 comments on commit 8168299

Please sign in to comment.