ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
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...
 

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.

References ilRadioGroupInputGUI\addOption(), getIdentPresentation(), and ilRadioOption\setInfo().

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  }
This class represents an option in a radio group.
setInfo($a_info)
Set Info.
addOption($a_option)
Add Option.
+ 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.

References $config, and ilPropertyFormGUI\getInput().

70  {
72  'country' => (string) $form->getInput($this->type->getTypeIdent() . '_country')
73  ]);
74 
75  return $config;
76  }
if(!array_key_exists('PATH_INFO', $_SERVER)) $config
Definition: metadata.php:68
Class ilTermsOfServiceCriterionConfig.
getInput($a_post_var, $ensureValidation=true)
Returns the value of a HTTP-POST variable, identified by the passed id.
+ Here is the call graph for this function:

◆ getIdentPresentation()

ilTermsOfServiceUserHasCountryCriterionGUI::getIdentPresentation ( )

Returns
string

Implements ilTermsOfServiceCriterionTypeGUI.

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

Referenced by appendOption().

81  : string
82  {
83  return $this->lng->txt('tos_crit_type_usr_country');
84  }
+ 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.

References ILIAS\UI\Factory\legacy().

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  }
legacy($content)
description: purpose: > This component is used to wrap an existing ILIAS UI element into a UI compon...
+ 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: