ILIAS
trunk Revision v11.0_alpha-2645-g16283d3b3f8
◀ ilDoc Overview
UserCountry.php
Go to the documentation of this file.
1
<?php
2
19
declare(strict_types=1);
20
21
namespace
ILIAS\LegalDocuments\Condition
;
22
23
use
ILIAS\LegalDocuments\Condition
;
24
use
ILIAS\LegalDocuments\ConditionDefinition
;
25
use
ILIAS\LegalDocuments\Condition\Definition\UserCountryDefinition
;
26
use
ILIAS\LegalDocuments\Value\CriterionContent
;
27
use
ILIAS\UI\Component\Component
;
28
use
ILIAS\UI\Factory
as
UIFactory
;
29
use
ilObjUser
;
30
31
class
UserCountry
implements
Condition
32
{
33
public
function
__construct
(
34
private
readonly
CriterionContent
$criterion,
35
private
readonly
UserCountryDefinition
$definition,
36
private
readonly
UIFactory
$create
37
) {
38
}
39
40
public
function
asComponent
():
Component
41
{
42
return
$this->create->legacy()->content(sprintf(
43
'<div><b>%s</b><br/>%s</div>'
,
44
$this->
definition
->translatedType(),
45
$this->
definition
->translatedCountry($this->criterion->arguments()[
'country'
] ??
''
)
46
));
47
}
48
49
public
function
eval
(
ilObjUser
$user): bool
50
{
51
return
strtoupper($user->
getCountry
()) === strtoupper($this->criterion->arguments()[
'country'
]);
52
}
53
54
public
function
definition
():
ConditionDefinition
55
{
56
return
$this->definition;
57
}
58
59
public
function
knownToNeverMatchWith
(
Condition
$other): bool
60
{
61
return
$other instanceof (self::class);
62
}
63
}
ConditionDefinition
Factory
ILIAS\LegalDocuments\ConditionDefinition
Definition:
ConditionDefinition.php:26
UserCountryDefinition
ILIAS\UI\Component
Component
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ilObjUser\getCountry
getCountry()
Definition:
class.ilObjUser.php:1390
CriterionContent
ilObjUser
ILIAS\LegalDocuments\Condition\Definition\UserCountryDefinition
Definition:
UserCountryDefinition.php:33
ILIAS\LegalDocuments\Condition\UserCountry\asComponent
asComponent()
Definition:
UserCountry.php:40
ILIAS\LegalDocuments\Condition\UserCountry\__construct
__construct(private readonly CriterionContent $criterion, private readonly UserCountryDefinition $definition, private readonly UIFactory $create)
Definition:
UserCountry.php:33
ILIAS\LegalDocuments\Condition\UserCountry\knownToNeverMatchWith
knownToNeverMatchWith(Condition $other)
Definition:
UserCountry.php:59
ILIAS\LegalDocuments\Condition\UserCountry\eval
eval(ilObjUser $user)
Definition:
UserCountry.php:49
ILIAS\LegalDocuments\Condition
Definition:
Condition.php:26
ILIAS\LegalDocuments\Value\CriterionContent
Definition:
CriterionContent.php:23
ILIAS\LegalDocuments\Condition\UserCountry
Definition:
UserCountry.php:31
ILIAS\LegalDocuments\Condition
ILIAS\LegalDocuments\Condition\UserCountry\definition
definition()
Definition:
UserCountry.php:54
components
ILIAS
LegalDocuments
classes
Condition
UserCountry.php
Generated on Mon Sep 1 2025 23:03:22 for ILIAS by
1.8.13 (using
Doxyfile
)