ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilTermsOfServiceUserHasCountryCriterion.php
Go to the documentation of this file.
1 <?php
2 
19 declare(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 }
Interface ilTermsOfServiceCriterionTypeGUI.
Interface ilTermsOfServiceCriterionType.
$lng
if(!array_key_exists('PATH_INFO', $_SERVER)) $config
Definition: metadata.php:85
Class ilTermsOfServiceCriterionConfig.
hasUniqueNature()
Returns whether or not a criterion is unique by it&#39;s nature.
__construct(array $countryCodes)
ilTermsOfServiceUserHasCountryCriterion constructor.
getSelectedCountry()
Get selected country (selection drop down)
evaluate(ilObjUser $user, ilTermsOfServiceCriterionConfig $config)