Merge branch 'MDL-80116-main' of https://github.com/ferranrecio/moodle
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
issueNumber: MDL-80116
|
||||
notes:
|
||||
core_courseformat:
|
||||
- message: >-
|
||||
The state actions section_move and all related functions are final
|
||||
deprecated and cannot be used anymore. Use the newer section_move_after
|
||||
from now on.
|
||||
type: deprecated
|
||||
- message: >-
|
||||
The core_courseformat::base get_section_number and set_section_number
|
||||
are now final deprecated. Use get_sectionum and set_sectionnum instead.
|
||||
type: deprecated
|
||||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
@@ -15,7 +15,6 @@
|
||||
|
||||
import ajax from 'core/ajax';
|
||||
import {getString} from "core/str";
|
||||
import log from 'core/log';
|
||||
import SRLogger from "core/local/reactive/srlogger";
|
||||
|
||||
/**
|
||||
@@ -333,28 +332,6 @@ export default class {
|
||||
this.cmLock(stateManager, cmids, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Move course modules to specific course location.
|
||||
*
|
||||
* @deprecated since Moodle 4.4 MDL-77038.
|
||||
* @todo MDL-80116 This will be deleted in Moodle 4.8.
|
||||
* @param {StateManager} stateManager the current state manager
|
||||
* @param {array} sectionIds the list of section ids to move
|
||||
* @param {number} targetSectionId the target section id
|
||||
*/
|
||||
async sectionMove(stateManager, sectionIds, targetSectionId) {
|
||||
log.debug('sectionMove() is deprecated. Use sectionMoveAfter() instead');
|
||||
if (!targetSectionId) {
|
||||
throw new Error(`Mutation sectionMove requires targetSectionId`);
|
||||
}
|
||||
const course = stateManager.get('course');
|
||||
this.sectionLock(stateManager, sectionIds, true);
|
||||
const updates = await this._callEditWebservice('section_move', course.id, sectionIds, targetSectionId);
|
||||
this.bulkReset(stateManager);
|
||||
stateManager.processUpdates(updates);
|
||||
this.sectionLock(stateManager, sectionIds, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Move course modules after a specific course location.
|
||||
*
|
||||
|
||||
@@ -655,26 +655,16 @@ abstract class base {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set if the current format instance will show multiple sections or an individual one.
|
||||
*
|
||||
* Some formats has the hability to swith from one section to multiple sections per page.
|
||||
*
|
||||
* @param int $singlesection zero for all sections or a section number
|
||||
* @deprecated Since 4.4. Use set_sectionnum instead.
|
||||
* @todo MDL-80116 This will be deleted in Moodle 4.8.
|
||||
*/
|
||||
public function set_section_number(int $singlesection): void {
|
||||
|
||||
debugging(
|
||||
'The method core_courseformat\base::set_section_number() has been deprecated, please use set_sectionnum() instead.',
|
||||
DEBUG_DEVELOPER
|
||||
);
|
||||
|
||||
if ($singlesection === 0) {
|
||||
// Convert zero to null, to guarantee all the sections are displayed.
|
||||
$singlesection = null;
|
||||
}
|
||||
$this->set_sectionnum($singlesection);
|
||||
#[\core\attribute\deprecated(
|
||||
replacement: 'base::set_sectionnum',
|
||||
since: '5.0',
|
||||
mdl: 'MDL-80248',
|
||||
final: true,
|
||||
)]
|
||||
public function set_section_number(): void {
|
||||
\core\deprecation::emit_deprecation_if_present([self::class, __FUNCTION__]);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -713,29 +703,16 @@ abstract class base {
|
||||
}
|
||||
|
||||
/**
|
||||
* Set if the current format instance will show multiple sections or an individual one.
|
||||
*
|
||||
* Some formats has the hability to swith from one section to multiple sections per page,
|
||||
* output components will use this method to know if the current display is a single or
|
||||
* multiple sections.
|
||||
*
|
||||
* @return int zero for all sections or the sectin number
|
||||
* @deprecated Since 4.4. Use get_sectionnum instead.
|
||||
* @todo MDL-80116 This will be deleted in Moodle 4.8.
|
||||
*/
|
||||
public function get_section_number(): int {
|
||||
|
||||
debugging(
|
||||
'The method core_courseformat\base::get_section_number() has been deprecated, please use get_sectionnum() instead.',
|
||||
DEBUG_DEVELOPER
|
||||
);
|
||||
|
||||
if ($this->singlesection === null) {
|
||||
// Convert null to zero, to guarantee all the sections are displayed.
|
||||
return 0;
|
||||
}
|
||||
|
||||
return $this->singlesection;
|
||||
#[\core\attribute\deprecated(
|
||||
replacement: 'base::get_sectionnum',
|
||||
since: '5.0',
|
||||
mdl: 'MDL-80248',
|
||||
final: true,
|
||||
)]
|
||||
public function get_section_number(): void {
|
||||
\core\deprecation::emit_deprecation_if_present([self::class, __FUNCTION__]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -142,65 +142,16 @@ class stateactions {
|
||||
}
|
||||
|
||||
/**
|
||||
* Move course sections to another location in the same course.
|
||||
*
|
||||
* @deprecated since Moodle 4.4 MDL-77038.
|
||||
* @todo MDL-80116 This will be deleted in Moodle 4.8.
|
||||
* @param stateupdates $updates the affected course elements track
|
||||
* @param stdClass $course the course object
|
||||
* @param int[] $ids the list of affected course module ids
|
||||
* @param int $targetsectionid optional target section id
|
||||
* @param int $targetcmid optional target cm id
|
||||
*/
|
||||
public function section_move(
|
||||
stateupdates $updates,
|
||||
stdClass $course,
|
||||
array $ids,
|
||||
?int $targetsectionid = null,
|
||||
?int $targetcmid = null
|
||||
): void {
|
||||
debugging(
|
||||
'The method stateactions::section_move() has been deprecated, please use stateactions::section_move_after() instead.',
|
||||
DEBUG_DEVELOPER
|
||||
);
|
||||
// Validate target elements.
|
||||
if (!$targetsectionid) {
|
||||
throw new moodle_exception("Action cm_move requires targetsectionid");
|
||||
}
|
||||
|
||||
$this->validate_sections($course, $ids, __FUNCTION__);
|
||||
|
||||
$coursecontext = context_course::instance($course->id);
|
||||
require_capability('moodle/course:movesections', $coursecontext);
|
||||
|
||||
$modinfo = get_fast_modinfo($course);
|
||||
|
||||
// Target section.
|
||||
$this->validate_sections($course, [$targetsectionid], __FUNCTION__);
|
||||
$targetsection = $modinfo->get_section_info_by_id($targetsectionid, MUST_EXIST);
|
||||
|
||||
$affectedsections = [$targetsection->section => true];
|
||||
|
||||
$sections = $this->get_section_info($modinfo, $ids);
|
||||
foreach ($sections as $section) {
|
||||
$affectedsections[$section->section] = true;
|
||||
move_section_to($course, $section->section, $targetsection->section);
|
||||
}
|
||||
|
||||
// Use section_state to return the section and activities updated state.
|
||||
$this->section_state($updates, $course, $ids, $targetsectionid);
|
||||
|
||||
// All course sections can be renamed because of the resort.
|
||||
$allsections = $modinfo->get_section_info_all();
|
||||
foreach ($allsections as $section) {
|
||||
// Ignore the affected sections because they are already in the updates.
|
||||
if (isset($affectedsections[$section->section])) {
|
||||
continue;
|
||||
}
|
||||
$updates->add_section_put($section->id);
|
||||
}
|
||||
// The section order is at a course level.
|
||||
$updates->add_course_put();
|
||||
#[\core\attribute\deprecated(
|
||||
replacement: 'stateactions::section_move_after',
|
||||
since: '5.0',
|
||||
mdl: 'MDL-77038',
|
||||
final: true,
|
||||
)]
|
||||
public function section_move(): void {
|
||||
\core\deprecation::emit_deprecation_if_present([self::class, __FUNCTION__]);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user