ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
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
More...
 
 getIdentPresentation ()
 
Returns
string
More...
 
 getValuePresentation (\ilTermsOfServiceCriterionConfig $config, Factory $uiFactory)
 
Parameters
\ilTermsOfServiceCriterionConfig$config
Factory$uiFactory
Returns
Component
More...
 

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.

References $lng, PHPMailer\PHPMailer\$options, ilRadioGroupInputGUI\addOption(), and getIdentPresentation().

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  }
$config
Definition: bootstrap.php:15
+ Here is the call graph for this function:

◆ getConfigByForm()

ilTermsOfServiceUserHasLanguageCriterionGUI::getConfigByForm ( \ilPropertyFormGUI  $form)

Parameters
ilPropertyFormGUI$form
Returns

Implements ilTermsOfServiceCriterionTypeGUI.

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

References $config, and ilPropertyFormGUI\getInput().

65  {
66  $config = new \ilTermsOfServiceCriterionConfig([
67  'lng' => (string) $form->getInput($this->type->getTypeIdent() . '_lng')
68  ]);
69 
70  return $config;
71  }
$config
Definition: bootstrap.php:15
Class ilTermsOfServiceCriterionConfig.
if(isset($_POST['submit'])) $form
+ Here is the call graph for this function:

◆ getIdentPresentation()

ilTermsOfServiceUserHasLanguageCriterionGUI::getIdentPresentation ( )

Returns
string

Implements ilTermsOfServiceCriterionTypeGUI.

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

Referenced by appendOption().

76  : string
77  {
78  return $this->lng->txt('tos_crit_type_usr_language');
79  }
+ 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.

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

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  }
$config
Definition: bootstrap.php:15
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

◆ $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: