Moodle APIs 3.11
Moodle 3.11.11+ (Build: 20221125)
Public Member Functions | Public Attributes | Protected Member Functions | Protected Attributes | List of all members
tool_brickfield\registration Class Reference
Inheritance diagram for tool_brickfield\registration:
tool_brickfield\mock_registration

Public Member Functions

 __construct ()
 Object registration constructor. More...
 
 get_api_key ()
 Get api key. More...
 
 get_regurl ()
 Get the registration URL. More...
 
 get_secret_key ()
 Get secret key. More...
 
 get_siteid ()
 Return the registered site id. More...
 
 get_termsurl ()
 Get the terms and conditions URL. More...
 
 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. More...
 
 set_keys_for_registration (string $apikey, string $secretkey)
 Perform all necessary steps when new keys are added. More...
 
 set_siteid (int $id)
 Set the registered site id. More...
 
 toolkit_is_active ()
 System can be used when it has been validated, or when its still awaiting validation. More...
 
 validate ()
 If the registration is not already valid, validate it. More...
 
 validation_error ()
 Return true if there was a validation error. More...
 
 validation_pending ()
 The "not validated" state also needs the grace period to still be in effect. More...
 

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. More...
 
 get_check_time ()
 Get the time of the last registration check. More...
 
 get_grace_period ()
 Get the registration grace period. More...
 
 get_registration_connection ()
 Return an instance of the connection class. More...
 
 get_status ()
 Return the current registration status. More...
 
 get_summary_time ()
 Return the time of the last summary update. More...
 
 get_validation_time ()
 Return the time of the registration validation. More...
 
 grace_period_valid ()
 Check if the unvalidated time is still within the grace period. More...
 
 keys_are_valid (?string $apikey=null, ?string $secretkey=null)
 Return true if all keys have valid format. More...
 
 secretkey_is_valid (string $secretkey)
 Validates that the entered Secret key is in the expected format. More...
 
 set_api_key (string $keyvalue)
 Set the configured api key value. More...
 
 set_check_time (int $time=0)
 Set the time of the last registration check. More...
 
 set_error ()
 Set the status to "error". More...
 
 set_expired ()
 Set the status to "expired". More...
 
 set_invalid ()
 Set the registration as invalid. More...
 
 set_not_entered ()
 Set the status as keys "not entered". More...
 
 set_not_validated ()
 "Not validated" means we have keys, but have not confirmed them yet. More...
 
 set_secret_key (string $keyvalue)
 Set the configured secret key value. More...
 
 set_status (int $status)
 Set the current registration status. More...
 
 set_summary_time (int $time=0)
 Set the time of the summary update. More...
 
 set_valid ()
 Set the registration as valid. More...
 
 set_validation_time (int $time=0)
 Set the registration validation time. More...
 
 status_is_error ()
 Return true if the current status is "error". More...
 
 status_is_expired ()
 Return true if the current status is "expired". More...
 
 status_is_invalid ()
 Return true if the current status is "invalid". More...
 
 status_is_not_entered ()
 Return true if the current status is "not entered". More...
 
 status_is_pending ()
 Return true if the current status is "pending". More...
 
 status_is_validated ()
 Return true if the logic says that the registration is valid. More...
 
 summarydata_grace_period_expired ()
 Check if the last time the summary data was sent is within the grace period. More...
 
 valid_key_format (string $key)
 Validates that the passed in key looks like an MD5 hash. More...
 

Protected Attributes

string $apikey
 The API key required for registration.
 
int $checktime
 The last time the validation was checked.
 
string $secretkey
 The secret key required for registration.
 
string $siteid
 The registered site id.
 
int $summarytime
 The last time the summary data was sent.
 
int $validation
 The current validation status.
 
int $validationtime
 The last time the validation time was confirmed.
 

Constructor & Destructor Documentation

◆ __construct()

tool_brickfield\registration::__construct ( )

Object registration constructor.

Exceptions
dml_exception

Member Function Documentation

◆ apikey_is_valid()

tool_brickfield\registration::apikey_is_valid ( string  $apikey)
protected

Validates that the entered API key is in the expected format.

Parameters
string$apikey
Return values
bool

◆ get_api_key()

tool_brickfield\registration::get_api_key ( )

Get api key.

Return values
string
Exceptions
dml_exception

◆ get_check_time()

tool_brickfield\registration::get_check_time ( )
protected

Get the time of the last registration check.

Return values
int
Exceptions
dml_exception

◆ get_grace_period()

tool_brickfield\registration::get_grace_period ( )
protected

Get the registration grace period.

Return values
int

◆ get_registration_connection()

tool_brickfield\registration::get_registration_connection ( )
protected

Return an instance of the connection class.

Return values
brickfieldconnect

Reimplemented in tool_brickfield\mock_registration.

◆ get_regurl()

tool_brickfield\registration::get_regurl ( )

Get the registration URL.

Return values
string

◆ get_secret_key()

tool_brickfield\registration::get_secret_key ( )

Get secret key.

Return values
string
Exceptions
dml_exception

◆ get_siteid()

tool_brickfield\registration::get_siteid ( )

Return the registered site id.

Return values
int
Exceptions
dml_exception

◆ get_status()

tool_brickfield\registration::get_status ( )
protected

Return the current registration status.

Return values
int
Exceptions
dml_exception

◆ get_summary_time()

tool_brickfield\registration::get_summary_time ( )
protected

Return the time of the last summary update.

Return values
int
Exceptions
dml_exception

◆ get_termsurl()

tool_brickfield\registration::get_termsurl ( )

Get the terms and conditions URL.

Return values
string

◆ get_validation_time()

tool_brickfield\registration::get_validation_time ( )
protected

Return the time of the registration validation.

Return values
int
Exceptions
dml_exception

◆ grace_period_valid()

tool_brickfield\registration::grace_period_valid ( )
protected

Check if the unvalidated time is still within the grace period.

Return values
bool

◆ keys_are_valid()

tool_brickfield\registration::keys_are_valid ( ?string  $apikey = null,
?string  $secretkey = null 
)
protected

Return true if all keys have valid format.

Parameters
string | null$apikey
string | null$secretkey
Return values
bool

◆ revalidate()

tool_brickfield\registration::revalidate ( )

Even if the regisration is currently valid, validate it again.

Return values
bool
Exceptions
dml_exception

◆ secretkey_is_valid()

tool_brickfield\registration::secretkey_is_valid ( string  $secretkey)
protected

Validates that the entered Secret key is in the expected format.

Parameters
string$secretkey
Return values
bool

◆ set_api_key()

tool_brickfield\registration::set_api_key ( string  $keyvalue)
protected

Set the configured api key value.

Parameters
string$keyvalue
Return values
bool

◆ set_check_time()

tool_brickfield\registration::set_check_time ( int  $time = 0)
protected

Set the time of the last registration check.

Parameters
int$time
Return values
bool

◆ set_error()

tool_brickfield\registration::set_error ( )
protected

Set the status to "error".

Return values
bool

◆ set_expired()

tool_brickfield\registration::set_expired ( )
protected

Set the status to "expired".

Return values
bool

◆ set_invalid()

tool_brickfield\registration::set_invalid ( )
protected

Set the registration as invalid.

Return values
bool

◆ set_keys_for_registration()

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.

Parameters
string$apikey
string$secretkey
Return values
bool

◆ set_not_entered()

tool_brickfield\registration::set_not_entered ( )
protected

Set the status as keys "not entered".

Return values
bool

◆ set_not_validated()

tool_brickfield\registration::set_not_validated ( )
protected

"Not validated" means we have keys, but have not confirmed them yet.

Set the validation time to start the grace period.

Return values
bool

◆ set_secret_key()

tool_brickfield\registration::set_secret_key ( string  $keyvalue)
protected

Set the configured secret key value.

Parameters
string$keyvalue
Return values
bool

◆ set_siteid()

tool_brickfield\registration::set_siteid ( int  $id)

Set the registered site id.

Parameters
int$id
Return values
bool

◆ set_status()

tool_brickfield\registration::set_status ( int  $status)
protected

Set the current registration status.

Parameters
int$status
Return values
bool

◆ set_summary_time()

tool_brickfield\registration::set_summary_time ( int  $time = 0)
protected

Set the time of the summary update.

Parameters
int$time
Return values
bool

◆ set_valid()

tool_brickfield\registration::set_valid ( )
protected

Set the registration as valid.

Return values
bool

◆ set_validation_time()

tool_brickfield\registration::set_validation_time ( int  $time = 0)
protected

Set the registration validation time.

Parameters
int$time
Return values
bool

◆ status_is_error()

tool_brickfield\registration::status_is_error ( )
protected

Return true if the current status is "error".

Return values
bool

◆ status_is_expired()

tool_brickfield\registration::status_is_expired ( )
protected

Return true if the current status is "expired".

Return values
bool

◆ status_is_invalid()

tool_brickfield\registration::status_is_invalid ( )
protected

Return true if the current status is "invalid".

Return values
bool

◆ status_is_not_entered()

tool_brickfield\registration::status_is_not_entered ( )
protected

Return true if the current status is "not entered".

Return values
bool

◆ status_is_pending()

tool_brickfield\registration::status_is_pending ( )
protected

Return true if the current status is "pending".

Return values
bool

◆ status_is_validated()

tool_brickfield\registration::status_is_validated ( )
protected

Return true if the logic says that the registration is valid.

Return values
bool

◆ summarydata_grace_period_expired()

tool_brickfield\registration::summarydata_grace_period_expired ( )
protected

Check if the last time the summary data was sent is within the grace period.

Return values
bool

◆ toolkit_is_active()

tool_brickfield\registration::toolkit_is_active ( )

System can be used when it has been validated, or when its still awaiting validation.

Return values
bool

◆ valid_key_format()

tool_brickfield\registration::valid_key_format ( string  $key)
protected

Validates that the passed in key looks like an MD5 hash.

Parameters
string$key
Return values
bool

◆ validate()

tool_brickfield\registration::validate ( )

If the registration is not already valid, validate it.

This may connect to the registration site.

Return values
bool
Exceptions
dml_exception

◆ validation_error()

tool_brickfield\registration::validation_error ( )

Return true if there was a validation error.

Return values
bool

◆ validation_pending()

tool_brickfield\registration::validation_pending ( )

The "not validated" state also needs the grace period to still be in effect.

Return values
bool

The documentation for this class was generated from the following file: