ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
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 ()
 

Protected Attributes

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

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 42 of file class.ilECSParticipantSettingsGUI.php.

43 {
44 global $DIC;
45
46 $this->lng = $DIC->language();
47 $this->tpl = $DIC->ui()->mainTemplate();
48 $this->ctrl = $DIC->ctrl();
49 $this->tabs = $DIC->tabs();
50 $this->ui_factory = $DIC->ui()->factory();
51 $this->toolbar = $DIC->toolbar();
52 $this->settings = $DIC->settings();
53
54 $this->server_id = $a_server_id;
55 $this->mid = $a_mid;
56
57 $this->lng->loadLanguageModule('ecs');
58 $this->lng->loadLanguageModule('auth');
59
60 $this->participant = new ilECSParticipantSetting($this->getServerId(), $this->getMid());
61 $this->auth_factory = new ilECSAuthFactory();
62 }
settings(?ilPropertyFormGUI $form=null)
Settings.
global $DIC
Definition: shib_login.php:26

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

+ Here is the call graph for this function:

Member Function Documentation

◆ abort()

ilECSParticipantSettingsGUI::abort ( )
private

Abort editing.

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

100 : void
101 {
102 $this->ctrl->returnToParent($this);
103 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ executeCommand()

ilECSParticipantSettingsGUI::executeCommand ( )

Execute command.

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

83 : bool
84 {
85 $this->ctrl->saveParameter($this, 'server_id');
86 $this->ctrl->saveParameter($this, 'mid');
87
88 $next_class = $this->ctrl->getNextClass($this);
89 $cmd = $this->ctrl->getCmd('settings');
90
91 $this->setTabs();
92 $this->$cmd();
93
94 return true;
95 }

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

+ Here is the call graph for this function:

◆ getMid()

ilECSParticipantSettingsGUI::getMid ( )

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

References $mid.

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

+ Here is the caller graph for this function:

◆ getParticipant()

ilECSParticipantSettingsGUI::getParticipant ( )
private

Definition at line 74 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 64 of file class.ilECSParticipantSettingsGUI.php.

References $server_id.

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

+ Here is the caller graph for this function:

◆ initFormSettings()

ilECSParticipantSettingsGUI::initFormSettings ( )
protected

Init settings form.

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

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

References $token, ILIAS\Repository\ctrl(), getParticipant(), ilECSUtils\getPossibleReleaseTypes(), ilECSUtils\getPossibleRemoteTypes(), ilECSParticipantSetting\INCOMING_AUTH_TYPE_INACTIVE, ILIAS\Repository\lng(), and parseAvailableAuthModes().

Referenced by saveSettings(), and settings().

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

◆ parseAvailableAuthModes()

ilECSParticipantSettingsGUI::parseAvailableAuthModes ( )
protected

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

320 : array
321 {
322 $options = [];
323 foreach ($this->auth_factory->getAvailableStrategies() as $auth_strategy) {
324 $options[$auth_strategy->getName()] = $this->lng->txt("auth_{$auth_strategy->getName()}");
325 }
326
329 $options['ldap_' . $server->getServerId()] = $server->getName();
330 }
331 return $options;
332 }
static getInstanceByServerId(int $a_server_id)
Get instance by server id.
static getServerIds()
Get all server ids.
$server
Definition: shib_login.php:28

References ILIAS\UI\Implementation\Component\Input\Field\$options, $server, $server_id, ilLDAPServer\getInstanceByServerId(), ilLDAPServer\getServerIds(), and ILIAS\Repository\lng().

Referenced by initFormSettings(), and saveSettings().

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

◆ renderConsentToolbar()

ilECSParticipantSettingsGUI::renderConsentToolbar ( )
protected

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

119 : void
120 {
121 $consents = new ilECSParticipantConsents(
122 $this->getServerId(),
123 $this->getMid()
124 );
125 if (!$consents->hasConsents()) {
126 return;
127 }
128
129 $confirm = $this->ui_factory->modal()->interruptive(
130 $this->lng->txt('ecs_consent_reset_confirm_title'),
131 $this->lng->txt('ecs_consent_reset_confirm_title_info'),
132 $this->ctrl->getLinkTarget($this, 'resetConsents')
133 );
134 $this->toolbar->addComponent($confirm);
135
136 $confirmation_trigger = $this->ui_factory->button()->standard(
137 $this->lng->txt('ecs_consent_reset_confirm_title'),
138 ''
139 )->withOnClick($confirm->getShowSignal());
140 $this->toolbar->addComponent($confirmation_trigger);
141 }

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

Referenced by settings().

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

◆ resetConsents()

ilECSParticipantSettingsGUI::resetConsents ( )
protected

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

144 {
145 $consents = new ilECSParticipantConsents($this->getServerId(), $this->getMid());
146 $consents->delete();
147 $this->tpl->setOnScreenMessage('success', $this->lng->txt('ecs_user_consents_deleted'), true);
148 $this->ctrl->redirect($this, 'settings');
149 }

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

+ Here is the call graph for this function:

◆ saveSettings()

ilECSParticipantSettingsGUI::saveSettings ( )
protected

Save settings.

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

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

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

+ Here is the call graph for this function:

◆ setTabs()

ilECSParticipantSettingsGUI::setTabs ( )
private

Set tabs.

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

337 : void
338 {
339 $this->tabs->clearTargets();
340 $this->tabs->setBackTarget(
341 $this->lng->txt('back'),
342 $this->ctrl->getParentReturnByClass(self::class)
343 );
344 }

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

Referenced by executeCommand().

+ 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 109 of file class.ilECSParticipantSettingsGUI.php.

109 : void
110 {
111 $this->renderConsentToolbar();
112
113 if (!$form instanceof ilPropertyFormGUI) {
114 $form = $this->initFormSettings();
115 }
116 $this->tpl->setContent($form->getHTML());
117 }

References initFormSettings(), and renderConsentToolbar().

Referenced by __construct(), and saveSettings().

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

Field Documentation

◆ $auth_factory

ilECSAuthFactory ilECSParticipantSettingsGUI::$auth_factory
protected

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

◆ $ctrl

ilCtrl ilECSParticipantSettingsGUI::$ctrl
protected

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

◆ $lng

ilLanguage ilECSParticipantSettingsGUI::$lng
protected

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

◆ $mid

int ilECSParticipantSettingsGUI::$mid
private

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

Referenced by getMid().

◆ $participant

ilECSParticipantSetting ilECSParticipantSettingsGUI::$participant
private

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

Referenced by getParticipant().

◆ $server_id

int ilECSParticipantSettingsGUI::$server_id
private

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

Referenced by getServerId(), and parseAvailableAuthModes().

◆ $settings

ilSetting ilECSParticipantSettingsGUI::$settings
protected

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

◆ $tabs

ilTabsGUI ilECSParticipantSettingsGUI::$tabs
protected

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

◆ $toolbar

ilToolbarGUI ilECSParticipantSettingsGUI::$toolbar
protected

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

◆ $tpl

ilGlobalTemplateInterface ilECSParticipantSettingsGUI::$tpl
protected

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

◆ $ui_factory

UiFactory ilECSParticipantSettingsGUI::$ui_factory
protected

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


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