MDL-33367 course: Deprecated message added to move_section, so it can be removed in 2.5

This commit is contained in:
Rajesh Taneja 2012-05-28 15:36:13 +08:00
parent eb01aa2c34
commit ac5f641465
2 changed files with 8 additions and 2 deletions

View File

@ -2948,8 +2948,11 @@ function delete_mod_from_section($mod, $section) {
* @param int $section Section number (not id!!!)
* @param int $move (-1 or 1)
* @return boolean true if section moved successfully
* @todo MDL-33379 remove this function in 2.5
*/
function move_section($course, $section, $move) {
debugging('This function will be removed before 2.5 is released please use move_section_to', DEBUG_DEVELOPER);
/// Moves a whole course section up and down within the course
global $USER, $DB;
@ -2989,7 +2992,7 @@ function move_section_to($course, $section, $destination) {
return true;
}
if ($destination > $course->numsections) {
if (($destination > $course->numsections) || ($destination < 1)) {
return false;
}

View File

@ -159,7 +159,10 @@
if (!empty($section)) {
if (!empty($move) and confirm_sesskey()) {
if (move_section($course, $section, $move)) {
$destsection = $section + $move;
if (move_section_to($course, $section, $destsection)) {
// Rebuild course cache, after moving section
rebuild_course_cache($course->id, true);
if ($course->id == SITEID) {
redirect($CFG->wwwroot . '/?redirect=0');
} else {