ILIAS  release_7 Revision v7.30-3-g800a261c036
ilTermsOfServiceUserHasLanguageCriterionGUI Class Reference

Class ilTermsOfServiceUserHasLanguageCriterionGUI. More...

+ Inheritance diagram for ilTermsOfServiceUserHasLanguageCriterionGUI:
+ Collaboration diagram for ilTermsOfServiceUserHasLanguageCriterionGUI:

Public Member Functions

 __construct (ilTermsOfServiceUserHasLanguageCriterion $type, ilLanguage $lng)
 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
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

Member Function Documentation

◆ appendOption()

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

Parameters
ilRadioGroupInputGUI$option
ilTermsOfServiceCriterionConfig$config

Implements ilTermsOfServiceCriterionTypeGUI.

Definition at line 35 of file class.ilTermsOfServiceUserHasLanguageCriterionGUI.php.

35 : void
36 {
37 $option = new ilRadioOption($this->getIdentPresentation(), $this->type->getTypeIdent());
38 $option->setInfo($this->lng->txt('tos_crit_type_usr_language_info'));
39
40 $languageSelection = new ilSelectInputGUI(
41 $this->lng->txt('language'),
42 $this->type->getTypeIdent() . '_lng'
43 );
44 $languageSelection->setRequired(true);
45
46 $options = [];
47 foreach ($this->lng->getInstalledLanguages() as $lng) {
48 $options[$lng] = $this->lng->txt('meta_l_' . $lng);
49 }
50
51 asort($options);
52
53 $languageSelection->setOptions(['' => $this->lng->txt('please_choose')] + $options);
54 $languageSelection->setValue((string) ($config['lng'] ?? ''));
55
56 $option->addSubItem($languageSelection);
57
58 $group->addOption($option);
59 }
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, $lng, ilRadioGroupInputGUI\addOption(), and getIdentPresentation().

+ Here is the call graph for this function:

◆ getConfigByForm()

ilTermsOfServiceUserHasLanguageCriterionGUI::getConfigByForm ( ilPropertyFormGUI  $form)

Parameters
ilPropertyFormGUI$form
Returns
ilTermsOfServiceCriterionConfig

Implements ilTermsOfServiceCriterionTypeGUI.

Definition at line 64 of file class.ilTermsOfServiceUserHasLanguageCriterionGUI.php.

65 {
67 'lng' => (string) $form->getInput($this->type->getTypeIdent() . '_lng')
68 ]);
69
70 return $config;
71 }
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()

ilTermsOfServiceUserHasLanguageCriterionGUI::getIdentPresentation ( )

Returns
string

Implements ilTermsOfServiceCriterionTypeGUI.

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

76 : string
77 {
78 return $this->lng->txt('tos_crit_type_usr_language');
79 }

Referenced by appendOption().

+ Here is the caller graph for this function:

◆ getValuePresentation()

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

Parameters
ilTermsOfServiceCriterionConfig$config
Factory$uiFactory
Returns
Component

Implements ilTermsOfServiceCriterionTypeGUI.

Definition at line 84 of file class.ilTermsOfServiceUserHasLanguageCriterionGUI.php.

84 : Component
85 {
86 $lng = $config['lng'] ?? '';
87
88 if (!is_string($lng) || 2 !== strlen($lng)) {
89 return $uiFactory->legacy('');
90 }
91
92 return $uiFactory->legacy($this->lng->txt('meta_l_' . (string) $lng));
93 }
A component is the most general form of an entity in the UI.
Definition: Component.php:14
legacy($content)

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

+ Here is the call graph for this function:

Field Documentation

◆ $lng

ilTermsOfServiceUserHasLanguageCriterionGUI::$lng
protected

◆ $type

ilTermsOfServiceUserHasLanguageCriterionGUI::$type
protected

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

Referenced by __construct().


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