ILIAS  trunk Revision v12.0_alpha-377-g3641b37b9db
ILIAS\User\Profile\PersonalProfileGUI Class Reference

GUI class for personal profile. More...

+ Collaboration diagram for ILIAS\User\Profile\PersonalProfileGUI:

Public Member Functions

 executeCommand ()
 
 showProfile ()
 show profile form More...
 
 setTabs ()
 
 setHeader ()
 
 showPersonalData (bool $a_no_init=false)
 
 initPersonalDataForm ()
 
 savePersonalData ()
 
 goToEmailConfirmation ()
 
 changeEmail ()
 
 showPublicProfile (bool $a_no_init=false)
 
 showPublicProfileFields (\ilPropertyFormGUI $form, ?array $prefs=null, \ilRadioOption|\ilCheckboxGroupInputGUI|null $parent=null, bool $anonymized=false, string $key_suffix='')
 
 savePublicProfile ()
 
 showExportImport ()
 
 exportPersonalData ()
 
 downloadPersonalData ()
 Download personal data export file. More...
 
 importPersonalDataSelection ()
 
 initPersonalDataImportForm ()
 
 importPersonalData ()
 

Data Fields

const CHANGE_EMAIL_CMD = 'changeEmail'
 

Private Member Functions

 buildInfoText ()
 
 emailChanged ()
 
 emailCompletionForced ()
 
 addEmailChangeModal ()
 
 loginChanged ()
 
 updateLoginOrSetErrorMessages ()
 
 addDataFromFormToUser (array $skip_fields=[])
 
 getProfilePortfolio ()
 
 initPublicProfileForm ()
 
 showChecklist (int $active_step)
 
 getPublishedFromPost (string $identifier)
 
 buildKeySuffix ()
 

Private Attributes

const PERSONAL_DATA_FORM_ID = 'pd'
 
const PUBLISH_SETTINGS_PREFIX = 'chk_'
 
ilGlobalTemplateInterface $tpl
 
ilAppEventHandler $event
 
ilPropertyFormGUI $form
 
ilSetting $settings
 
ilObjUser $user
 
ilAuthSession $auth_session
 
StaticUrlServices $static_url
 
Language $lng
 
ilCtrl $ctrl
 
ilTabsGUI $tabs
 
ilToolbarGUI $toolbar
 
ilHelpGUI $help
 
HTTP $http
 
ilErrorHandling $error_handler
 
ChecklistGUI $checklist
 
ChecklistStatus $checklist_status
 
UIFactory $ui_factory
 
UIRenderer $ui_renderer
 
Refinery $refinery
 
ChangeMailRepository $change_mail_token_repo
 
PromptRepository $prompt_repository
 
GUIRequest $profile_request
 
ProfileImplementation $profile
 
UserSettings $user_settings
 
ilLogger $logger
 
FileUpload $uploads
 
Interruptive $email_change_confirmation_modal = null
 

Detailed Description

GUI class for personal profile.

Author
Alexander Killing killi.nosp@m.ng@l.nosp@m.eifos.nosp@m..de @ilCtrl_Calls ILIAS\User\Profile\PersonalProfileGUI: ILIAS\User\Profile\PublicProfileGUI @ilCtrl_Calls ILIAS\User\Profile\PersonalProfileGUI: ILIAS\User\Privacy\SettingsGUI @ilCtrl_Calls ILIAS\User\Profile\PersonalProfileGUI: ilLegalDocumentsAgreementGUI, ilLegalDocumentsWithdrawalGUI

Definition at line 55 of file class.PersonalProfileGUI.php.

Member Function Documentation

◆ addDataFromFormToUser()

ILIAS\User\Profile\PersonalProfileGUI::addDataFromFormToUser ( array  $skip_fields = [])
private

Definition at line 482 of file class.PersonalProfileGUI.php.

484 : void {
485 $this->user = $this->profile->addFormValuesToUser($this->form, Context::User, $this->user, $skip_fields);
486 $this->user->setProfileIncomplete(false);
487
488 $this->user->setTitle($this->user->getFullname());
489 $this->user->setDescription($this->user->getEmail());
490 }
form(?array $class_path, string $cmd, string $submit_caption="")

◆ addEmailChangeModal()

ILIAS\User\Profile\PersonalProfileGUI::addEmailChangeModal ( )
private

Definition at line 393 of file class.PersonalProfileGUI.php.

393 : bool
394 {
395 $form_id = 'form_' . self::PERSONAL_DATA_FORM_ID;
396
397 $message = $this->lng->txt('confirm_logout_for_email_change');
398 if ((int) $this->settings->get('new_registration_type', '1') === \ilRegistrationSettings::IL_REG_ACTIVATION) {
399 $message .= '<br>' . $this->lng->txt('confirm_logout_for_email_change_with_confirmation');
400 }
401
402 $modal = $this->ui_factory->modal()->interruptive(
403 $this->lng->txt('confirm'),
404 $message,
405 ''
406 )->withActionButtonLabel($this->lng->txt('change'));
407 $this->email_change_confirmation_modal = $modal->withOnLoad($modal->getShowSignal())
408 ->withAdditionalOnLoadCode(
409 static function ($id) use ($form_id) {
410 return "var button = {$id}.querySelector('input[type=\"submit\"]'); "
411 . "button.addEventListener('click', (e) => {e.preventDefault();"
412 . "document.getElementById('{$form_id}').submit();});";
413 }
414 );
415
416 $this->form->setFormAction($this->ctrl->getFormActionByClass(self::class, 'goToEmailConfirmation'));
417 return true;
418 }
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23

References $id, ILIAS\Repository\ctrl(), ILIAS\Repository\form(), ilRegistrationSettings\IL_REG_ACTIVATION, ILIAS\Repository\lng(), and ILIAS\Repository\settings().

+ Here is the call graph for this function:

◆ buildInfoText()

ILIAS\User\Profile\PersonalProfileGUI::buildInfoText ( )
private

Definition at line 289 of file class.PersonalProfileGUI.php.

289 : string
290 {
291 $change_mail_info = '';
292 if ($this->change_mail_token_repo->hasUserValidEmailConfirmationToken($this->user)) {
293 $change_mail_info = $this->lng->txt('change_email_info_message');
294 }
295
296 $it = '';
297 if ($this->profile_request->getPrompted() === 1) {
298 $it = $this->prompt_repository->getSettings()->getPromptText($this->user->getLanguage());
299 }
300 if ($it === '') {
301 $it = $this->prompt_repository->getSettings()->getInfoText($this->user->getLanguage());
302 }
303 if (trim($it) === '') {
304 return $change_mail_info === ''
305 ? ''
306 : $this->ui_renderer->render($this->ui_factory->messageBox()->info($change_mail_info));
307 }
308
309 if ($change_mail_info !== '') {
310 $it .= '<br>' . $change_mail_info;
311 }
312
313 $pub_prof = in_array($this->user->getPref('public_profile'), ['y', 'n', 'g'])
314 ? $this->user->getPref('public_profile')
315 : 'n';
316 $box = $this->ui_factory->messageBox()->info($it);
317 if ($pub_prof === 'n') {
318 $box = $box->withLinks(
319 [$this->ui_factory->link()->standard(
320 $this->lng->txt('user_make_profile_public'),
321 $this->ctrl->getLinkTarget($this, 'showPublicProfile')
322 )]
323 );
324 }
325 return $this->ui_renderer->render($box);
326 }

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

+ Here is the call graph for this function:

◆ buildKeySuffix()

ILIAS\User\Profile\PersonalProfileGUI::buildKeySuffix ( )
private

Definition at line 900 of file class.PersonalProfileGUI.php.

900 : string
901 {
902 switch ($this->form->getInput('public_profile')) {
903 case 'y':
904 return '-1';
905 case 'g':
906 return '-2';
907 default:
908 return '';
909 }
910 }

References ILIAS\Repository\form().

+ Here is the call graph for this function:

◆ changeEmail()

ILIAS\User\Profile\PersonalProfileGUI::changeEmail ( )

Definition at line 492 of file class.PersonalProfileGUI.php.

492 : void
493 {
494 $token = $this->change_mail_token_repo->getTokenForTokenString(
495 $this->profile_request->getToken(),
496 $this->user
497 );
498
499 if ($token === null) {
500 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('email_could_not_be_changed'));
501 $this->showPublicProfile();
502 return;
503 }
504
505 if ($token->getStatus() === ChangeMailStatus::Login
506 && (int) $this->settings->get('new_registration_type', '1') === \ilRegistrationSettings::IL_REG_ACTIVATION) {
507 (new ChangeMailMail(
508 $this->user,
509 $this->change_mail_token_repo->moveToNextStep($token, time())
510 ->getUriForStatus($this->static_url->builder()),
511 $this->lng,
512 $this->logger
513 ))->send($token->getNewEmail(), ChangeMailStatus::EmailConfirmation->getValidity($this->settings));
514 $this->tpl->setOnScreenMessage('info', $this->lng->txt('change_email_email_sent'));
515 $this->showPublicProfile();
516 return;
517 }
518
519 $this->user->setEmail($token->getNewEmail());
520 $this->user->update();
521 $this->change_mail_token_repo->deleteEntryByToken($token->getToken());
522 $this->change_mail_token_repo->deleteExpiredEntries();
523
524 $this->tpl->setOnScreenMessage(
525 'success',
526 $this->lng->txt('saved_successfully')
527 );
528 $this->showPublicProfile();
529 return;
530 }
$token
Definition: xapitoken.php:67
catch(ilCmiXapiException $e) send($response)
Definition: xapitoken.php:97

References $token, ilRegistrationSettings\IL_REG_ACTIVATION, ILIAS\Repository\lng(), send(), ILIAS\Repository\settings(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ downloadPersonalData()

ILIAS\User\Profile\PersonalProfileGUI::downloadPersonalData ( )

Download personal data export file.

Definition at line 809 of file class.PersonalProfileGUI.php.

809 : void
810 {
811 $this->user->sendPersonalDataFile();
812 }

References ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ emailChanged()

ILIAS\User\Profile\PersonalProfileGUI::emailChanged ( )
private

Definition at line 367 of file class.PersonalProfileGUI.php.

367 : bool
368 {
369 $identifier_email = $this->profile->getFieldByClass(Email::class)->getIdentifier();
370 $email_input = $this->form->getItemByPostVar($identifier_email);
371 if ($email_input !== null && !$email_input->getDisabled()
372 && $this->form->getInput($identifier_email) !== $this->user->getEmail()) {
373 return true;
374 }
375
376 return false;
377 }

References ILIAS\Repository\form(), and ILIAS\Repository\profile().

+ Here is the call graph for this function:

◆ emailCompletionForced()

ILIAS\User\Profile\PersonalProfileGUI::emailCompletionForced ( )
private

Definition at line 379 of file class.PersonalProfileGUI.php.

379 : bool
380 {
381 $current_email = $this->user->getEmail();
382 if (
383 $this->user->getProfileIncomplete()
384 && $this->profile->getFieldByClass(Email::class)->isRequired()
385 && ($current_email === null || $current_email === '')
386 ) {
387 return true;
388 }
389
390 return false;
391 }

References ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ executeCommand()

ILIAS\User\Profile\PersonalProfileGUI::executeCommand ( )

Definition at line 151 of file class.PersonalProfileGUI.php.

151 : void
152 {
153 $next_class = $this->ctrl->getNextClass();
154
155 switch ($next_class) {
156 case strtolower(PublicProfileGUI::class):
157 $pub_profile_gui = new PublicProfileGUI($this->user->getId());
158 $pub_profile_gui->setBackUrl($this->ctrl->getLinkTarget($this, 'showPersonalData'));
159 $this->ctrl->forwardCommand($pub_profile_gui);
160 $this->tpl->printToStdout();
161 break;
162
163 case strtolower(PrivacySettingsGUI::class):
164 $this->setHeader();
165 $this->setTabs();
166 $this->tabs->activateTab('visibility_settings');
168 $this->ctrl->forwardCommand(
169 new PrivacySettingsGUI(
170 $this->lng,
171 $this->ctrl,
172 $this->event,
173 $this->http->request(),
174 $this->user,
175 $this->settings,
176 $this->tpl,
177 $this->ui_factory,
178 $this->ui_renderer,
179 $this->user_settings,
180 new Visibility(
181 $this->lng,
182 $this->settings,
183 $this->user
184 ),
185 $this->checklist_status,
186 new \ilSetting('chatroom'),
187 new \ilSetting('notifications')
188 )
189 );
190 break;
191
192 case strtolower(\ilLegalDocumentsAgreementGUI::class):
193 $this->ctrl->forwardCommand(new \ilLegalDocumentsAgreementGUI());
194 $this->tpl->printToStdout();
195 break;
196
197 case strtolower(\ilLegalDocumentsWithdrawalGUI::class):
198 $this->ctrl->forwardCommand(new \ilLegalDocumentsWithdrawalGUI());
199 $this->tpl->printToStdout();
200 break;
201
202 default:
203 $this->setTabs();
204 $cmd = $this->ctrl->getCmd('showPersonalData');
205 $this->$cmd();
206 break;
207 }
208 }
ILIAS Setting Class.
static http()
Fetches the global http state from ILIAS.

References ILIAS\Repository\ctrl(), ILIAS\Repository\event(), ILIAS\FileDelivery\http(), ILIAS\Repository\lng(), ILIAS\User\Profile\PersonalProfileGUI\setHeader(), ILIAS\User\Profile\PersonalProfileGUI\setTabs(), ILIAS\Repository\settings(), ILIAS\User\Profile\PersonalProfileGUI\showChecklist(), ILIAS\User\Profile\ChecklistStatus\STEP_VISIBILITY_OPTIONS, ILIAS\Repository\tabs(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ exportPersonalData()

ILIAS\User\Profile\PersonalProfileGUI::exportPersonalData ( )

Definition at line 799 of file class.PersonalProfileGUI.php.

799 : void
800 {
801 $this->user->exportPersonalData();
802 $this->user->sendPersonalDataFile();
803 $this->ctrl->redirect($this, 'showExportImport');
804 }

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

+ Here is the call graph for this function:

◆ getProfilePortfolio()

ILIAS\User\Profile\PersonalProfileGUI::getProfilePortfolio ( )
private

Definition at line 547 of file class.PersonalProfileGUI.php.

547 : ?int
548 {
549 if ($this->settings->get('user_portfolios')) {
550 return \ilObjPortfolio::getDefaultPortfolio($this->user->getId());
551 }
552 return null;
553 }

References ILIAS\Repository\settings(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ getPublishedFromPost()

ILIAS\User\Profile\PersonalProfileGUI::getPublishedFromPost ( string  $identifier)
private

Definition at line 886 of file class.PersonalProfileGUI.php.

886 : bool
887 {
888 $key = self::PUBLISH_SETTINGS_PREFIX . $identifier . $this->buildKeySuffix();
889
890 if (!$this->http->wrapper()->post()->has($key)) {
891 return false;
892 }
893
894 return $this->http->wrapper()->post()->retrieve(
895 $key,
896 $this->refinery->kindlyTo()->string()
897 ) === '1';
898 }

References ILIAS\FileDelivery\http(), and ILIAS\Repository\refinery().

+ Here is the call graph for this function:

◆ goToEmailConfirmation()

ILIAS\User\Profile\PersonalProfileGUI::goToEmailConfirmation ( )

Definition at line 455 of file class.PersonalProfileGUI.php.

455 : void
456 {
457 $this->initPersonalDataForm();
458 if (!$this->form->checkInput()
459 || $this->loginChanged() && !$this->updateLoginOrSetErrorMessages()) {
460 $this->form->setValuesByPost();
461 $this->showPersonalData(true);
462 return;
463 }
464 $this->addDataFromFormToUser([Email::class]);
465 $this->user->update();
466
468 $this->auth_session->logout();
469 session_unset();
470 $token = $this->change_mail_token_repo->getNewTokenForUser(
471 $this->user,
472 $this->form->getInput(
473 $this->profile->getFieldByClass(Email::class)->getIdentifier()
474 ),
475 time()
476 );
477 $this->ctrl->redirectToURL(
478 $token->getUriForStatus($this->static_url->builder())->__toString()
479 );
480 }
static setClosingContext(int $a_context)
set closing context (for statistics)
const int SESSION_CLOSE_USER

References $token, ILIAS\Repository\ctrl(), ILIAS\Repository\form(), ilSession\SESSION_CLOSE_USER, ilSession\setClosingContext(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ importPersonalData()

ILIAS\User\Profile\PersonalProfileGUI::importPersonalData ( )

Definition at line 858 of file class.PersonalProfileGUI.php.

858 : void
859 {
861 if ($this->form->checkInput()) {
862 $this->user->importPersonalData(
863 $_FILES['file'],
864 (bool) $this->form->getInput('profile_data'),
865 (bool) $this->form->getInput('settings'),
866 (bool) $this->form->getInput('notes'),
867 (bool) $this->form->getInput('calendar')
868 );
869 $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_obj_modified'), true);
870 $this->ctrl->redirect($this, '');
871 } else {
872 $this->tabs->activateTab('export');
873 $this->setHeader();
874 $this->form->setValuesByPost();
875 $this->tpl->setContent($this->form->getHTML());
876 $this->tpl->printToStdout();
877 }
878 }

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

+ Here is the call graph for this function:

◆ importPersonalDataSelection()

ILIAS\User\Profile\PersonalProfileGUI::importPersonalDataSelection ( )

Definition at line 814 of file class.PersonalProfileGUI.php.

814 : void
815 {
816 $this->tabs->activateTab('export');
817 $this->setHeader();
818
820
821 $this->tpl->setContent($this->form->getHTML());
822 $this->tpl->printToStdout();
823 }

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

+ Here is the call graph for this function:

◆ initPersonalDataForm()

ILIAS\User\Profile\PersonalProfileGUI::initPersonalDataForm ( )

Definition at line 328 of file class.PersonalProfileGUI.php.

328 : void
329 {
330 $this->form = new \ilPropertyFormGUI();
331 $this->form->setFormAction($this->ctrl->getFormAction($this));
332 $this->form->setId(self::PERSONAL_DATA_FORM_ID);
333
334 $this->form = $this->profile->addFieldsToForm($this->form, Context::User, true, $this->user);
335
336 $this->form->addCommandButton('savePersonalData', $this->lng->txt('user_save_continue'));
337 }

References ILIAS\Repository\ctrl(), ILIAS\Repository\form(), ILIAS\Repository\lng(), ILIAS\Repository\profile(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ initPersonalDataImportForm()

ILIAS\User\Profile\PersonalProfileGUI::initPersonalDataImportForm ( )

Definition at line 825 of file class.PersonalProfileGUI.php.

825 : void
826 {
827 $this->form = new \ilPropertyFormGUI();
828
829 // input file
830 $fi = new \ilFileInputGUI($this->lng->txt('file'), 'file');
831 $fi->setRequired(true);
832 $fi->setSuffixes(['zip']);
833 $this->form->addItem($fi);
834
835 // profile data
836 $cb = new \ilCheckboxInputGUI($this->lng->txt('pd_profile_data'), 'profile_data');
837 $this->form->addItem($cb);
838
839 // settings
840 $cb = new \ilCheckboxInputGUI($this->lng->txt('settings'), 'settings');
841 $this->form->addItem($cb);
842
843 // personal notes
844 $cb = new \ilCheckboxInputGUI($this->lng->txt('notes'), 'notes');
845 $this->form->addItem($cb);
846
847 // calendar entries
848 $cb = new \ilCheckboxInputGUI($this->lng->txt('pd_private_calendars'), 'calendar');
849 $this->form->addItem($cb);
850
851 $this->form->addCommandButton('importPersonalData', $this->lng->txt('import'));
852 $this->form->addCommandButton('showExportImport', $this->lng->txt('cancel'));
853
854 $this->form->setTitle($this->lng->txt('pd_import_personal_data'));
855 $this->form->setFormAction($this->ctrl->getFormAction($this));
856 }

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

+ Here is the call graph for this function:

◆ initPublicProfileForm()

ILIAS\User\Profile\PersonalProfileGUI::initPublicProfileForm ( )
private

Definition at line 555 of file class.PersonalProfileGUI.php.

555 : void
556 {
557 $this->form = new \ilPropertyFormGUI();
558
559 $this->form->setTitle($this->lng->txt('user_publish_options'));
560 $this->form->setDescription($this->lng->txt('user_public_profile_info'));
561 $this->form->setFormAction($this->ctrl->getFormAction($this));
562
563 $portfolio_id = $this->getProfilePortfolio();
564
565 if (!$portfolio_id) {
566 // Activate public profile
567 $radg = new \ilRadioGroupInputGUI($this->lng->txt('user_activate_public_profile'), 'public_profile');
568 $info = $this->lng->txt('user_activate_public_profile_info');
569 $radg->setValue(
570 (new Visibility($this->lng, $this->settings, $this->user))->getMode()
571 );
572 $op1 = new \ilRadioOption($this->lng->txt('usr_public_profile_disabled'), 'n', $this->lng->txt('usr_public_profile_disabled_info'));
573 $radg->addOption($op1);
574 $op2 = new \ilRadioOption($this->lng->txt('usr_public_profile_logged_in'), 'y');
575 $radg->addOption($op2);
576 if ($this->settings->get('enable_global_profiles')) {
577 $op3 = new \ilRadioOption($this->lng->txt('usr_public_profile_global'), 'g');
578 $radg->addOption($op3);
579 }
580 $this->form->addItem($radg);
581
582 // #11773
583 if ($this->settings->get('user_portfolios')) {
584 // #10826
585 $href = $this->ctrl->getLinkTargetByClass(\ilDashboardGUI::class, 'jumpToPortfolio');
586 $prtf = '<br />' . $this->lng->txt('user_profile_portfolio');
587 $prtf .= '<br /><a href="' . $href . '">&raquo; ' .
588 $this->lng->txt('user_portfolios') . '</a>';
589 $info .= $prtf;
590 }
591
592 $radg->setInfo($info);
593 } else {
594 $this->ctrl->setParameterByClass(\ilDashboardGUI::class, 'prt_id', $portfolio_id);
595 $href = $this->ctrl->getLinkTargetByClass(\ilDashboardGUI::class, 'jumpToPortfolio');
596 $this->ctrl->clearParameterByClass(\ilDashboardGUI::class, 'prt_id');
597 $prtf = $this->lng->txt('user_profile_portfolio_selected');
598 $prtf .= '<br /><a href="' . $href . '">&raquo; ' .
599 $this->lng->txt('portfolio') . '</a>';
600
601 $info = new \ilCustomInputGUI($this->lng->txt('user_activate_public_profile'));
602 $info->setHtml($prtf);
603 $this->form->addItem($info);
604 $this->showPublicProfileFields($this->form);
605 }
606
607 if (isset($op2)) {
608 $this->showPublicProfileFields($this->form, null, $op2, false, '-1');
609 }
610 if (isset($op3)) {
611 $this->showPublicProfileFields($this->form, null, $op3, false, '-2');
612 }
613 $this->form->setForceTopButtons(true);
614 $this->form->addCommandButton('savePublicProfile', $this->lng->txt('user_save_continue'));
615 }
showPublicProfileFields(\ilPropertyFormGUI $form, ?array $prefs=null, \ilRadioOption|\ilCheckboxGroupInputGUI|null $parent=null, bool $anonymized=false, string $key_suffix='')
$info
Definition: entry_point.php:21

References $info, ILIAS\Repository\ctrl(), ILIAS\Repository\form(), ILIAS\Repository\lng(), ILIAS\Repository\settings(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ loginChanged()

ILIAS\User\Profile\PersonalProfileGUI::loginChanged ( )
private

Definition at line 420 of file class.PersonalProfileGUI.php.

420 : bool
421 {
422 if ($this->profile->userFieldEditableByUser('username')
423 && $this->form->getInput('username') !== $this->user->getLogin()) {
424 return true;
425 }
426
427 return false;
428 }

References ILIAS\Repository\profile().

+ Here is the call graph for this function:

◆ savePersonalData()

ILIAS\User\Profile\PersonalProfileGUI::savePersonalData ( )

Definition at line 339 of file class.PersonalProfileGUI.php.

339 : void
340 {
341 $this->initPersonalDataForm();
342 $this->uploads->process();
343
344 if (!$this->form->checkInput()
345 || !$this->emailCompletionForced()
346 && $this->emailChanged()
347 && $this->addEmailChangeModal()
348 || $this->loginChanged() && !$this->updateLoginOrSetErrorMessages()) {
349 $this->form->setValuesByPost();
350 $this->profile->tempStorePicture($this->form);
351 $this->showPersonalData(true);
352 return;
353 }
354
355 $this->addDataFromFormToUser();
356
357 $this->user = $this->checklist_status->setStepSucessOnUser(
359 $this->user
360 );
361 $this->user->update();
362
363 $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_obj_modified'), true);
364 $this->ctrl->redirect($this, 'showPublicProfile');
365 }

References ILIAS\Repository\ctrl(), ILIAS\Repository\form(), ILIAS\Repository\lng(), ILIAS\Repository\profile(), ILIAS\User\Profile\ChecklistStatus\STEP_PROFILE_DATA, and ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ savePublicProfile()

ILIAS\User\Profile\PersonalProfileGUI::savePublicProfile ( )

Definition at line 721 of file class.PersonalProfileGUI.php.

721 : void
722 {
723 $this->initPublicProfileForm();
724 if (!$this->form->checkInput()) {
725 $this->form->setValuesByPost();
726 $this->tpl->showPublicProfile(true);
727 }
728
729 if ($this->form->getInput('public_profile') !== '') {
730 $this->user->setPref('public_profile', $this->form->getInput('public_profile'));
731 }
732
733 $this->user = array_reduce(
734 $this->profile->getVisibleFields(Context::User, $this->user),
735 fn(\ilObjUser $c, ProfileField $v): \ilObjUser =>
736 $v->setPublishedOnUser($c, $this->getPublishedFromPost($v->getIdentifier())),
737 $this->user
738 );
739
740 if (\ilBadgeHandler::getInstance()->isActive()) {
741 $badge_positions = $this->form->getInput('bpos' . $this->buildKeySuffix()) ?? [];
742 if (is_array($badge_positions) && $badge_positions !== []) {
743 \ilBadgeAssignment::updatePositions($this->user->getId(), $badge_positions);
744 }
745 }
746
747 $this->user = $this->checklist_status->setStepSucessOnUser(
749 $this->user
750 );
751 $this->user->update();
752
753 // update lucene index
754 \ilLuceneIndexer::updateLuceneIndex([(int) $this->user->getId()]);
755 $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_obj_modified'), true);
756
757 if (\ilSession::get('orig_request_target')) {
758 $target = \ilSession::get('orig_request_target');
759 \ilSession::set('orig_request_target', '');
760 \ilUtil::redirect($target);
761 }
762
763 $this->ctrl->redirectByClass([self::class, PrivacySettingsGUI::class], '');
764 }
static updatePositions(int $a_user_id, array $a_positions)
static updateLuceneIndex(array $a_obj_ids)
Update lucene index.
User class.
static get(string $a_var)
static set(string $a_var, $a_val)
Set a value.
static redirect(string $a_script)
$c
Definition: deliver.php:25

References $c, ILIAS\Repository\ctrl(), ILIAS\Repository\form(), ilSession\get(), ilBadgeHandler\getInstance(), ILIAS\Repository\lng(), ILIAS\Repository\profile(), ilUtil\redirect(), ilSession\set(), ilLuceneIndexer\updateLuceneIndex(), ilBadgeAssignment\updatePositions(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ setHeader()

ILIAS\User\Profile\PersonalProfileGUI::setHeader ( )

Definition at line 257 of file class.PersonalProfileGUI.php.

257 : void
258 {
259 $this->tpl->setTitle($this->lng->txt('personal_profile'));
260 }

References ILIAS\Repository\lng().

Referenced by ILIAS\User\Profile\PersonalProfileGUI\executeCommand().

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

◆ setTabs()

ILIAS\User\Profile\PersonalProfileGUI::setTabs ( )

Definition at line 221 of file class.PersonalProfileGUI.php.

221 : void
222 {
223 $this->help->setScreenIdComponent('user');
224
225 // personal data
226 $this->tabs->addTab(
227 'personal_data',
228 $this->lng->txt('user_profile_data'),
229 $this->ctrl->getLinkTarget($this, 'showPersonalData')
230 );
231
232 // publishing options
233 $this->tabs->addTab(
234 'public_profile',
235 $this->lng->txt('user_publish_options'),
236 $this->ctrl->getLinkTarget($this, 'showPublicProfile')
237 );
238
239 // visibility settings
240 $txt_visibility = $this->checklist_status->anyVisibilitySettings()
241 ? $this->lng->txt('user_visibility_settings')
242 : $this->lng->txt('preview');
243 $this->tabs->addTab(
244 'visibility_settings',
245 $txt_visibility,
246 $this->ctrl->getLinkTargetByClass(PrivacySettingsGUI::class, '')
247 );
248
249 // export
250 $this->tabs->addTab(
251 'export',
252 $this->lng->txt('export') . '/' . $this->lng->txt('import'),
253 $this->ctrl->getLinkTarget($this, 'showExportImport')
254 );
255 }

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

Referenced by ILIAS\User\Profile\PersonalProfileGUI\executeCommand().

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

◆ showChecklist()

ILIAS\User\Profile\PersonalProfileGUI::showChecklist ( int  $active_step)
private

Definition at line 880 of file class.PersonalProfileGUI.php.

880 : void
881 {
882 $main_tpl = $this->tpl;
883 $main_tpl->setRightContent($this->checklist->render($active_step));
884 }
setRightContent(string $a_html)
Sets content of right column.

Referenced by ILIAS\User\Profile\PersonalProfileGUI\executeCommand().

+ Here is the caller graph for this function:

◆ showExportImport()

ILIAS\User\Profile\PersonalProfileGUI::showExportImport ( )

Definition at line 766 of file class.PersonalProfileGUI.php.

766 : void
767 {
768 $this->tabs->activateTab('export');
769 $this->setHeader();
770
771 $button = $this->ui_factory->link()->standard(
772 $this->lng->txt('pd_export_profile'),
773 $this->ctrl->getLinkTarget($this, 'exportPersonalData')
774 );
775 $this->toolbar->addStickyItem($button);
776
777 $exp_file = $this->user->getPersonalDataExportFile();
778 if ($exp_file != '') {
779 $this->toolbar->addSeparator();
780 $this->toolbar->addComponent(
781 $this->ui_factory->link()->standard(
782 $this->lng->txt("pd_download_last_export_file"),
783 $this->ctrl->getLinkTarget($this, "downloadPersonalData")
784 )
785 );
786 }
787
788 $this->toolbar->addSeparator();
789 $this->toolbar->addComponent(
790 $this->ui_factory->link()->standard(
791 $this->lng->txt("pd_import_personal_data"),
792 $this->ctrl->getLinkTarget($this, "importPersonalDataSelection")
793 )
794 );
795
796 $this->tpl->printToStdout();
797 }

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

+ Here is the call graph for this function:

◆ showPersonalData()

ILIAS\User\Profile\PersonalProfileGUI::showPersonalData ( bool  $a_no_init = false)

Definition at line 262 of file class.PersonalProfileGUI.php.

264 : void {
265 $this->tabs->activateTab('personal_data');
266
267 $this->setHeader();
268
270
271 if (!$a_no_init) {
272 $this->initPersonalDataForm();
273 // catch feedback message
274 if ($this->user->getProfileIncomplete()) {
275 $this->tpl->setOnScreenMessage('info', $this->lng->txt('profile_incomplete'));
276 }
277 }
278
279 $modal = '';
280 if ($this->email_change_confirmation_modal !== null) {
281 $modal = $this->ui_renderer->render($this->email_change_confirmation_modal);
282 }
283
284 $this->tpl->setContent($this->buildInfoText() . $this->form->getHTML() . $modal);
285
286 $this->tpl->printToStdout();
287 }

Referenced by ILIAS\User\Profile\PersonalProfileGUI\showProfile().

+ Here is the caller graph for this function:

◆ showProfile()

ILIAS\User\Profile\PersonalProfileGUI::showProfile ( )

show profile form

/OLD IMPLEMENTATION DEPRECATED

Definition at line 215 of file class.PersonalProfileGUI.php.

215 : void
216 {
217 $this->showPersonalData();
218 }

References ILIAS\User\Profile\PersonalProfileGUI\showPersonalData().

+ Here is the call graph for this function:

◆ showPublicProfile()

ILIAS\User\Profile\PersonalProfileGUI::showPublicProfile ( bool  $a_no_init = false)

Definition at line 532 of file class.PersonalProfileGUI.php.

532 : void
533 {
534 $this->tabs->activateTab('public_profile');
536
537 $this->setHeader();
538
539 if (!$a_no_init) {
540 $this->initPublicProfileForm();
541 }
542
543 $this->tpl->setContent($this->form->getHTML());
544 $this->tpl->printToStdout();
545 }

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

+ Here is the call graph for this function:

◆ showPublicProfileFields()

ILIAS\User\Profile\PersonalProfileGUI::showPublicProfileFields ( \ilPropertyFormGUI  $form,
?array  $prefs = null,
\ilRadioOption|\ilCheckboxGroupInputGUI|null  $parent = null,
bool  $anonymized = false,
string  $key_suffix = '' 
)

Definition at line 617 of file class.PersonalProfileGUI.php.

623 : void {
624 foreach ($this->profile->getVisibleFields(
625 Context::User,
626 null,
627 [],
628 [FirstName::class, LastName::class, Alias::class, OrganisationalUnits::class, Roles::class]
629 ) as $field) {
630 $value = $field->retrieveValueFromUser($this->user);
631 if (!$anonymized && ($value === '' || $value === '-' || $value === null)) {
632 continue;
633 }
634 if ($anonymized) {
635 $value = null;
636 }
637
638 if ($field->isVisibleToUser()) {
639 // #18795 - we should use ilUserProfile
640 switch ($field->getIdentifier()) {
641 case 'avatar':
642 $caption = $this->lng->txt('personal_picture');
643 $value = "<img src='{$value}' alt='{$this->lng->txt('user_avatar')}' />";
644 break;
645
646 default:
647 $caption = $field->getLabel($this->lng);
648 }
649 $cb = new \ilCheckboxInputGUI($caption, self::PUBLISH_SETTINGS_PREFIX . $field->getIdentifier() . $key_suffix);
650 $cb->setChecked(
651 $prefs === null
652 ? $field->isPublishedByUser($this->user)
653 : $prefs["public_{$field->getIdentifier()}"] ?? false
654 );
655
656 $cb->setOptionTitle(
657 $this->refinery->byTrying([
658 $this->refinery->kindlyTo()->string(),
659 $this->refinery->custom()->transformation(
660 function (mixed $v): string {
661 return array_reduce(
662 $this->refinery->kindlyTo()->listOf(
663 $this->refinery->kindlyTo()->string()
664 )->transform($v),
665 static fn(string $c, string $v): string => $c === ''
666 ? $v : "{$c}, {$v}",
667 ''
668 );
669 }
670 ),
671 $this->refinery->always('')
672 ])->transform($value)
673 );
674
675 if (!$parent) {
676 $form->addItem($cb);
677 } else {
678 $parent->addSubItem($cb);
679 }
680 }
681 }
682
683 if (!$anonymized) {
685 if ($handler->isActive()) {
686 $badge_options = [];
687
688 foreach (\ilBadgeAssignment::getInstancesByUserId($this->user->getId()) as $ass) {
689 // only active
690 if ($ass->getPosition()) {
691 $badge = new \ilBadge($ass->getBadgeId());
692 $badge_options[] = $badge->getTitle();
693 }
694 }
695
696 if (count($badge_options) > 1) {
697 $badge_order = new \ilNonEditableValueGUI($this->lng->txt('obj_bdga'), 'bpos' . $key_suffix);
698 $badge_order->setMultiValues($badge_options);
699 $badge_order->setValue(array_shift($badge_options));
700 $badge_order->setMulti(true, true, false);
701
702 if (!$parent) {
703 $form->addItem($badge_order);
704 } else {
705 $parent->addSubItem($badge_order);
706 }
707 }
708 }
709 }
710
711 // permalink
712 $ne = new \ilNonEditableValueGUI($this->lng->txt('perma_link'), '');
713 $ne->setValue(\ilLink::_getLink($this->user->getId(), 'usr'));
714 if (!$parent) {
715 $form->addItem($ne);
716 } else {
717 $parent->addSubItem($ne);
718 }
719 }
static getInstancesByUserId(int $a_user_id)
$handler
Definition: oai.php:29

References $c, ilPropertyFormGUI\addItem(), ILIAS\Repository\lng(), ILIAS\Repository\refinery(), ILIAS\Refinery\transform(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ updateLoginOrSetErrorMessages()

ILIAS\User\Profile\PersonalProfileGUI::updateLoginOrSetErrorMessages ( )
private

Definition at line 430 of file class.PersonalProfileGUI.php.

430 : bool
431 {
432 $login = $this->form->getInput('username');
433 if ($login === '' || !\ilUtil::isLogin($login)) {
434 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('form_input_not_valid'));
435 $this->form->getItemByPostVar('username')->setAlert($this->lng->txt('login_invalid'));
436 return false;
437 }
438
439 if (\ilObjUser::_loginExists($login, $this->user->getId())) {
440 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('form_input_not_valid'));
441 $this->form->getItemByPostVar('username')->setAlert($this->lng->txt('loginname_already_exists'));
442 return false;
443 }
444
445 try {
446 $this->user->updateLogin($login, Context::User);
447 return true;
448 } catch (\ilUserException $e) {
449 $this->tpl->setOnScreenMessage('failure', $this->lng->txt('form_input_not_valid'));
450 $this->form->getItemByPostVar('username')->setAlert($e->getMessage());
451 return false;
452 }
453 }
static _loginExists(string $a_login, int $a_user_id=0)
static isLogin(string $a_login)

References Vendor\Package\$e, ilObjUser\_loginExists(), ILIAS\Repository\form(), ilUtil\isLogin(), ILIAS\Repository\lng(), and ILIAS\Repository\user().

+ Here is the call graph for this function:

Field Documentation

◆ $auth_session

ilAuthSession ILIAS\User\Profile\PersonalProfileGUI::$auth_session
private

Definition at line 66 of file class.PersonalProfileGUI.php.

◆ $change_mail_token_repo

ChangeMailRepository ILIAS\User\Profile\PersonalProfileGUI::$change_mail_token_repo
private

Definition at line 81 of file class.PersonalProfileGUI.php.

◆ $checklist

ChecklistGUI ILIAS\User\Profile\PersonalProfileGUI::$checklist
private

Definition at line 75 of file class.PersonalProfileGUI.php.

◆ $checklist_status

ChecklistStatus ILIAS\User\Profile\PersonalProfileGUI::$checklist_status
private

Definition at line 76 of file class.PersonalProfileGUI.php.

◆ $ctrl

ilCtrl ILIAS\User\Profile\PersonalProfileGUI::$ctrl
private

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

◆ $email_change_confirmation_modal

Interruptive ILIAS\User\Profile\PersonalProfileGUI::$email_change_confirmation_modal = null
private

Definition at line 90 of file class.PersonalProfileGUI.php.

◆ $error_handler

ilErrorHandling ILIAS\User\Profile\PersonalProfileGUI::$error_handler
private

Definition at line 74 of file class.PersonalProfileGUI.php.

◆ $event

ilAppEventHandler ILIAS\User\Profile\PersonalProfileGUI::$event
private

Definition at line 62 of file class.PersonalProfileGUI.php.

◆ $form

ilPropertyFormGUI ILIAS\User\Profile\PersonalProfileGUI::$form
private

Definition at line 63 of file class.PersonalProfileGUI.php.

◆ $help

ilHelpGUI ILIAS\User\Profile\PersonalProfileGUI::$help
private

Definition at line 72 of file class.PersonalProfileGUI.php.

◆ $http

HTTP ILIAS\User\Profile\PersonalProfileGUI::$http
private

Definition at line 73 of file class.PersonalProfileGUI.php.

◆ $lng

Language ILIAS\User\Profile\PersonalProfileGUI::$lng
private

Definition at line 68 of file class.PersonalProfileGUI.php.

◆ $logger

ilLogger ILIAS\User\Profile\PersonalProfileGUI::$logger
private

Definition at line 87 of file class.PersonalProfileGUI.php.

◆ $profile

ProfileImplementation ILIAS\User\Profile\PersonalProfileGUI::$profile
private

Definition at line 84 of file class.PersonalProfileGUI.php.

◆ $profile_request

GUIRequest ILIAS\User\Profile\PersonalProfileGUI::$profile_request
private

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

◆ $prompt_repository

PromptRepository ILIAS\User\Profile\PersonalProfileGUI::$prompt_repository
private

Definition at line 82 of file class.PersonalProfileGUI.php.

◆ $refinery

Refinery ILIAS\User\Profile\PersonalProfileGUI::$refinery
private

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

◆ $settings

ilSetting ILIAS\User\Profile\PersonalProfileGUI::$settings
private

Definition at line 64 of file class.PersonalProfileGUI.php.

◆ $static_url

StaticUrlServices ILIAS\User\Profile\PersonalProfileGUI::$static_url
private

Definition at line 67 of file class.PersonalProfileGUI.php.

◆ $tabs

ilTabsGUI ILIAS\User\Profile\PersonalProfileGUI::$tabs
private

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

◆ $toolbar

ilToolbarGUI ILIAS\User\Profile\PersonalProfileGUI::$toolbar
private

Definition at line 71 of file class.PersonalProfileGUI.php.

◆ $tpl

ilGlobalTemplateInterface ILIAS\User\Profile\PersonalProfileGUI::$tpl
private

Definition at line 61 of file class.PersonalProfileGUI.php.

◆ $ui_factory

UIFactory ILIAS\User\Profile\PersonalProfileGUI::$ui_factory
private

Definition at line 77 of file class.PersonalProfileGUI.php.

◆ $ui_renderer

UIRenderer ILIAS\User\Profile\PersonalProfileGUI::$ui_renderer
private

Definition at line 78 of file class.PersonalProfileGUI.php.

◆ $uploads

FileUpload ILIAS\User\Profile\PersonalProfileGUI::$uploads
private

Definition at line 88 of file class.PersonalProfileGUI.php.

◆ $user

ilObjUser ILIAS\User\Profile\PersonalProfileGUI::$user
private

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

◆ $user_settings

UserSettings ILIAS\User\Profile\PersonalProfileGUI::$user_settings
private

Definition at line 85 of file class.PersonalProfileGUI.php.

◆ CHANGE_EMAIL_CMD

const ILIAS\User\Profile\PersonalProfileGUI::CHANGE_EMAIL_CMD = 'changeEmail'

◆ PERSONAL_DATA_FORM_ID

const ILIAS\User\Profile\PersonalProfileGUI::PERSONAL_DATA_FORM_ID = 'pd'
private

Definition at line 57 of file class.PersonalProfileGUI.php.

◆ PUBLISH_SETTINGS_PREFIX

const ILIAS\User\Profile\PersonalProfileGUI::PUBLISH_SETTINGS_PREFIX = 'chk_'
private

Definition at line 58 of file class.PersonalProfileGUI.php.


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