ILIAS  release_7 Revision v7.30-3-g800a261c036
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)
 ilTermsOfServiceUserHasGlobalRoleCriterionGUI 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
 
 $rbacReview
 
 $lng
 
 $objectCache
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

Member Function Documentation

◆ appendOption()

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

Parameters
ilRadioGroupInputGUI$option
ilTermsOfServiceCriterionConfig$config

Implements ilTermsOfServiceCriterionTypeGUI.

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

57 : void
58 {
59 $option = new ilRadioOption($this->getIdentPresentation(), $this->type->getTypeIdent());
60 $option->setInfo($this->lng->txt('tos_crit_type_usr_global_role_info'));
61
62 $roleSelection = new ilSelectInputGUI(
63 $this->lng->txt('perm_global_role'),
64 $this->type->getTypeIdent() . '_role_id'
65 );
66 $roleSelection->setRequired(true);
67
68 $options = [];
69 foreach ($this->rbacReview->getGlobalRoles() as $roleId) {
70 $options[$roleId] = $this->objectCache->lookupTitle($roleId);
71 }
72
73 asort($options);
74
75 $roleSelection->setOptions(['' => $this->lng->txt('please_choose')] + $options);
76 $roleSelection->setValue((int) ($config['role_id'] ?? 0));
77
78 $option->addSubItem($roleSelection);
79
80 $group->addOption($option);
81 }
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, ilRadioGroupInputGUI\addOption(), and getIdentPresentation().

+ Here is the call graph for this function:

◆ getConfigByForm()

ilTermsOfServiceUserHasGlobalRoleCriterionGUI::getConfigByForm ( ilPropertyFormGUI  $form)

Parameters
ilPropertyFormGUI$form
Returns
ilTermsOfServiceCriterionConfig

Implements ilTermsOfServiceCriterionTypeGUI.

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

87 {
89 'role_id' => (int) $form->getInput($this->type->getTypeIdent() . '_role_id')
90 ]);
91
92 return $config;
93 }
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()

ilTermsOfServiceUserHasGlobalRoleCriterionGUI::getIdentPresentation ( )

Returns
string

Implements ilTermsOfServiceCriterionTypeGUI.

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

98 : string
99 {
100 return $this->lng->txt('tos_crit_type_usr_global_role');
101 }

Referenced by appendOption().

+ Here is the caller graph for this function:

◆ getValuePresentation()

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

Parameters
ilTermsOfServiceCriterionConfig$config
Factory$uiFactory
Returns
Component

Implements ilTermsOfServiceCriterionTypeGUI.

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

106 : Component
107 {
108 $roleId = $config['role_id'] ?? 0;
109
110 if (!is_numeric($roleId) || $roleId < 1 || is_float($roleId)) {
111 return $uiFactory->legacy('');
112 }
113
114 if (!in_array($roleId, $this->rbacReview->getGlobalRoles())) {
115 return $uiFactory->legacy($this->lng->txt('deleted'));
116 }
117
118 return $uiFactory->legacy($this->objectCache->lookupTitle($roleId));
119 }
A component is the most general form of an entity in the UI.
Definition: Component.php:14
legacy($content)

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

+ Here is the call graph for this function:

Field Documentation

◆ $lng

ilTermsOfServiceUserHasGlobalRoleCriterionGUI::$lng
protected

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

Referenced by __construct().

◆ $objectCache

ilTermsOfServiceUserHasGlobalRoleCriterionGUI::$objectCache
protected

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

Referenced by __construct().

◆ $rbacReview

ilTermsOfServiceUserHasGlobalRoleCriterionGUI::$rbacReview
protected

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

Referenced by __construct().

◆ $type

ilTermsOfServiceUserHasGlobalRoleCriterionGUI::$type
protected

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

Referenced by __construct().


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