ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
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 41 of file class.ilECSParticipantSettingsGUI.php.

42 {
43 global $DIC;
44
45 $this->lng = $DIC->language();
46 $this->tpl = $DIC->ui()->mainTemplate();
47 $this->ctrl = $DIC->ctrl();
48 $this->tabs = $DIC->tabs();
49 $this->ui_factory = $DIC->ui()->factory();
50 $this->toolbar = $DIC->toolbar();
51 $this->settings = $DIC->settings();
52
53 $this->server_id = $a_server_id;
54 $this->mid = $a_mid;
55
56 $this->lng->loadLanguageModule('ecs');
57
58 $this->participant = new ilECSParticipantSetting($this->getServerId(), $this->getMid());
59 }
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 97 of file class.ilECSParticipantSettingsGUI.php.

97 : void
98 {
99 $this->ctrl->returnToParent($this);
100 }

References ILIAS\Repository\ctrl().

+ Here is the call graph for this function:

◆ executeCommand()

ilECSParticipantSettingsGUI::executeCommand ( )

Execute command.

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

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

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

+ Here is the call graph for this function:

◆ getMid()

ilECSParticipantSettingsGUI::getMid ( )

Definition at line 66 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 71 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 61 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 195 of file class.ilECSParticipantSettingsGUI.php.

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

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(), and parseAvailableAuthModes().

Referenced by saveSettings(), and settings().

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

◆ isShibbolethActive()

ilECSParticipantSettingsGUI::isShibbolethActive ( )
protected

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

331 : bool
332 {
333 return (bool) $this->settings->get('shib_active', '0');
334 }

References settings().

Referenced by initFormSettings(), and parseAvailableAuthModes().

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

318 : array
319 {
320 $options = [];
321 if ($this->isShibbolethActive()) {
322 $options['shibboleth'] = $this->lng->txt('auth_shib');
323 }
326 $options['ldap_' . $server->getServerId()] = $server->getName();
327 }
328 return $options;
329 }
static getInstanceByServerId(int $a_server_id)
Get instance by server id.
static getServerIds()
Get all server ids.
$server
Definition: shib_login.php:28

References $server, $server_id, ilLDAPServer\getInstanceByServerId(), ilLDAPServer\getServerIds(), isShibbolethActive(), 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 116 of file class.ilECSParticipantSettingsGUI.php.

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

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

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

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

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

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

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

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

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

References initFormSettings(), and renderConsentToolbar().

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

+ 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 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: