ILIAS  release_7 Revision v7.30-3-g800a261c036
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)
 
Parameters
ilRadioGroupInputGUI$option
ilTermsOfServiceCriterionConfig$config
More...
 
 getConfigByForm (ilPropertyFormGUI $form)
 
Parameters
ilPropertyFormGUI$form
Returns
ilTermsOfServiceCriterionConfig
More...
 
 getIdentPresentation ()
 
Returns
string
More...
 
 getValuePresentation (ilTermsOfServiceCriterionConfig $config, Factory $uiFactory)
 
Parameters
ilTermsOfServiceCriterionConfig$config
Factory$uiFactory
Returns
Component
More...
 
 appendOption (ilRadioGroupInputGUI $option, ilTermsOfServiceCriterionConfig $config)
 
 getConfigByForm (ilPropertyFormGUI $form)
 
 getIdentPresentation ()
 
 getValuePresentation (ilTermsOfServiceCriterionConfig $config, Factory $uiFactory)
 

Protected Attributes

 $type
 
 $lng
 
 $countryCodes = []
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

Member Function Documentation

◆ appendOption()

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

Parameters
ilRadioGroupInputGUI$option
ilTermsOfServiceCriterionConfig$config

Implements ilTermsOfServiceCriterionTypeGUI.

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

41 : void
42 {
43 $option = new ilRadioOption($this->getIdentPresentation(), $this->type->getTypeIdent());
44 $option->setInfo($this->lng->txt('tos_crit_type_usr_country_info'));
45
46 $countrySelection = new ilSelectInputGUI(
47 $this->lng->txt('country'),
48 $this->type->getTypeIdent() . '_country'
49 );
50 $countrySelection->setRequired(true);
51
52 $options = [];
53 foreach ($this->countryCodes as $country) {
54 $options[strtolower($country)] = $this->lng->txt('meta_c_' . strtoupper($country));
55 }
56 asort($options);
57
58 $countrySelection->setOptions(['' => $this->lng->txt('please_choose')] + $options);
59 $countrySelection->setValue((string) ($config['country'] ?? ''));
60
61 $option->addSubItem($countrySelection);
62
63 $group->addOption($option);
64 }
addOption($a_option)
Add Option.
This class represents an option in a radio group.
This class represents a selection list property in a property form.
if(!array_key_exists('PATH_INFO', $_SERVER)) $config
Definition: metadata.php:68

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

+ Here is the call graph for this function:

◆ getConfigByForm()

ilTermsOfServiceUserHasCountryCriterionGUI::getConfigByForm ( ilPropertyFormGUI  $form)

Parameters
ilPropertyFormGUI$form
Returns
ilTermsOfServiceCriterionConfig

Implements ilTermsOfServiceCriterionTypeGUI.

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

70 {
72 'country' => (string) $form->getInput($this->type->getTypeIdent() . '_country')
73 ]);
74
75 return $config;
76 }
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.
Class ilTermsOfServiceCriterionConfig.

References $config, and ilPropertyFormGUI\getInput().

+ Here is the call graph for this function:

◆ getIdentPresentation()

ilTermsOfServiceUserHasCountryCriterionGUI::getIdentPresentation ( )

Returns
string

Implements ilTermsOfServiceCriterionTypeGUI.

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

81 : string
82 {
83 return $this->lng->txt('tos_crit_type_usr_country');
84 }

Referenced by appendOption().

+ Here is the caller graph for this function:

◆ getValuePresentation()

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

Parameters
ilTermsOfServiceCriterionConfig$config
Factory$uiFactory
Returns
Component

Implements ilTermsOfServiceCriterionTypeGUI.

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

89 : Component
90 {
91 $country = $config['country'] ?? '';
92
93 if (!is_string($country) || 2 !== strlen($country)) {
94 return $uiFactory->legacy('');
95 }
96
97 return $uiFactory->legacy($this->lng->txt('meta_c_' . strtoupper((string) $country)));
98 }
A component is the most general form of an entity in the UI.
Definition: Component.php:14
legacy($content)

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

+ Here is the call graph for this function:

Field Documentation

◆ $countryCodes

ilTermsOfServiceUserHasCountryCriterionGUI::$countryCodes = []
protected

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

Referenced by __construct().

◆ $lng

ilTermsOfServiceUserHasCountryCriterionGUI::$lng
protected

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

Referenced by __construct().

◆ $type

ilTermsOfServiceUserHasCountryCriterionGUI::$type
protected

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

Referenced by __construct().


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