Moodle APIs 3.9
Moodle 3.9.13+ (Build: 20220325)
Public Member Functions | Static Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
core_xapi\local\statement\item_activity Class Reference

Class that implements a xAPI activity compatible with xAPI object. More...

Inheritance diagram for core_xapi\local\statement\item_activity:
core_xapi\local\statement\item_object core_xapi\local\statement\item

Public Member Functions

 get_data ()
 Return the original data from this item. More...
 
 get_definition ()
 Returns the item_definition of this item. More...
 
 get_id ()
 Return the activity ID. More...
 
 jsonSerialize ()
 Return the data to serialize in case JSON statement is needed. More...
 

Static Public Member Functions

static create_from_data (stdClass $data)
 Function to create an item from part of the xAPI statement. More...
 
static create_from_id (string $id, item_definition $definition=null)
 Generate a valid item_activity from a simple ID string and an optional definition. More...
 

Protected Member Functions

 __construct (stdClass $data, item_definition $definition=null)
 Item activity constructor. More...
 

Protected Attributes

stdClass $data
 the item structure.
 
item_definition $definition
 Definition object.
 
string $id
 Activity ID.
 

Detailed Description

Class that implements a xAPI activity compatible with xAPI object.

License
http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later

Constructor & Destructor Documentation

◆ __construct()

core_xapi\local\statement\item_activity::__construct ( stdClass  $data,
item_definition  $definition = null 
)
protected

Item activity constructor.

An xAPI activity is mainly an IRI ID and an optional definition.

Parameters
stdClass$datafrom the specific xAPI element
item_definition$definitionoption definition item

Member Function Documentation

◆ create_from_data()

static core_xapi\local\statement\item_activity::create_from_data ( stdClass  $data)
static

Function to create an item from part of the xAPI statement.

Parameters
stdClass$datathe original xAPI element
Return values
itemitem_activity xAPI generated

Reimplemented from core_xapi\local\statement\item_object.

◆ create_from_id()

static core_xapi\local\statement\item_activity::create_from_id ( string  $id,
item_definition  $definition = null 
)
static

Generate a valid item_activity from a simple ID string and an optional definition.

Parameters
string$idany string that will converted into a valid IRI
item_definition | null$definitionoptional item_definition
Return values
item_activity

◆ get_data()

core_xapi\local\statement\item::get_data ( )
inherited

Return the original data from this item.

Return values
stdClassthe original data structure

◆ get_definition()

core_xapi\local\statement\item_activity::get_definition ( )

Returns the item_definition of this item.

Return values
item_definition|nullthe item definition if available

◆ get_id()

core_xapi\local\statement\item_activity::get_id ( )

Return the activity ID.

If the ID was generated by iri::generate this function will return the iri:extract value.

Return values
stringthe activity ID

◆ jsonSerialize()

core_xapi\local\statement\item::jsonSerialize ( )
inherited

Return the data to serialize in case JSON statement is needed.

Return values
stdClassthe original data structure

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