ILIAS  release_8 Revision v8.24
ilTermsOfServiceUserHasCountryCriterionGUI Class Reference

Class ilTermsOfServiceUserHasCountryCriterionGUI. More...

+ Inheritance diagram for ilTermsOfServiceUserHasCountryCriterionGUI:
+ Collaboration diagram for ilTermsOfServiceUserHasCountryCriterionGUI:

Public Member Functions

 __construct (ilTermsOfServiceUserHasCountryCriterion $type, ilLanguage $lng, array $countryCodes)
 ilTermsOfServiceUserHasLanguageCriterionGUI constructor. More...
 
 appendOption (ilRadioGroupInputGUI $group, ilTermsOfServiceCriterionConfig $config)
 
 getConfigByForm (ilPropertyFormGUI $form)
 
 getIdentPresentation ()
 
 getValuePresentation (ilTermsOfServiceCriterionConfig $config, Factory $uiFactory)
 
 appendOption (ilRadioGroupInputGUI $group, ilTermsOfServiceCriterionConfig $config)
 
 getConfigByForm (ilPropertyFormGUI $form)
 
 getIdentPresentation ()
 
 getValuePresentation (ilTermsOfServiceCriterionConfig $config, Factory $uiFactory)
 

Protected Attributes

ilTermsOfServiceUserHasCountryCriterion $type
 
ilLanguage $lng
 
array $countryCodes = []
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilTermsOfServiceUserHasCountryCriterionGUI::__construct ( ilTermsOfServiceUserHasCountryCriterion  $type,
ilLanguage  $lng,
array  $countryCodes 
)

Member Function Documentation

◆ appendOption()

ilTermsOfServiceUserHasCountryCriterionGUI::appendOption ( ilRadioGroupInputGUI  $group,
ilTermsOfServiceCriterionConfig  $config 
)

Implements ilTermsOfServiceCriterionTypeGUI.

Definition at line 51 of file class.ilTermsOfServiceUserHasCountryCriterionGUI.php.

51 : void
52 {
53 $option = new ilRadioOption($this->getIdentPresentation(), $this->type->getTypeIdent());
54 $option->setInfo($this->lng->txt('tos_crit_type_usr_country_info'));
55
56 $countrySelection = new ilSelectInputGUI(
57 $this->lng->txt('country'),
58 $this->type->getTypeIdent() . '_country'
59 );
60 $countrySelection->setRequired(true);
61
62 $options = [];
63 foreach ($this->countryCodes as $country) {
64 $options[strtolower($country)] = $this->lng->txt('meta_c_' . strtoupper($country));
65 }
66 natcasesort($options);
67
68 $countrySelection->setOptions(['' => $this->lng->txt('please_choose')] + $options);
69 $countrySelection->setValue((string) ($config['country'] ?? ''));
70
71 $option->addSubItem($countrySelection);
72
73 $group->addOption($option);
74 }
addOption(ilRadioOption $a_option)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a selection list property in a property form.
if(!array_key_exists('PATH_INFO', $_SERVER)) $config
Definition: metadata.php:85

References $config, ilRadioGroupInputGUI\addOption(), getIdentPresentation(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

◆ getConfigByForm()

ilTermsOfServiceUserHasCountryCriterionGUI::getConfigByForm ( ilPropertyFormGUI  $form)

Implements ilTermsOfServiceCriterionTypeGUI.

Definition at line 76 of file class.ilTermsOfServiceUserHasCountryCriterionGUI.php.

77 {
79 'country' => (string) $form->getInput($this->type->getTypeIdent() . '_country')
80 ]);
81
82 return $config;
83 }
getInput(string $a_post_var, bool $ensureValidation=true)
Returns the input of an item, if item provides getInput method and as fallback the value of the HTTP-...
Class ilTermsOfServiceCriterionConfig.

References $config, and ilPropertyFormGUI\getInput().

+ Here is the call graph for this function:

◆ getIdentPresentation()

ilTermsOfServiceUserHasCountryCriterionGUI::getIdentPresentation ( )

Implements ilTermsOfServiceCriterionTypeGUI.

Definition at line 85 of file class.ilTermsOfServiceUserHasCountryCriterionGUI.php.

85 : string
86 {
87 return $this->lng->txt('tos_crit_type_usr_country');
88 }

References ILIAS\Repository\lng().

Referenced by appendOption().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getValuePresentation()

ilTermsOfServiceUserHasCountryCriterionGUI::getValuePresentation ( ilTermsOfServiceCriterionConfig  $config,
Factory  $uiFactory 
)

Implements ilTermsOfServiceCriterionTypeGUI.

Definition at line 90 of file class.ilTermsOfServiceUserHasCountryCriterionGUI.php.

90 : Component
91 {
92 $country = $config['country'] ?? '';
93
94 if (!is_string($country) || 2 !== strlen($country)) {
95 return $uiFactory->legacy('');
96 }
97
98 return $uiFactory->legacy($this->lng->txt('meta_c_' . strtoupper($country)));
99 }
legacy(string $content)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

References $config, ILIAS\UI\Factory\legacy(), and ILIAS\Repository\lng().

+ Here is the call graph for this function:

Field Documentation

◆ $countryCodes

array ilTermsOfServiceUserHasCountryCriterionGUI::$countryCodes = []
protected

Definition at line 33 of file class.ilTermsOfServiceUserHasCountryCriterionGUI.php.

Referenced by __construct().

◆ $lng

ilLanguage ilTermsOfServiceUserHasCountryCriterionGUI::$lng
protected

Definition at line 31 of file class.ilTermsOfServiceUserHasCountryCriterionGUI.php.

Referenced by __construct().

◆ $type

ilTermsOfServiceUserHasCountryCriterion ilTermsOfServiceUserHasCountryCriterionGUI::$type
protected

Definition at line 30 of file class.ilTermsOfServiceUserHasCountryCriterionGUI.php.

Referenced by __construct().


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