Moodle PHP Documentation 4.2
Moodle 4.2.8 (Build: 20240610) (2d41ac46f45)
|
Public Member Functions | |
__construct () | |
Object registration constructor. | |
get_api_key () | |
Get api key. | |
get_regurl () | |
Get the registration URL. | |
get_secret_key () | |
Get secret key. | |
get_siteid () | |
Return the registered site id. | |
get_termsurl () | |
Get the terms and conditions URL. | |
mark_summary_data_sent () | |
Perform all actions needed to note that the summary data was sent. | |
revalidate () | |
Even if the regisration is currently valid, validate it again. | |
set_keys_for_registration (string $apikey, string $secretkey) | |
Perform all necessary steps when new keys are added. | |
set_siteid (int $id) | |
Set the registered site id. | |
toolkit_is_active () | |
System can be used when it has been validated, or when its still awaiting validation. | |
validate () | |
If the registration is not already valid, validate it. | |
validation_error () | |
Return true if there was a validation error. | |
validation_pending () | |
The "not validated" state also needs the grace period to still be in effect. | |
Public Attributes | |
string const | API_KEY = 'key' |
Name of variable storing the registration API key. | |
int const | ERROR = 5 |
Registration validation attempted, but failed. | |
int const | EXPIRED = 4 |
Registration information has expired and needs to be revalidated. | |
int const | INVALID = 2 |
Registration information was entered but was not validated within the defined grace periods. | |
int const | NOT_ENTERED = 0 |
Registration information has not been entered. | |
int const | PENDING = 1 |
Registration information has been entered but not externally validated. | |
string const | SECRET_KEY = 'hash' |
Name of variable storing the registration API key. | |
string const | SITEID = 'id' |
Name of the variable storing the site id. | |
string const | STATUS = 'bfregstatus' |
Name of variable storing the registration status. | |
string const | SUMMARY_TIME = 'bfsummarytime' |
Name of variable storing the time the summary data was last sent. | |
int const | VALIDATED = 3 |
Registration information has been externally validated. | |
string const | VALIDATION_CHECK_TIME = 'bfregvalidationchecktime' |
Name of variable storing the last time the registration information was checked. | |
string const | VALIDATION_TIME = 'bfregvalidationtime' |
Name of variable storing the time the registration information was validated. | |
Protected Member Functions | |
apikey_is_valid (string $apikey) | |
Validates that the entered API key is in the expected format. | |
get_check_time () | |
Get the time of the last registration check. | |
get_grace_period () | |
Get the registration grace period. | |
get_registration_connection () | |
Return an instance of the connection class. | |
get_status () | |
Return the current registration status. | |
get_summary_time () | |
Return the time of the last summary update. | |
get_validation_time () | |
Return the time of the registration validation. | |
grace_period_valid () | |
Check if the unvalidated time is still within the grace period. | |
keys_are_valid (?string $apikey=null, ?string $secretkey=null) | |
Return true if all keys have valid format. | |
secretkey_is_valid (string $secretkey) | |
Validates that the entered Secret key is in the expected format. | |
set_api_key (string $keyvalue) | |
Set the configured api key value. | |
set_check_time (int $time=0) | |
Set the time of the last registration check. | |
set_error () | |
Set the status to "error". | |
set_expired () | |
Set the status to "expired". | |
set_invalid () | |
Set the registration as invalid. | |
set_not_entered () | |
Set the status as keys "not entered". | |
set_not_validated () | |
"Not validated" means we have keys, but have not confirmed them yet. | |
set_secret_key (string $keyvalue) | |
Set the configured secret key value. | |
set_status (int $status) | |
Set the current registration status. | |
set_summary_time (int $time=0) | |
Set the time of the summary update. | |
set_valid () | |
Set the registration as valid. | |
set_validation_time (int $time=0) | |
Set the registration validation time. | |
status_is_error () | |
Return true if the current status is "error". | |
status_is_expired () | |
Return true if the current status is "expired". | |
status_is_invalid () | |
Return true if the current status is "invalid". | |
status_is_not_entered () | |
Return true if the current status is "not entered". | |
status_is_pending () | |
Return true if the current status is "pending". | |
status_is_validated () | |
Return true if the logic says that the registration is valid. | |
summarydata_grace_period_expired () | |
Check if the last time the summary data was sent is within the grace period. | |
valid_key_format (string $key) | |
Validates that the passed in key looks like an MD5 hash. | |
tool_brickfield\registration::__construct | ( | ) |
Object registration constructor.
dml_exception |
|
protected |
Validates that the entered API key is in the expected format.
string | $apikey |
bool |
tool_brickfield\registration::get_api_key | ( | ) |
|
protected |
|
protected |
Get the registration grace period.
int |
|
protected |
Return an instance of the connection class.
brickfieldconnect |
Reimplemented in tool_brickfield\mock_registration.
tool_brickfield\registration::get_regurl | ( | ) |
Get the registration URL.
string |
tool_brickfield\registration::get_secret_key | ( | ) |
tool_brickfield\registration::get_siteid | ( | ) |
|
protected |
|
protected |
tool_brickfield\registration::get_termsurl | ( | ) |
Get the terms and conditions URL.
string |
|
protected |
|
protected |
Check if the unvalidated time is still within the grace period.
bool |
|
protected |
Return true if all keys have valid format.
string | null | $apikey | |
string | null | $secretkey |
bool |
tool_brickfield\registration::revalidate | ( | ) |
Even if the regisration is currently valid, validate it again.
bool |
dml_exception |
|
protected |
Validates that the entered Secret key is in the expected format.
string | $secretkey |
bool |
|
protected |
Set the configured api key value.
string | $keyvalue |
bool |
|
protected |
Set the time of the last registration check.
int | $time |
bool |
|
protected |
Set the status to "error".
bool |
|
protected |
Set the status to "expired".
bool |
|
protected |
Set the registration as invalid.
bool |
tool_brickfield\registration::set_keys_for_registration | ( | string | $apikey, |
string | $secretkey ) |
Perform all necessary steps when new keys are added.
Also check that they actually look like keys.
string | $apikey | |
string | $secretkey |
bool |
|
protected |
Set the status as keys "not entered".
bool |
|
protected |
"Not validated" means we have keys, but have not confirmed them yet.
Set the validation time to start the grace period.
bool |
|
protected |
Set the configured secret key value.
string | $keyvalue |
bool |
tool_brickfield\registration::set_siteid | ( | int | $id | ) |
Set the registered site id.
int | $id |
bool |
|
protected |
Set the current registration status.
int | $status |
bool |
|
protected |
Set the time of the summary update.
int | $time |
bool |
|
protected |
Set the registration as valid.
bool |
|
protected |
Set the registration validation time.
int | $time |
bool |
|
protected |
Return true if the current status is "error".
bool |
|
protected |
Return true if the current status is "expired".
bool |
|
protected |
Return true if the current status is "invalid".
bool |
|
protected |
Return true if the current status is "not entered".
bool |
|
protected |
Return true if the current status is "pending".
bool |
|
protected |
Return true if the logic says that the registration is valid.
bool |
|
protected |
Check if the last time the summary data was sent is within the grace period.
bool |
tool_brickfield\registration::toolkit_is_active | ( | ) |
System can be used when it has been validated, or when its still awaiting validation.
bool |
|
protected |
Validates that the passed in key looks like an MD5 hash.
string | $key |
bool |
tool_brickfield\registration::validate | ( | ) |
If the registration is not already valid, validate it.
This may connect to the registration site.
bool |
dml_exception |
tool_brickfield\registration::validation_error | ( | ) |
Return true if there was a validation error.
bool |
tool_brickfield\registration::validation_pending | ( | ) |
The "not validated" state also needs the grace period to still be in effect.
bool |