ILIAS  release_8 Revision v8.19
All Data Structures Namespaces Files Functions Variables Modules Pages
class.ilPersonalProfileGUI.php
Go to the documentation of this file.
1 <?php
2 
25 
32 {
33  private const PERSONAL_DATA_FORM_ID = 'pd';
34  public const CHANGE_EMAIL_CMD = 'changeEmail';
37  protected string $password_error;
38  protected string $upload_error;
39  protected ilSetting $setting;
40  protected ilObjUser $user;
41  protected \ILIAS\User\ProfileGUIRequest $profile_request;
45  protected ilLanguage $lng;
46  protected ilCtrl $ctrl;
49  protected ilTabsGUI $tabs;
58 
60 
61  public function __construct(
62  \ilTermsOfServiceDocumentEvaluation $termsOfServiceEvaluation = null,
63  \ilTermsOfServiceHelper $termsOfServiceHelper = null
64  ) {
66  global $DIC;
67 
68  $this->tabs = $DIC->tabs();
69  $this->user = $DIC->user();
70  $this->lng = $DIC->language();
71  $this->setting = $DIC->settings();
72  $this->ui_factory = $DIC['ui.factory'];
73  $this->ui_renderer = $DIC['ui.renderer'];
74  $this->tpl = $DIC->ui()->mainTemplate();
75  $this->ctrl = $DIC->ctrl();
76  $this->auth_session = $DIC['ilAuthSession'];
77  $this->errorHandler = $DIC['ilErr'];
78  $this->eventHandler = $DIC['ilAppEventHandler'];
79  $this->request = $DIC->http()->request();
80 
81  if ($termsOfServiceEvaluation === null) {
82  $termsOfServiceEvaluation = $DIC['tos.document.evaluator'];
83  }
84  $this->termsOfServiceEvaluation = $termsOfServiceEvaluation;
85  if ($termsOfServiceHelper === null) {
86  $termsOfServiceHelper = new ilTermsOfServiceHelper();
87  }
88  $this->termsOfServiceHelper = $termsOfServiceHelper;
89 
90  $this->user_defined_fields = ilUserDefinedFields::_getInstance();
91 
92  $this->change_mail_token_repo = new ProfileChangeMailTokenDBRepository($DIC['ilDB']);
93 
94  $this->lng->loadLanguageModule("jsmath");
95  $this->lng->loadLanguageModule("pd");
96  $this->upload_error = "";
97  $this->password_error = "";
98  $this->lng->loadLanguageModule("user");
99  $this->ctrl->saveParameter($this, "prompted");
100 
101  $this->checklist = new ilProfileChecklistGUI();
102  $this->checklist_status = new ilProfileChecklistStatus();
103 
104  $this->user_settings_config = new ilUserSettingsConfig();
105 
106  $this->profile_request = new \ILIAS\User\ProfileGUIRequest(
107  $DIC->http(),
108  $DIC->refinery()
109  );
110  }
111 
112  public function executeCommand(): void
113  {
114  global $DIC;
115 
116  $ilUser = $DIC['ilUser'];
117  $ilCtrl = $DIC['ilCtrl'];
118  $tpl = $DIC['tpl'];
119  $ilTabs = $DIC['ilTabs'];
120 
121  $next_class = $this->ctrl->getNextClass();
122 
123  switch ($next_class) {
124  case "ilpublicuserprofilegui":
125  $pub_profile_gui = new ilPublicUserProfileGUI($ilUser->getId());
126  $pub_profile_gui->setBackUrl($ilCtrl->getLinkTarget($this, "showPersonalData"));
127  $ilCtrl->forwardCommand($pub_profile_gui);
128  $tpl->printToStdout();
129  break;
130 
131  case "iluserprivacysettingsgui":
132  $this->setHeader();
133  $this->setTabs();
134  $ilTabs->activateTab("visibility_settings");
136  $gui = new ilUserPrivacySettingsGUI();
137  $ilCtrl->forwardCommand($gui);
138  break;
139 
140  default:
141  $this->setTabs();
142  $cmd = $this->ctrl->getCmd("showPersonalData");
143  $this->$cmd();
144  break;
145  }
146  }
147 
148 
149  public function workWithUserSetting(string $setting): bool
150  {
151  return $this->user_settings_config->isVisibleAndChangeable($setting);
152  }
153 
154  public function userSettingVisible(string $setting): bool
155  {
156  return $this->user_settings_config->isVisible($setting);
157  }
158 
159  public function userSettingEnabled(string $setting): bool
160  {
161  return $this->user_settings_config->isChangeable($setting);
162  }
163 
164  public function uploadUserPicture(): void
165  {
166  global $DIC;
167  $ilUser = $DIC['ilUser'];
168 
169  if (!$this->workWithUserSetting("upload")) {
170  return;
171  }
172 
173  if (!$this->form->hasFileUpload('userfile')
174  && $this->profile_request->getUserFileCapture() === '') {
175  if ($this->form->getItemByPostVar("userfile")->getDeletionFlag()) {
176  $ilUser->removeUserPicture();
177  }
178  return;
179  }
180 
181  $webspace_dir = ilFileUtils::getWebspaceDir();
182  $image_dir = $webspace_dir . "/usr_images";
183  ilFileUtils::makeDir($image_dir);
184  $store_file = "usr_" . $ilUser->getID() . "." . "jpg";
185 
186  // store filename
187  $ilUser->setPref("profile_image", $store_file);
188  $ilUser->update();
189 
190  if ($this->form->hasFileUpload("userfile")) {
191  $file_info = $this->form->getFileUpload('userfile');
192  $tmp_path = $file_info['tmp_name'];
193  if (!$file_info['is_upload']) {
194  $new_path = ilFileUtils::ilTempnam();
195  rename($tmp_path, $new_path);
196  $tmp_path = $new_path;
197  }
198  $this->convertUserPicture($tmp_path, $image_dir);
199  return;
200  }
201 
202  $capture = $this->profile_request->getUserFileCapture();
203  if ($capture === null) {
204  return;
205  }
206 
207  $uploaded_file = $image_dir . DIRECTORY_SEPARATOR . "upload_" . $ilUser->getId() . ".png";
208  $img = str_replace(
209  ['data:image/png;base64,', ' '],
210  ['', '+'],
211  $capture
212  );
213  $data = base64_decode($img);
214  $success = file_put_contents($uploaded_file, $data);
215  if (!$success) {
216  $this->tpl->setOnScreenMessage('failure', $this->lng->txt("upload_error_file_not_found", true));
217  $this->ctrl->redirect($this, "showProfile");
218  }
219 
220  $this->convertUserPicture($uploaded_file, $image_dir);
221  chmod($uploaded_file, 0770);
222  }
223 
224  private function convertUserPicture(string $uploaded_file, string $image_dir): void
225  {
226  global $DIC;
227  $ilUser = $DIC['ilUser'];
228 
229  // take quality 100 to avoid jpeg artefacts when uploading jpeg files
230  // taking only frame [0] to avoid problems with animated gifs
231  $show_file = "$image_dir/usr_" . $ilUser->getId() . ".jpg";
232  $thumb_file = "$image_dir/usr_" . $ilUser->getId() . "_small.jpg";
233  $xthumb_file = "$image_dir/usr_" . $ilUser->getId() . "_xsmall.jpg";
234  $xxthumb_file = "$image_dir/usr_" . $ilUser->getId() . "_xxsmall.jpg";
235  $uploaded_file = ilShellUtil::escapeShellArg($uploaded_file);
236  $show_file = ilShellUtil::escapeShellArg($show_file);
237  $thumb_file = ilShellUtil::escapeShellArg($thumb_file);
238  $xthumb_file = ilShellUtil::escapeShellArg($xthumb_file);
239  $xxthumb_file = ilShellUtil::escapeShellArg($xxthumb_file);
240 
241  if (ilShellUtil::isConvertVersionAtLeast("6.3.8-3")) {
243  $uploaded_file . "[0] -geometry 200x200^ -gravity center -extent 200x200 -quality 100 JPEG:" . $show_file
244  );
246  $uploaded_file . "[0] -geometry 100x100^ -gravity center -extent 100x100 -quality 100 JPEG:" . $thumb_file
247  );
249  $uploaded_file . "[0] -geometry 75x75^ -gravity center -extent 75x75 -quality 100 JPEG:" . $xthumb_file
250  );
252  $uploaded_file . "[0] -geometry 30x30^ -gravity center -extent 30x30 -quality 100 JPEG:" . $xxthumb_file
253  );
254  } else {
255  ilShellUtil::execConvert($uploaded_file . "[0] -geometry 200x200 -quality 100 JPEG:" . $show_file);
256  ilShellUtil::execConvert($uploaded_file . "[0] -geometry 100x100 -quality 100 JPEG:" . $thumb_file);
257  ilShellUtil::execConvert($uploaded_file . "[0] -geometry 75x75 -quality 100 JPEG:" . $xthumb_file);
258  ilShellUtil::execConvert($uploaded_file . "[0] -geometry 30x30 -quality 100 JPEG:" . $xxthumb_file);
259  }
260  }
261 
262  public function removeUserPicture(): void
263  {
264  global $DIC;
265 
266  $ilUser = $DIC['ilUser'];
267  $ilUser->removeUserPicture();
268  }
269 
275  public function showProfile(): void
276  {
277  $this->showPersonalData();
278  }
279 
280  protected function showUserAgreement(): void
281  {
282  $this->tabs->clearTargets();
283  $this->tabs->clearSubTabs();
284 
285  $tpl = new \ilTemplate('tpl.view_terms_of_service.html', true, true, 'Services/Init');
286 
287  $this->tpl->setTitle($this->lng->txt('usr_agreement'));
288 
289  $noAgreement = true;
290  if (!$this->user->isAnonymous() && $this->user->getId() > 0 && $this->user->getAgreeDate()) {
291  $helper = new \ilTermsOfServiceHelper();
292 
293  $entity = $helper->getCurrentAcceptanceForUser($this->user);
294  if ($entity->getId()) {
295  $noAgreement = false;
296  $tpl->setVariable('TERMS_OF_SERVICE_CONTENT', $entity->getText());
297  }
298  } else {
299  $handleDocument = \ilTermsOfServiceHelper::isEnabled() && $this->termsOfServiceEvaluation->hasDocument();
300  if ($handleDocument) {
301  $noAgreement = false;
302  $document = $this->termsOfServiceEvaluation->document();
303  $tpl->setVariable('TERMS_OF_SERVICE_CONTENT', $document->content());
304  }
305  }
306 
307  if ($noAgreement) {
308  $tpl->setVariable(
309  'TERMS_OF_SERVICE_CONTENT',
310  sprintf(
311  $this->lng->txt('no_agreement_description'),
314  )
315  )
316  );
317  }
318 
319  $this->tpl->setContent($tpl->get());
320  $this->tpl->setPermanentLink('usr', null, 'agreement');
321  $this->tpl->printToStdout();
322  }
323 
324  protected function showConsentWithdrawalConfirmation(): void
325  {
326  if (
327  !$this->user->getPref('consent_withdrawal_requested') ||
328  !$this->termsOfServiceHelper->isIncludedUser($this->user)
329  ) {
330  $this->errorHandler->raiseError($this->lng->txt('permission_denied'), $this->errorHandler->MESSAGE);
331  }
332 
333  $this->tabs->clearTargets();
334  $this->tabs->clearSubTabs();
335  $this->tpl->setTitle($this->lng->txt('refuse_tos_acceptance'));
336 
337  $tosWithdrawalGui = new ilTermsOfServiceWithdrawalGUIHelper($this->user);
338  $content = $tosWithdrawalGui->getConsentWithdrawalConfirmation($this);
339 
340  $this->tpl->setContent($content);
341  $this->tpl->setPermanentLink('usr', null, 'agreement');
342  $this->tpl->printToStdout();
343  }
344 
345  protected function cancelWithdrawal(): void
346  {
347  if (!$this->termsOfServiceHelper->isIncludedUser($this->user)) {
348  $this->errorHandler->raiseError($this->lng->txt('permission_denied'), $this->errorHandler->MESSAGE);
349  }
350 
351  $this->user->deletePref('consent_withdrawal_requested');
352 
353  if (ilSession::get('orig_request_target')) {
354  $target = ilSession::get('orig_request_target');
355  ilSession::set('orig_request_target', '');
356  $this->ctrl->redirectToURL($target);
357  } else {
359  }
360  }
361 
362  protected function withdrawAcceptance(): void
363  {
364  if (
365  !$this->user->getPref('consent_withdrawal_requested') ||
366  !$this->termsOfServiceHelper->isIncludedUser($this->user)
367  ) {
368  $this->errorHandler->raiseError($this->lng->txt('permission_denied'), $this->errorHandler->MESSAGE);
369  }
370  $this->termsOfServiceHelper->resetAcceptance($this->user);
371 
372  $defaultAuth = ilAuthUtils::AUTH_LOCAL;
373  if ($this->setting->get('auth_mode')) {
374  $defaultAuth = $this->setting->get('auth_mode');
375  }
376 
377  $withdrawalType = 0;
378  if (
379  $this->user->getAuthMode() == ilAuthUtils::AUTH_LDAP ||
380  ($this->user->getAuthMode() === 'default' && $defaultAuth == ilAuthUtils::AUTH_LDAP)
381  ) {
382  $withdrawalType = 2;
383  } elseif ($this->setting->get('tos_withdrawal_usr_deletion', '0') !== '0') {
384  $withdrawalType = 1;
385  }
386 
387  $domainEvent = new ilTermsOfServiceEventWithdrawn($this->user);
388  $this->eventHandler->raise(
389  'Services/TermsOfService',
390  'ilTermsOfServiceEventWithdrawn',
391  ['event' => $domainEvent]
392  );
393 
395  $this->auth_session->logout();
396 
397  $this->ctrl->redirectToURL('login.php?tos_withdrawal_type=' . $withdrawalType . '&cmd=force_login');
398  }
399 
403  public function addLocationToForm(ilPropertyFormGUI $a_form, ilObjUser $a_user): void
404  {
405  global $DIC;
406 
407  $ilCtrl = $DIC['ilCtrl'];
408 
409  // check map activation
410  if (!ilMapUtil::isActivated()) {
411  return;
412  }
413 
414  // Don't really know if this is still necessary...
415  $this->lng->loadLanguageModule("maps");
416 
417  // Get user settings
418  $latitude = ($a_user->getLatitude() != "")
419  ? (float) $a_user->getLatitude()
420  : null;
421  $longitude = ($a_user->getLongitude() != "")
422  ? (float) $a_user->getLongitude()
423  : null;
424  $zoom = $a_user->getLocationZoom();
425 
426  // Get Default settings, when nothing is set
427  if ($latitude == null && $longitude == null && $zoom == 0) {
429  $latitude = (float) $def["latitude"];
430  $longitude = (float) $def["longitude"];
431  $zoom = (int) $def["zoom"];
432  }
433 
434  $street = $a_user->getStreet();
435  if (!$street) {
436  $street = $this->lng->txt("street");
437  }
438  $city = $a_user->getCity();
439  if (!$city) {
440  $city = $this->lng->txt("city");
441  }
442  $country = $a_user->getCountry();
443  if (!$country) {
444  $country = $this->lng->txt("country");
445  }
446 
447  // location property
448  $loc_prop = new ilLocationInputGUI(
449  $this->lng->txt("location"),
450  "location"
451  );
452  $loc_prop->setLatitude($latitude);
453  $loc_prop->setLongitude($longitude);
454  $loc_prop->setZoom($zoom);
455  $loc_prop->setAddress($street . "," . $city . "," . $country);
456 
457  $a_form->addItem($loc_prop);
458  }
459 
460  // init sub tabs
461  public function setTabs(): void
462  {
463  global $DIC;
464 
465  $ilTabs = $DIC['ilTabs'];
466  $ilHelp = $DIC['ilHelp'];
467 
468  $ilHelp->setScreenIdComponent("user");
469 
470  // personal data
471  $ilTabs->addTab(
472  "personal_data",
473  $this->lng->txt("user_profile_data"),
474  $this->ctrl->getLinkTarget($this, "showPersonalData")
475  );
476 
477  // publishing options
478  $ilTabs->addTab(
479  "public_profile",
480  $this->lng->txt("user_publish_options"),
481  $this->ctrl->getLinkTarget($this, "showPublicProfile")
482  );
483 
484  // visibility settings
485  $txt_visibility = $this->checklist_status->anyVisibilitySettings()
486  ? $this->lng->txt("user_visibility_settings")
487  : $this->lng->txt("preview");
488  $ilTabs->addTab(
489  "visibility_settings",
490  $txt_visibility,
491  $this->ctrl->getLinkTargetByClass("ilUserPrivacySettingsGUI", "")
492  );
493 
494  // export
495  $ilTabs->addTab(
496  "export",
497  $this->lng->txt("export") . "/" . $this->lng->txt("import"),
498  $this->ctrl->getLinkTarget($this, "showExportImport")
499  );
500  }
501 
502 
503  public function __showOtherInformations(): bool
504  {
505  $d_set = new ilSetting("delicous");
506  if ($this->userSettingVisible("matriculation") or count($this->user_defined_fields->getVisibleDefinitions())
507  or $d_set->get("user_profile") == "1") {
508  return true;
509  }
510  return false;
511  }
512 
513  public function __showUserDefinedFields(): bool
514  {
515  global $DIC;
516 
517  $ilUser = $DIC['ilUser'];
518 
519  $user_defined_data = $ilUser->getUserDefinedData();
520  foreach ($this->user_defined_fields->getVisibleDefinitions() as $field_id => $definition) {
521  if ($definition['field_type'] == UDF_TYPE_TEXT) {
522  $this->tpl->setCurrentBlock("field_text");
523  $this->tpl->setVariable(
524  "FIELD_VALUE",
525  ilLegacyFormElementsUtil::prepareFormOutput($user_defined_data[$field_id])
526  );
527  if (!$definition['changeable']) {
528  $this->tpl->setVariable("DISABLED_FIELD", 'disabled=\"disabled\"');
529  }
530  $this->tpl->setVariable("FIELD_NAME", 'udf[' . $definition['field_id'] . ']');
531  } else {
532  if ($definition['changeable']) {
533  $name = 'udf[' . $definition['field_id'] . ']';
534  $disabled = false;
535  } else {
536  $name = '';
537  $disabled = true;
538  }
539  $this->tpl->setCurrentBlock("field_select");
540  $this->tpl->setVariable(
541  "SELECT_BOX",
543  $user_defined_data[$field_id],
544  $name,
545  $this->user_defined_fields->fieldValuesToSelectArray(
546  $definition['field_values']
547  ),
548  false,
549  true,
550  0,
551  '',
552  [],
553  $disabled
554  )
555  );
556  }
557  $this->tpl->parseCurrentBlock();
558  $this->tpl->setCurrentBlock("user_defined");
559 
560  if ($definition['required']) {
561  $name = $definition['field_name'] . "<span class=\"asterisk\">*</span>";
562  } else {
563  $name = $definition['field_name'];
564  }
565  $this->tpl->setVariable("TXT_FIELD_NAME", $name);
566  $this->tpl->parseCurrentBlock();
567  }
568  return true;
569  }
570 
571  public function setHeader(): void
572  {
573  $this->tpl->setTitle($this->lng->txt('personal_profile'));
574  }
575 
576  //
577  //
578  // PERSONAL DATA FORM
579  //
580  //
581 
582  public function showPersonalData(
583  bool $a_no_init = false,
584  bool $a_migration_started = false
585  ): void {
586  global $DIC;
587 
588  $ilUser = $DIC['ilUser'];
589  $lng = $DIC['lng'];
590  $ilTabs = $DIC['ilTabs'];
591  $prompt_service = new ilUserProfilePromptService();
592 
593  $ilTabs->activateTab("personal_data");
594  $ctrl = $DIC->ctrl();
595 
596  $it = "";
597  if ($this->profile_request->getPrompted() == 1) {
598  $it = $prompt_service->data()->getSettings()->getPromptText($ilUser->getLanguage());
599  }
600  if ($it === "") {
601  $it = $prompt_service->data()->getSettings()->getInfoText($ilUser->getLanguage());
602  }
603  if (trim($it) !== "") {
604  $pub_prof = in_array($ilUser->prefs["public_profile"] ?? "", array("y", "n", "g"))
605  ? $ilUser->prefs["public_profile"]
606  : "n";
607  $box = $DIC->ui()->factory()->messageBox()->info($it);
608  if ($pub_prof === "n") {
609  $box = $box->withLinks(
610  [$DIC->ui()->factory()->link()->standard(
611  $lng->txt("user_make_profile_public"),
612  $ctrl->getLinkTarget($this, "showPublicProfile")
613  )]
614  );
615  }
616  $it = $DIC->ui()->renderer()->render($box);
617  }
618  $this->setHeader();
619 
621 
622  if (!$a_no_init) {
623  $this->initPersonalDataForm();
624  // catch feedback message
625  if ($ilUser->getProfileIncomplete()) {
626  $this->tpl->setOnScreenMessage('info', $lng->txt("profile_incomplete"));
627  }
628  }
629 
630  $modal = '';
631  if ($this->email_change_confirmation_modal !== null) {
632  $modal = $this->ui_renderer->render($this->email_change_confirmation_modal);
633  }
634 
635  $this->tpl->setContent($it . $this->form->getHTML() . $modal);
636  $this->tpl->printToStdout();
637  }
638 
639  public function initPersonalDataForm(): void
640  {
641  global $DIC;
642 
643  $lng = $DIC['lng'];
644  $ilUser = $DIC['ilUser'];
645  $input = [];
646 
647  $this->form = new ilPropertyFormGUI();
648  $this->form->setFormAction($this->ctrl->getFormAction($this));
649  $this->form->setId(self::PERSONAL_DATA_FORM_ID);
650 
651  // user defined fields
652  $user_defined_data = $ilUser->getUserDefinedData();
653 
654 
655  foreach ($this->user_defined_fields->getVisibleDefinitions() as $field_id => $definition) {
656  $value = $user_defined_data["f_" . $field_id] ?? "";
657 
658  $fprop = ilCustomUserFieldsHelper::getInstance()->getFormPropertyForDefinition(
659  $definition,
660  $definition['changeable'] ?? false,
661  $value
662  );
663  if ($fprop instanceof ilFormPropertyGUI) {
664  $input['udf_' . $definition['field_id']] = $fprop;
665  }
666  }
667 
668  // standard fields
669  $up = new ilUserProfile();
670  $up->skipField("password");
671  $up->skipGroup("settings");
672  $up->skipGroup("preferences");
673 
674  $up->setAjaxCallback(
675  $this->ctrl->getLinkTargetByClass('ilPublicUserProfileGUI', 'doProfileAutoComplete', '', true)
676  );
677 
678  // standard fields
679  $up->addStandardFieldsToForm($this->form, $ilUser, $input);
680 
681  $this->addLocationToForm($this->form, $ilUser);
682 
683  $this->form->addCommandButton("savePersonalData", $lng->txt("user_save_continue"));
684  }
685 
686  public function savePersonalData(): void
687  {
688  $this->initPersonalDataForm();
689  if (!$this->form->checkInput()
690  || !$this->emailCompletionForced()
691  && $this->emailChanged()
692  && $this->addEmailChangeModal()
693  || $this->loginChanged() && !$this->updateLoginOrSetErrorMessages()) {
694  $this->form->setValuesByPost();
695  $this->tempStorePicture();
696  $this->showPersonalData(true);
697  return;
698  }
699 
700  $this->savePersonalDataForm();
701 
702  $this->checklist_status->saveStepSucess(ilProfileChecklistStatus::STEP_PROFILE_DATA);
703  $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
704 
705  $this->ctrl->redirect($this, "showPublicProfile");
706  }
707 
708  private function emailChanged(): bool
709  {
710  $email_input = $this->form->getItemByPostVar('usr_email');
711  if ($email_input !== null && !$email_input->getDisabled()
712  && $this->form->getInput('usr_email') !== $this->user->getEmail()) {
713  return true;
714  }
715 
716  return false;
717  }
718 
719  private function emailCompletionForced(): bool
720  {
721  $current_email = $this->user->getEmail();
722  if (
723  $this->user->getProfileIncomplete()
724  && $this->setting->get('require_email') === '1'
725  && ($current_email === null || $current_email === '')
726  ) {
727  return true;
728  }
729 
730  return false;
731  }
732 
733  private function addEmailChangeModal(): bool
734  {
735  $form_id = 'form_' . self::PERSONAL_DATA_FORM_ID;
736  $modal = $this->ui_factory->modal()->interruptive(
737  $this->lng->txt('confirm'),
738  $this->lng->txt('confirm_logout_for_email_change'),
739  '#'
740  )->withActionButtonLabel('change');
741  $this->email_change_confirmation_modal = $modal->withOnLoad($modal->getShowSignal())
743  static function ($id) use ($form_id) {
744  return "var button = {$id}.querySelector('input[name=\"cmd[change]\"]'); "
745  . "button.addEventListener('click', (e) => {e.preventDefault();"
746  . "document.getElementById('{$form_id}').submit();});";
747  }
748  );
749 
750  $this->form->setFormAction($this->ctrl->getFormActionByClass(self::class, 'goToEmailConfirmation'));
751  return true;
752  }
753 
754  private function loginChanged(): bool
755  {
756  $login = $this->form->getInput('username');
757  if ((int) $this->setting->get('allow_change_loginname')
758  && $login !== $this->user->getLogin()) {
759  return true;
760  }
761 
762  return false;
763  }
764 
765  private function updateLoginOrSetErrorMessages(): bool
766  {
767  $login = $this->form->getInput('username');
768  if ($login === '' || !ilUtil::isLogin($login)) {
769  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('form_input_not_valid'));
770  $this->form->getItemByPostVar('username')->setAlert($this->lng->txt('login_invalid'));
771  return false;
772  }
773 
774  if (ilObjUser::_loginExists($login, $this->user->getId())) {
775  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('form_input_not_valid'));
776  $this->form->getItemByPostVar('username')->setAlert($this->lng->txt('loginname_already_exists'));
777  return false;
778  }
779 
780  $this->user->setLogin($login);
781 
782  try {
783  $this->user->updateLogin($this->user->getLogin());
784  return true;
785  } catch (ilUserException $e) {
786  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('form_input_not_valid'));
787  $this->form->getItemByPostVar('username')->setAlert($e->getMessage());
788  return false;
789  }
790  }
791 
792  public function goToEmailConfirmation(): void
793  {
794  $this->initPersonalDataForm();
795  if (!$this->form->checkInput()
796  || $this->loginChanged() && !$this->updateLoginOrSetErrorMessages()) {
797  $this->form->setValuesByPost();
798  $this->showPersonalData(true);
799  return;
800  }
801  $this->savePersonalDataForm();
802 
804  $this->auth_session->logout();
805  session_unset();
806  $token = $this->change_mail_token_repo->getNewTokenForUser($this->user, $this->form->getInput('usr_email'));
807  $this->ctrl->redirectToURL('login.php?cmd=force_login&target=usr_' . self::CHANGE_EMAIL_CMD . $token);
808  }
809 
810  private function savePersonalDataForm(): void
811  {
812  // if form field name differs from setter
813  $map = [
814  "firstname" => "FirstName",
815  "lastname" => "LastName",
816  "title" => "UTitle",
817  "sel_country" => "SelectedCountry",
818  "phone_office" => "PhoneOffice",
819  "phone_home" => "PhoneHome",
820  "phone_mobile" => "PhoneMobile",
821  "referral_comment" => "Comment",
822  "interests_general" => "GeneralInterests",
823  "interests_help_offered" => "OfferingHelp",
824  "interests_help_looking" => "LookingForHelp"
825  ];
826  $up = new ilUserProfile();
827  foreach (array_keys($up->getStandardFields()) as $f) {
828  // if item is part of form, it is currently valid (if not disabled)
829  $item = $this->form->getItemByPostVar("usr_" . $f);
830  if (!$item || $item->getDisabled()) {
831  continue;
832  }
833 
834  $value = $this->form->getInput("usr_" . $f);
835  switch ($f) {
836  case 'email':
837  if ($this->emailCompletionForced()) {
838  $this->user->setEmail($value);
839  }
840 
841  break;
842  case "birthday":
843  $value = $item->getDate();
844  $this->user->setBirthday($value
845  ? $value->get(IL_CAL_DATE)
846  : "");
847  break;
848  case "second_email":
849  $this->user->setSecondEmail($value);
850  break;
851  default:
852  $m = $map[$f] ?? ucfirst($f);
853  $this->user->{"set" . $m}($value);
854  break;
855  }
856  }
857  $this->user->setFullname();
858 
859  // check map activation
860  if (ilMapUtil::isActivated()) {
861  // #17619 - proper escaping
862  $location = $this->form->getInput("location");
863  $lat = ilUtil::stripSlashes($location["latitude"]);
864  $long = ilUtil::stripSlashes($location["longitude"]);
865  $zoom = ilUtil::stripSlashes($location["zoom"]);
866  $this->user->setLatitude(is_numeric($lat) ? $lat : null);
867  $this->user->setLongitude(is_numeric($long) ? $long : null);
868  $this->user->setLocationZoom(is_numeric($zoom) ? $zoom : null);
869  }
870 
871  // Set user defined data
872  $defs = $this->user_defined_fields->getVisibleDefinitions();
873  $udf = [];
874  foreach ($defs as $definition) {
875  $f = "udf_" . $definition['field_id'];
876  $item = $this->form->getItemByPostVar($f);
877  if ($item && !$item->getDisabled()) {
878  $udf[$definition['field_id']] = $this->form->getInput($f);
879  }
880  }
881  $this->user->setUserDefinedData($udf);
882 
883  $this->uploadUserPicture();
884 
885  // profile ok
886  $this->user->setProfileIncomplete(false);
887 
888  // save user data & object_data
889  $this->user->setTitle($this->user->getFullname());
890  $this->user->setDescription($this->user->getEmail());
891 
892  $this->user->update();
893  }
894 
895  public function changeEmail(): void
896  {
897  $token = $this->profile_request->getToken();
898  $new_email = $this->change_mail_token_repo->getNewEmailForUser($this->user, $token);
899 
900  if ($new_email !== '') {
901  $this->user->setEmail($new_email);
902  $this->user->update();
903  $this->change_mail_token_repo->deleteEntryByToken($token);
904  $this->tpl->setOnScreenMessage(
905  'success',
906  $this->lng->txt('saved_successfully')
907  );
908  $this->showPublicProfile();
909  return;
910  }
911 
912  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('email_could_not_be_changed'));
913  $this->showPublicProfile();
914  }
915 
916  public function showPublicProfile(bool $a_no_init = false): void
917  {
918  $ilTabs = $this->tabs;
919 
920  $ilTabs->activateTab("public_profile");
922 
923  $this->setHeader();
924 
925  if (!$a_no_init) {
926  $this->initPublicProfileForm();
927  }
928 
929  $this->tpl->setContent($this->form->getHTML());
930  $this->tpl->printToStdout();
931  }
932 
936  protected function getProfilePortfolio(): ?int
937  {
938  global $DIC;
939 
940  $ilUser = $DIC['ilUser'];
941  $ilSetting = $DIC['ilSetting'];
942 
943  if ($ilSetting->get('user_portfolios')) {
945  }
946  return null;
947  }
948 
949  public function initPublicProfileForm(): void
950  {
951  global $DIC;
952 
953  $lng = $DIC['lng'];
954  $ilUser = $DIC['ilUser'];
955  $ilSetting = $DIC['ilSetting'];
956 
957  $this->form = new ilPropertyFormGUI();
958 
959  $this->form->setTitle($lng->txt("user_publish_options"));
960  $this->form->setDescription($lng->txt("user_public_profile_info"));
961  $this->form->setFormAction($this->ctrl->getFormAction($this));
962 
963  $portfolio_id = $this->getProfilePortfolio();
964 
965  if (!$portfolio_id) {
966  // Activate public profile
967  $radg = new ilRadioGroupInputGUI($lng->txt("user_activate_public_profile"), "public_profile");
968  $info = $this->lng->txt("user_activate_public_profile_info");
969  $profile_mode = new ilPersonalProfileMode($ilUser, $ilSetting);
970  $pub_prof = $profile_mode->getMode();
971  $radg->setValue($pub_prof);
972  $op1 = new ilRadioOption($lng->txt("usr_public_profile_disabled"), "n", $lng->txt("usr_public_profile_disabled_info"));
973  $radg->addOption($op1);
974  $op2 = new ilRadioOption($lng->txt("usr_public_profile_logged_in"), "y");
975  $radg->addOption($op2);
976  if ($ilSetting->get('enable_global_profiles')) {
977  $op3 = new ilRadioOption($lng->txt("usr_public_profile_global"), "g");
978  $radg->addOption($op3);
979  }
980  $this->form->addItem($radg);
981 
982  // #11773
983  if ($ilSetting->get('user_portfolios')) {
984  // #10826
985  $prtf = "<br />" . $lng->txt("user_profile_portfolio");
986  $prtf .= "<br /><a href=\"ilias.php?baseClass=ilDashboardGUI&cmd=jumpToPortfolio\">&raquo; " .
987  $lng->txt("user_portfolios") . "</a>";
988  $info .= $prtf;
989  }
990 
991  $radg->setInfo($info);
992  } else {
993  $prtf = $lng->txt("user_profile_portfolio_selected");
994  $prtf .= "<br /><a href=\"ilias.php?baseClass=ilDashboardGUI&cmd=jumpToPortfolio&prt_id=" . $portfolio_id . "\">&raquo; " .
995  $lng->txt("portfolio") . "</a>";
996 
997  $info = new ilCustomInputGUI($lng->txt("user_activate_public_profile"));
998  $info->setHtml($prtf);
999  $this->form->addItem($info);
1000  $this->showPublicProfileFields($this->form, $ilUser->prefs);
1001  }
1002 
1003  if (isset($op2)) {
1004  $this->showPublicProfileFields($this->form, $ilUser->prefs, $op2, false, "-1");
1005  }
1006  if (isset($op3)) {
1007  $this->showPublicProfileFields($this->form, $ilUser->prefs, $op3, false, "-2");
1008  }
1009  $this->form->setForceTopButtons(true);
1010  $this->form->addCommandButton("savePublicProfile", $lng->txt("user_save_continue"));
1011  }
1012 
1013  public function showPublicProfileFields(
1015  array $prefs,
1016  ?object $parent = null,
1017  bool $anonymized = false,
1018  string $key_suffix = ""
1019  ): void {
1020  global $DIC;
1021 
1022  $ilUser = $DIC['ilUser'];
1023 
1024  $birthday = $ilUser->getBirthday();
1025  if ($birthday) {
1026  $birthday = ilDatePresentation::formatDate(new ilDate($birthday, IL_CAL_DATE));
1027  }
1028  $gender = $ilUser->getGender();
1029  if ($gender) {
1030  $gender = $this->lng->txt("gender_" . $gender);
1031  }
1032 
1033  $txt_sel_country = "";
1034  if ($ilUser->getSelectedCountry() != "") {
1035  $this->lng->loadLanguageModule("meta");
1036  $txt_sel_country = $this->lng->txt("meta_c_" . $ilUser->getSelectedCountry());
1037  }
1038 
1039  // profile picture
1040  $pic = ilObjUser::_getPersonalPicturePath($ilUser->getId(), "xsmall", true, true);
1041  if ($pic) {
1042  $pic = "<img src=\"" . $pic . "\" />";
1043  }
1044 
1045  // personal data
1046  $val_array = array(
1047  "title" => $ilUser->getUTitle(),
1048  "birthday" => $birthday,
1049  "gender" => $gender,
1050  "upload" => $pic,
1051  "interests_general" => $ilUser->getGeneralInterestsAsText(),
1052  "interests_help_offered" => $ilUser->getOfferingHelpAsText(),
1053  "interests_help_looking" => $ilUser->getLookingForHelpAsText(),
1054  "org_units" => $ilUser->getOrgUnitsRepresentation(),
1055  "institution" => $ilUser->getInstitution(),
1056  "department" => $ilUser->getDepartment(),
1057  "street" => $ilUser->getStreet(),
1058  "zipcode" => $ilUser->getZipcode(),
1059  "city" => $ilUser->getCity(),
1060  "country" => $ilUser->getCountry(),
1061  "sel_country" => $txt_sel_country,
1062  "phone_office" => $ilUser->getPhoneOffice(),
1063  "phone_home" => $ilUser->getPhoneHome(),
1064  "phone_mobile" => $ilUser->getPhoneMobile(),
1065  "fax" => $ilUser->getFax(),
1066  "email" => $ilUser->getEmail(),
1067  "second_email" => $ilUser->getSecondEmail(),
1068  "hobby" => $ilUser->getHobby(),
1069  "matriculation" => $ilUser->getMatriculation()
1070  );
1071 
1072  // location
1073  if (ilMapUtil::isActivated()) {
1074  $val_array["location"] = ((int) $ilUser->getLatitude() + (int) $ilUser->getLongitude() + (int) $ilUser->getLocationZoom() > 0)
1075  ? " "
1076  : "";
1077  }
1078  foreach ($val_array as $key => $value) {
1079  if (in_array($value, ["", "-"]) && !$anonymized) {
1080  continue;
1081  }
1082  if ($anonymized) {
1083  $value = null;
1084  }
1085 
1086  if ($this->userSettingVisible($key)) {
1087  // #18795 - we should use ilUserProfile
1088  switch ($key) {
1089  case "upload":
1090  $caption = "personal_picture";
1091  break;
1092 
1093  case "title":
1094  $caption = "person_title";
1095  break;
1096 
1097  default:
1098  $caption = $key;
1099  }
1100  $cb = new ilCheckboxInputGUI($this->lng->txt($caption), "chk_" . $key . $key_suffix);
1101  if (isset($prefs["public_" . $key]) && $prefs["public_" . $key] == "y") {
1102  $cb->setChecked(true);
1103  }
1104  //$cb->setInfo($value);
1105  $cb->setOptionTitle((string) $value);
1106 
1107  if (!$parent) {
1108  $form->addItem($cb);
1109  } else {
1110  $parent->addSubItem($cb);
1111  }
1112  }
1113  }
1114 
1115  // additional defined user data fields
1116  $user_defined_data = array();
1117  if (!$anonymized) {
1118  $user_defined_data = $ilUser->getUserDefinedData();
1119  }
1120  foreach ($this->user_defined_fields->getVisibleDefinitions() as $field_id => $definition) {
1121  // public setting
1122  $cb = new ilCheckboxInputGUI($definition["field_name"], "chk_udf_" . $definition["field_id"] . $key_suffix);
1123  $cb->setOptionTitle($user_defined_data["f_" . $definition["field_id"]] ?? "");
1124  $public_udf = (string) ($prefs["public_udf_" . $definition["field_id"]] ?? '');
1125  if ($public_udf === 'y') {
1126  $cb->setChecked(true);
1127  }
1128 
1129  if (!$parent) {
1130  $form->addItem($cb);
1131  } else {
1132  $parent->addSubItem($cb);
1133  }
1134  }
1135 
1136  if (!$anonymized) {
1137  $handler = ilBadgeHandler::getInstance();
1138  if ($handler->isActive()) {
1139  $badge_options = array();
1140 
1141  foreach (ilBadgeAssignment::getInstancesByUserId($ilUser->getId()) as $ass) {
1142  // only active
1143  if ($ass->getPosition()) {
1144  $badge = new ilBadge($ass->getBadgeId());
1145  $badge_options[] = $badge->getTitle();
1146  }
1147  }
1148 
1149  if (count($badge_options) > 1) {
1150  $badge_order = new ilNonEditableValueGUI($this->lng->txt("obj_bdga"), "bpos" . $key_suffix);
1151  $badge_order->setMultiValues($badge_options);
1152  $badge_order->setValue(array_shift($badge_options));
1153  $badge_order->setMulti(true, true, false);
1154 
1155  if (!$parent) {
1156  $form->addItem($badge_order);
1157  } else {
1158  $parent->addSubItem($badge_order);
1159  }
1160  }
1161  }
1162  }
1163 
1164  // permalink
1165  $ne = new ilNonEditableValueGUI($this->lng->txt("perma_link"), "");
1166  $ne->setValue(ilLink::_getLink($this->user->getId(), "usr"));
1167  if (!$parent) {
1168  $form->addItem($ne);
1169  } else {
1170  $parent->addSubItem($ne);
1171  }
1172  }
1173 
1174  public function savePublicProfile(): void
1175  {
1176  global $DIC;
1177 
1178  $tpl = $DIC['tpl'];
1179  $lng = $DIC['lng'];
1180  $ilCtrl = $DIC['ilCtrl'];
1181  $ilUser = $DIC['ilUser'];
1182  $key_suffix = "";
1183 
1184  $this->initPublicProfileForm();
1185  if ($this->form->checkInput()) {
1186  // with active portfolio no options are presented
1187  if ($this->form->getInput("public_profile") != "") {
1188  $ilUser->setPref("public_profile", $this->form->getInput("public_profile"));
1189  }
1190 
1191  // if check on Institute
1192  $val_array = array("title", "birthday", "gender", "org_units", "institution", "department", "upload",
1193  "street", "zipcode", "city", "country", "sel_country", "phone_office", "phone_home", "phone_mobile",
1194  "fax", "email", "second_email", "hobby", "matriculation", "location",
1195  "interests_general", "interests_help_offered", "interests_help_looking");
1196 
1197  // set public profile preferences
1198  $checked_values = $this->getCheckedValues();
1199  foreach ($val_array as $key => $value) {
1200  if ($checked_values["chk_" . $value] ?? false) {
1201  $ilUser->setPref("public_" . $value, "y");
1202  } else {
1203  $ilUser->setPref("public_" . $value, "n");
1204  }
1205  }
1206  // additional defined user data fields
1207  foreach ($this->user_defined_fields->getVisibleDefinitions() as $field_id => $definition) {
1208  if ($checked_values["chk_udf_" . $definition["field_id"]] ?? false) {
1209  $ilUser->setPref("public_udf_" . $definition["field_id"], "y");
1210  } else {
1211  $ilUser->setPref("public_udf_" . $definition["field_id"], "n");
1212  }
1213  }
1214 
1215  $ilUser->update();
1216 
1217  switch ($this->form->getInput("public_profile")) {
1218  case "y":
1219  $key_suffix = "-1";
1220  break;
1221  case "g":
1222  $key_suffix = "-2";
1223  break;
1224  }
1225 
1226  $handler = ilBadgeHandler::getInstance();
1227  if ($handler->isActive()) {
1228  $badgePositions = [];
1229  $bpos = $this->form->getInput("bpos" . $key_suffix);
1230  if (isset($bpos) && is_array($bpos)) {
1231  $badgePositions = $bpos;
1232  }
1233 
1234  if (count($badgePositions) > 0) {
1235  ilBadgeAssignment::updatePositions($ilUser->getId(), $badgePositions);
1236  }
1237  }
1238 
1239  // update lucene index
1240  ilLuceneIndexer::updateLuceneIndex(array((int) $GLOBALS['DIC']['ilUser']->getId()));
1241 
1242  $this->tpl->setOnScreenMessage('success', $lng->txt("msg_obj_modified"), true);
1243 
1244  $this->checklist_status->saveStepSucess(ilProfileChecklistStatus::STEP_PUBLISH_OPTIONS);
1245 
1246  if (ilSession::get('orig_request_target')) {
1247  $target = ilSession::get('orig_request_target');
1248  ilSession::set('orig_request_target', '');
1249  ilUtil::redirect($target);
1250  } else {
1251  $ilCtrl->redirectByClass("iluserprivacysettingsgui", "");
1252  }
1253  }
1254  $this->form->setValuesByPost();
1255  $tpl->showPublicProfile(true);
1256  }
1257 
1258  protected function getCheckedValues(): array // Missing array type.
1259  {
1260  $key_suffix = "";
1261  switch ($this->form->getInput("public_profile")) {
1262  case "y":
1263  $key_suffix = "-1";
1264  break;
1265  case "g":
1266  $key_suffix = "-2";
1267  break;
1268  }
1269 
1270  $checked_values = [];
1271  $post = $this->request->getParsedBody();
1272  foreach ($post as $k => $v) {
1273  if (strpos($k, "chk_") !== 0) {
1274  continue;
1275  }
1276  if (substr($k, -2) === $key_suffix) {
1277  $k = str_replace(["-1", "-2"], "", $k);
1278  }
1279  $checked_values[$k] = $v;
1280  }
1281  foreach ($this->user_defined_fields->getVisibleDefinitions() as $field_id => $definition) {
1282  if (isset($post["chk_udf_" . $definition["field_id"] . $key_suffix])) {
1283  $checked_values["chk_udf_" . $definition["field_id"]] = "1";
1284  }
1285  }
1286  return $checked_values;
1287  }
1288 
1289  public function showExportImport(): void
1290  {
1291  global $DIC;
1292 
1293  $ilToolbar = $DIC['ilToolbar'];
1294  $ilCtrl = $DIC['ilCtrl'];
1295  $tpl = $DIC['tpl'];
1296  $ilTabs = $DIC['ilTabs'];
1297  $ilUser = $DIC['ilUser'];
1298 
1299  $ilTabs->activateTab("export");
1300  $this->setHeader();
1301 
1302  $button = ilLinkButton::getInstance();
1303  $button->setCaption("pd_export_profile");
1304  $button->setUrl($ilCtrl->getLinkTarget($this, "exportPersonalData"));
1305  $ilToolbar->addStickyItem($button);
1306 
1307  $exp_file = $ilUser->getPersonalDataExportFile();
1308  if ($exp_file != "") {
1309  $ilToolbar->addSeparator();
1310  $ilToolbar->addButton(
1311  $this->lng->txt("pd_download_last_export_file"),
1312  $ilCtrl->getLinkTarget($this, "downloadPersonalData")
1313  );
1314  }
1315 
1316  $ilToolbar->addSeparator();
1317  $ilToolbar->addButton(
1318  $this->lng->txt("pd_import_personal_data"),
1319  $ilCtrl->getLinkTarget($this, "importPersonalDataSelection")
1320  );
1321 
1322  $tpl->printToStdout();
1323  }
1324 
1325  public function exportPersonalData(): void
1326  {
1327  global $DIC;
1328 
1329  $ilCtrl = $DIC['ilCtrl'];
1330  $ilUser = $DIC['ilUser'];
1331 
1332  $ilUser->exportPersonalData();
1333  $ilUser->sendPersonalDataFile();
1334  $ilCtrl->redirect($this, "showExportImport");
1335  }
1336 
1340  public function downloadPersonalData(): void
1341  {
1342  global $DIC;
1343 
1344  $ilUser = $DIC['ilUser'];
1345 
1346  $ilUser->sendPersonalDataFile();
1347  }
1348 
1349  public function importPersonalDataSelection(): void
1350  {
1351  global $DIC;
1352 
1353  $tpl = $DIC['tpl'];
1354  $ilTabs = $DIC['ilTabs'];
1355 
1356  $ilTabs->activateTab("export");
1357  $this->setHeader();
1358 
1359  $this->initPersonalDataImportForm();
1360 
1361  $tpl->setContent($this->form->getHTML());
1362  $tpl->printToStdout();
1363  }
1364 
1365  public function initPersonalDataImportForm(): void
1366  {
1367  global $DIC;
1368 
1369  $lng = $DIC['lng'];
1370  $ilCtrl = $DIC['ilCtrl'];
1371 
1372  $this->form = new ilPropertyFormGUI();
1373 
1374  // input file
1375  $fi = new ilFileInputGUI($lng->txt("file"), "file");
1376  $fi->setRequired(true);
1377  $fi->setSuffixes(array("zip"));
1378  $this->form->addItem($fi);
1379 
1380  // profile data
1381  $cb = new ilCheckboxInputGUI($this->lng->txt("pd_profile_data"), "profile_data");
1382  $this->form->addItem($cb);
1383 
1384  // settings
1385  $cb = new ilCheckboxInputGUI($this->lng->txt("settings"), "settings");
1386  $this->form->addItem($cb);
1387 
1388  // personal notes
1389  $cb = new ilCheckboxInputGUI($this->lng->txt("notes"), "notes");
1390  $this->form->addItem($cb);
1391 
1392  // calendar entries
1393  $cb = new ilCheckboxInputGUI($this->lng->txt("pd_private_calendars"), "calendar");
1394  $this->form->addItem($cb);
1395 
1396  $this->form->addCommandButton("importPersonalData", $lng->txt("import"));
1397  $this->form->addCommandButton("showExportImport", $lng->txt("cancel"));
1398 
1399  $this->form->setTitle($lng->txt("pd_import_personal_data"));
1400  $this->form->setFormAction($ilCtrl->getFormAction($this));
1401  }
1402 
1403  public function importPersonalData(): void
1404  {
1405  global $DIC;
1406 
1407  $ilUser = $DIC['ilUser'];
1408  $ilCtrl = $DIC['ilCtrl'];
1409  $tpl = $DIC['tpl'];
1410  $ilTabs = $DIC['ilTabs'];
1411 
1412  $this->initPersonalDataImportForm();
1413  if ($this->form->checkInput()) {
1414  $ilUser->importPersonalData(
1415  $_FILES["file"],
1416  (int) $this->form->getInput("profile_data"),
1417  (int) $this->form->getInput("settings"),
1418  (int) $this->form->getInput("notes"),
1419  (int) $this->form->getInput("calendar")
1420  );
1421  $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
1422  $ilCtrl->redirect($this, "");
1423  } else {
1424  $ilTabs->activateTab("export");
1425  $this->setHeader();
1426  $this->form->setValuesByPost();
1427  $tpl->setContent($this->form->getHTML());
1428  $tpl->printToStdout();
1429  }
1430  }
1431 
1432  protected function showChecklist(int $active_step): void
1433  {
1434  $main_tpl = $this->tpl;
1435  $main_tpl->setRightContent($this->checklist->render($active_step));
1436  }
1437 
1438  private function tempStorePicture(): void
1439  {
1440  $capture = $this->profile_request->getUserFileCapture();
1441 
1442  if ($capture !== '') {
1443  $this->form->getItemByPostVar('userfile')->setImage($capture);
1444  $hidden_user_picture_carry = new ilHiddenInputGUI('user_picture_carry');
1445  $hidden_user_picture_carry->setValue($capture);
1446  $this->form->addItem($hidden_user_picture_carry);
1447  }
1448  }
1449 }
printToStdout(string $part=self::DEFAULT_BLOCK, bool $has_tabs=true, bool $skip_main_menu=false)
static getWebspaceDir(string $mode="filesystem")
get webspace directory
ilUserDefinedFields $user_defined_fields
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
ILIAS User ProfileGUIRequest $profile_request
static get(string $a_var)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Global event handler.
ilTermsOfServiceHelper $termsOfServiceHelper
showPersonalData(bool $a_no_init=false, bool $a_migration_started=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
txt(string $a_topic, string $a_default_lang_fallback_mod="")
gets the text for a given topic if the topic is not in the list, the topic itself with "-" will be re...
ilProfileChecklistGUI $checklist
static updateLuceneIndex(array $a_obj_ids)
Update lucene index.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
$location
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
Definition: buildRTE.php:22
static getInstancesByUserId(int $a_user_id)
Additional user data fields definition.
This class represents a file property in a property form.
static stripSlashes(string $a_str, bool $a_strip_html=true, string $a_allow="")
static isConvertVersionAtLeast(string $a_version)
Compare convert version numbers.
static formatDate(ilDateTime $date, bool $a_skip_day=false, bool $a_include_wd=false, bool $include_seconds=false)
static getDefaultPortfolio(int $a_user_id)
Get default portfolio of user.
Class ilUserProfile.
get(string $part=self::DEFAULT_BLOCK)
Renders the given block and returns the html string.
static formSelect( $selected, string $varname, array $options, bool $multiple=false, bool $direct_text=false, int $size=0, string $style_class="", array $attribs=[], bool $disabled=false)
Builds a select form field with options and shows the selected option first.
This class represents a checkbox property in a property form.
convertUserPicture(string $uploaded_file, string $image_dir)
static escapeShellArg(string $a_arg)
setMultiValues(array $a_values)
setVariable(string $variable, $value='')
Sets the given variable to the given value.
ProfileChangeMailTokenRepository $change_mail_token_repo
Interface ilTermsOfServiceDocumentEvaluation.
showPublicProfile(bool $a_no_init=false)
static prepareFormOutput($a_str, bool $a_strip=false)
getProfilePortfolio()
has profile set to a portfolio?
Class ilTermsOfServiceEventWithdrawn.
ilUserSettingsConfig $user_settings_config
global $DIC
Definition: feed.php:28
if($format !==null) $name
Definition: metadata.php:247
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a property in a property form.
static getMailsToAddress()
Get mailto: emails.
setContent(string $a_html)
Sets content for standard template.
static updatePositions(int $a_user_id, array $a_positions)
downloadPersonalData()
Download personal data export file.
$token
Definition: xapitoken.php:70
const SESSION_CLOSE_USER
static _loginExists(string $a_login, int $a_user_id=0)
check if a login name already exists You may exclude a user from the check by giving his user id as 2...
static isLogin(string $a_login)
static getDefaultSettings()
Get default longitude, latitude and zoom.
This class represents a location property in a property form.
const UDF_TYPE_TEXT
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
string $key
Consumer key/client ID value.
Definition: System.php:193
setBackUrl(string $a_backurl)
Set Back Link URL.
setRequired(bool $a_required)
form( $class_path, string $cmd)
ilTermsOfServiceDocumentEvaluation $termsOfServiceEvaluation
$img
Definition: imgupload.php:83
static redirect(string $a_script)
static _getPersonalPicturePath(int $a_usr_id, string $a_size="small", bool $a_force_pic=false, bool $a_prevent_no_photo_image=false, bool $html_export=false)
static isActivated()
Checks whether Map feature is activated.
Class ilTermsOfServiceHelper.
static ilTempnam(?string $a_temp_path=null)
Returns a unique and non existing Path for e temporary file or directory.
activateTab(string $a_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
const IL_CAL_DATE
getLinkTarget(object $a_gui_obj, string $a_cmd=null, string $a_anchor=null, bool $is_async=false, bool $has_xml_style=false)
Error Handling & global info handling uses PEAR error class.
ilGlobalTemplateInterface $tpl
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
setLatitude(?float $a_latitude)
static redirectToStartingPage(string $target='')
This class represents a property in a property form.
global $ilSetting
Definition: privfeed.php:17
static setClosingContext(int $a_context)
set closing context (for statistics)
__construct(Container $dic, ilPlugin $plugin)
$ilUser
Definition: imgupload.php:34
$id
plugin.php for ilComponentBuildPluginInfoObjectiveTest::testAddPlugins
Definition: plugin.php:23
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addLocationToForm(ilPropertyFormGUI $a_form, ilObjUser $a_user)
Add location fields to form if activated.
setRightContent(string $a_html)
Sets content of right column.
$post
Definition: ltitoken.php:49
ilProfileChecklistStatus $checklist_status
static set(string $a_var, $a_val)
Set a value.
static execConvert(string $args)
execute convert command
static makeDir(string $a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
showPublicProfileFields(ilPropertyFormGUI $form, array $prefs, ?object $parent=null, bool $anonymized=false, string $key_suffix="")