Search moodle.org's
Developer Documentation

See Release Notes
Long Term Support Release

  • Bug fixes for general core bugs in 4.1.x will end 13 November 2023 (12 months).
  • Bug fixes for security issues in 4.1.x will end 10 November 2025 (36 months).
  • PHP version: minimum PHP 7.4.0 Note: minimum PHP version has increased since Moodle 4.0. PHP 8.0.x is supported too.

Differences Between: [Versions 401 and 402] [Versions 401 and 403]

Statement base object for xAPI structure checking and validation.

Copyright: 2020 Ferran Recio
License: http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
File Size: 440 lines (12 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

statement:: (28 methods):
  create_from_data()
  jsonSerialize()
  minify()
  set_actor()
  set_verb()
  set_object()
  set_context()
  set_result()
  set_timestamp()
  set_stored()
  set_authority()
  set_version()
  add_attachment()
  get_user()
  get_all_users()
  get_group()
  get_verb_id()
  get_activity_id()
  get_actor()
  get_verb()
  get_object()
  get_context()
  get_result()
  get_timestamp()
  get_stored()
  get_authority()
  get_version()
  get_attachments()


Class: statement  - X-Ref

Privacy Subsystem for core_xapi implementing null_provider.

create_from_data(stdClass $data)   X-Ref
Function to create a full statement from xAPI statement data.

param: stdClass $data the original xAPI statement
return: statement statement object

jsonSerialize()   X-Ref
Return the data to serialize in case JSON statement is needed.

return: stdClass the statement data structure

minify()   X-Ref
Returns a minified version of a given statement.

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: array the minimal statement needed to be stored a part from logstore data

set_actor(item_actor $actor)   X-Ref
Set the statement actor.

param: item_actor $actor actor item

set_verb(item_verb $verb)   X-Ref
Set the statement verb.

param: item_verb $verb verb element

set_object(item_object $object)   X-Ref
Set the statement object.

param: item_object $object compatible object item

set_context(item_context $context)   X-Ref
Set the statement context.

param: item_context $context context item element

set_result(item_result $result)   X-Ref
Set the statement result.

param: item_result $result result item element

set_timestamp(string $timestamp)   X-Ref
Set the statement timestamp.

param: string $timestamp timestamp element

set_stored(string $stored)   X-Ref
Set the statement stored.

param: string $stored stored element

set_authority(item_actor $authority)   X-Ref
Set the statement authority.

param: item $authority authority item element

set_version(string $version)   X-Ref
Set the statement version.

param: string $version version element

add_attachment(item_attachment $attachment)   X-Ref
Adds and attachment to the statement.

param: item $attachments attachments item element

get_user()   X-Ref
Returns the moodle user represented by this statement actor.

return: stdClass user record

get_all_users()   X-Ref
Return all moodle users represented by this statement actor.

return: array user records

get_group()   X-Ref
Return the moodle group represented by this statement actor.

return: stdClass a group record

get_verb_id()   X-Ref
Returns the statement verb ID.

return: string verb ID

get_activity_id()   X-Ref
Returns the statement activity ID.

return: string activity ID

get_actor()   X-Ref
Return the statement actor if it is defined.

return: item_actor|null

get_verb()   X-Ref
Return the statement verb if it is defined.

return: item_verb|null

get_object()   X-Ref
Return the statement object if it is defined.

return: item_object|null

get_context()   X-Ref
Return the statement context if it is defined.

return: item|null

get_result()   X-Ref
Return the statement result if it is defined.

return: item|null

get_timestamp()   X-Ref
Return the statement timestamp if it is defined.

return: string|null

get_stored()   X-Ref
Return the statement stored if it is defined.

return: string|null

get_authority()   X-Ref
Return the statement authority if it is defined.

return: item|null

get_version()   X-Ref
Return the statement version if it is defined.

return: string|null

get_attachments()   X-Ref
Return the statement attachments if it is defined.

return: item_attachment[]|null