Merge branch 'wip-MDL-21097-master' of git://github.com/marinaglancy/moodle

This commit is contained in:
Dan Poltawski 2013-06-05 13:10:12 +08:00
commit 1caff55c2c

View file

@ -122,6 +122,7 @@
$PAGE->set_pagelayout('course'); $PAGE->set_pagelayout('course');
$PAGE->set_pagetype('course-view-' . $course->format); $PAGE->set_pagetype('course-view-' . $course->format);
$PAGE->set_other_editing_capability('moodle/course:update');
$PAGE->set_other_editing_capability('moodle/course:manageactivities'); $PAGE->set_other_editing_capability('moodle/course:manageactivities');
$PAGE->set_other_editing_capability('moodle/course:activityvisibility'); $PAGE->set_other_editing_capability('moodle/course:activityvisibility');
if (course_format_uses_sections($course->format)) { if (course_format_uses_sections($course->format)) {
@ -194,9 +195,8 @@
} }
} }
if (has_capability('moodle/course:update', $context)) { if (!empty($section) && !empty($move) &&
if (!empty($section)) { has_capability('moodle/course:movesections', $context) && confirm_sesskey()) {
if (!empty($move) and has_capability('moodle/course:movesections', $context) and confirm_sesskey()) {
$destsection = $section + $move; $destsection = $section + $move;
if (move_section_to($course, $section, $destsection)) { if (move_section_to($course, $section, $destsection)) {
if ($course->id == SITEID) { if ($course->id == SITEID) {
@ -208,8 +208,6 @@
echo $OUTPUT->notification('An error occurred while moving a section'); echo $OUTPUT->notification('An error occurred while moving a section');
} }
} }
}
}
} else { } else {
$USER->editing = 0; $USER->editing = 0;
} }