ILIAS  trunk Revision v12.0_alpha-1221-g4e438232683
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 902 of file class.PersonalProfileGUI.php.

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

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

811 : void
812 {
813 $this->user->sendPersonalDataFile();
814 }

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

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

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

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

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

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

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

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

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

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

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

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

882 : void
883 {
884 $main_tpl = $this->tpl;
885 $main_tpl->setRightContent($this->checklist->render($active_step));
886 }
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 768 of file class.PersonalProfileGUI.php.

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

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 = $value !== null
644 ? "<img src='{$value}' alt='{$this->lng->txt('user_avatar')}' />"
645 : null;
646 break;
647
648 default:
649 $caption = $field->getLabel($this->lng);
650 }
651 $cb = new \ilCheckboxInputGUI($caption, self::PUBLISH_SETTINGS_PREFIX . $field->getIdentifier() . $key_suffix);
652 $cb->setChecked(
653 $prefs === null
654 ? $field->isPublishedByUser($this->user)
655 : $prefs["public_{$field->getIdentifier()}"] ?? false
656 );
657
658 $cb->setOptionTitle(
659 $this->refinery->byTrying([
660 $this->refinery->kindlyTo()->string(),
661 $this->refinery->custom()->transformation(
662 function (mixed $v): string {
663 return array_reduce(
664 $this->refinery->kindlyTo()->listOf(
665 $this->refinery->kindlyTo()->string()
666 )->transform($v),
667 static fn(string $c, string $v): string => $c === ''
668 ? $v : "{$c}, {$v}",
669 ''
670 );
671 }
672 ),
673 $this->refinery->always('')
674 ])->transform($value)
675 );
676
677 if (!$parent) {
678 $form->addItem($cb);
679 } else {
680 $parent->addSubItem($cb);
681 }
682 }
683 }
684
685 if (!$anonymized) {
687 if ($handler->isActive()) {
688 $badge_options = [];
689
690 foreach (\ilBadgeAssignment::getInstancesByUserId($this->user->getId()) as $ass) {
691 // only active
692 if ($ass->getPosition()) {
693 $badge = new \ilBadge($ass->getBadgeId());
694 $badge_options[] = $badge->getTitle();
695 }
696 }
697
698 if (count($badge_options) > 1) {
699 $badge_order = new \ilNonEditableValueGUI($this->lng->txt('obj_bdga'), 'bpos' . $key_suffix);
700 $badge_order->setMultiValues($badge_options);
701 $badge_order->setValue(array_shift($badge_options));
702 $badge_order->setMulti(true, true, false);
703
704 if (!$parent) {
705 $form->addItem($badge_order);
706 } else {
707 $parent->addSubItem($badge_order);
708 }
709 }
710 }
711 }
712
713 // permalink
714 $ne = new \ilNonEditableValueGUI($this->lng->txt('perma_link'), '');
715 $ne->setValue(\ilLink::_getLink($this->user->getId(), 'usr'));
716 if (!$parent) {
717 $form->addItem($ne);
718 } else {
719 $parent->addSubItem($ne);
720 }
721 }
static getInstancesByUserId(int $a_user_id)
$handler
Definition: oai.php:31

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: