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_agent Class Reference

Agent xAPI statement element representing a Moodle user. More...

Inheritance diagram for core_xapi\local\statement\item_agent:
core_xapi\local\statement\item_actor core_xapi\local\statement\item_object core_xapi\local\statement\item

Public Member Functions

 get_all_users ()
 Return all users represented by this item. More...
 
 get_data ()
 Return the original data from this item. More...
 
 get_user ()
 Returns the moodle user represented by this item. 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_user (stdClass $user)
 Create a item_agent from a existing user. More...
 

Protected Member Functions

 __construct (stdClass $data, stdClass $user)
 Function to create an agent (user) from part of the xAPI statement. More...
 

Protected Attributes

stdClass $data
 the item structure.
 
stdClass $user
 The user record of this actor.
 

Detailed Description

Agent xAPI statement element representing a Moodle user.

Agents can be used either as actor or object in a statement.

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

Constructor & Destructor Documentation

◆ __construct()

core_xapi\local\statement\item_agent::__construct ( stdClass  $data,
stdClass  $user 
)
protected

Function to create an agent (user) from part of the xAPI statement.

Parameters
stdClass$datathe original xAPI element
stdClass$useruser record

Member Function Documentation

◆ create_from_data()

static core_xapi\local\statement\item_agent::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_agentxAPI generated

Reimplemented from core_xapi\local\statement\item_actor.

◆ create_from_user()

static core_xapi\local\statement\item_agent::create_from_user ( stdClass  $user)
static

Create a item_agent from a existing user.

Parameters
stdClass$userA user record.
Return values
item_agent

◆ get_all_users()

core_xapi\local\statement\item_agent::get_all_users ( )

Return all users represented by this item.

In this case the item is an agent so a single element array will be returned always.

Return values
arraylist of users

Reimplemented from core_xapi\local\statement\item_actor.

◆ get_data()

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

Return the original data from this item.

Return values
stdClassthe original data structure

◆ get_user()

core_xapi\local\statement\item_agent::get_user ( )

Returns the moodle user represented by this item.

Return values
stdClassuser record

Reimplemented from core_xapi\local\statement\item_actor.

◆ 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: