Moodle PHP Documentation 5.1
Moodle 5.1dev (Build: 20250711) (9addea9f0ac)
|
Public Member Functions | |
__construct (protected moodle_database readonly moodle_database $db,) | |
Create a new SMS manager. | |
create_gateway_instance (string $classname, string $name, bool $enabled=false, ?stdClass $config=null,) | |
Create a new gateway instance. | |
delete_gateway (gateway $gateway) | |
Delete the gateway instance. | |
disable_gateway (gateway $gateway) | |
Disable a gateway. | |
enable_gateway (gateway $gateway) | |
Enable a gateway. | |
get_enabled_gateway_instances () | |
Get a list of all enabled gateway instances. | |
get_gateway_for_message (message $message, ?int $gatewayid=null,) | |
Get the gateway that can send the given message. | |
get_gateway_instances (?array $filter=null) | |
Get a list of all gateway instances. | |
get_gateway_records (?array $filter=null) | |
Get the gateway records according to the filter. | |
get_message (array $filter,) | |
Get a message. | |
get_messages (string $sort='timecreated ASC', ?array $filter=null, int $pagesize=0, int $page=0,) | |
Get all messages. | |
get_possible_gateways_for_message (message $message,) | |
Get the gateways that can send the given message. | |
save_message (message $message,) | |
Save the message to the database. | |
send (string $recipientnumber, string $content, string $component, string $messagetype, ?int $recipientuserid, bool $issensitive=false, bool $async=true, ?int $gatewayid=null,) | |
Send an SMS to the given recipient. | |
send_message (message $message, bool $async=true, ?int $gatewayid=null,) | |
Send a message using the message object. | |
update_gateway_instance (gateway $gateway, ?stdClass $config=null,) | |
Update gateway instance. | |
Static Public Member Functions | |
static | format_number (string $phonenumber, ?string $countrycode=null,) |
This function internationalises a number to E.164 standard. | |
core_sms\manager::__construct | ( | protected moodle_database readonly moodle_database | $db | ) |
core_sms\manager::create_gateway_instance | ( | string | $classname, |
string | $name, | ||
bool | $enabled = false, | ||
?stdClass | $config = null ) |
Create a new gateway instance.
string | $classname | Classname of the gateway |
string | $name | The name of the gateway config |
bool | $enabled | If the gateway is enabled or not |
stdClass | null | $config | The config json |
gateway |
core_sms\manager::delete_gateway | ( | gateway | $gateway | ) |
Delete the gateway instance.
gateway | $gateway | The gateway instance |
bool |
core_sms\manager::disable_gateway | ( | gateway | $gateway | ) |
Disable a gateway.
gateway | $gateway |
gateway |
core_sms\manager::enable_gateway | ( | gateway | $gateway | ) |
Enable a gateway.
gateway | $gateway |
gateway |
|
static |
This function internationalises a number to E.164 standard.
string | $phonenumber | the phone number to format. |
?string | $countrycode | The country code of the phone number. |
string | the formatted phone number. |
core_sms\manager::get_enabled_gateway_instances | ( | ) |
Get a list of all enabled gateway instances.
array |
core_sms\manager::get_gateway_for_message | ( | message | $message, |
?int | $gatewayid = null ) |
Get the gateway that can send the given message.
message | $message | The message instance |
?int | $gatewayid | the gateway instance id to send the sms in a specific gateway config |
null|gateway |
core_sms\manager::get_gateway_instances | ( | ?array | $filter = null | ) |
Get a list of all gateway instances.
null | array | $filter | The database filter to apply |
array |
core_sms\manager::get_gateway_records | ( | ?array | $filter = null | ) |
Get the gateway records according to the filter.
array | null | $filter | The filterable elements to get the records from |
array |
core_sms\manager::get_message | ( | array | $filter | ) |
Get a message.
array | $filter |
message |
core_sms\manager::get_messages | ( | string | $sort = 'timecreated ASC', |
?array | $filter = null, | ||
int | $pagesize = 0, | ||
int | $page = 0 ) |
Get all messages.
string | $sort | |
null | array | $filter | |
int | $pagesize | |
int | $page |
Generator |
core_sms\manager::get_possible_gateways_for_message | ( | message | $message | ) |
Get the gateways that can send the given message.
message | $message |
gateway[] |
core_sms\manager::save_message | ( | message | $message | ) |
Save the message to the database.
message | $message |
message |
core_sms\manager::send | ( | string | $recipientnumber, |
string | $content, | ||
string | $component, | ||
string | $messagetype, | ||
?int | $recipientuserid, | ||
bool | $issensitive = false, | ||
bool | $async = true, | ||
?int | $gatewayid = null ) |
Send an SMS to the given recipient.
string | $recipientnumber | The phone number to send the SMS to |
string | $content | The SMS Content |
string | $component | The owning component |
string | $messagetype | The message type within the component |
null | int | $recipientuserid | The user id of the recipient if one exists |
bool | $issensitive | Whether this SMS contains sensitive information |
bool | $async | Whether this SMS should be sent asynchronously. Note: sensitive messages cannot be sent async |
?int | $gatewayid | the gateway instance id to send the sms in a specific gateway config |
message |
coding_exception | If a sensitive message is sent asynchronously |
core_sms\manager::send_message | ( | message | $message, |
bool | $async = true, | ||
?int | $gatewayid = null ) |
Send a message using the message object.
message | $message | The message object |
bool | $async | Whether this SMS should be sent asynchronously. Note: sensitive messages cannot be sent async |
?int | $gatewayid | the gateway instance id to send the sms in a specific gateway config |
message | the message object after trying to send the message |
core_sms\manager::update_gateway_instance | ( | gateway | $gateway, |
?stdClass | $config = null ) |
Update gateway instance.
gateway | $gateway | The gateway instance |
stdClass | null | $config | the configuration of the gateway instance to be updated |
gateway |