|
| create (int $position=0, bool $skipcheck=false) |
| Creates a course section and adds it to the specified position.
|
|
| create_delegated (string $component, ?int $itemid=null, ?stdClass $fields=null) |
| Create a delegated section.
|
|
| create_if_missing (array $sectionnums) |
| Create course sections if they are not created yet.
|
|
| delete (section_info $sectioninfo, bool $forcedeleteifnotempty=true, bool $async=false) |
| Delete a course section.
|
|
| update (section_info $sectioninfo, array|stdClass $fields) |
| Update a course section.
|
|
|
stdClass stdClass | $course |
| the course object.
|
|
◆ create()
core_courseformat\local\sectionactions::create |
( |
int | $position = 0, |
|
|
bool | $skipcheck = false ) |
Creates a course section and adds it to the specified position.
This method returns a section record, not a section_info object. This prevents the regeneration of the modinfo object each time we create a section.
If position is greater than number of existing sections, the section is added to the end. This will become sectionnum of the new section. All existing sections at this or bigger position will be shifted down.
- Parameters
-
int | $position | The position to add to, 0 means to the end. |
bool | $skipcheck | the check has already been made and we know that the section with this position does not exist |
- Return values
-
stdClass | created section object) |
◆ create_delegated()
core_courseformat\local\sectionactions::create_delegated |
( |
string | $component, |
|
|
?int | $itemid = null, |
|
|
?stdClass | $fields = null ) |
Create a delegated section.
- Parameters
-
string | $component | the name of the plugin |
int | null | $itemid | the id of the delegated section |
stdClass | null | $fields | the fields to set on the section |
- Return values
-
◆ create_from_object()
core_courseformat\local\sectionactions::create_from_object |
( |
stdClass | $fields, |
|
|
bool | $skipcheck = false ) |
|
protected |
Create a course section using a record object.
If $fields->section is not set, the section is added to the end of the course.
- Parameters
-
stdClass | $fields | the fields to set on the section |
bool | $skipcheck | the position check has already been made and we know it can be used |
- Return values
-
stdClass | the created section record |
◆ create_if_missing()
core_courseformat\local\sectionactions::create_if_missing |
( |
array | $sectionnums | ) |
|
Create course sections if they are not created yet.
The calculations will ignore sections delegated to components. If the section is created, all delegated sections will be pushed down.
- Parameters
-
int[] | $sectionnums | the section numbers to create |
- Return values
-
bool | whether any section was created |
◆ delete()
core_courseformat\local\sectionactions::delete |
( |
section_info | $sectioninfo, |
|
|
bool | $forcedeleteifnotempty = true, |
|
|
bool | $async = false ) |
Delete a course section.
- Parameters
-
section_info | $sectioninfo | the section to delete. |
bool | $forcedeleteifnotempty | whether to force section deletion if it contains modules. |
bool | $async | whether or not to try to delete the section using an adhoc task. Async also depends on a plugin hook. |
- Return values
-
bool | whether section was deleted |
◆ delete_async()
core_courseformat\local\sectionactions::delete_async |
( |
section_info | $sectioninfo, |
|
|
bool | $forcedeleteifnotempty = true ) |
|
protected |
Course section deletion, using an adhoc task for deletion of the modules it contains.
- Schedule all modules within the section for adhoc removal.
- Move all modules to course section 0.
- Delete the resulting empty section.
- Parameters
-
section_info | $sectioninfo | the section to schedule for deletion. |
bool | $forcedeleteifnotempty | whether to force section deletion if it contains modules. |
- Return values
-
bool | true if the section was scheduled for deletion, false otherwise. |
◆ delete_format_data()
Delete a course section.
- Parameters
-
section_info | $sectioninfo | the section to delete. |
bool | $forcedeleteifnotempty | whether to force section deletion if it contains modules. |
course_section_deleted | $event | the event to trigger |
- Return values
-
bool | whether section was deleted |
◆ get_cm_info()
core_courseformat\local\baseactions::get_cm_info |
( |
| $cmid | ) |
|
|
protectedinherited |
Get the cm info.
- Parameters
-
- Return values
-
cm_info|null | Information for numbered cm or null if not found |
◆ get_course()
core_courseformat\local\baseactions::get_course |
( |
| ) |
|
|
protectedinherited |
Get the course.
- Return values
-
stdClass | the course object. |
◆ get_delete_event()
core_courseformat\local\sectionactions::get_delete_event |
( |
section_info | $sectioninfo | ) |
|
|
protected |
Get the event to trigger when deleting a section.
- Parameters
-
- Return values
-
course_section_deleted | the event to trigger |
◆ get_format()
core_courseformat\local\baseactions::get_format |
( |
| ) |
|
|
protectedinherited |
Get the course format.
- Return values
-
course_format | the course format. |
◆ get_last_section_number()
core_courseformat\local\sectionactions::get_last_section_number |
( |
bool | $includedelegated = true | ) |
|
|
protected |
Get the last section number in the course.
- Parameters
-
bool | $includedelegated | whether to include delegated sections |
- Return values
-
◆ get_section_info()
core_courseformat\local\baseactions::get_section_info |
( |
| $sectionid, |
|
|
int | $strictness = IGNORE_MISSING ) |
|
protectedinherited |
Get the section info.
- Parameters
-
int | $sectionid | the section id. |
int | $strictness | Use MUST_EXIST to throw exception if it doesn't |
- Return values
-
section_info|null | Information for numbered section or null if not found |
◆ preprocess_delegated_section_fields()
core_courseformat\local\sectionactions::preprocess_delegated_section_fields |
( |
section_info | $sectioninfo, |
|
|
array | $fields ) |
|
protected |
Preprocess the section fields before updating a delegated section.
- Parameters
-
section_info | $sectioninfo | the section info or database record to update. |
array | $fields | the fields to update. |
- Return values
-
◆ transfer_visibility_to_cms()
core_courseformat\local\sectionactions::transfer_visibility_to_cms |
( |
section_info | $sectioninfo, |
|
|
bool | $visibility ) |
|
protected |
Transfer the visibility of the section to the course modules.
- Parameters
-
section_info | $sectioninfo | the section info or database record to update. |
bool | $visibility | the new visibility of the section. |
◆ update()
core_courseformat\local\sectionactions::update |
( |
section_info | $sectioninfo, |
|
|
array|stdClass | $fields ) |
Update a course section.
- Parameters
-
section_info | $sectioninfo | the section info or database record to update. |
array | stdClass | $fields | the fields to update. |
- Return values
-
bool | whether section was updated |
The documentation for this class was generated from the following file:
- course/format/classes/local/sectionactions.php