ILIAS  release_8 Revision v8.24
ilTermsOfServiceUserHasCountryCriterion Class Reference

Class ilTermsOfServiceUserHasCountryCriterion. More...

+ Inheritance diagram for ilTermsOfServiceUserHasCountryCriterion:
+ Collaboration diagram for ilTermsOfServiceUserHasCountryCriterion:

Public Member Functions

 __construct (array $countryCodes)
 ilTermsOfServiceUserHasCountryCriterion constructor. More...
 
 getTypeIdent ()
 Returns a unique id of the criterion type. More...
 
 hasUniqueNature ()
 Returns whether or not a criterion is unique by it's nature. More...
 
 evaluate (ilObjUser $user, ilTermsOfServiceCriterionConfig $config)
 
 ui (ilLanguage $lng)
 
 getTypeIdent ()
 Returns a unique id of the criterion type. More...
 
 hasUniqueNature ()
 Returns whether or not a criterion is unique by it's nature. More...
 
 evaluate (ilObjUser $user, ilTermsOfServiceCriterionConfig $config)
 
 ui (ilLanguage $lng)
 

Protected Attributes

array $countryCodes = []
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilTermsOfServiceUserHasCountryCriterion::__construct ( array  $countryCodes)

ilTermsOfServiceUserHasCountryCriterion constructor.

Parameters
string[]$countryCodes

Definition at line 34 of file class.ilTermsOfServiceUserHasCountryCriterion.php.

References $countryCodes.

Member Function Documentation

◆ evaluate()

ilTermsOfServiceUserHasCountryCriterion::evaluate ( ilObjUser  $user,
ilTermsOfServiceCriterionConfig  $config 
)
Parameters
ilObjUser$user
ilTermsOfServiceCriterionConfig$config
Returns
bool

Implements ilTermsOfServiceCriterionType.

Definition at line 49 of file class.ilTermsOfServiceUserHasCountryCriterion.php.

49 : bool
50 {
51 $country = $config['country'] ?? '';
52
53 if (!is_string($country) || 2 !== strlen($country) || !is_string($user->getSelectedCountry())) {
54 return false;
55 }
56
57 return strtolower($country) === strtolower($user->getSelectedCountry());
58 }
getSelectedCountry()
Get selected country (selection drop down)
if(!array_key_exists('PATH_INFO', $_SERVER)) $config
Definition: metadata.php:85

References $config, and ilObjUser\getSelectedCountry().

+ Here is the call graph for this function:

◆ getTypeIdent()

ilTermsOfServiceUserHasCountryCriterion::getTypeIdent ( )

Returns a unique id of the criterion type.

Returns
string

Implements ilTermsOfServiceCriterionType.

Definition at line 39 of file class.ilTermsOfServiceUserHasCountryCriterion.php.

39 : string
40 {
41 return 'usr_country';
42 }

◆ hasUniqueNature()

ilTermsOfServiceUserHasCountryCriterion::hasUniqueNature ( )

Returns whether or not a criterion is unique by it's nature.

Example: "User Language". A user account can only have one profile language .

Returns
bool

Implements ilTermsOfServiceCriterionType.

Definition at line 44 of file class.ilTermsOfServiceUserHasCountryCriterion.php.

44 : bool
45 {
46 return true;
47 }

◆ ui()

ilTermsOfServiceUserHasCountryCriterion::ui ( ilLanguage  $lng)
Parameters
ilLanguage$lng
Returns
ilTermsOfServiceCriterionTypeGUI

Implements ilTermsOfServiceCriterionType.

Definition at line 60 of file class.ilTermsOfServiceUserHasCountryCriterion.php.

61 {
62 return new ilTermsOfServiceUserHasCountryCriterionGUI($this, $lng, $this->countryCodes);
63 }
Interface ilTermsOfServiceCriterionTypeGUI.
$lng

References $lng.

Field Documentation

◆ $countryCodes

array ilTermsOfServiceUserHasCountryCriterion::$countryCodes = []
protected

Definition at line 28 of file class.ilTermsOfServiceUserHasCountryCriterion.php.

Referenced by __construct().


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