Skip to content

Commit

Permalink
Merge branch 'MDL-77472' of https://github.com/paulholden/moodle
Browse files Browse the repository at this point in the history
  • Loading branch information
junpataleta committed Mar 8, 2023
2 parents 9f178c1 + 6a62ccc commit 530e55e
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 7 deletions.
4 changes: 2 additions & 2 deletions grade/edit/tree/item.php
Expand Up @@ -57,12 +57,12 @@
if ($grade_item = grade_item::fetch(array('id'=>$id, 'courseid'=>$courseid))) {
// redirect if outcomeid present
if (!empty($grade_item->outcomeid) && !empty($CFG->enableoutcomes)) {
$url = $CFG->wwwroot.'/grade/edit/tree/outcomeitem.php?id='.$id.'&courseid='.$courseid;
$url = new moodle_url('/grade/edit/tree/outcomeitem.php', ['id' => $id, 'courseid' => $courseid]);
redirect($gpr->add_url_params($url));
}
if ($grade_item->is_course_item() or $grade_item->is_category_item()) {
$grade_category = $grade_item->get_item_category();
$url = $CFG->wwwroot.'/grade/edit/tree/category.php?id='.$grade_category->id.'&courseid='.$courseid;
$url = new moodle_url('/grade/edit/tree/category.php', ['id' => $grade_category->id, 'courseid' => $courseid]);
redirect($gpr->add_url_params($url));
}

Expand Down
2 changes: 1 addition & 1 deletion grade/edit/tree/outcomeitem.php
Expand Up @@ -63,7 +63,7 @@
if ($grade_item = grade_item::fetch(array('id'=>$id, 'courseid'=>$courseid))) {
// redirect if outcomeid present
if (empty($grade_item->outcomeid)) {
$url = $CFG->wwwroot.'/grade/edit/tree/item.php?id='.$id.'&courseid='.$courseid;
$url = new moodle_url('/grade/edit/tree/item.php', ['id' => $id, 'courseid' => $courseid]);
redirect($gpr->add_url_params($url));
}
$item = $grade_item->get_record_data();
Expand Down
7 changes: 3 additions & 4 deletions grade/lib.php
Expand Up @@ -1222,10 +1222,9 @@ public function add_mform_elements(&$mform) {
* Add return tracking params into url
*
* @param moodle_url $url A URL
*
* @return string $url with return tracking params
* @return moodle_url with return tracking params
*/
public function add_url_params(moodle_url $url) {
public function add_url_params(moodle_url $url): moodle_url {
if (empty($this->type)) {
return $url;
}
Expand Down Expand Up @@ -1959,9 +1958,9 @@ public function get_edit_link(array $element, object $gpr, array $langstrings):
$url = new moodle_url('/grade/edit/tree/grade.php',
['courseid' => $this->courseid, 'id' => $object->id]);
}
$url = $gpr->add_url_params($url);
$title = $langstrings[0];
}
$gpr->add_url_params($url);
return html_writer::link($url, $title,
['class' => 'dropdown-item', 'aria-label' => $title, 'role' => 'menuitem']);
}
Expand Down

0 comments on commit 530e55e

Please sign in to comment.