ILIAS  release_8 Revision v8.24
class.ilTermsOfServiceUserHasCountryCriterion.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
26{
28 protected array $countryCodes = [];
29
34 public function __construct(array $countryCodes)
35 {
36 $this->countryCodes = $countryCodes;
37 }
38
39 public function getTypeIdent(): string
40 {
41 return 'usr_country';
42 }
43
44 public function hasUniqueNature(): bool
45 {
46 return true;
47 }
48
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 }
59
61 {
62 return new ilTermsOfServiceUserHasCountryCriterionGUI($this, $lng, $this->countryCodes);
63 }
64}
language handling
User class.
getSelectedCountry()
Get selected country (selection drop down)
Class ilTermsOfServiceCriterionConfig.
hasUniqueNature()
Returns whether or not a criterion is unique by it's nature.
__construct(array $countryCodes)
ilTermsOfServiceUserHasCountryCriterion constructor.
evaluate(ilObjUser $user, ilTermsOfServiceCriterionConfig $config)
Interface ilTermsOfServiceCriterionTypeGUI.
Interface ilTermsOfServiceCriterionType.
if(!array_key_exists('PATH_INFO', $_SERVER)) $config
Definition: metadata.php:85
$lng