ILIAS  trunk Revision v11.0_alpha-2645-g16283d3b3f8
ILIAS\LegalDocuments\Condition\Definition\UserCountryDefinition Class Reference
+ Inheritance diagram for ILIAS\LegalDocuments\Condition\Definition\UserCountryDefinition:
+ Collaboration diagram for ILIAS\LegalDocuments\Condition\Definition\UserCountryDefinition:

Public Member Functions

 __construct (private readonly UI $ui, private readonly Closure $required)
 
 formGroup (array $arguments=[])
 
 withCriterion (CriterionContent $criterion)
 
 translatedType ()
 
 translatedCountry (string $country)
 

Detailed Description

Definition at line 33 of file UserCountryDefinition.php.

Constructor & Destructor Documentation

◆ __construct()

ILIAS\LegalDocuments\Condition\Definition\UserCountryDefinition::__construct ( private readonly UI  $ui,
private readonly Closure  $required 
)
Parameters
Closure(array<string,mixed>)Constraint $required

Definition at line 38 of file UserCountryDefinition.php.

39  {
40  }

Member Function Documentation

◆ formGroup()

ILIAS\LegalDocuments\Condition\Definition\UserCountryDefinition::formGroup ( array  $arguments = [])

Implements ILIAS\LegalDocuments\ConditionDefinition.

Definition at line 42 of file UserCountryDefinition.php.

References ilCountry\getCountryCodes(), null, ILIAS\LegalDocuments\Condition\Definition\UserCountryDefinition\translatedCountry(), and ILIAS\Repository\ui().

42  : Group
43  {
44  $countries = ilCountry::getCountryCodes();
45  $countries = array_combine($countries, array_map($this->translatedCountry(...), $countries));
46 
47  return $this->ui->create()->input()->field()->group([
48  'country' => $this->ui->create()->input()->field()->select(
49  $this->ui->txt('country'),
50  $countries
51  )->withRequired(true, ($this->required)($countries))->withValue(strtoupper($arguments['country'] ?? '') ?: null)
52  ], $this->ui->txt('crit_type_usr_country'), $this->ui->txt('crit_type_usr_country_info'));
53  }
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
static getCountryCodes()
Get country codes (DIN EN 3166-1)
+ Here is the call graph for this function:

◆ translatedCountry()

ILIAS\LegalDocuments\Condition\Definition\UserCountryDefinition::translatedCountry ( string  $country)

Definition at line 65 of file UserCountryDefinition.php.

References ILIAS\Repository\ui().

Referenced by ILIAS\LegalDocuments\Condition\Definition\UserCountryDefinition\formGroup().

65  : string
66  {
67  return $this->ui->txt('meta_c_' . strtoupper($country));
68  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ translatedType()

ILIAS\LegalDocuments\Condition\Definition\UserCountryDefinition::translatedType ( )

Implements ILIAS\LegalDocuments\ConditionDefinition.

Definition at line 60 of file UserCountryDefinition.php.

References ILIAS\Repository\ui().

60  : string
61  {
62  return $this->ui->txt('crit_type_usr_country');
63  }
+ Here is the call graph for this function:

◆ withCriterion()

ILIAS\LegalDocuments\Condition\Definition\UserCountryDefinition::withCriterion ( CriterionContent  $criterion)

Implements ILIAS\LegalDocuments\ConditionDefinition.

Definition at line 55 of file UserCountryDefinition.php.

References ILIAS\Repository\ui().

55  : Condition
56  {
57  return new UserCountry($criterion, $this, $this->ui->create());
58  }
+ Here is the call graph for this function:

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