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

Protected Attributes

 $type
 
 $rbacReview
 
 $lng
 
 $objectCache
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

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

ilTermsOfServiceUserHasGlobalRoleCriterionGUI constructor.

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

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

References $lng, $objectCache, $rbacReview, and $type.

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.

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

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

◆ getConfigByForm()

ilTermsOfServiceUserHasGlobalRoleCriterionGUI::getConfigByForm ( \ilPropertyFormGUI  $form)

Parameters
ilPropertyFormGUI$form
Returns

Implements ilTermsOfServiceCriterionTypeGUI.

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

References $config, and ilPropertyFormGUI\getInput().

87  {
88  $config = new \ilTermsOfServiceCriterionConfig([
89  'role_id' => (int) $form->getInput($this->type->getTypeIdent() . '_role_id')
90  ]);
91 
92  return $config;
93  }
$config
Definition: bootstrap.php:15
Class ilTermsOfServiceCriterionConfig.
if(isset($_POST['submit'])) $form
+ Here is the call graph for this function:

◆ getIdentPresentation()

ilTermsOfServiceUserHasGlobalRoleCriterionGUI::getIdentPresentation ( )

Returns
string

Implements ilTermsOfServiceCriterionTypeGUI.

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

Referenced by appendOption().

98  : string
99  {
100  return $this->lng->txt('tos_crit_type_usr_global_role');
101  }
+ 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.

References ILIAS\UI\Factory\legacy().

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  return $uiFactory->legacy($this->objectCache->lookupTitle($roleId));
115  }
$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

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: