Moodle APIs 4.3
Moodle 4.3.6 (Build: 20240812)
core_courseformat\stateupdates Class Reference

Class to track state actions. More...

Inheritance diagram for core_courseformat\stateupdates:

Public Member Functions

 __construct (course_format $format)
 State update class constructor.
 
 add_cm_create (int $cmid)
 Add track about a course module created.
 
 add_cm_delete (int $cmid)
 Add track about a course module deleted.
 
 add_cm_put (int $cmid)
 Add track about a course module state update.
 
 add_cm_remove (int $cmid)
 Add track about a course module removed.
 
 add_course_put ()
 Add track about a general course state change.
 
 add_section_create (int $sectionid)
 Add track about a new section created.
 
 add_section_delete (int $sectionid)
 Add track about a section deleted.
 
 add_section_put (int $sectionid)
 Add track about a section state put.
 
 add_section_remove (int $sectionid)
 Add track about a section removed.
 
 jsonSerialize ()
 Return the data to serialize the current track in JSON.
 

Protected Member Functions

 add_update (string $name, string $action, stdClass $fields)
 Add a valid update message to the update list.
 
 create_or_put_cm (int $cmid, string $action)
 Add track about section created or put.
 
 create_or_put_section (int $sectionid, string $action)
 Add track about section created or put.
 

Protected Attributes

course_format $format
 format the course format
 
renderer_base $output
 renderer format renderer
 
array $updates
 the tracked updates
 

Detailed Description

Class to track state actions.

The methods from this class should be executed via "stateactions" methods.

Each format plugin could extend this class to provide new updates to the frontend mutation module. Extended classes should be located in "format_XXX::course" namespace and extends {

See also
core_courseformat\stateupdates}.
License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Constructor & Destructor Documentation

◆ __construct()

core_courseformat\stateupdates::__construct ( course_format $format)

State update class constructor.

Parameters
course_format$formatCourse format.

Member Function Documentation

◆ add_cm_create()

core_courseformat\stateupdates::add_cm_create ( int $cmid)

Add track about a course module created.

Parameters
int$cmidthe affected course module id

◆ add_cm_delete()

core_courseformat\stateupdates::add_cm_delete ( int $cmid)

Add track about a course module deleted.

Deprecated
since Moodle 4.1 MDL-74925 - please call add_cm_remove() instead.
Parameters
int$cmidthe affected course module id

◆ add_cm_put()

core_courseformat\stateupdates::add_cm_put ( int $cmid)

Add track about a course module state update.

Parameters
int$cmidthe affected course module id

◆ add_cm_remove()

core_courseformat\stateupdates::add_cm_remove ( int $cmid)

Add track about a course module removed.

Parameters
int$cmidthe affected course module id

◆ add_section_create()

core_courseformat\stateupdates::add_section_create ( int $sectionid)

Add track about a new section created.

Parameters
int$sectionidThe affected section id.

◆ add_section_delete()

core_courseformat\stateupdates::add_section_delete ( int $sectionid)

Add track about a section deleted.

Deprecated
since Moodle 4.1 MDL-74925 - please call add_section_remove() instead.
Parameters
int$sectionidThe affected section id.

◆ add_section_put()

core_courseformat\stateupdates::add_section_put ( int $sectionid)

Add track about a section state put.

Parameters
int$sectionidThe affected section id.

◆ add_section_remove()

core_courseformat\stateupdates::add_section_remove ( int $sectionid)

Add track about a section removed.

Parameters
int$sectionidThe affected section id.

◆ add_update()

core_courseformat\stateupdates::add_update ( string $name,
string $action,
stdClass $fields )
protected

Add a valid update message to the update list.

Parameters
string$namethe update name
string$actionthe update action (usually update, create, remove)
stdClass$fieldsthe object fields

◆ create_or_put_cm()

core_courseformat\stateupdates::create_or_put_cm ( int $cmid,
string $action )
protected

Add track about section created or put.

Parameters
int$cmidThe affected course module id.
string$actionThe action to track for the section ('create' or 'put').

◆ create_or_put_section()

core_courseformat\stateupdates::create_or_put_section ( int $sectionid,
string $action )
protected

Add track about section created or put.

Parameters
int$sectionidThe affected section id.
string$actionThe action to track for the section ('create' or 'put').

◆ jsonSerialize()

core_courseformat\stateupdates::jsonSerialize ( )

Return the data to serialize the current track in JSON.

Return values
stdClassthe statement data structure

The documentation for this class was generated from the following file: