ILIAS  release_8 Revision v8.24
ilTermsOfServiceUserHasGlobalRoleCriterionGUI Class Reference

Class ilTermsOfServiceUserHasGlobalRoleCriterionGUI. More...

+ Inheritance diagram for ilTermsOfServiceUserHasGlobalRoleCriterionGUI:
+ Collaboration diagram for ilTermsOfServiceUserHasGlobalRoleCriterionGUI:

Public Member Functions

 __construct (ilTermsOfServiceUserHasGlobalRoleCriterion $type, ilLanguage $lng, ilRbacReview $rbacReview, ilObjectDataCache $objectCache)
 
 appendOption (ilRadioGroupInputGUI $group, ilTermsOfServiceCriterionConfig $config)
 
 getConfigByForm (ilPropertyFormGUI $form)
 
 getIdentPresentation ()
 
 getValuePresentation (ilTermsOfServiceCriterionConfig $config, Factory $uiFactory)
 
 appendOption (ilRadioGroupInputGUI $group, ilTermsOfServiceCriterionConfig $config)
 
 getConfigByForm (ilPropertyFormGUI $form)
 
 getIdentPresentation ()
 
 getValuePresentation (ilTermsOfServiceCriterionConfig $config, Factory $uiFactory)
 

Protected Attributes

ilTermsOfServiceUserHasGlobalRoleCriterion $type
 
ilRbacReview $rbacReview
 
ilLanguage $lng
 
ilObjectDataCache $objectCache
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilTermsOfServiceUserHasGlobalRoleCriterionGUI::__construct ( ilTermsOfServiceUserHasGlobalRoleCriterion  $type,
ilLanguage  $lng,
ilRbacReview  $rbacReview,
ilObjectDataCache  $objectCache 
)

Member Function Documentation

◆ appendOption()

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

Implements ilTermsOfServiceCriterionTypeGUI.

Definition at line 49 of file class.ilTermsOfServiceUserHasGlobalRoleCriterionGUI.php.

49 : void
50 {
51 $option = new ilRadioOption($this->getIdentPresentation(), $this->type->getTypeIdent());
52 $option->setInfo($this->lng->txt('tos_crit_type_usr_global_role_info'));
53
54 $roleSelection = new ilSelectInputGUI(
55 $this->lng->txt('perm_global_role'),
56 $this->type->getTypeIdent() . '_role_id'
57 );
58 $roleSelection->setRequired(true);
59
60 $options = [];
61 foreach ($this->rbacReview->getGlobalRoles() as $roleId) {
62 $options[$roleId] = $this->objectCache->lookupTitle($roleId);
63 }
64
65 natcasesort($options);
66
67 $roleSelection->setOptions(['' => $this->lng->txt('please_choose')] + $options);
68 $roleSelection->setValue((string) ((int) ($config['role_id'] ?? 0)));
69
70 $option->addSubItem($roleSelection);
71
72 $group->addOption($option);
73 }
addOption(ilRadioOption $a_option)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a selection list property in a property form.
if(!array_key_exists('PATH_INFO', $_SERVER)) $config
Definition: metadata.php:85

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

+ Here is the call graph for this function:

◆ getConfigByForm()

ilTermsOfServiceUserHasGlobalRoleCriterionGUI::getConfigByForm ( ilPropertyFormGUI  $form)

Implements ilTermsOfServiceCriterionTypeGUI.

Definition at line 75 of file class.ilTermsOfServiceUserHasGlobalRoleCriterionGUI.php.

76 {
78 'role_id' => (int) $form->getInput($this->type->getTypeIdent() . '_role_id')
79 ]);
80
81 return $config;
82 }
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-...
Class ilTermsOfServiceCriterionConfig.

References $config, and ilPropertyFormGUI\getInput().

+ Here is the call graph for this function:

◆ getIdentPresentation()

ilTermsOfServiceUserHasGlobalRoleCriterionGUI::getIdentPresentation ( )

Implements ilTermsOfServiceCriterionTypeGUI.

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

84 : string
85 {
86 return $this->lng->txt('tos_crit_type_usr_global_role');
87 }

References ILIAS\Repository\lng().

Referenced by appendOption().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getValuePresentation()

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

Implements ilTermsOfServiceCriterionTypeGUI.

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

89 : Component
90 {
91 $roleId = $config['role_id'] ?? 0;
92
93 if (!is_numeric($roleId) || $roleId < 1 || $roleId > PHP_INT_MAX || is_float($roleId)) {
94 return $uiFactory->legacy('');
95 }
96
97 $roleId = (int) $roleId;
98 if (!in_array($roleId, $this->rbacReview->getGlobalRoles(), true)) {
99 return $uiFactory->legacy($this->lng->txt('deleted'));
100 }
101
102 return $uiFactory->legacy($this->objectCache->lookupTitle($roleId));
103 }
legacy(string $content)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...

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

+ Here is the call graph for this function:

Field Documentation

◆ $lng

ilLanguage ilTermsOfServiceUserHasGlobalRoleCriterionGUI::$lng
protected

Definition at line 32 of file class.ilTermsOfServiceUserHasGlobalRoleCriterionGUI.php.

Referenced by __construct().

◆ $objectCache

ilObjectDataCache ilTermsOfServiceUserHasGlobalRoleCriterionGUI::$objectCache
protected

Definition at line 33 of file class.ilTermsOfServiceUserHasGlobalRoleCriterionGUI.php.

Referenced by __construct().

◆ $rbacReview

ilRbacReview ilTermsOfServiceUserHasGlobalRoleCriterionGUI::$rbacReview
protected

Definition at line 31 of file class.ilTermsOfServiceUserHasGlobalRoleCriterionGUI.php.

Referenced by __construct().

◆ $type

ilTermsOfServiceUserHasGlobalRoleCriterion ilTermsOfServiceUserHasGlobalRoleCriterionGUI::$type
protected

Definition at line 30 of file class.ilTermsOfServiceUserHasGlobalRoleCriterionGUI.php.

Referenced by __construct().


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