|
| | __construct (int $cmid, protected int $userid, protected moodlenet_client $moodlenetclient, protected client $oauthclient, protected int $shareformat=self::SHARE_FORMAT_BACKUP,) |
| | Class constructor.
|
| |
| | share_activity () |
| | Share an activity/resource to MoodleNet.
|
| |
|
|
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.
|
| |
|
|
cm_info cm_info | $cminfo |
| | The context module info object for the activity being shared.
|
| |
|
stdClass stdClass | $course |
| | The course where the activity is located.
|
| |
◆ __construct()
| core\moodlenet\activity_sender::__construct |
( |
int |
$cmid, |
|
|
protected int |
$userid, |
|
|
protected moodlenet_client |
$moodlenetclient, |
|
|
protected client |
$oauthclient, |
|
|
protected int |
$shareformat = self::SHARE_FORMAT_BACKUP |
|
) |
| |
Class constructor.
- Parameters
-
| int | $cmid | The course module ID of the activity being shared. |
| int | $userid | The user ID who is sharing the activity. |
| moodlenet_client | $moodlenetclient | The moodlenet_client object used to perform the share. |
| client | $oauthclient | The OAuth 2 client for the MoodleNet instance. |
| int | $shareformat | The data format to share in. Defaults to a Moodle backup (SHARE_FORMAT_BACKUP). |
- Exceptions
-
◆ get_allowed_share_formats()
| core\moodlenet\activity_sender::get_allowed_share_formats |
( |
| ) |
|
|
protected |
Return the list of supported share formats.
- Return values
-
| array | Array of supported share format values. |
◆ get_resource_description()
| core\moodlenet\activity_sender::get_resource_description |
( |
context |
$coursecontext | ) |
|
|
protected |
Fetch the description for the resource being created, in a supported text format.
- Parameters
-
| context | $coursecontext | The course context being shared from. |
- Return values
-
| string | Converted activity description. |
◆ log_event()
| core\moodlenet\activity_sender::log_event |
( |
core\context |
$coursecontext, |
|
|
int |
$cmid, |
|
|
string |
$resourceurl, |
|
|
int |
$responsecode |
|
) |
| |
|
protected |
Log an event to the admin logs for an outbound share attempt.
- Parameters
-
| context | $coursecontext | The course context being shared from. |
| int | $cmid | The CMID of the activity being shared. |
| string | $resourceurl | The URL of the draft resource if it was created. |
| int | $responsecode | The HTTP response code describing the outcome of the attempt. |
- Return values
-
◆ prepare_share_contents()
| core\moodlenet\activity_sender::prepare_share_contents |
( |
| ) |
|
|
protected |
Prepare the data for sharing, in the format specified.
- Return values
-
◆ share_activity()
| core\moodlenet\activity_sender::share_activity |
( |
| ) |
|
Share an activity/resource to MoodleNet.
- Return values
-
| array | The HTTP response code from MoodleNet and the MoodleNet draft resource URL (URL empty string on fail). Format: ['responsecode' => 201, 'drafturl' => 'https://draft.mnurl/here'] |
- Exceptions
-
The documentation for this class was generated from the following file: