action_handler
Handles the execution of actions dynamically.
Table of Contents
Properties
- $actions : array<string|int, mixed>
- List of registered action classes.
Methods
- execute() : null|array<string|int, mixed>
- Executes an action based on its type and provided parameters.
- get_execute_actions_order() : array<string|int, mixed>
- get_registered_actions() : array<string|int, mixed>
- Returns a list of registered actions.
- get_registered_actions_info() : array<string|int, mixed>
- Returns info of registered actions.
- compare_values() : bool
- resolve_value() : mixed
Properties
$actions
List of registered action classes.
private
static array<string|int, mixed>
$actions
= ['createUser' => \local_middag\extensions\customform\model\actions\create_user_action::class, 'condition' => \local_middag\extensions\customform\model\actions\condition_action::class, 'createCohort' => \local_middag\extensions\customform\model\actions\create_cohort_action::class, 'addUserInCohort' => \local_middag\extensions\customform\model\actions\add_user_in_cohort_action::class, 'createCourseGroup' => \local_middag\extensions\customform\model\actions\create_course_group_action::class, 'addUserInCourseGroup' => \local_middag\extensions\customform\model\actions\add_user_in_course_group_action::class, 'createEnrolMethodSyncCohort' => \local_middag\extensions\customform\model\actions\create_enrol_method_sync_cohort_action::class, 'sendEmail' => \local_middag\extensions\customform\model\actions\send_email_action::class, 'externalDataReturn' => \local_middag\extensions\customform\model\actions\external_data_return_action::class, 'enrolUser' => \local_middag\extensions\customform\model\actions\enrol_user_action::class]
Methods
execute()
Executes an action based on its type and provided parameters.
public
static execute(submission $submission, form $form) : null|array<string|int, mixed>
Parameters
- $submission : submission
-
the action type (must be registered in $actions)
- $form : form
-
parameters required by the action
Tags
Return values
null|array<string|int, mixed> —the result of the action execution
get_execute_actions_order()
public
static get_execute_actions_order(array<string|int, mixed> $edges, array<string|int, mixed> $nodes) : array<string|int, mixed>
Parameters
- $edges : array<string|int, mixed>
- $nodes : array<string|int, mixed>
Return values
array<string|int, mixed>get_registered_actions()
Returns a list of registered actions.
public
static get_registered_actions() : array<string|int, mixed>
Return values
array<string|int, mixed> —list of available actions
get_registered_actions_info()
Returns info of registered actions.
public
static get_registered_actions_info(mixed $formid) : array<string|int, mixed>
Parameters
- $formid : mixed
Return values
array<string|int, mixed> —list of available actions
compare_values()
protected
static compare_values(mixed $left, mixed $right, string $operator) : bool
Parameters
- $left : mixed
- $right : mixed
- $operator : string
Return values
boolresolve_value()
protected
static resolve_value(mixed $key, mixed $submission, mixed $context) : mixed
Parameters
- $key : mixed
- $submission : mixed
- $context : mixed