Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.3.x will end 7 October 2024 (12 months).
  • Bug fixes for security issues in 4.3.x will end 21 April 2025 (18 months).
  • PHP version: minimum PHP 8.0.0 Note: minimum PHP version has increased since Moodle 4.1. PHP 8.2.x is supported too.

Statement agent (user) object for xAPI structure checking and usage.

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

Defines 1 class

item_agent:: (5 methods):
  __construct()
  create_from_data()
  create_from_user()
  get_user()
  get_all_users()


Class: item_agent  - X-Ref

Agent xAPI statement element representing a Moodle user.

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

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

param: stdClass $data the original xAPI element
param: stdClass $user user record

create_from_data(stdClass $data)   X-Ref
Function to create an item from part of the xAPI statement.

param: stdClass $data the original xAPI element
return: item item_agentxAPI generated

create_from_user(stdClass $user)   X-Ref
Create a item_agent from a existing user.

param: stdClass $user A user record.
return: item_agent

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

return: stdClass user record

get_all_users()   X-Ref
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: array list of users