Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 4.0.x will end 8 May 2023 (12 months).
  • Bug fixes for security issues in 4.0.x will end 13 November 2023 (18 months).
  • PHP version: minimum PHP 7.3.0 Note: the minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is also supported.

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.

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

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

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

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