19declare(strict_types=1);
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();
54 $this->server_id = $a_server_id;
57 $this->
lng->loadLanguageModule(
'ecs');
58 $this->
lng->loadLanguageModule(
'auth');
85 $this->
ctrl->saveParameter($this,
'server_id');
86 $this->
ctrl->saveParameter($this,
'mid');
88 $next_class = $this->
ctrl->getNextClass($this);
89 $cmd = $this->
ctrl->getCmd(
'settings');
102 $this->
ctrl->returnToParent($this);
116 $this->tpl->setContent($form->getHTML());
125 if (!$consents->hasConsents()) {
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')
134 $this->
toolbar->addComponent($confirm);
136 $confirmation_trigger = $this->ui_factory->button()->standard(
137 $this->
lng->txt(
'ecs_consent_reset_confirm_title'),
139 )->withOnClick($confirm->getShowSignal());
140 $this->
toolbar->addComponent($confirmation_trigger);
147 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'ecs_user_consents_deleted'),
true);
148 $this->
ctrl->redirect($this,
'settings');
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'));
170 $placeholders[$authmode_name] = $form->getInput(
171 'username_placeholder_' . $authmode_name
174 $this->
getParticipant()->setOutgoingUsernamePlaceholders($placeholders);
178 switch ($error_code) {
180 $form->getItemByPostVar(
'outgoing_auth_modes')->setAlert(
181 $this->
lng->txt(
'ecs_username_place_holder_err_mssing_placeholder')
186 $this->tpl->setOnScreenMessage(
'success', $this->
lng->txt(
'settings_saved'),
true);
187 $this->
ctrl->redirect($this,
'settings');
190 $form->setValuesByPost();
191 $this->tpl->setOnScreenMessage(
'failure', $this->
lng->txt(
'err_check_input'));
201 $form->setFormAction($this->
ctrl->getFormAction($this));
202 $form->setTitle($this->
lng->txt(
'ecs_part_settings') .
' ' . $this->getParticipant()->getTitle());
206 $token->setInfo($this->
lng->txt(
'ecs_token_mechanism_info'));
213 $export->setValue(
"1");
215 $form->addItem($export);
218 $this->
lng->txt(
'ecs_export_local_account'),
219 'incoming_local_accounts'
221 $auth_types->setInfo($this->
lng->txt(
'ecs_export_local_account_info'));
222 $auth_types->setChecked($this->
getParticipant()->areIncomingLocalAccountsSupported());
223 $export->addSubItem($auth_types);
227 $this->
lng->txt(
'ecs_export_auth_type'),
230 $external_auth_type->setInfo($this->
lng->txt(
'ecs_export_auth_type_info'));
231 $external_auth_type->setValue(
234 foreach ($this->auth_factory->getAvailableStrategies() as $auth_type => $auth_strategy) {
235 $external_auth_type->addOption(
237 $this->
lng->txt(
"ecs_export_auth_type_{$auth_strategy->getName()}"),
242 $external_auth_type->addOption(
244 $this->
lng->txt(
'ecs_export_auth_type_none'),
248 $export->addSubItem($external_auth_type);
258 $export->addSubItem($obj_types);
263 $import->setValue(
"1");
265 $form->addItem($import);
269 $this->
lng->txt(
'ecs_import_user_credentials_by_auth_mode'),
270 'outgoing_auth_modes'
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);
277 if ($option_name ===
'ilias') {
282 sprintf($this->
lng->txt(
'ecs_import_auth_mode'), $option_text),
285 $user_credentials->addOption($option);
287 $this->
lng->txt(
'ecs_outgoing_user_credentials'),
288 'username_placeholder_' . $option_name
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(
297 $option->addSubItem($username_placeholder);
300 $this->
lng->txt(
'ecs_import_auth_type_default'),
303 $user_credentials->addOption($option);
313 $import->addSubItem($imp_types);
315 $form->addCommandButton(
'saveSettings', $this->
lng->txt(
'save'));
316 $form->addCommandButton(
'abort', $this->
lng->txt(
'cancel'));
323 foreach ($this->auth_factory->getAvailableStrategies() as $auth_strategy) {
324 $options[$auth_strategy->getName()] = $this->
lng->txt(
"auth_{$auth_strategy->getName()}");
339 $this->
tabs->clearTargets();
340 $this->
tabs->setBackTarget(
341 $this->
lng->txt(
'back'),
342 $this->ctrl->getParentReturnByClass(self::class)
Builds a Color from either hex- or rgb values.
This class represents an option in a checkbox group.
Class ilCtrl provides processing control methods.
const ERR_MISSING_USERNAME_PLACEHOLDER
const INCOMING_AUTH_TYPE_INACTIVE
ilECSParticipantSetting $participant
executeCommand()
Execute command.
saveSettings()
Save settings.
ilGlobalTemplateInterface $tpl
__construct(int $a_server_id, int $a_mid)
settings(?ilPropertyFormGUI $form=null)
Settings.
parseAvailableAuthModes()
initFormSettings()
Init settings form.
ilECSAuthFactory $auth_factory
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.
static getInstanceByServerId(int $a_server_id)
Get instance by server id.
static getServerIds()
Get all server ids.
This class represents an option in a radio group.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a text property in a property form.