Search moodle.org's
Developer Documentation

See Release Notes

  • Bug fixes for general core bugs in 3.11.x will end 14 Nov 2022 (12 months plus 6 months extension).
  • Bug fixes for security issues in 3.11.x will end 13 Nov 2023 (18 months plus 12 months extension).
  • PHP version: minimum PHP 7.3.0 Note: minimum PHP version has increased since Moodle 3.10. PHP 7.4.x is supported too.

(no description)

File Size: 595 lines (18 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class


Class: registration  - X-Ref

Class registration contains the functions to manage registration validation.

__construct()   X-Ref
Object registration constructor.


toolkit_is_active()   X-Ref
System can be used when it has been validated, or when its still awaiting validation.

return: bool

validation_pending()   X-Ref
The "not validated" state also needs the grace period to still be in effect.

return: bool

validation_error()   X-Ref
Return true if there was a validation error.

return: bool

set_keys_for_registration(string $apikey, string $secretkey)   X-Ref
Perform all necessary steps when new keys are added. Also check that they actually look like keys.

param: string $apikey
param: string $secretkey
return: bool

validate()   X-Ref
If the registration is not already valid, validate it. This may connect to the registration site.

return: bool

revalidate()   X-Ref
Even if the regisration is currently valid, validate it again.

return: bool

get_api_key()   X-Ref
Get api key.

return: string

get_secret_key()   X-Ref
Get secret key.

return: string

get_regurl()   X-Ref
Get the registration URL.

return: string

get_termsurl()   X-Ref
Get the terms and conditions URL.

return: string

mark_summary_data_sent()   X-Ref
Perform all actions needed to note that the summary data was sent.


set_siteid(int $id)   X-Ref
Set the registered site id.

param: int $id
return: bool

get_siteid()   X-Ref
Return the registered site id.

return: int

set_not_entered()   X-Ref
Set the status as keys "not entered".

return: bool

set_not_validated()   X-Ref
"Not validated" means we have keys, but have not confirmed them yet. Set the validation time to start the grace period.

return: bool

set_invalid()   X-Ref
Set the registration as invalid.

return: bool

set_valid()   X-Ref
Set the registration as valid.

return: bool

set_expired()   X-Ref
Set the status to "expired".

return: bool

set_error()   X-Ref
Set the status to "error".

return: bool

set_api_key(string $keyvalue)   X-Ref
Set the configured api key value.

param: string $keyvalue
return: bool

set_secret_key(string $keyvalue)   X-Ref
Set the configured secret key value.

param: string $keyvalue
return: bool

status_is_validated()   X-Ref
Return true if the logic says that the registration is valid.

return: bool

status_is_not_entered()   X-Ref
Return true if the current status is "not entered".

return: bool

status_is_pending()   X-Ref
Return true if the current status is "pending".

return: bool

status_is_expired()   X-Ref
Return true if the current status is "expired".

return: bool

status_is_invalid()   X-Ref
Return true if the current status is "invalid".

return: bool

status_is_error()   X-Ref
Return true if the current status is "error".

return: bool

set_status(int $status)   X-Ref
Set the current registration status.

param: int $status
return: bool

get_status()   X-Ref
Return the current registration status.

return: int

set_check_time(int $time = 0)   X-Ref
Set the time of the last registration check.

param: int $time
return: bool

get_check_time()   X-Ref
Get the time of the last registration check.

return: int

set_validation_time(int $time = 0)   X-Ref
Set the registration validation time.

param: int $time
return: bool

get_validation_time()   X-Ref
Return the time of the registration validation.

return: int

set_summary_time(int $time = 0)   X-Ref
Set the time of the summary update.

param: int $time
return: bool

get_summary_time()   X-Ref
Return the time of the last summary update.

return: int

keys_are_valid(?string $apikey = null, ?string $secretkey = null)   X-Ref
Return true if all keys have valid format.

param: string|null $apikey
param: string|null $secretkey
return: bool

apikey_is_valid(string $apikey)   X-Ref
Validates that the entered API key is in the expected format.

param: string $apikey
return: bool

secretkey_is_valid(string $secretkey)   X-Ref
Validates that the entered Secret key is in the expected format.

param: string $secretkey
return: bool

valid_key_format(string $key)   X-Ref
Validates that the passed in key looks like an MD5 hash.

param: string $key
return: bool

get_grace_period()   X-Ref
Get the registration grace period.

return: int

grace_period_valid()   X-Ref
Check if the unvalidated time is still within the grace period.

return: bool

summarydata_grace_period_expired()   X-Ref
Check if the last time the summary data was sent is within the grace period.

return: bool

get_registration_connection()   X-Ref
Return an instance of the connection class.

return: brickfieldconnect