Moodle PHP Documentation 4.3
Moodle 4.3.5 (Build: 20240610) (7dcfaa79f78)
core\moodlenet\resource_sender Class Reference
Inheritance diagram for core\moodlenet\resource_sender:
core\moodlenet\activity_sender core\moodlenet\course_sender core\moodlenet\course_partial_sender

Public Member Functions

 __construct (int $resourceid, protected int $userid, protected moodlenet_client $moodlenetclient, protected client $oauthclient, protected int $shareformat=self::SHARE_FORMAT_BACKUP,)
 Class constructor.
 
 share_resource ()
 Share a resource to MoodleNet.
 

Public Attributes

int const MAX_FILESIZE = 1070000000
 Maximum upload file size (1.07 GB).
 
int const SHARE_FORMAT_BACKUP = 0
 Backup share format - the content is being shared as a Moodle backup file.
 

Protected Member Functions

 prepare_share_contents ()
 Prepare the data for sharing, in the format specified.
 

Static Protected Member Functions

static get_allowed_share_formats ()
 Return the list of supported share formats.
 

Protected Attributes

stdClass stdClass $course
 The course where the activity is located.
 
resource_packager resource_packager $packager
 Resource packager.
 

Constructor & Destructor Documentation

◆ __construct()

core\moodlenet\resource_sender::__construct ( int $resourceid,
protected int $userid,
protected moodlenet_client $moodlenetclient,
protected client $oauthclient,
protected int $shareformat = self::SHARE_FORMAT_BACKUP )

Class constructor.

Parameters
int$resourceidThe resource ID of the resource being shared.
int$useridThe user ID who is sharing the activity.
moodlenet_client$moodlenetclientThe moodlenet_client object used to perform the share.
client$oauthclientThe OAuth 2 client for the MoodleNet instance.
int$shareformatThe data format to share in. Defaults to a Moodle backup (SHARE_FORMAT_BACKUP).
Exceptions
moodle_exception

Reimplemented in core\moodlenet\activity_sender, and core\moodlenet\course_sender.

Member Function Documentation

◆ get_allowed_share_formats()

static core\moodlenet\resource_sender::get_allowed_share_formats ( )
staticprotected

Return the list of supported share formats.

Return values
arrayArray of supported share format values.

Reimplemented in core\moodlenet\course_sender.

◆ prepare_share_contents()

core\moodlenet\resource_sender::prepare_share_contents ( )
protected

Prepare the data for sharing, in the format specified.

Return values
stored_file

◆ share_resource()

core\moodlenet\resource_sender::share_resource ( )
abstract

Share a resource to MoodleNet.

Return values
arrayThe HTTP response code from MoodleNet and the MoodleNet draft resource URL (URL empty string on fail). Format: ['responsecode' => 201, 'drafturl' => 'https://draft.mnurl/here']

Reimplemented in core\moodlenet\activity_sender, and core\moodlenet\course_sender.


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