|
Moodle APIs 3.11
Moodle 3.11.11+ (Build: 20221125)
|
Task for synchronising members using the enrolment LTI. More...
Public Member Functions | |
| eval_cron_field ($field, $min, $max) | |
| Take a cron field definition and return an array of valid numbers with the range min-max. More... | |
| execute () | |
| Performs the synchronisation of members. More... | |
| get_component () | |
| Getter for $component. More... | |
| get_cron_lock () | |
| Get the current lock for the entire cron. More... | |
| get_day () | |
| Getter for $day. More... | |
| get_day_of_week () | |
| Getter for $dayofweek. More... | |
| get_disabled () | |
| Getter for $disabled. More... | |
| get_fail_delay () | |
| Getter for $faildelay. More... | |
| get_hostname () | |
| Getter for $hostname. More... | |
| get_hour () | |
| Getter for $hour. More... | |
| get_last_run_time () | |
| Get the last run time for this scheduled task. More... | |
| get_lock () | |
| Get the current lock for this task. More... | |
| get_minute () | |
| Getter for $minute. More... | |
| get_month () | |
| Getter for $month. More... | |
| get_name () | |
| Get a descriptive name for this task. More... | |
| get_next_run_time () | |
| Get the next run time for this task. More... | |
| get_next_scheduled_time () | |
| Calculate when this task should next be run based on the schedule. More... | |
| get_pid () | |
| Getter for $pid. More... | |
| get_run_if_component_disabled () | |
| Override this function if you want this scheduled task to run, even if the component is disabled. More... | |
| get_timestarted () | |
| Getter for $timestarted. More... | |
| is_blocking () | |
| Getter for $blocking. More... | |
| is_customised () | |
| Has this task been changed from it's default config? More... | |
| is_overridden () | |
| Has this task been changed from it's default config? More... | |
| set_blocking ($blocking) | |
| Setter for $blocking. More... | |
| set_component ($component) | |
| Setter for $component. More... | |
| set_cron_lock (\core\lock\lock $lock) | |
| Set the current lock for the entire cron process. More... | |
| set_customised ($customised) | |
| Has this task been changed from it's default config? More... | |
| set_day ($day) | |
| Setter for $day. More... | |
| set_day_of_week ($dayofweek, $expandr=true) | |
| Setter for $dayofweek. More... | |
| set_disabled ($disabled) | |
| Setter for $disabled. More... | |
| set_fail_delay ($faildelay) | |
| Setter for $faildelay. More... | |
| set_hostname ($hostname=null) | |
| Setter for $hostname. More... | |
| set_hour ($hour, $expandr=true) | |
| Setter for $hour. More... | |
| set_last_run_time ($lastruntime) | |
| Set the last run time for this scheduled task. More... | |
| set_lock (\core\lock\lock $lock) | |
| Set the current lock for this task. More... | |
| set_minute ($minute, $expandr=true) | |
| Setter for $minute. More... | |
| set_month ($month) | |
| Setter for $month. More... | |
| set_next_run_time ($nextruntime) | |
| Set the next run time for this task. More... | |
| set_overridden (bool $overridden) | |
| Set the overridden value. More... | |
| set_pid ($pid=null) | |
| Setter for $pid. More... | |
| set_timestarted ($timestarted=null) | |
| Setter for $timestarted. More... | |
Protected Member Functions | |
| do_context_membership_request (Context $context, ResourceLink $resourcelink=null, $membershipsurltemplate='') | |
| Performs membership service request using an LTI Context object. More... | |
| do_resourcelink_membership_request (ResourceLink $resourcelink) | |
| Performs membership service request using ResourceLink::doMembershipsService() method. More... | |
| fetch_members_from_consumer (ToolConsumer $consumer) | |
| Fetches the members that belong to a ToolConsumer. More... | |
| should_sync_enrol ($syncmode) | |
| Method to determine whether to sync enrolments or not. More... | |
| should_sync_unenrol ($syncmode) | |
| Method to determine whether to sync unenrolments or not. More... | |
| sync_member_information (stdClass $tool, ToolConsumer $consumer, $members) | |
| Performs synchronisation of member information and enrolments. More... | |
| sync_profile_images () | |
| Performs synchronisation of user profile images. | |
| sync_unenrol (stdClass $tool, string $consumerkey, array $currentusers) | |
| Performs unenrolment of users that are no longer enrolled in the consumer side. More... | |
Protected Attributes | |
| data_connector | $dataconnector |
| $dataconnector A data_connector instance. | |
| array | $userphotos = [] |
| Array of user photos. | |
Task for synchronising members using the enrolment LTI.
|
protected |
Performs membership service request using an LTI Context object.
If the context has a 'custom_context_memberships_url' setting, we use this to perform the membership service request. Otherwise, if a context is associated with resource link, we try first to get the members using the ResourceLink::doMembershipsService() method. If we're still unable to fetch members from the resource link, we try to build a memberships URL from the memberships URL endpoint template that is defined in the ToolConsumer profile and substitute the parameters accordingly.
| Context | $context | The context object. |
| ResourceLink | $resourcelink | The resource link object. |
| string | $membershipsurltemplate | The memberships endpoint URL template. |
| bool|User[] | Array of User objects upon successful membership service request. False, otherwise. |
|
protected |
Performs membership service request using ResourceLink::doMembershipsService() method.
| ResourceLink | $resourcelink |
| bool|User[] | Array of User objects upon successful membership service request. False, otherwise. |
|
inherited |
Take a cron field definition and return an array of valid numbers with the range min-max.
| string | $field | - The field definition. |
| int | $min | - The minimum allowable value. |
| int | $max | - The maximum allowable value. |
| array(int) |
| enrol_lti\task\sync_members::execute | ( | ) |
Performs the synchronisation of members.
Reimplemented from core\task\task_base.
|
protected |
Fetches the members that belong to a ToolConsumer.
| ToolConsumer | $consumer |
| bool|User[] |
|
inherited |
Getter for $component.
| string |
|
inherited |
Get the current lock for the entire cron.
| core::lock::lock |
|
inherited |
Getter for $day.
| string |
|
inherited |
Getter for $dayofweek.
| string |
|
inherited |
Getter for $disabled.
| bool |
|
inherited |
Getter for $faildelay.
| int |
|
inherited |
Getter for $hostname.
| string |
|
inherited |
Getter for $hour.
| string |
|
inherited |
Get the last run time for this scheduled task.
| int |
|
inherited |
Get the current lock for this task.
| core::lock::lock |
|
inherited |
Getter for $minute.
| string |
|
inherited |
Getter for $month.
| string |
| enrol_lti\task\sync_members::get_name | ( | ) |
Get a descriptive name for this task.
| string |
Reimplemented from core\task\scheduled_task.
|
inherited |
Get the next run time for this task.
| int | timestamp |
|
inherited |
Calculate when this task should next be run based on the schedule.
| int::$nextruntime,. |
|
inherited |
Getter for $pid.
| int |
|
inherited |
Override this function if you want this scheduled task to run, even if the component is disabled.
| bool |
|
inherited |
Getter for $timestarted.
| int |
|
inherited |
Getter for $blocking.
| bool |
|
inherited |
Has this task been changed from it's default config?
| bool |
|
inherited |
Has this task been changed from it's default config?
| bool |
|
inherited |
Setter for $blocking.
| bool | $blocking |
|
inherited |
Setter for $component.
| string | $component |
|
inherited |
Set the current lock for the entire cron process.
| core::lock::lock | $lock |
|
inherited |
Has this task been changed from it's default config?
| bool |
|
inherited |
Setter for $day.
| string | $day |
|
inherited |
Setter for $dayofweek.
| string | $dayofweek | |
| bool | $expandr | - if true (default) an 'R' value in a time is expanded to an appropriate int. If false, they are left as 'R' |
|
inherited |
Setter for $disabled.
| bool | $disabled |
|
inherited |
Setter for $faildelay.
| int | $faildelay |
|
inherited |
Setter for $hostname.
| string | $hostname |
|
inherited |
Setter for $hour.
Accepts a special 'R' value which will be translated to a random hour.
| string | $hour | |
| bool | $expandr | - if true (default) an 'R' value in a time is expanded to an appropriate int. If false, they are left as 'R' |
|
inherited |
Set the last run time for this scheduled task.
| int | $lastruntime |
|
inherited |
Set the current lock for this task.
| core::lock::lock | $lock |
|
inherited |
Setter for $minute.
Accepts a special 'R' value which will be translated to a random minute.
| string | $minute | |
| bool | $expandr | - if true (default) an 'R' value in a time is expanded to an appropriate int. If false, they are left as 'R' |
|
inherited |
Setter for $month.
| string | $month |
|
inherited |
Set the next run time for this task.
| int | $nextruntime |
|
inherited |
Set the overridden value.
| bool | $overridden |
|
inherited |
Setter for $pid.
| int | $pid |
|
inherited |
Setter for $timestarted.
| int | $timestarted |
|
protected |
Method to determine whether to sync enrolments or not.
| int | $syncmode | The tool's membersyncmode. |
| bool |
|
protected |
Method to determine whether to sync unenrolments or not.
| int | $syncmode | The tool's membersyncmode. |
| bool |
|
protected |
Performs synchronisation of member information and enrolments.
| stdClass | $tool | |
| ToolConsumer | $consumer | |
| User[] | $members |
| array | An array of users from processed members and the number that were enrolled. |
|
protected |
Performs unenrolment of users that are no longer enrolled in the consumer side.
| stdClass | $tool | The tool record object. |
| string | $consumerkey | ensure we only unenrol users from this tool consumer. |
| array | $currentusers | The list of current users. |
| int | The number of users that have been unenrolled. |