MDL-32508 course: Introduce course_get_url()

This commit is contained in:
Dan Poltawski 2012-04-26 21:36:02 +08:00
parent 45774bddf7
commit 5218b9bb7d
4 changed files with 36 additions and 15 deletions

View file

@ -108,7 +108,7 @@ if (!empty($add)) {
get_string('continue'),
'post'),
new single_button(
new moodle_url('/course/view.php#section-' . $cm->sectionnum, array('id' => $cm->course)),
course_get_url($course, $cm->sectionnum),
get_string('cancel'),
'get')
);
@ -125,7 +125,7 @@ if (!empty($add)) {
$modcontext = get_context_instance(CONTEXT_MODULE, $cm->id);
require_capability('moodle/course:manageactivities', $modcontext);
$return = "$CFG->wwwroot/course/view.php?id=$cm->course#section-$cm->sectionnum";
$return = course_get_url($course, $cm->sectionnum);
if (!$confirm or !confirm_sesskey()) {
$fullmodulename = get_string('modulename', $cm->modname);
@ -235,7 +235,7 @@ if ((!empty($movetosection) or !empty($moveto)) and confirm_sesskey()) {
if (SITEID == $section->course) {
redirect($CFG->wwwroot);
} else {
redirect("view.php?id=$section->course#section-$sectionreturn");
redirect(course_get_url($course, $sectionreturn));
}
} else if (!empty($indent) and confirm_sesskey()) {
@ -262,7 +262,7 @@ if ((!empty($movetosection) or !empty($moveto)) and confirm_sesskey()) {
if (SITEID == $cm->course) {
redirect($CFG->wwwroot);
} else {
redirect("view.php?id=$cm->course#section-$cm->sectionnum");
redirect(course_get_url($course, $cm->sectionnum));
}
} else if (!empty($hide) and confirm_sesskey()) {
@ -281,7 +281,7 @@ if ((!empty($movetosection) or !empty($moveto)) and confirm_sesskey()) {
if (SITEID == $cm->course) {
redirect($CFG->wwwroot);
} else {
redirect("view.php?id=$cm->course#section-$cm->sectionnum");
redirect(course_get_url($course, $cm->sectionnum));
}
} else if (!empty($show) and confirm_sesskey()) {
@ -305,7 +305,7 @@ if ((!empty($movetosection) or !empty($moveto)) and confirm_sesskey()) {
if (SITEID == $cm->course) {
redirect($CFG->wwwroot);
} else {
redirect("view.php?id=$cm->course#section-$cm->sectionnum");
redirect(course_get_url($course, $cm->sectionnum));
}
} else if ($groupmode > -1 and confirm_sesskey()) {
@ -326,7 +326,7 @@ if ((!empty($movetosection) or !empty($moveto)) and confirm_sesskey()) {
if (SITEID == $cm->course) {
redirect($CFG->wwwroot);
} else {
redirect("view.php?id=$cm->course#section-$cm->sectionnum");
redirect(course_get_url($course, $cm->sectionnum));
}
} else if (!empty($copy) and confirm_sesskey()) { // value = course module
@ -344,7 +344,7 @@ if ((!empty($movetosection) or !empty($moveto)) and confirm_sesskey()) {
$USER->activitycopycourse = $cm->course;
$USER->activitycopyname = $cm->name;
redirect("view.php?id=$cm->course#section-$sectionreturn");
redirect(course_get_url($course, $sectionreturn));
} else if (!empty($cancelcopy) and confirm_sesskey()) { // value = course module