Moodle PHP Documentation 4.3
Moodle 4.3.5 (Build: 20240610) (7dcfaa79f78)
|
Public Member Functions | |
cm_delete (stateupdates $updates, stdClass $course, array $ids=[], ?int $targetsectionid=null, ?int $targetcmid=null) | |
Delete course cms. | |
cm_duplicate (stateupdates $updates, stdClass $course, array $ids=[], ?int $targetsectionid=null, ?int $targetcmid=null) | |
Duplicate a course modules instances into the same course. | |
cm_hide (stateupdates $updates, stdClass $course, array $ids=[], ?int $targetsectionid=null, ?int $targetcmid=null) | |
Hide course cms. | |
cm_move (stateupdates $updates, stdClass $course, array $ids, ?int $targetsectionid=null, ?int $targetcmid=null) | |
Move course modules to another location in the same course. | |
cm_moveleft (stateupdates $updates, stdClass $course, array $ids=[], ?int $targetsectionid=null, ?int $targetcmid=null) | |
Move course cms to the left. | |
cm_moveright (stateupdates $updates, stdClass $course, array $ids=[], ?int $targetsectionid=null, ?int $targetcmid=null) | |
Move course cms to the right. | |
cm_nogroups (stateupdates $updates, stdClass $course, array $ids=[], ?int $targetsectionid=null, ?int $targetcmid=null) | |
Set NOGROUPS const value to cms groupmode. | |
cm_separategroups (stateupdates $updates, stdClass $course, array $ids=[], ?int $targetsectionid=null, ?int $targetcmid=null) | |
Set SEPARATEGROUPS const value to cms groupmode. | |
cm_show (stateupdates $updates, stdClass $course, array $ids=[], ?int $targetsectionid=null, ?int $targetcmid=null) | |
Show course cms. | |
cm_state (stateupdates $updates, stdClass $course, array $ids, ?int $targetsectionid=null, ?int $targetcmid=null) | |
Add the update messages of the updated version of any cm and section related to the cm ids. | |
cm_stealth (stateupdates $updates, stdClass $course, array $ids=[], ?int $targetsectionid=null, ?int $targetcmid=null) | |
Stealth course cms. | |
cm_visiblegroups (stateupdates $updates, stdClass $course, array $ids=[], ?int $targetsectionid=null, ?int $targetcmid=null) | |
Set VISIBLEGROUPS const value to cms groupmode. | |
course_state (stateupdates $updates, stdClass $course, array $ids=[], ?int $targetsectionid=null, ?int $targetcmid=null) | |
Add all the update messages from the complete course state. | |
section_add (stateupdates $updates, stdClass $course, array $ids=[], ?int $targetsectionid=null, ?int $targetcmid=null) | |
Create a course section. | |
section_content_collapsed (stateupdates $updates, stdClass $course, array $ids=[], ?int $targetsectionid=null, ?int $targetcmid=null,) | |
Update the course content section state to collapse. | |
section_content_expanded (stateupdates $updates, stdClass $course, array $ids=[], ?int $targetsectionid=null, ?int $targetcmid=null,) | |
Update the course content section state to expand. | |
section_delete (stateupdates $updates, stdClass $course, array $ids=[], ?int $targetsectionid=null, ?int $targetcmid=null) | |
Delete course sections. | |
section_hide (stateupdates $updates, stdClass $course, array $ids=[], ?int $targetsectionid=null, ?int $targetcmid=null) | |
Hide course sections. | |
section_index_collapsed (stateupdates $updates, stdClass $course, array $ids=[], ?int $targetsectionid=null, ?int $targetcmid=null,) | |
Update the course index section state to collapse. | |
section_index_expanded (stateupdates $updates, stdClass $course, array $ids=[], ?int $targetsectionid=null, ?int $targetcmid=null,) | |
Update the course index section state to expand. | |
section_move (stateupdates $updates, stdClass $course, array $ids, ?int $targetsectionid=null, ?int $targetcmid=null) | |
Move course sections to another location in the same course. | |
section_move_after (stateupdates $updates, stdClass $course, array $ids, ?int $targetsectionid=null, ?int $targetcmid=null) | |
Move course sections after to another location in the same course. | |
section_show (stateupdates $updates, stdClass $course, array $ids=[], ?int $targetsectionid=null, ?int $targetcmid=null) | |
Show course sections. | |
section_state (stateupdates $updates, stdClass $course, array $ids, ?int $targetsectionid=null, ?int $targetcmid=null) | |
Add the update messages of the updated version of any cm and section related to the section ids. | |
Protected Member Functions | |
get_cm_info (course_modinfo $modinfo, array $ids) | |
Extract several cm_info from the course_modinfo. | |
get_section_info (course_modinfo $modinfo, array $ids) | |
Extract several section_info from the course_modinfo. | |
set_cm_groupmode (stateupdates $updates, stdClass $course, array $ids, int $groupmode) | |
Internal method to define the cm groupmode value. | |
set_cm_indentation (stateupdates $updates, stdClass $course, array $ids, int $indent) | |
Internal method to define the cm indentation level. | |
set_cm_visibility (stateupdates $updates, stdClass $course, array $ids, int $visible, int $coursevisible) | |
Internal method to define the cm visibility. | |
set_section_visibility (stateupdates $updates, stdClass $course, array $ids, int $visible) | |
Show course sections. | |
sort_cm_ids_by_course_position (stdClass $course, array $cmids, bool $descending=false) | |
Sort the cm ids list depending on the course position. | |
sort_section_ids_by_section_number (stdClass $course, array $sectionids, bool $descending=false) | |
Sort the sections ids depending on the section number. | |
validate_cms (stdClass $course, array $cmids, ?string $info=null, array $capabilities=[]) | |
Checks related to course modules: all given cm exist and the user has the required capabilities. | |
validate_sections (stdClass $course, array $sectionids, ?string $info=null) | |
Checks related to sections: course format support them, all given sections exist and topic 0 is not included. | |
core_courseformat\stateactions::cm_delete | ( | stateupdates | $updates, |
stdClass | $course, | ||
array | $ids = [], | ||
?int | $targetsectionid = null, | ||
?int | $targetcmid = null ) |
Delete course cms.
stateupdates | $updates | the affected course elements track |
stdClass | $course | the course object |
int[] | $ids | section ids |
int | $targetsectionid | not used |
int | $targetcmid | not used |
core_courseformat\stateactions::cm_duplicate | ( | stateupdates | $updates, |
stdClass | $course, | ||
array | $ids = [], | ||
?int | $targetsectionid = null, | ||
?int | $targetcmid = null ) |
Duplicate a course modules instances into the same course.
stateupdates | $updates | the affected course elements track |
stdClass | $course | the course object |
int[] | $ids | course modules ids to duplicate |
int | null | $targetsectionid | optional target section id destination |
int | null | $targetcmid | optional target before cm id destination |
core_courseformat\stateactions::cm_hide | ( | stateupdates | $updates, |
stdClass | $course, | ||
array | $ids = [], | ||
?int | $targetsectionid = null, | ||
?int | $targetcmid = null ) |
Hide course cms.
stateupdates | $updates | the affected course elements track |
stdClass | $course | the course object |
int[] | $ids | cm ids |
int | $targetsectionid | not used |
int | $targetcmid | not used |
core_courseformat\stateactions::cm_move | ( | stateupdates | $updates, |
stdClass | $course, | ||
array | $ids, | ||
?int | $targetsectionid = null, | ||
?int | $targetcmid = null ) |
Move course modules to another location in the same course.
stateupdates | $updates | the affected course elements track |
stdClass | $course | the course object |
int[] | $ids | the list of affected course module ids |
int | $targetsectionid | optional target section id |
int | $targetcmid | optional target cm id |
core_courseformat\stateactions::cm_moveleft | ( | stateupdates | $updates, |
stdClass | $course, | ||
array | $ids = [], | ||
?int | $targetsectionid = null, | ||
?int | $targetcmid = null ) |
Move course cms to the left.
Indent = 0.
stateupdates | $updates | the affected course elements track |
stdClass | $course | the course object |
int[] | $ids | cm ids |
int | $targetsectionid | not used |
int | $targetcmid | not used |
core_courseformat\stateactions::cm_moveright | ( | stateupdates | $updates, |
stdClass | $course, | ||
array | $ids = [], | ||
?int | $targetsectionid = null, | ||
?int | $targetcmid = null ) |
Move course cms to the right.
Indent = 1.
stateupdates | $updates | the affected course elements track |
stdClass | $course | the course object |
int[] | $ids | cm ids |
int | $targetsectionid | not used |
int | $targetcmid | not used |
core_courseformat\stateactions::cm_nogroups | ( | stateupdates | $updates, |
stdClass | $course, | ||
array | $ids = [], | ||
?int | $targetsectionid = null, | ||
?int | $targetcmid = null ) |
Set NOGROUPS const value to cms groupmode.
stateupdates | $updates | the affected course elements track |
stdClass | $course | the course object |
int[] | $ids | cm ids |
int | $targetsectionid | not used |
int | $targetcmid | not used |
core_courseformat\stateactions::cm_separategroups | ( | stateupdates | $updates, |
stdClass | $course, | ||
array | $ids = [], | ||
?int | $targetsectionid = null, | ||
?int | $targetcmid = null ) |
Set SEPARATEGROUPS const value to cms groupmode.
stateupdates | $updates | the affected course elements track |
stdClass | $course | the course object |
int[] | $ids | cm ids |
int | $targetsectionid | not used |
int | $targetcmid | not used |
core_courseformat\stateactions::cm_show | ( | stateupdates | $updates, |
stdClass | $course, | ||
array | $ids = [], | ||
?int | $targetsectionid = null, | ||
?int | $targetcmid = null ) |
Show course cms.
stateupdates | $updates | the affected course elements track |
stdClass | $course | the course object |
int[] | $ids | cm ids |
int | $targetsectionid | not used |
int | $targetcmid | not used |
core_courseformat\stateactions::cm_state | ( | stateupdates | $updates, |
stdClass | $course, | ||
array | $ids, | ||
?int | $targetsectionid = null, | ||
?int | $targetcmid = null ) |
Add the update messages of the updated version of any cm and section related to the cm ids.
This action is mainly used by legacy actions to partially update the course state when the result of core_course_edit_module is not enough to generate the correct state data.
stateupdates | $updates | the affected course elements track |
stdClass | $course | the course object |
int[] | $ids | the list of affected course module ids |
int | $targetsectionid | optional target section id |
int | $targetcmid | optional target cm id |
core_courseformat\stateactions::cm_stealth | ( | stateupdates | $updates, |
stdClass | $course, | ||
array | $ids = [], | ||
?int | $targetsectionid = null, | ||
?int | $targetcmid = null ) |
Stealth course cms.
stateupdates | $updates | the affected course elements track |
stdClass | $course | the course object |
int[] | $ids | cm ids |
int | $targetsectionid | not used |
int | $targetcmid | not used |
core_courseformat\stateactions::cm_visiblegroups | ( | stateupdates | $updates, |
stdClass | $course, | ||
array | $ids = [], | ||
?int | $targetsectionid = null, | ||
?int | $targetcmid = null ) |
Set VISIBLEGROUPS const value to cms groupmode.
stateupdates | $updates | the affected course elements track |
stdClass | $course | the course object |
int[] | $ids | cm ids |
int | $targetsectionid | not used |
int | $targetcmid | not used |
core_courseformat\stateactions::course_state | ( | stateupdates | $updates, |
stdClass | $course, | ||
array | $ids = [], | ||
?int | $targetsectionid = null, | ||
?int | $targetcmid = null ) |
Add all the update messages from the complete course state.
This action is mainly used by legacy actions to partially update the course state when the result of core_course_edit_module is not enough to generate the correct state data.
stateupdates | $updates | the affected course elements track |
stdClass | $course | the course object |
int[] | $ids | the list of affected course module ids (not used) |
int | $targetsectionid | optional target section id (not used) |
int | $targetcmid | optional target cm id (not used) |
|
protected |
Extract several cm_info from the course_modinfo.
course_modinfo | $modinfo | the course modinfo. |
int[] | $ids | the course modules $ids |
cm_info[] | the extracted cm_info objects |
|
protected |
Extract several section_info from the course_modinfo.
course_modinfo | $modinfo | the course modinfo. |
int[] | $ids | the course modules $ids |
section_info[] | the extracted section_info objects |
core_courseformat\stateactions::section_add | ( | stateupdates | $updates, |
stdClass | $course, | ||
array | $ids = [], | ||
?int | $targetsectionid = null, | ||
?int | $targetcmid = null ) |
Create a course section.
This method follows the same logic as changenumsections.php.
stateupdates | $updates | the affected course elements track |
stdClass | $course | the course object |
int[] | $ids | not used |
int | $targetsectionid | optional target section id (if not passed section will be appended) |
int | $targetcmid | not used |
core_courseformat\stateactions::section_content_collapsed | ( | stateupdates | $updates, |
stdClass | $course, | ||
array | $ids = [], | ||
?int | $targetsectionid = null, | ||
?int | $targetcmid = null ) |
Update the course content section state to collapse.
stateupdates | $updates | the affected course elements track |
stdClass | $course | the course object |
int[] | $ids | the collapsed section ids |
int | $targetsectionid | not used |
int | $targetcmid | not used |
core_courseformat\stateactions::section_content_expanded | ( | stateupdates | $updates, |
stdClass | $course, | ||
array | $ids = [], | ||
?int | $targetsectionid = null, | ||
?int | $targetcmid = null ) |
Update the course content section state to expand.
stateupdates | $updates | the affected course elements track |
stdClass | $course | the course object |
int[] | $ids | the collapsed section ids |
int | null | $targetsectionid | not used |
int | null | $targetcmid | not used |
core_courseformat\stateactions::section_delete | ( | stateupdates | $updates, |
stdClass | $course, | ||
array | $ids = [], | ||
?int | $targetsectionid = null, | ||
?int | $targetcmid = null ) |
Delete course sections.
This method follows the same logic as editsection.php.
stateupdates | $updates | the affected course elements track |
stdClass | $course | the course object |
int[] | $ids | section ids |
int | $targetsectionid | not used |
int | $targetcmid | not used |
core_courseformat\stateactions::section_hide | ( | stateupdates | $updates, |
stdClass | $course, | ||
array | $ids = [], | ||
?int | $targetsectionid = null, | ||
?int | $targetcmid = null ) |
Hide course sections.
stateupdates | $updates | the affected course elements track |
stdClass | $course | the course object |
int[] | $ids | section ids |
int | $targetsectionid | not used |
int | $targetcmid | not used |
core_courseformat\stateactions::section_index_collapsed | ( | stateupdates | $updates, |
stdClass | $course, | ||
array | $ids = [], | ||
?int | $targetsectionid = null, | ||
?int | $targetcmid = null ) |
Update the course index section state to collapse.
stateupdates | $updates | the affected course elements track |
stdClass | $course | the course object |
int[] | $ids | the collapsed section ids |
int | $targetsectionid | not used |
int | $targetcmid | not used |
core_courseformat\stateactions::section_index_expanded | ( | stateupdates | $updates, |
stdClass | $course, | ||
array | $ids = [], | ||
?int | $targetsectionid = null, | ||
?int | $targetcmid = null ) |
Update the course index section state to expand.
stateupdates | $updates | the affected course elements track |
stdClass | $course | the course object |
int[] | $ids | the collapsed section ids |
int | null | $targetsectionid | not used |
int | null | $targetcmid | not used |
core_courseformat\stateactions::section_move | ( | stateupdates | $updates, |
stdClass | $course, | ||
array | $ids, | ||
?int | $targetsectionid = null, | ||
?int | $targetcmid = null ) |
Move course sections to another location in the same course.
stateupdates | $updates | the affected course elements track |
stdClass | $course | the course object |
int[] | $ids | the list of affected course module ids |
int | $targetsectionid | optional target section id |
int | $targetcmid | optional target cm id |
core_courseformat\stateactions::section_move_after | ( | stateupdates | $updates, |
stdClass | $course, | ||
array | $ids, | ||
?int | $targetsectionid = null, | ||
?int | $targetcmid = null ) |
Move course sections after to another location in the same course.
stateupdates | $updates | the affected course elements track |
stdClass | $course | the course object |
int[] | $ids | the list of affected course module ids |
int | $targetsectionid | optional target section id |
int | $targetcmid | optional target cm id |
core_courseformat\stateactions::section_show | ( | stateupdates | $updates, |
stdClass | $course, | ||
array | $ids = [], | ||
?int | $targetsectionid = null, | ||
?int | $targetcmid = null ) |
Show course sections.
stateupdates | $updates | the affected course elements track |
stdClass | $course | the course object |
int[] | $ids | section ids |
int | $targetsectionid | not used |
int | $targetcmid | not used |
core_courseformat\stateactions::section_state | ( | stateupdates | $updates, |
stdClass | $course, | ||
array | $ids, | ||
?int | $targetsectionid = null, | ||
?int | $targetcmid = null ) |
Add the update messages of the updated version of any cm and section related to the section ids.
This action is mainly used by legacy actions to partially update the course state when the result of core_course_edit_module is not enough to generate the correct state data.
stateupdates | $updates | the affected course elements track |
stdClass | $course | the course object |
int[] | $ids | the list of affected course section ids |
int | $targetsectionid | optional target section id |
int | $targetcmid | optional target cm id |
|
protected |
Internal method to define the cm groupmode value.
stateupdates | $updates | the affected course elements track |
stdClass | $course | the course object |
int[] | $ids | cm ids |
int | $groupmode | new value for groupmode: NOGROUPS, SEPARATEGROUPS, VISIBLEGROUPS |
|
protected |
Internal method to define the cm indentation level.
stateupdates | $updates | the affected course elements track |
stdClass | $course | the course object |
int[] | $ids | cm ids |
int | $indent | new value for indentation |
|
protected |
Internal method to define the cm visibility.
stateupdates | $updates | the affected course elements track |
stdClass | $course | the course object |
int[] | $ids | cm ids |
int | $visible | the new visible value |
int | $coursevisible | the new course visible value |
|
protected |
Show course sections.
stateupdates | $updates | the affected course elements track |
stdClass | $course | the course object |
int[] | $ids | section ids |
int | $visible | the new visible value |
|
protected |
Sort the cm ids list depending on the course position.
Some actions like move should be done in an specific order.
stdClass | $course | the course object |
int[] | $cmids | the array of section $ids |
bool | $descending | if the sort order must be descending instead of ascending |
int[] | the array of section ids sorted by section number |
|
protected |
Sort the sections ids depending on the section number.
Some actions like move should be done in an specific order.
stdClass | $course | the course object |
int[] | $sectionids | the array of section $ids |
bool | $descending | if the sort order must be descending instead of ascending |
int[] | the array of section ids sorted by section number |
|
protected |
Checks related to course modules: all given cm exist and the user has the required capabilities.
stdClass | $course | The course where given $cmids belong. |
array | $cmids | List of course module ids to validate. |
string | $info | additional information in case of error. |
array | $capabilities | optional capabilities checks per each cm context. |
moodle_exception | if any id is not valid |
|
protected |
Checks related to sections: course format support them, all given sections exist and topic 0 is not included.
stdClass | $course | The course where given $sectionids belong. |
array | $sectionids | List of sections to validate. |
string | null | $info | additional information in case of error (default null). |
moodle_exception | if any id is not valid |