MDL-73645 grades: Update breadcrumb nodes

This commit is contained in:
Mihail Geshoski 2022-02-01 14:14:47 +08:00
parent 1060ee827c
commit 724578a008
10 changed files with 46 additions and 18 deletions

View file

@ -30,7 +30,7 @@ $contextid = optional_param('id', SYSCONTEXTID, PARAM_INT);
$action = optional_param('action', '', PARAM_ALPHA); $action = optional_param('action', '', PARAM_ALPHA);
$edit = optional_param('edit', false, PARAM_BOOL); //are we editing? $edit = optional_param('edit', false, PARAM_BOOL); //are we editing?
$PAGE->set_url('/grade/edit/letter/index.php', array('id' => $contextid)); $url = new moodle_url('/grade/edit/letter/index.php', array('id' => $contextid));
list($context, $course, $cm) = get_context_info_array($contextid); list($context, $course, $cm) = get_context_info_array($contextid);
$contextid = null;//now we have a context object throw away the $contextid from the params $contextid = null;//now we have a context object throw away the $contextid from the params
@ -42,7 +42,11 @@ if (!$edit) {
} }
} else {//else we're editing } else {//else we're editing
require_capability('moodle/grade:manageletters', $context); require_capability('moodle/grade:manageletters', $context);
navigation_node::override_active_url($url);
$url->param('edit', 1);
$PAGE->navbar->add(get_string('editgradeletters', 'grades'), $url);
} }
$PAGE->set_url($url);
$returnurl = null; $returnurl = null;
$editparam = null; $editparam = null;

View file

@ -79,7 +79,6 @@ if ($id) {
require_login($course); require_login($course);
$context = context_course::instance($course->id); $context = context_course::instance($course->id);
require_capability('moodle/grade:manage', $context); require_capability('moodle/grade:manage', $context);
navigation_node::override_active_url(new moodle_url('/grade/edit/outcome/course.php', array('id'=>$courseid)));
$outcome_rec = new stdClass(); $outcome_rec = new stdClass();
$outcome_rec->standard = 0; $outcome_rec->standard = 0;
@ -98,6 +97,10 @@ if ($id) {
if (!$courseid) { if (!$courseid) {
require_once $CFG->libdir.'/adminlib.php'; require_once $CFG->libdir.'/adminlib.php';
admin_externalpage_setup('outcomes'); admin_externalpage_setup('outcomes');
} else {
navigation_node::override_active_url(new moodle_url('/grade/edit/outcome/course.php', ['id' => $courseid]));
$PAGE->navbar->add(get_string('manageoutcomes', 'grades'),
new moodle_url('/grade/edit/outcome/index.php', ['id' => $courseid]));
} }
// default return url // default return url
@ -158,6 +161,8 @@ if ($mform->is_cancelled()) {
redirect($returnurl); redirect($returnurl);
} }
$PAGE->navbar->add($heading, $url);
print_grade_page_head($courseid ?: SITEID, 'outcome', 'edit', $heading, false, false, false); print_grade_page_head($courseid ?: SITEID, 'outcome', 'edit', $heading, false, false, false);
if (!grade_scale::fetch_all_local($courseid) && !grade_scale::fetch_all_global()) { if (!grade_scale::fetch_all_local($courseid) && !grade_scale::fetch_all_global()) {

View file

@ -32,7 +32,8 @@ $courseid = optional_param('courseid', 0, PARAM_INT);
$action = optional_param('action', '', PARAM_ALPHA); $action = optional_param('action', '', PARAM_ALPHA);
$scope = optional_param('scope', 'custom', PARAM_ALPHA); $scope = optional_param('scope', 'custom', PARAM_ALPHA);
$PAGE->set_url('/grade/edit/outcome/import.php', array('courseid' => $courseid)); $url = new moodle_url('/grade/edit/outcome/import.php', array('courseid' => $courseid));
$PAGE->set_url($url);
$PAGE->set_pagelayout('admin'); $PAGE->set_pagelayout('admin');
/// Make sure they can even access this course /// Make sure they can even access this course
@ -46,6 +47,11 @@ if ($courseid) {
if (empty($CFG->enableoutcomes)) { if (empty($CFG->enableoutcomes)) {
redirect('../../index.php?id='.$courseid); redirect('../../index.php?id='.$courseid);
} }
navigation_node::override_active_url(new moodle_url('/grade/edit/outcome/course.php', ['id' => $courseid]));
$PAGE->navbar->add(get_string('manageoutcomes', 'grades'),
new moodle_url('/grade/edit/outcome/index.php', ['id' => $courseid]));
$PAGE->navbar->add(get_string('importoutcomes', 'grades'),
new moodle_url('/grade/edit/outcome/import.php', ['courseid' => $courseid]));
} else { } else {
require_once $CFG->libdir.'/adminlib.php'; require_once $CFG->libdir.'/adminlib.php';
@ -55,8 +61,6 @@ if ($courseid) {
require_capability('moodle/grade:manageoutcomes', $context); require_capability('moodle/grade:manageoutcomes', $context);
$navigation = grade_build_nav(__FILE__, get_string('outcomes', 'grades'), $courseid);
$upload_form = new import_outcomes_form(); $upload_form = new import_outcomes_form();
if ($upload_form->is_cancelled()) { if ($upload_form->is_cancelled()) {

View file

@ -29,7 +29,8 @@ require_once($CFG->libdir.'/gradelib.php');
$courseid = optional_param('id', 0, PARAM_INT); $courseid = optional_param('id', 0, PARAM_INT);
$action = optional_param('action', '', PARAM_ALPHA); $action = optional_param('action', '', PARAM_ALPHA);
$PAGE->set_url('/grade/edit/outcome/index.php', array('id' => $courseid)); $url = new moodle_url('/grade/edit/outcome/index.php', ['id' => $courseid]);
$PAGE->set_url($url);
$PAGE->set_pagelayout('admin'); $PAGE->set_pagelayout('admin');
/// Make sure they can even access this course /// Make sure they can even access this course
@ -44,6 +45,7 @@ if ($courseid) {
} }
// This page doesn't exist on the navigation so map it to another // This page doesn't exist on the navigation so map it to another
navigation_node::override_active_url(new moodle_url('/grade/edit/outcome/course.php', array('id'=>$courseid))); navigation_node::override_active_url(new moodle_url('/grade/edit/outcome/course.php', array('id'=>$courseid)));
$PAGE->navbar->add(get_string('manageoutcomes', 'grades'), $url);
} else { } else {
if (empty($CFG->enableoutcomes)) { if (empty($CFG->enableoutcomes)) {
redirect('../../../'); redirect('../../../');
@ -90,6 +92,7 @@ switch ($action) {
if(!$deleteconfirmed){ if(!$deleteconfirmed){
$PAGE->set_title(get_string('outcomedelete', 'grades')); $PAGE->set_title(get_string('outcomedelete', 'grades'));
$PAGE->navbar->add(get_string('outcomedelete', 'grades'));
echo $OUTPUT->header(); echo $OUTPUT->header();
$confirmurl = new moodle_url('index.php', array( $confirmurl = new moodle_url('index.php', array(
'id' => $courseid, 'outcomeid' => $outcome->id, 'id' => $courseid, 'outcomeid' => $outcome->id,

View file

@ -144,6 +144,7 @@ if ($mform->is_cancelled()) {
} }
$heading = $id ? get_string('editscale', 'grades') : get_string('addscale', 'grades'); $heading = $id ? get_string('editscale', 'grades') : get_string('addscale', 'grades');
$PAGE->navbar->add($heading);
print_grade_page_head($COURSE->id, 'scale', null, $heading, false, false, false); print_grade_page_head($COURSE->id, 'scale', null, $heading, false, false, false);
$mform->display(); $mform->display();

View file

@ -81,7 +81,11 @@ switch ($action) {
$deleteconfirmed = optional_param('deleteconfirmed', 0, PARAM_BOOL); $deleteconfirmed = optional_param('deleteconfirmed', 0, PARAM_BOOL);
if (!$deleteconfirmed) { if (!$deleteconfirmed) {
$strdeletescale = get_string('delete'). ' '. get_string('scale'); if ($courseid) {
$PAGE->navbar->add(get_string('scales'), new moodle_url('/grade/edit/scale/index.php',
['id' => $courseid]));
}
$strdeletescale = get_string('deletescale', 'grades');
$PAGE->navbar->add($strdeletescale); $PAGE->navbar->add($strdeletescale);
$PAGE->set_title($strdeletescale); $PAGE->set_title($strdeletescale);
$PAGE->set_heading($COURSE->fullname); $PAGE->set_heading($COURSE->fullname);

View file

@ -76,11 +76,18 @@ if (!empty($key->userid) and $USER->id != $key->userid) {
$returnurl = $CFG->wwwroot.'/grade/export/keymanager.php?id='.$course->id; $returnurl = $CFG->wwwroot.'/grade/export/keymanager.php?id='.$course->id;
$strkeys = get_string('keymanager', 'userkey');
$strexportgrades = get_string('export', 'grades');
$PAGE->navbar->add($strexportgrades, new moodle_url('/grade/export/index.php', ['id' => $courseid]));
$PAGE->navbar->add($strkeys, new moodle_url('/grade/export/keymanager.php', ['id' => $courseid]));
if ($id and $delete) { if ($id and $delete) {
if (!$confirm) { if (!$confirm) {
$PAGE->set_title(get_string('deleteselectedkey')); $PAGE->set_title(get_string('deleteselectedkey'));
$PAGE->set_heading($course->fullname); $PAGE->set_heading($course->fullname);
$PAGE->set_secondary_active_tab('grades'); $PAGE->set_secondary_active_tab('grades');
$PAGE->navbar->add(get_string('deleteuserkey', 'userkey'));
echo $OUTPUT->header(); echo $OUTPUT->header();
$optionsyes = array('id'=>$id, 'delete'=>1, 'courseid'=>$courseid, 'sesskey'=>sesskey(), 'confirm'=>1); $optionsyes = array('id'=>$id, 'delete'=>1, 'courseid'=>$courseid, 'sesskey'=>sesskey(), 'confirm'=>1);
$optionsno = array('id'=>$courseid); $optionsno = array('id'=>$courseid);
@ -118,17 +125,12 @@ if ($editform->is_cancelled()) {
redirect($returnurl); redirect($returnurl);
} }
$strkeys = get_string('userkeys', 'userkey');
$strgrades = get_string('grades');
if ($id) { if ($id) {
$strheading = get_string('edituserkey', 'userkey'); $strheading = get_string('edituserkey', 'userkey');
} else { } else {
$strheading = get_string('createuserkey', 'userkey'); $strheading = get_string('createuserkey', 'userkey');
} }
$PAGE->navbar->add($strgrades, new moodle_url('/grade/index.php', array('id'=>$courseid)));
$PAGE->navbar->add($strkeys, new moodle_url('/grade/export/keymanager.php', array('id'=>$courseid)));
$PAGE->navbar->add($strheading); $PAGE->navbar->add($strheading);
/// Print header /// Print header

View file

@ -33,7 +33,8 @@ $id = optional_param('id', 0, PARAM_INT);
$delete = optional_param('delete', 0, PARAM_BOOL); $delete = optional_param('delete', 0, PARAM_BOOL);
$confirm = optional_param('confirm', 0, PARAM_BOOL); $confirm = optional_param('confirm', 0, PARAM_BOOL);
$PAGE->set_url('/grade/import/key.php', array('courseid' => $courseid, 'id' => $id)); $url = new moodle_url('/grade/import/key.php', ['courseid' => $courseid, 'id' => $id]);
$PAGE->set_url($url);
if ($id) { if ($id) {
if (!$key = $DB->get_record('user_private_key', array('id' => $id))) { if (!$key = $DB->get_record('user_private_key', array('id' => $id))) {
@ -76,11 +77,18 @@ if (!empty($key->userid) and $USER->id != $key->userid) {
$returnurl = $CFG->wwwroot.'/grade/import/keymanager.php?id='.$course->id; $returnurl = $CFG->wwwroot.'/grade/import/keymanager.php?id='.$course->id;
$strkeys = get_string('keymanager', 'userkey');
$strimportgrades = get_string('import', 'grades');
$PAGE->navbar->add($strimportgrades, new moodle_url(new moodle_url('/grade/import/index.php', ['id' => $courseid])));
$PAGE->navbar->add($strkeys, new moodle_url('/grade/import/keymanager.php', ['id' => $courseid]));
if ($id and $delete) { if ($id and $delete) {
if (!$confirm) { if (!$confirm) {
$PAGE->set_title(get_string('deleteselectedkey')); $PAGE->set_title(get_string('deleteselectedkey'));
$PAGE->set_heading($course->fullname); $PAGE->set_heading($course->fullname);
$PAGE->set_secondary_active_tab('grades'); $PAGE->set_secondary_active_tab('grades');
$PAGE->navbar->add(get_string('deleteuserkey', 'userkey'));
echo $OUTPUT->header(); echo $OUTPUT->header();
$optionsyes = array('id'=>$id, 'delete'=>1, 'courseid'=>$courseid, 'sesskey'=>sesskey(), 'confirm'=>1); $optionsyes = array('id'=>$id, 'delete'=>1, 'courseid'=>$courseid, 'sesskey'=>sesskey(), 'confirm'=>1);
$optionsno = array('id'=>$courseid); $optionsno = array('id'=>$courseid);
@ -118,17 +126,12 @@ if ($editform->is_cancelled()) {
redirect($returnurl); redirect($returnurl);
} }
$strkeys = get_string('userkeys', 'userkey');
$strgrades = get_string('grades');
if ($id) { if ($id) {
$strheading = get_string('edituserkey', 'userkey'); $strheading = get_string('edituserkey', 'userkey');
} else { } else {
$strheading = get_string('createuserkey', 'userkey'); $strheading = get_string('createuserkey', 'userkey');
} }
$PAGE->navbar->add($strgrades, new moodle_url('/grade/index.php', array('id'=>$courseid)));
$PAGE->navbar->add($strkeys, new moodle_url('/grade/import/keymanager.php', array('id'=>$courseid)));
$PAGE->navbar->add($strheading); $PAGE->navbar->add($strheading);
/// Print header /// Print header

View file

@ -148,6 +148,7 @@ $string['decimalpoints_help'] = 'This setting determines the number of decimal p
$string['default'] = 'Default'; $string['default'] = 'Default';
$string['defaultprev'] = 'Default ({$a})'; $string['defaultprev'] = 'Default ({$a})';
$string['deletecategory'] = 'Delete category'; $string['deletecategory'] = 'Delete category';
$string['deletescale'] = 'Delete scale';
$string['disablegradehistory'] = 'Disable grade history'; $string['disablegradehistory'] = 'Disable grade history';
$string['disablegradehistory_help'] = 'Disable history tracking of changes in grades related tables. This may speed up the server a little and conserve space in database.'; $string['disablegradehistory_help'] = 'Disable history tracking of changes in grades related tables. This may speed up the server a little and conserve space in database.';
$string['displaylettergrade'] = 'Display letter grades'; $string['displaylettergrade'] = 'Display letter grades';

View file

@ -26,6 +26,7 @@ $string['adduserkey'] = 'Add user key';
$string['createnewkey'] = 'Create a new user key'; $string['createnewkey'] = 'Create a new user key';
$string['createuserkey'] = 'Create user key'; $string['createuserkey'] = 'Create user key';
$string['deletekeyconfirm'] = 'Do you really want to delete this user key?'; $string['deletekeyconfirm'] = 'Do you really want to delete this user key?';
$string['deleteuserkey'] = 'Delete user key';
$string['edituserkey'] = 'Edit user key'; $string['edituserkey'] = 'Edit user key';
$string['keyiprestriction'] = 'Key IP restriction'; $string['keyiprestriction'] = 'Key IP restriction';
$string['keyiprestriction_help'] = 'Enter a specific IP address, or a range of IP addresses that will be the only IP addresses allowed to access this data. Leave empty to disable IP restriction (not recommended).'; $string['keyiprestriction_help'] = 'Enter a specific IP address, or a range of IP addresses that will be the only IP addresses allowed to access this data. Leave empty to disable IP restriction (not recommended).';