ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
ILIAS\User\Profile\PersonalProfileGUI Class Reference

GUI class for personal profile. More...

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

Public Member Functions

 executeCommand ()
 
 userSettingVisible (string $setting)
 
 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 ()
 
 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
 
Profile $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 49 of file class.PersonalProfileGUI.php.

Member Function Documentation

◆ addDataFromFormToUser()

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

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

478 : void
479 {
480 $this->user = $this->profile->addFormValuesToUser($this->form, Context::User, $this->user);
481 $this->user->setProfileIncomplete(false);
482
483 $this->user->setTitle($this->user->getFullname());
484 $this->user->setDescription($this->user->getEmail());
485 }
form( $class_path, string $cmd, string $submit_caption="")

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

+ Here is the call graph for this function:

◆ addEmailChangeModal()

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

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

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

References $id, $message, 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 288 of file class.PersonalProfileGUI.php.

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

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 893 of file class.PersonalProfileGUI.php.

893 : string
894 {
895 switch ($this->form->getInput('public_profile')) {
896 case 'y':
897 return '-1';
898 case 'g':
899 return '-2';
900 default:
901 return '';
902 }
903 }

References ILIAS\Repository\form().

+ Here is the call graph for this function:

◆ changeEmail()

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

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

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

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 802 of file class.PersonalProfileGUI.php.

802 : void
803 {
804 $this->user->sendPersonalDataFile();
805 }

References ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ emailChanged()

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

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

366 : bool
367 {
368 $email_input = $this->form->getItemByPostVar('usr_email');
369 if ($email_input !== null && !$email_input->getDisabled()
370 && $this->form->getInput('usr_email') !== $this->user->getEmail()) {
371 return true;
372 }
373
374 return false;
375 }

References ILIAS\Repository\form().

+ Here is the call graph for this function:

◆ emailCompletionForced()

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

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

377 : bool
378 {
379 $current_email = $this->user->getEmail();
380 if (
381 $this->user->getProfileIncomplete()
382 && $this->settings->get('require_email') === '1'
383 && ($current_email === null || $current_email === '')
384 ) {
385 return true;
386 }
387
388 return false;
389 }

References ILIAS\Repository\user().

+ Here is the call graph for this function:

◆ executeCommand()

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

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

145 : void
146 {
147 $next_class = $this->ctrl->getNextClass();
148
149 switch ($next_class) {
150 case strtolower(PublicProfileGUI::class):
151 $pub_profile_gui = new PublicProfileGUI($this->user->getId());
152 $pub_profile_gui->setBackUrl($this->ctrl->getLinkTarget($this, 'showPersonalData'));
153 $this->ctrl->forwardCommand($pub_profile_gui);
154 $this->tpl->printToStdout();
155 break;
156
157 case strtolower(PrivacySettingsGUI::class):
158 $this->setHeader();
159 $this->setTabs();
160 $this->tabs->activateTab('visibility_settings');
162 $this->ctrl->forwardCommand(
163 new PrivacySettingsGUI(
164 $this->lng,
165 $this->ctrl,
166 $this->event,
167 $this->http->request(),
168 $this->user,
169 $this->settings,
170 $this->tpl,
171 $this->ui_factory,
172 $this->ui_renderer,
173 $this->user_settings,
174 new Visibility(
175 $this->lng,
176 $this->settings,
177 $this->user
178 ),
179 $this->checklist_status,
180 new \ilSetting('chatroom'),
181 new \ilSetting('notifications')
182 )
183 );
184 break;
185
186 case strtolower(\ilLegalDocumentsAgreementGUI::class):
187 $this->ctrl->forwardCommand(new \ilLegalDocumentsAgreementGUI());
188 $this->tpl->printToStdout();
189 break;
190
191 case strtolower(\ilLegalDocumentsWithdrawalGUI::class):
192 $this->ctrl->forwardCommand(new \ilLegalDocumentsWithdrawalGUI());
193 $this->tpl->printToStdout();
194 break;
195
196 default:
197 $this->setTabs();
198 $cmd = $this->ctrl->getCmd('showPersonalData');
199 $this->$cmd();
200 break;
201 }
202 }
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 792 of file class.PersonalProfileGUI.php.

792 : void
793 {
794 $this->user->exportPersonalData();
795 $this->user->sendPersonalDataFile();
796 $this->ctrl->redirect($this, 'showExportImport');
797 }

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 542 of file class.PersonalProfileGUI.php.

542 : ?int
543 {
544 if ($this->settings->get('user_portfolios')) {
545 return \ilObjPortfolio::getDefaultPortfolio($this->user->getId());
546 }
547 return null;
548 }

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 879 of file class.PersonalProfileGUI.php.

879 : bool
880 {
881 $key = self::PUBLISH_SETTINGS_PREFIX . $identifier . $this->buildKeySuffix();
882
883 if (!$this->http->wrapper()->post()->has($key)) {
884 return false;
885 }
886
887 return $this->http->wrapper()->post()->retrieve(
888 $key,
889 $this->refinery->kindlyTo()->string()
890 ) === '1';
891 }

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 453 of file class.PersonalProfileGUI.php.

453 : void
454 {
455 $this->initPersonalDataForm();
456 if (!$this->form->checkInput()
457 || $this->loginChanged() && !$this->updateLoginOrSetErrorMessages()) {
458 $this->form->setValuesByPost();
459 $this->showPersonalData(true);
460 return;
461 }
462 $this->addDataFromFormToUser();
463 $this->user->update();
464
466 $this->auth_session->logout();
467 session_unset();
468 $token = $this->change_mail_token_repo->getNewTokenForUser(
469 $this->user,
470 $this->form->getInput('usr_email'),
471 time()
472 );
473 $this->ctrl->redirectToURL(
474 $token->getUriForStatus($this->static_url->builder())->__toString()
475 );
476 }
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 851 of file class.PersonalProfileGUI.php.

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

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 807 of file class.PersonalProfileGUI.php.

807 : void
808 {
809 $this->tabs->activateTab('export');
810 $this->setHeader();
811
813
814 $this->tpl->setContent($this->form->getHTML());
815 $this->tpl->printToStdout();
816 }

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 327 of file class.PersonalProfileGUI.php.

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

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 818 of file class.PersonalProfileGUI.php.

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

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 550 of file class.PersonalProfileGUI.php.

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

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

References ILIAS\Repository\profile().

+ Here is the call graph for this function:

◆ savePersonalData()

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

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

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

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 714 of file class.PersonalProfileGUI.php.

714 : void
715 {
716 $this->initPublicProfileForm();
717 if (!$this->form->checkInput()) {
718 $this->form->setValuesByPost();
719 $this->tpl->showPublicProfile(true);
720 }
721
722 if ($this->form->getInput('public_profile') !== '') {
723 $this->user->setPref('public_profile', $this->form->getInput('public_profile'));
724 }
725
726 $this->user = array_reduce(
727 $this->profile->getVisibleFields(Context::User, $this->user),
728 fn(\ilObjUser $c, ProfileField $v): \ilObjUser =>
729 $v->setPublishedOnUser($c, $this->getPublishedFromPost($v->getIdentifier())),
730 $this->user
731 );
732
733 if (\ilBadgeHandler::getInstance()->isActive()) {
734 $badge_positions = $this->form->getInput('bpos' . $this->buildKeySuffix()) ?? [];
735 if (is_array($badge_positions) && $badge_positions !== []) {
736 \ilBadgeAssignment::updatePositions($this->user->getId(), $badge_positions);
737 }
738 }
739
740 $this->user = $this->checklist_status->setStepSucessOnUser(
742 $this->user
743 );
744 $this->user->update();
745
746 // update lucene index
747 \ilLuceneIndexer::updateLuceneIndex([(int) $this->user->getId()]);
748 $this->tpl->setOnScreenMessage('success', $this->lng->txt('msg_obj_modified'), true);
749
750 if (\ilSession::get('orig_request_target')) {
751 $target = \ilSession::get('orig_request_target');
752 \ilSession::set('orig_request_target', '');
753 \ilUtil::redirect($target);
754 }
755
756 $this->ctrl->redirectByClass([self::class, PrivacySettingsGUI::class], '');
757 }
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 256 of file class.PersonalProfileGUI.php.

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

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 220 of file class.PersonalProfileGUI.php.

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

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 873 of file class.PersonalProfileGUI.php.

873 : void
874 {
875 $main_tpl = $this->tpl;
876 $main_tpl->setRightContent($this->checklist->render($active_step));
877 }
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 759 of file class.PersonalProfileGUI.php.

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

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 261 of file class.PersonalProfileGUI.php.

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

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 214 of file class.PersonalProfileGUI.php.

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

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 527 of file class.PersonalProfileGUI.php.

527 : void
528 {
529 $this->tabs->activateTab('public_profile');
531
532 $this->setHeader();
533
534 if (!$a_no_init) {
535 $this->initPublicProfileForm();
536 }
537
538 $this->tpl->setContent($this->form->getHTML());
539 $this->tpl->printToStdout();
540 }

References ILIAS\Repository\form(), ILIAS\User\Profile\ChecklistStatus\STEP_PUBLISH_OPTIONS, 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 612 of file class.PersonalProfileGUI.php.

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

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

◆ userSettingVisible()

ILIAS\User\Profile\PersonalProfileGUI::userSettingVisible ( string  $setting)

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

204 : bool
205 {
206 return $this->user_settings_config->isVisible($setting);
207 }
ilSetting $setting
Definition: class.ilias.php:68

References ILIAS\$setting.

Field Documentation

◆ $auth_session

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

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

◆ $change_mail_token_repo

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

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

◆ $checklist

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

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

◆ $checklist_status

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

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

◆ $ctrl

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

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

◆ $email_change_confirmation_modal

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

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

◆ $error_handler

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

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

◆ $event

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

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

◆ $form

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

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

◆ $help

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

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

◆ $http

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

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

◆ $lng

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

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

◆ $logger

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

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

◆ $profile

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

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

◆ $profile_request

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

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

◆ $prompt_repository

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

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

◆ $refinery

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

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

◆ $settings

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

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

◆ $static_url

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

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

◆ $tabs

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

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

◆ $toolbar

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

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

◆ $tpl

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

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

◆ $ui_factory

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

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

◆ $ui_renderer

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

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

◆ $uploads

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

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

◆ $user

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

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

◆ $user_settings

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

Definition at line 79 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 51 of file class.PersonalProfileGUI.php.

◆ PUBLISH_SETTINGS_PREFIX

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

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


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