ILIAS  release_7 Revision v7.30-3-g800a261c036
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.
Returns
string
More...
 
 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
More...
 
 evaluate (ilObjUser $user, ilTermsOfServiceCriterionConfig $config)
 
Parameters
ilObjUser$user
ilTermsOfServiceCriterionConfig$config
Returns
bool
More...
 
 ui (ilLanguage $lng)
 
Parameters
ilLanguage$lng
Returns
ilTermsOfServiceCriterionTypeGUI
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

 $countryCodes = []
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilTermsOfServiceUserHasCountryCriterion::__construct ( array  $countryCodes)

ilTermsOfServiceUserHasCountryCriterion constructor.

Parameters
string[]$countryCodes

Definition at line 17 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 41 of file class.ilTermsOfServiceUserHasCountryCriterion.php.

41 : bool
42 {
43 $country = $config['country'] ?? '';
44
45 if (!is_string($country) || 2 !== strlen($country) || !is_string($user->getSelectedCountry())) {
46 return false;
47 }
48
49 $result = strtolower($country) === strtolower($user->getSelectedCountry());
50
51 return $result;
52 }
$result
getSelectedCountry()
Get selected country (selection drop down)
if(!array_key_exists('PATH_INFO', $_SERVER)) $config
Definition: metadata.php:68

References $config, $result, 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 25 of file class.ilTermsOfServiceUserHasCountryCriterion.php.

25 : string
26 {
27 return 'usr_country';
28 }

◆ 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 33 of file class.ilTermsOfServiceUserHasCountryCriterion.php.

33 : bool
34 {
35 return true;
36 }

◆ ui()

ilTermsOfServiceUserHasCountryCriterion::ui ( ilLanguage  $lng)

Parameters
ilLanguage$lng
Returns
ilTermsOfServiceCriterionTypeGUI

Implements ilTermsOfServiceCriterionType.

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

58 {
59 return new ilTermsOfServiceUserHasCountryCriterionGUI($this, $lng, $this->countryCodes);
60 }
Interface ilTermsOfServiceCriterionTypeGUI.
$lng

References $lng.

Field Documentation

◆ $countryCodes

ilTermsOfServiceUserHasCountryCriterion::$countryCodes = []
protected

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

Referenced by __construct().


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