ILIAS  release_7 Revision v7.30-3-g800a261c036
class.ilTermsOfServiceUserHasCountryCriterion.php
Go to the documentation of this file.
1<?php declare(strict_types=1);
2/* Copyright (c) 1998-2018 ILIAS open source, Extended GPL, see docs/LICENSE */
3
9{
11 protected $countryCodes = [];
12
17 public function __construct(array $countryCodes)
18 {
19 $this->countryCodes = $countryCodes;
20 }
21
25 public function getTypeIdent() : string
26 {
27 return 'usr_country';
28 }
29
33 public function hasUniqueNature() : bool
34 {
35 return true;
36 }
37
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 }
53
58 {
59 return new ilTermsOfServiceUserHasCountryCriterionGUI($this, $lng, $this->countryCodes);
60 }
61}
$result
An exception for terminatinating execution or to throw for unit testing.
language handling
getSelectedCountry()
Get selected country (selection drop down)
Class ilTermsOfServiceCriterionConfig.
ui(ilLanguage $lng)
ilTermsOfServiceCriterionTypeGUI
getTypeIdent()
Returns a unique id of the criterion type.string
hasUniqueNature()
Returns whether or not a criterion is unique by it's nature.Example: "User Language"....
__construct(array $countryCodes)
ilTermsOfServiceUserHasCountryCriterion constructor.
evaluate(ilObjUser $user, ilTermsOfServiceCriterionConfig $config)
bool
Interface ilTermsOfServiceCriterionTypeGUI.
Interface ilTermsOfServiceCriterionType.
if(!array_key_exists('PATH_INFO', $_SERVER)) $config
Definition: metadata.php:68
$lng