ILIAS  release_8 Revision v8.19
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)
 
 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.

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

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  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setInfo(string $a_info)
addOption(ilRadioOption $a_option)
+ Here is the call graph for this function:

◆ getConfigByForm()

ilTermsOfServiceUserHasCountryCriterionGUI::getConfigByForm ( ilPropertyFormGUI  $form)

Implements ilTermsOfServiceCriterionTypeGUI.

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

References $config, and ilPropertyFormGUI\getInput().

77  {
79  'country' => (string) $form->getInput($this->type->getTypeIdent() . '_country')
80  ]);
81 
82  return $config;
83  }
if(!array_key_exists('PATH_INFO', $_SERVER)) $config
Definition: metadata.php:85
Class ilTermsOfServiceCriterionConfig.
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-...
+ Here is the call graph for this function:

◆ getIdentPresentation()

ilTermsOfServiceUserHasCountryCriterionGUI::getIdentPresentation ( )

Implements ilTermsOfServiceCriterionTypeGUI.

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

References ILIAS\Repository\lng().

Referenced by appendOption().

85  : string
86  {
87  return $this->lng->txt('tos_crit_type_usr_country');
88  }
+ 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.

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

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  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
legacy(string $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

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: