Skip to content

Commit

Permalink
MDL-73645 grades: Update breadcrumb nodes
Browse files Browse the repository at this point in the history
  • Loading branch information
Mihail Geshoski committed Mar 2, 2022
1 parent 1060ee8 commit 724578a
Show file tree
Hide file tree
Showing 10 changed files with 46 additions and 18 deletions.
6 changes: 5 additions & 1 deletion grade/edit/letter/index.php
Expand Up @@ -30,7 +30,7 @@
$action = optional_param('action', '', PARAM_ALPHA);
$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);
$contextid = null;//now we have a context object throw away the $contextid from the params
Expand All @@ -42,7 +42,11 @@
}
} else {//else we're editing
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;
$editparam = null;
Expand Down
7 changes: 6 additions & 1 deletion grade/edit/outcome/edit.php
Expand Up @@ -79,7 +79,6 @@
require_login($course);
$context = context_course::instance($course->id);
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->standard = 0;
Expand All @@ -98,6 +97,10 @@
if (!$courseid) {
require_once $CFG->libdir.'/adminlib.php';
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
Expand Down Expand Up @@ -158,6 +161,8 @@
redirect($returnurl);
}

$PAGE->navbar->add($heading, $url);

print_grade_page_head($courseid ?: SITEID, 'outcome', 'edit', $heading, false, false, false);

if (!grade_scale::fetch_all_local($courseid) && !grade_scale::fetch_all_global()) {
Expand Down
10 changes: 7 additions & 3 deletions grade/edit/outcome/import.php
Expand Up @@ -32,7 +32,8 @@
$action = optional_param('action', '', 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');

/// Make sure they can even access this course
Expand All @@ -46,6 +47,11 @@
if (empty($CFG->enableoutcomes)) {
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 {
require_once $CFG->libdir.'/adminlib.php';
Expand All @@ -55,8 +61,6 @@

require_capability('moodle/grade:manageoutcomes', $context);

$navigation = grade_build_nav(__FILE__, get_string('outcomes', 'grades'), $courseid);

$upload_form = new import_outcomes_form();

if ($upload_form->is_cancelled()) {
Expand Down
5 changes: 4 additions & 1 deletion grade/edit/outcome/index.php
Expand Up @@ -29,7 +29,8 @@
$courseid = optional_param('id', 0, PARAM_INT);
$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');

/// Make sure they can even access this course
Expand All @@ -44,6 +45,7 @@
}
// 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)));
$PAGE->navbar->add(get_string('manageoutcomes', 'grades'), $url);
} else {
if (empty($CFG->enableoutcomes)) {
redirect('../../../');
Expand Down Expand Up @@ -90,6 +92,7 @@

if(!$deleteconfirmed){
$PAGE->set_title(get_string('outcomedelete', 'grades'));
$PAGE->navbar->add(get_string('outcomedelete', 'grades'));
echo $OUTPUT->header();
$confirmurl = new moodle_url('index.php', array(
'id' => $courseid, 'outcomeid' => $outcome->id,
Expand Down
1 change: 1 addition & 0 deletions grade/edit/scale/edit.php
Expand Up @@ -144,6 +144,7 @@
}

$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);

$mform->display();
Expand Down
6 changes: 5 additions & 1 deletion grade/edit/scale/index.php
Expand Up @@ -81,7 +81,11 @@
$deleteconfirmed = optional_param('deleteconfirmed', 0, PARAM_BOOL);

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->set_title($strdeletescale);
$PAGE->set_heading($COURSE->fullname);
Expand Down
12 changes: 7 additions & 5 deletions grade/export/key.php
Expand Up @@ -76,11 +76,18 @@

$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 (!$confirm) {
$PAGE->set_title(get_string('deleteselectedkey'));
$PAGE->set_heading($course->fullname);
$PAGE->set_secondary_active_tab('grades');
$PAGE->navbar->add(get_string('deleteuserkey', 'userkey'));

echo $OUTPUT->header();
$optionsyes = array('id'=>$id, 'delete'=>1, 'courseid'=>$courseid, 'sesskey'=>sesskey(), 'confirm'=>1);
$optionsno = array('id'=>$courseid);
Expand Down Expand Up @@ -118,17 +125,12 @@
redirect($returnurl);
}

$strkeys = get_string('userkeys', 'userkey');
$strgrades = get_string('grades');

if ($id) {
$strheading = get_string('edituserkey', 'userkey');
} else {
$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);

/// Print header
Expand Down
15 changes: 9 additions & 6 deletions grade/import/key.php
Expand Up @@ -33,7 +33,8 @@
$delete = optional_param('delete', 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 (!$key = $DB->get_record('user_private_key', array('id' => $id))) {
Expand Down Expand Up @@ -76,11 +77,18 @@

$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 (!$confirm) {
$PAGE->set_title(get_string('deleteselectedkey'));
$PAGE->set_heading($course->fullname);
$PAGE->set_secondary_active_tab('grades');
$PAGE->navbar->add(get_string('deleteuserkey', 'userkey'));

echo $OUTPUT->header();
$optionsyes = array('id'=>$id, 'delete'=>1, 'courseid'=>$courseid, 'sesskey'=>sesskey(), 'confirm'=>1);
$optionsno = array('id'=>$courseid);
Expand Down Expand Up @@ -118,17 +126,12 @@
redirect($returnurl);
}

$strkeys = get_string('userkeys', 'userkey');
$strgrades = get_string('grades');

if ($id) {
$strheading = get_string('edituserkey', 'userkey');
} else {
$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);

/// Print header
Expand Down
1 change: 1 addition & 0 deletions lang/en/grades.php
Expand Up @@ -148,6 +148,7 @@
$string['default'] = 'Default';
$string['defaultprev'] = 'Default ({$a})';
$string['deletecategory'] = 'Delete category';
$string['deletescale'] = 'Delete scale';
$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['displaylettergrade'] = 'Display letter grades';
Expand Down
1 change: 1 addition & 0 deletions lang/en/userkey.php
Expand Up @@ -26,6 +26,7 @@
$string['createnewkey'] = 'Create a new user key';
$string['createuserkey'] = 'Create user key';
$string['deletekeyconfirm'] = 'Do you really want to delete this user key?';
$string['deleteuserkey'] = 'Delete user key';
$string['edituserkey'] = 'Edit user key';
$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).';
Expand Down

0 comments on commit 724578a

Please sign in to comment.