|
item_activity | $activity = null |
| The state activity owner (the plugin instance).
|
|
item_agent | $agent = null |
| The state agent (user).
|
|
string null | $registration = null |
| The state registration.
|
|
stdClass null | $statedata = null |
| The state data.
|
|
string | $stateid = null |
| The state identifier.
|
|
◆ __construct()
core_xapi\local\state::__construct |
( |
item_agent | $agent, |
|
|
item_activity | $activity, |
|
|
string | $stateid, |
|
|
?stdClass | $statedata, |
|
|
?string | $registration ) |
State constructor.
- Parameters
-
item_agent | $agent | The state agent (user) |
item_activity | $activity | The state activity owner |
string | $stateid | The state identifier |
stdClass | null | $statedata | The state data |
string | null | $registration | The state registration |
◆ get_activity()
core_xapi\local\state::get_activity |
( |
| ) |
|
Return the state object if it is defined.
- Return values
-
◆ get_activity_id()
core_xapi\local\state::get_activity_id |
( |
| ) |
|
Returns the state activity ID.
- Return values
-
◆ get_agent()
core_xapi\local\state::get_agent |
( |
| ) |
|
Return the state agent.
- Return values
-
◆ get_record_data()
core_xapi\local\state::get_record_data |
( |
| ) |
|
Return the record data of this state.
- Return values
-
stdClass | the record data structure |
◆ get_registration()
core_xapi\local\state::get_registration |
( |
| ) |
|
Returns the state registration if any.
- Return values
-
string|null | state registration |
◆ get_state_data()
core_xapi\local\state::get_state_data |
( |
| ) |
|
Returns the state data.
For getting the JSON representation of this state data, use jsonSerialize().
- Return values
-
stdClass|null | The state data object. |
◆ get_state_id()
core_xapi\local\state::get_state_id |
( |
| ) |
|
Returns the state id.
- Return values
-
◆ get_user()
core_xapi\local\state::get_user |
( |
| ) |
|
Returns the moodle user represented by this state agent.
- Return values
-
◆ jsonSerialize()
core_xapi\local\state::jsonSerialize |
( |
| ) |
|
Return the data to serialize in case JSON state when needed.
- Return values
-
stdClass | The state data structure. If statedata is null, this method will return an empty class. |
◆ minify()
core_xapi\local\state::minify |
( |
| ) |
|
Returns a minified version of a given state.
The returned structure is suitable to store in the "other" field of logstore. xAPI standard specifies a list of attributes that can be calculated instead of stored literally. This function get rid of these attributes.
Note: it also converts stdClass to assoc array to make it compatible with "other" field in the logstore
- Return values
-
array | the minimal state needed to be stored a part from logstore data |
◆ set_state_data()
core_xapi\local\state::set_state_data |
( |
?stdClass | $statedata | ) |
|
Set the state data.
- Parameters
-
stdClass | null | $statedata | the state data |
The documentation for this class was generated from the following file:
- lib/xapi/classes/local/state.php