mirror of
https://github.com/moodle/moodle.git
synced 2025-04-20 07:56:06 +02:00
MDL-33367 course: Deprecated message added to move_section, so it can be removed in 2.5
This commit is contained in:
parent
eb01aa2c34
commit
ac5f641465
@ -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;
|
||||
}
|
||||
|
||||
|
@ -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 {
|
||||
|
Loading…
x
Reference in New Issue
Block a user