ILIAS  release_10 Revision v10.1-43-ga1241a92c2f
ilECSParticipantSettingsGUI Class Reference
+ Collaboration diagram for ilECSParticipantSettingsGUI:

Public Member Functions

 __construct (int $a_server_id, int $a_mid)
 
 getServerId ()
 
 getMid ()
 
 executeCommand ()
 Execute command. More...
 

Protected Member Functions

 renderConsentToolbar ()
 
 resetConsents ()
 
 saveSettings ()
 Save settings. More...
 
 initFormSettings ()
 Init settings form. More...
 
 parseAvailableAuthModes ($a_mode_incoming=true)
 
 isShibbolethActive ()
 

Protected Attributes

ilGlobalTemplateInterface $tpl
 
ilLanguage $lng
 
ilCtrl $ctrl
 
ilTabsGUI $tabs
 
UiFactory $ui_factory
 
ilToolbarGUI $toolbar
 
ilSetting $settings
 

Private Member Functions

 getParticipant ()
 
 abort ()
 Abort editing. More...
 
 settings (ilPropertyFormGUI $form=null)
 Settings. More...
 
 setTabs ()
 Set tabs. More...
 

Private Attributes

int $server_id
 
int $mid
 
ilECSParticipantSetting $participant
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilECSParticipantSettingsGUI::__construct ( int  $a_server_id,
int  $a_mid 
)

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

References $DIC, ILIAS\Repository\ctrl(), getMid(), getServerId(), ILIAS\Repository\lng(), settings(), ILIAS\Repository\tabs(), and ILIAS\Repository\toolbar().

41  {
42  global $DIC;
43 
44  $this->lng = $DIC->language();
45  $this->tpl = $DIC->ui()->mainTemplate();
46  $this->ctrl = $DIC->ctrl();
47  $this->tabs = $DIC->tabs();
48  $this->ui_factory = $DIC->ui()->factory();
49  $this->toolbar = $DIC->toolbar();
50  $this->settings = $DIC->settings();
51 
52  $this->server_id = $a_server_id;
53  $this->mid = $a_mid;
54 
55  $this->lng->loadLanguageModule('ecs');
56 
57  $this->participant = new ilECSParticipantSetting($this->getServerId(), $this->getMid());
58  }
global $DIC
Definition: shib_login.php:25
settings(ilPropertyFormGUI $form=null)
Settings.
+ Here is the call graph for this function:

Member Function Documentation

◆ abort()

ilECSParticipantSettingsGUI::abort ( )
private

Abort editing.

Definition at line 96 of file class.ilECSParticipantSettingsGUI.php.

References ILIAS\Repository\ctrl().

96  : void
97  {
98  $this->ctrl->returnToParent($this);
99  }
+ Here is the call graph for this function:

◆ executeCommand()

ilECSParticipantSettingsGUI::executeCommand ( )

Execute command.

Definition at line 79 of file class.ilECSParticipantSettingsGUI.php.

References ILIAS\Repository\ctrl(), and setTabs().

79  : bool
80  {
81  $this->ctrl->saveParameter($this, 'server_id');
82  $this->ctrl->saveParameter($this, 'mid');
83 
84  $next_class = $this->ctrl->getNextClass($this);
85  $cmd = $this->ctrl->getCmd('settings');
86 
87  $this->setTabs();
88  $this->$cmd();
89 
90  return true;
91  }
+ Here is the call graph for this function:

◆ getMid()

ilECSParticipantSettingsGUI::getMid ( )

Definition at line 65 of file class.ilECSParticipantSettingsGUI.php.

References $mid.

Referenced by __construct(), renderConsentToolbar(), and resetConsents().

65  : int
66  {
67  return $this->mid;
68  }
+ Here is the caller graph for this function:

◆ getParticipant()

ilECSParticipantSettingsGUI::getParticipant ( )
private

Definition at line 70 of file class.ilECSParticipantSettingsGUI.php.

References $participant.

Referenced by initFormSettings(), and saveSettings().

+ Here is the caller graph for this function:

◆ getServerId()

ilECSParticipantSettingsGUI::getServerId ( )

Definition at line 60 of file class.ilECSParticipantSettingsGUI.php.

References $server_id.

Referenced by __construct(), renderConsentToolbar(), and resetConsents().

60  : int
61  {
62  return $this->server_id;
63  }
+ Here is the caller graph for this function:

◆ initFormSettings()

ilECSParticipantSettingsGUI::initFormSettings ( )
protected

Init settings form.

Definition at line 194 of file class.ilECSParticipantSettingsGUI.php.

References $token, ILIAS\Repository\ctrl(), getParticipant(), ilECSUtils\getPossibleReleaseTypes(), ilECSUtils\getPossibleRemoteTypes(), ilECSParticipantSetting\INCOMING_AUTH_TYPE_INACTIVE, ilECSParticipantSetting\INCOMING_AUTH_TYPE_LOGIN_PAGE, ilECSParticipantSetting\INCOMING_AUTH_TYPE_SHIBBOLETH, isShibbolethActive(), ILIAS\Repository\lng(), parseAvailableAuthModes(), ilFormPropertyGUI\setInfo(), and ilCheckboxGroupInputGUI\setValue().

Referenced by saveSettings(), and settings().

195  {
196  $form = new ilPropertyFormGUI();
197  $form->setFormAction($this->ctrl->getFormAction($this));
198  $form->setTitle($this->lng->txt('ecs_part_settings') . ' ' . $this->getParticipant()->getTitle());
199 
200 
201  $token = new ilCheckboxInputGUI($this->lng->txt('ecs_token_mechanism'), 'token');
202  $token->setInfo($this->lng->txt('ecs_token_mechanism_info'));
203  $token->setValue("1");
204  $token->setChecked($this->getParticipant()->isTokenEnabled());
205  $form->addItem($token);
206 
207  // Export
208  $export = new ilCheckboxInputGUI($this->lng->txt('ecs_tbl_export'), 'export');
209  $export->setValue("1");
210  $export->setChecked($this->getParticipant()->isExportEnabled());
211  $form->addItem($export);
212 
213  $auth_types = new ilCheckboxInputGUI(
214  $this->lng->txt('ecs_export_local_account'),
215  'incoming_local_accounts'
216  );
217  $auth_types->setInfo($this->lng->txt('ecs_export_local_account_info'));
218  $auth_types->setChecked($this->getParticipant()->areIncomingLocalAccountsSupported());
219  $export->addSubItem($auth_types);
220 
221  // radio group with login page and (optional) shibboleth option
222  $external_auth_type = new ilRadioGroupInputGUI(
223  $this->lng->txt('ecs_export_auth_type'),
224  'incoming_auth_type'
225  );
226  $external_auth_type->setInfo($this->lng->txt('ecs_export_auth_type_info'));
227  $external_auth_type->setValue(
228  (string) $this->getParticipant()->getIncomingAuthType()
229  );
230  $external_auth_type->addOption(
231  new ilRadioOption(
232  $this->lng->txt('ecs_export_auth_type_ilias'),
234  )
235  );
236  if ($this->isShibbolethActive()) {
237  $external_auth_type->addOption(
238  new ilRadioOption(
239  $this->lng->txt('ecs_export_auth_type_shib'),
241  )
242  );
243  }
244  $external_auth_type->addOption(
245  new ilRadioOption(
246  $this->lng->txt('ecs_export_auth_type_none'),
248  )
249  );
250  $export->addSubItem($external_auth_type);
251 
252  // Export types
253  $obj_types = new ilCheckboxGroupInputGUI($this->lng->txt('ecs_export_types'), 'export_types');
254  $obj_types->setValue($this->getParticipant()->getExportTypes());
255 
256 
257  foreach (ilECSUtils::getPossibleReleaseTypes(true) as $type => $trans) {
258  $obj_types->addOption(new ilCheckboxOption($trans, $type));
259  }
260  $export->addSubItem($obj_types);
261 
262 
263  // Import
264  $import = new ilCheckboxInputGUI($this->lng->txt('ecs_tbl_import'), 'import');
265  $import->setValue("1");
266  $import->setChecked($this->getParticipant()->isImportEnabled());
267  $form->addItem($import);
268 
269  // user credentials by auth mode
270  $user_credentials = new ilCheckboxGroupInputGUI(
271  $this->lng->txt('ecs_import_user_credentials_by_auth_mode'),
272  'outgoing_auth_modes'
273  );
274  $user_credentials->setInfo($this->lng->txt('ecs_import_user_credentials_by_auth_mode_info'));
275  $user_credentials->setValue($this->getParticipant()->getOutgoingAuthModes());
276  $import->addSubItem($user_credentials);
277  foreach ($this->parseAvailableAuthModes() as $option_name => $option_text) {
278  $option = new ilCheckboxOption(
279  $this->lng->txt('ecs_import_auth_mode') . ' ' . $option_text,
280  $option_name
281  );
282  $user_credentials->addOption($option);
283  $username_placeholder = new ilTextInputGUI(
284  $this->lng->txt('ecs_outgoing_user_credentials'),
285  'username_placeholder_' . $option_name
286  );
287  $username_placeholder->setRequired(false);
288  $username_placeholder->setInfo($this->lng->txt('ecs_outgoing_user_credentials_info'));
289  $username_placeholder->setValue(
290  $this->getParticipant()->getOutgoingUsernamePlaceholderByAuthMode(
291  $option_name
292  )
293  );
294  $option->addSubItem($username_placeholder);
295  }
296  $option = new ilCheckboxOption(
297  $this->lng->txt('ecs_import_auth_type_default'),
298  'default'
299  );
300  $user_credentials->addOption($option);
301 
302  // Import types
303  $imp_types = new ilCheckboxGroupInputGUI($this->lng->txt('ecs_import_types'), 'import_types');
304  $imp_types->setValue($this->getParticipant()->getImportTypes());
305 
306 
307  foreach (ilECSUtils::getPossibleRemoteTypes(true) as $type => $trans) {
308  $imp_types->addOption(new ilCheckboxOption($trans, $type));
309  }
310  $import->addSubItem($imp_types);
311 
312  $form->addCommandButton('saveSettings', $this->lng->txt('save'));
313  $form->addCommandButton('abort', $this->lng->txt('cancel'));
314  return $form;
315  }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getPossibleReleaseTypes(bool $a_with_captions=false)
Get all possible release object types.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static getPossibleRemoteTypes(bool $a_with_captions=false)
Get all possible remote object types.
This class represents a property in a property form.
$token
Definition: xapitoken.php:67
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isShibbolethActive()

ilECSParticipantSettingsGUI::isShibbolethActive ( )
protected

Definition at line 330 of file class.ilECSParticipantSettingsGUI.php.

References settings().

Referenced by initFormSettings(), and parseAvailableAuthModes().

330  : bool
331  {
332  return (bool) $this->settings->get('shib_active', '0');
333  }
settings(ilPropertyFormGUI $form=null)
Settings.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ parseAvailableAuthModes()

ilECSParticipantSettingsGUI::parseAvailableAuthModes (   $a_mode_incoming = true)
protected

Definition at line 317 of file class.ilECSParticipantSettingsGUI.php.

References $server, ilLDAPServer\getInstanceByServerId(), ilLDAPServer\getServerIds(), isShibbolethActive(), and ILIAS\Repository\lng().

Referenced by initFormSettings(), and saveSettings().

317  : array
318  {
319  $options = [];
320  if ($this->isShibbolethActive()) {
321  $options['shibboleth'] = $this->lng->txt('auth_shib');
322  }
323  foreach (ilLDAPServer::getServerIds() as $server_id) {
325  $options['ldap_' . $server->getServerId()] = $server->getName();
326  }
327  return $options;
328  }
static getInstanceByServerId(int $a_server_id)
Get instance by server id.
static getServerIds()
Get all server ids.
$server
Definition: shib_login.php:27
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ renderConsentToolbar()

ilECSParticipantSettingsGUI::renderConsentToolbar ( )
protected

Definition at line 115 of file class.ilECSParticipantSettingsGUI.php.

References ILIAS\Repository\ctrl(), getMid(), getServerId(), ILIAS\Repository\lng(), and ILIAS\Repository\toolbar().

Referenced by settings().

115  : void
116  {
117  $consents = new ilECSParticipantConsents(
118  $this->getServerId(),
119  $this->getMid()
120  );
121  if (!$consents->hasConsents()) {
122  return;
123  }
124 
125  $confirm = $this->ui_factory->modal()->interruptive(
126  $this->lng->txt('ecs_consent_reset_confirm_title'),
127  $this->lng->txt('ecs_consent_reset_confirm_title_info'),
128  $this->ctrl->getLinkTarget($this, 'resetConsents')
129  );
130  $this->toolbar->addComponent($confirm);
131 
132  $confirmation_trigger = $this->ui_factory->button()->standard(
133  $this->lng->txt('ecs_consent_reset_confirm_title'),
134  ''
135  )->withOnClick($confirm->getShowSignal());
136  $this->toolbar->addComponent($confirmation_trigger);
137  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ resetConsents()

ilECSParticipantSettingsGUI::resetConsents ( )
protected

Definition at line 139 of file class.ilECSParticipantSettingsGUI.php.

References ILIAS\Repository\ctrl(), getMid(), getServerId(), and ILIAS\Repository\lng().

140  {
141  $consents = new ilECSParticipantConsents($this->getServerId(), $this->getMid());
142  $consents->delete();
143  $this->tpl->setOnScreenMessage('success', $this->lng->txt('ecs_user_consents_deleted'), true);
144  $this->ctrl->redirect($this, 'settings');
145  }
+ Here is the call graph for this function:

◆ saveSettings()

ilECSParticipantSettingsGUI::saveSettings ( )
protected

Save settings.

Definition at line 150 of file class.ilECSParticipantSettingsGUI.php.

References ILIAS\Repository\ctrl(), ilECSParticipantSetting\ERR_MISSING_USERNAME_PLACEHOLDER, getParticipant(), initFormSettings(), ILIAS\Repository\lng(), parseAvailableAuthModes(), and settings().

150  : void
151  {
152  $form = $this->initFormSettings();
153  if ($form->checkInput()) {
154  $this->getParticipant()->enableToken((bool) $form->getInput('token'));
155  $this->getParticipant()->enableExport((bool) $form->getInput('export'));
156  $this->getParticipant()->setExportTypes($form->getInput('export_types'));
157  $this->getParticipant()->enableImport((bool) $form->getInput('import'));
158  $this->getParticipant()->setImportTypes($form->getInput('import_types'));
159  $this->getParticipant()->enableIncomingLocalAccounts((bool) $form->getInput('incoming_local_accounts'));
160  $this->getParticipant()->setIncomingAuthType((int) $form->getInput('incoming_auth_type'));
161  $this->getParticipant()->setOutgoingAuthModes((array) $form->getInput('outgoing_auth_modes'));
162 
163  // placeholders
164  $placeholders = [];
165  foreach ($this->parseAvailableAuthModes() as $authmode_name => $authmode_text) {
166  $placeholders[$authmode_name] = $form->getInput(
167  'username_placeholder_' . $authmode_name
168  );
169  }
170  $this->getParticipant()->setOutgoingUsernamePlaceholders($placeholders);
171 
172  // additional validation
173  $error_code = $this->getParticipant()->validate();
174  switch ($error_code) {
176  $form->getItemByPostVar('outgoing_auth_modes')->setAlert(
177  $this->lng->txt('ecs_username_place_holder_err_mssing_placeholder')
178  );
179  break;
180  default:
181  $this->getParticipant()->update();
182  $this->tpl->setOnScreenMessage('success', $this->lng->txt('settings_saved'), true);
183  $this->ctrl->redirect($this, 'settings');
184  }
185  }
186  $form->setValuesByPost();
187  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('err_check_input'));
188  $this->settings($form);
189  }
settings(ilPropertyFormGUI $form=null)
Settings.
+ Here is the call graph for this function:

◆ setTabs()

ilECSParticipantSettingsGUI::setTabs ( )
private

Set tabs.

Definition at line 338 of file class.ilECSParticipantSettingsGUI.php.

References ILIAS\Repository\ctrl(), ILIAS\Repository\lng(), and ILIAS\Repository\tabs().

Referenced by executeCommand().

338  : void
339  {
340  $this->tabs->clearTargets();
341  $this->tabs->setBackTarget(
342  $this->lng->txt('back'),
343  $this->ctrl->getParentReturnByClass(self::class)
344  );
345  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ settings()

ilECSParticipantSettingsGUI::settings ( ilPropertyFormGUI  $form = null)
private

Settings.

Definition at line 105 of file class.ilECSParticipantSettingsGUI.php.

References initFormSettings(), and renderConsentToolbar().

Referenced by __construct(), isShibbolethActive(), and saveSettings().

105  : void
106  {
107  $this->renderConsentToolbar();
108 
109  if (!$form instanceof ilPropertyFormGUI) {
110  $form = $this->initFormSettings();
111  }
112  $this->tpl->setContent($form->getHTML());
113  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

ilCtrl ilECSParticipantSettingsGUI::$ctrl
protected

Definition at line 34 of file class.ilECSParticipantSettingsGUI.php.

◆ $lng

ilLanguage ilECSParticipantSettingsGUI::$lng
protected

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

◆ $mid

int ilECSParticipantSettingsGUI::$mid
private

Definition at line 28 of file class.ilECSParticipantSettingsGUI.php.

Referenced by getMid().

◆ $participant

ilECSParticipantSetting ilECSParticipantSettingsGUI::$participant
private

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

Referenced by getParticipant().

◆ $server_id

int ilECSParticipantSettingsGUI::$server_id
private

Definition at line 27 of file class.ilECSParticipantSettingsGUI.php.

Referenced by getServerId().

◆ $settings

ilSetting ilECSParticipantSettingsGUI::$settings
protected

Definition at line 38 of file class.ilECSParticipantSettingsGUI.php.

◆ $tabs

ilTabsGUI ilECSParticipantSettingsGUI::$tabs
protected

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

◆ $toolbar

ilToolbarGUI ilECSParticipantSettingsGUI::$toolbar
protected

Definition at line 37 of file class.ilECSParticipantSettingsGUI.php.

◆ $tpl

ilGlobalTemplateInterface ilECSParticipantSettingsGUI::$tpl
protected

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

◆ $ui_factory

UiFactory ilECSParticipantSettingsGUI::$ui_factory
protected

Definition at line 36 of file class.ilECSParticipantSettingsGUI.php.


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