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.

Differences Between: [Versions 402 and 403]

(no description)

File Size: 189 lines (7 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

activity_sender:: (5 methods):
  __construct()
  share_activity()
  share_resource()
  log_event()
  get_resource_description()


Class: activity_sender  - X-Ref

API for sharing Moodle LMS activities to MoodleNet instances.

__construct(int $cmid,protected int $userid,protected moodlenet_client $moodlenetclient,protected client $oauthclient,protected int $shareformat = self::SHARE_FORMAT_BACKUP,)   X-Ref
Class constructor.

param: int $cmid The course module ID of the activity being shared
param: int $userid The user ID who is sharing the activity
param: moodlenet_client $moodlenetclient The moodlenet_client object used to perform the share
param: client $oauthclient The OAuth 2 client for the MoodleNet instance
param: int $shareformat The data format to share in. Defaults to a Moodle backup (SHARE_FORMAT_BACKUP)

share_activity()   X-Ref
Share an activity/resource to MoodleNet.

return: array The HTTP response code from MoodleNet and the MoodleNet draft resource URL (URL empty string on fail).

share_resource()   X-Ref
Share an activity/resource to MoodleNet.

return: array The HTTP response code from MoodleNet and the MoodleNet draft resource URL (URL empty string on fail).

log_event(\core\context $coursecontext,int $cmid,string $resourceurl,int $responsecode,)   X-Ref
Log an event to the admin logs for an outbound share attempt.

param: \context $coursecontext The course context being shared from.
param: int $cmid The CMID of the activity being shared.
param: string $resourceurl The URL of the draft resource if it was created.
param: int $responsecode The HTTP response code describing the outcome of the attempt.
return: void

get_resource_description(\context $coursecontext,)   X-Ref
Fetch the description for the resource being created, in a supported text format.

param: \context $coursecontext The course context being shared from.
return: string Converted activity description.