ILIAS  release_8 Revision v8.19-1-g4e8f2f9140c
All Data Structures Namespaces Files Functions Variables Modules Pages
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)
 

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.

References ilObjUser\getSelectedCountry().

Referenced by ilTermsOfServiceUserHasCountryCriterionTest\testEvaluationFailsIfUserCountryDoesNotMatchDefinedLanguage(), and ilTermsOfServiceUserHasCountryCriterionTest\testEvaluationSucceedsIfUserCountryDoesMatchDefinedLanguage().

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)
+ Here is the call graph for this function:
+ Here is the caller 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.

Referenced by ilTermsOfServiceUserHasCountryCriterionTest\testFormUserInterfaceElementsAreProperlyBuilt(), and ilTermsOfServiceUserHasCountryCriterionTest\testValuesFromFormUserInterfaceElementsCanBeRetrieved().

39  : string
40  {
41  return 'usr_country';
42  }
+ Here is the caller graph for this function:

◆ 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()

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: