ILIAS  release_7 Revision v7.30-3-g800a261c036
All Data Structures Namespaces Files Functions Variables Modules Pages
ilPersonalProfileGUI Class Reference

GUI class for personal profile. More...

+ Collaboration diagram for ilPersonalProfileGUI:

Public Member Functions

 __construct (\ilTermsOfServiceDocumentEvaluation $termsOfServiceEvaluation=null, \ilTermsOfServiceHelper $termsOfServiceHelper=null)
 constructor More...
 
 executeCommand ()
 execute command More...
 
 workWithUserSetting (string $setting)
 
 userSettingVisible (string $setting)
 
 userSettingEnabled (string $setting)
 
 uploadUserPicture ()
 Upload user image. More...
 
 removeUserPicture ()
 remove user image More...
 
 saveProfile ()
 save user profile data More...
 
 showProfile ()
 show profile form More...
 
 addLocationToForm (ilPropertyFormGUI $a_form, ilObjUser $a_user)
 Add location fields to form if activated. More...
 
 setTabs ()
 
 __showOtherInformations ()
 
 __showUserDefinedFields ()
 
 __checkUserDefinedRequiredFields ()
 
 setHeader ()
 Set header. More...
 
 showPersonalData ($a_no_init=false, $a_migration_started=false)
 Personal data form. More...
 
 initPersonalDataForm ()
 Init personal form. More...
 
 savePersonalData ()
 Save personal data form. More...
 
 goToEmailConfirmation ()
 
 changeEmail ()
 
 showPublicProfile ($a_no_init=false)
 Public profile form. More...
 
 initPublicProfileForm ()
 Init public profile form. More...
 
 showPublicProfileFields (ilPropertyformGUI $form, array $prefs, $parent=null, $anonymized=false, $key_suffix="")
 Add fields to form. More...
 
 savePublicProfile ()
 Save public profile form. More...
 
 showExportImport ()
 Show export/import. More...
 
 exportPersonalData ()
 Export personal data. More...
 
 downloadPersonalData ()
 Download personal data export file. More...
 
 importPersonalDataSelection ()
 Import personal data selection. More...
 
 initPersonalDataImportForm ()
 Init personal data import form. More...
 
 importPersonalData ()
 Import personal data. More...
 

Data Fields

const CHANGE_EMAIL_CMD = 'changeEmail'
 
 $tpl
 
 $user_defined_fields = null
 

Protected Member Functions

 showUserAgreement ()
 
 showConsentWithdrawalConfirmation ()
 
 cancelWithdrawal ()
 
 withdrawAcceptance ()
 
 getProfilePortfolio ()
 has profile set to a portfolio? More...
 
 getCheckedValues ()
 Get checked values. More...
 
 showChecklist ($active_step)
 Show checklist. More...
 

Protected Attributes

 $lng
 
 $ctrl
 
 $tabs
 
 $termsOfServiceEvaluation
 
 $termsOfServiceHelper
 
 $errorHandler
 
 $checklist
 
 $user_settings_config
 
 $checklist_status
 
 $ui_factory
 
 $ui_renderer
 
 $auth_session
 
 $email_change_confirmation_modal = null
 

Private Member Functions

 emailChanged ()
 
 emailCompletionForced ()
 
 addEmailChangeModal ()
 
 loginChanged ()
 
 updateLoginOrSetErrorMessages ()
 
 savePersonalDataForm ()
 

Private Attributes

const PERSONAL_DATA_FORM_ID = 'pd'
 
 $eventHandler
 
 $change_mail_token_repo
 

Detailed Description

Constructor & Destructor Documentation

◆ __construct()

ilPersonalProfileGUI::__construct ( \ilTermsOfServiceDocumentEvaluation  $termsOfServiceEvaluation = null,
\ilTermsOfServiceHelper  $termsOfServiceHelper = null 
)

constructor

Parameters
\ilTermsOfServiceDocumentEvaluation | null$termsOfServiceEvaluation
ilTermsOfServiceHelper | null$termsOfServiceHelper

Definition at line 95 of file class.ilPersonalProfileGUI.php.

References $DIC, $termsOfServiceEvaluation, $termsOfServiceHelper, ilUserDefinedFields\_getInstance(), and user().

98  {
99  global $DIC;
100 
101  $this->tabs = $DIC->tabs();
102  $this->user = $DIC->user();
103  $this->lng = $DIC->language();
104  $this->setting = $DIC->settings();
105  $this->tpl = $DIC->ui()->mainTemplate();
106  $this->ctrl = $DIC->ctrl();
107  $this->errorHandler = $DIC['ilErr'];
108  $this->eventHandler = $DIC['ilAppEventHandler'];
109 
110  if ($termsOfServiceEvaluation === null) {
111  $termsOfServiceEvaluation = $DIC['tos.document.evaluator'];
112  }
113  $this->termsOfServiceEvaluation = $termsOfServiceEvaluation;
114  if ($termsOfServiceHelper === null) {
116  }
117  $this->termsOfServiceHelper = $termsOfServiceHelper;
118 
119  include_once './Services/User/classes/class.ilUserDefinedFields.php';
120  $this->user_defined_fields = &ilUserDefinedFields::_getInstance();
121 
122  $this->lng->loadLanguageModule("jsmath");
123  $this->lng->loadLanguageModule("pd");
124  $this->upload_error = "";
125  $this->password_error = "";
126  $this->lng->loadLanguageModule("user");
127  $this->ctrl->saveParameter($this, "prompted");
128 
129  $this->checklist = new ilProfileChecklistGUI();
130  $this->checklist_status = new ilProfileChecklistStatus();
131 
132  $this->user_settings_config = new ilUserSettingsConfig();
133 
134  $this->ui_factory = $DIC['ui.factory'];
135  $this->ui_renderer = $DIC['ui.renderer'];
136  $this->auth_session = $DIC['ilAuthSession'];
137  $this->change_mail_token_repo = new ProfileChangeMailTokenDBRepository($DIC['ilDB']);
138  }
static _getInstance()
Get instance.
user()
Definition: user.php:4
global $DIC
Definition: goto.php:24
Class ilTermsOfServiceHelper.
User settings configuration (what preferences can be visible/changed/...)
+ Here is the call graph for this function:

Member Function Documentation

◆ __checkUserDefinedRequiredFields()

ilPersonalProfileGUI::__checkUserDefinedRequiredFields ( )

Definition at line 827 of file class.ilPersonalProfileGUI.php.

References $_POST.

Referenced by saveProfile().

828  {
829  foreach ($this->user_defined_fields->getVisibleDefinitions() as $definition) {
830  $field_id = $definition['field_id'];
831  if ($definition['required'] and !strlen($_POST['udf'][$field_id])) {
832  return false;
833  }
834  }
835  return true;
836  }
$_POST["username"]
+ Here is the caller graph for this function:

◆ __showOtherInformations()

ilPersonalProfileGUI::__showOtherInformations ( )

Definition at line 762 of file class.ilPersonalProfileGUI.php.

References userSettingVisible().

763  {
764  $d_set = new ilSetting("delicous");
765  if ($this->userSettingVisible("matriculation") or count($this->user_defined_fields->getVisibleDefinitions())
766  or $d_set->get("user_profile") == "1") {
767  return true;
768  }
769  return false;
770  }
+ Here is the call graph for this function:

◆ __showUserDefinedFields()

ilPersonalProfileGUI::__showUserDefinedFields ( )

Definition at line 772 of file class.ilPersonalProfileGUI.php.

References $DIC, $ilUser, $name, ilUtil\formSelect(), ilUtil\prepareFormOutput(), and UDF_TYPE_TEXT.

773  {
774  global $DIC;
775 
776  $ilUser = $DIC['ilUser'];
777 
778  $user_defined_data = $ilUser->getUserDefinedData();
779  foreach ($this->user_defined_fields->getVisibleDefinitions() as $field_id => $definition) {
780  if ($definition['field_type'] == UDF_TYPE_TEXT) {
781  $this->tpl->setCurrentBlock("field_text");
782  $this->tpl->setVariable("FIELD_VALUE", ilUtil::prepareFormOutput($user_defined_data[$field_id]));
783  if (!$definition['changeable']) {
784  $this->tpl->setVariable("DISABLED_FIELD", 'disabled=\"disabled\"');
785  $this->tpl->setVariable("FIELD_NAME", 'udf[' . $definition['field_id'] . ']');
786  } else {
787  $this->tpl->setVariable("FIELD_NAME", 'udf[' . $definition['field_id'] . ']');
788  }
789  $this->tpl->parseCurrentBlock();
790  } else {
791  if ($definition['changeable']) {
792  $name = 'udf[' . $definition['field_id'] . ']';
793  $disabled = false;
794  } else {
795  $name = '';
796  $disabled = true;
797  }
798  $this->tpl->setCurrentBlock("field_select");
799  $this->tpl->setVariable("SELECT_BOX", ilUtil::formSelect(
800  $user_defined_data[$field_id],
801  $name,
802  $this->user_defined_fields->fieldValuesToSelectArray(
803  $definition['field_values']
804  ),
805  false,
806  true,
807  0,
808  '',
809  '',
810  $disabled
811  ));
812  $this->tpl->parseCurrentBlock();
813  }
814  $this->tpl->setCurrentBlock("user_defined");
815 
816  if ($definition['required']) {
817  $name = $definition['field_name'] . "<span class=\"asterisk\">*</span>";
818  } else {
819  $name = $definition['field_name'];
820  }
821  $this->tpl->setVariable("TXT_FIELD_NAME", $name);
822  $this->tpl->parseCurrentBlock();
823  }
824  return true;
825  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
if($format !==null) $name
Definition: metadata.php:230
global $DIC
Definition: goto.php:24
const UDF_TYPE_TEXT
static formSelect( $selected, $varname, $options, $multiple=false, $direct_text=false, $size="0", $style_class="", $attribs="", $disabled=false)
Builds a select form field with options and shows the selected option first.
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:

◆ addEmailChangeModal()

ilPersonalProfileGUI::addEmailChangeModal ( )
private

Definition at line 1012 of file class.ilPersonalProfileGUI.php.

References ILIAS\UI\Implementation\Component\withAdditionalOnLoadCode().

Referenced by savePersonalData().

1012  : bool
1013  {
1014  $form_id = 'form_' . self::PERSONAL_DATA_FORM_ID;
1015  $modal = $this->ui_factory->modal()->interruptive(
1016  $this->lng->txt('confirm'),
1017  $this->lng->txt('confirm_logout_for_email_change'),
1018  '#'
1019  )->withActionButtonLabel('change');
1020  $this->email_change_confirmation_modal = $modal->withOnLoad($modal->getShowSignal())
1022  static function ($id) use ($form_id) {
1023  return "var button = {$id}.querySelector('input[type=\"submit\"]'); "
1024  . "button.addEventListener('click', (e) => {e.preventDefault();"
1025  . "document.getElementById('{$form_id}').submit();});";
1026  }
1027  );
1028 
1029  $this->form->setFormAction($this->ctrl->getFormActionByClass(self::class, 'goToEmailConfirmation'));
1030  return true;
1031  }
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ addLocationToForm()

ilPersonalProfileGUI::addLocationToForm ( ilPropertyFormGUI  $a_form,
ilObjUser  $a_user 
)

Add location fields to form if activated.

Parameters
ilPropertyFormGUI$a_form
ilObjUser$a_user

Definition at line 665 of file class.ilPersonalProfileGUI.php.

References $DIC, ilPropertyFormGUI\addItem(), ilObjUser\getCity(), ilObjUser\getCountry(), ilMapUtil\getDefaultSettings(), ilObjUser\getLatitude(), ilObjUser\getLocationZoom(), ilObjUser\getLongitude(), ilObjUser\getStreet(), ilMapUtil\isActivated(), and ilLocationInputGUI\setLatitude().

Referenced by initPersonalDataForm().

666  {
667  global $DIC;
668 
669  $ilCtrl = $DIC['ilCtrl'];
670 
671  // check map activation
672  include_once("./Services/Maps/classes/class.ilMapUtil.php");
673  if (!ilMapUtil::isActivated()) {
674  return;
675  }
676 
677  // Don't really know if this is still necessary...
678  $this->lng->loadLanguageModule("maps");
679 
680  // Get user settings
681  $latitude = $a_user->getLatitude();
682  $longitude = $a_user->getLongitude();
683  $zoom = $a_user->getLocationZoom();
684 
685  // Get Default settings, when nothing is set
686  if ($latitude == 0 && $longitude == 0 && $zoom == 0) {
688  $latitude = $def["latitude"];
689  $longitude = $def["longitude"];
690  $zoom = $def["zoom"];
691  }
692 
693  $street = $a_user->getStreet();
694  if (!$street) {
695  $street = $this->lng->txt("street");
696  }
697  $city = $a_user->getCity();
698  if (!$city) {
699  $city = $this->lng->txt("city");
700  }
701  $country = $a_user->getCountry();
702  if (!$country) {
703  $country = $this->lng->txt("country");
704  }
705 
706  // location property
707  $loc_prop = new ilLocationInputGUI(
708  $this->lng->txt("location"),
709  "location"
710  );
711  $loc_prop->setLatitude($latitude);
712  $loc_prop->setLongitude($longitude);
713  $loc_prop->setZoom($zoom);
714  $loc_prop->setAddress($street . "," . $city . "," . $country);
715 
716  $a_form->addItem($loc_prop);
717  }
setLatitude($a_latitude)
Set Latitude.
getLocationZoom()
Get Location Zoom.
addItem($a_item)
Add Item (Property, SectionHeader).
getLongitude()
Get Longitude.
getStreet()
get street public
getCountry()
Get country (free text)
getCity()
get city public
static getDefaultSettings()
Get default longitude, latitude and zoom.
global $DIC
Definition: goto.php:24
This class represents a location property in a property form.
getLatitude()
Get Latitude.
static isActivated()
Checks whether Map feature is activated.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ cancelWithdrawal()

ilPersonalProfileGUI::cancelWithdrawal ( )
protected

Definition at line 604 of file class.ilPersonalProfileGUI.php.

References ilSession\get(), ilSession\set(), and user().

604  : void
605  {
606  if (!$this->termsOfServiceHelper->isIncludedUser($this->user)) {
607  $this->errorHandler->raiseError($this->lng->txt('permission_denied'), $this->errorHandler->MESSAGE);
608  }
609 
610  $this->user->deletePref('consent_withdrawal_requested');
611 
612  if (ilSession::get('orig_request_target')) {
613  $target = ilSession::get('orig_request_target');
614  ilSession::set('orig_request_target', '');
615  $this->ctrl->redirectToUrl($target);
616  } else {
617  ilInitialisation::redirectToStartingPage();
618  }
619  }
static get($a_var)
Get a value.
static set($a_var, $a_val)
Set a value.
user()
Definition: user.php:4
+ Here is the call graph for this function:

◆ changeEmail()

ilPersonalProfileGUI::changeEmail ( )

Definition at line 1174 of file class.ilPersonalProfileGUI.php.

References $_GET, $token, showPublicProfile(), and user().

1174  : void
1175  {
1176  $token = $_GET['token'];
1177  $new_email = $this->change_mail_token_repo->getNewEmailForUser($this->user, $token);
1178 
1179  if ($new_email !== '') {
1180  $this->user->setEmail($new_email);
1181  $this->user->update();
1182  $this->change_mail_token_repo->deleteEntryByToken($token);
1183  $this->tpl->setOnScreenMessage(
1184  'success',
1185  $this->lng->txt('saved_successfully')
1186  );
1187  $this->showPublicProfile();
1188  return;
1189  }
1190 
1191  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('email_could_not_be_changed'));
1192  $this->showPublicProfile();
1193  }
showPublicProfile($a_no_init=false)
Public profile form.
$_GET["client_id"]
user()
Definition: user.php:4
$token
Definition: xapitoken.php:52
+ Here is the call graph for this function:

◆ downloadPersonalData()

ilPersonalProfileGUI::downloadPersonalData ( )

Download personal data export file.

Parameters

Definition at line 1657 of file class.ilPersonalProfileGUI.php.

References $DIC, and $ilUser.

1658  {
1659  global $DIC;
1660 
1661  $ilUser = $DIC['ilUser'];
1662 
1663  $ilUser->sendPersonalDataFile();
1664  }
global $DIC
Definition: goto.php:24
$ilUser
Definition: imgupload.php:18

◆ emailChanged()

ilPersonalProfileGUI::emailChanged ( )
private

Definition at line 985 of file class.ilPersonalProfileGUI.php.

References user().

Referenced by savePersonalData().

985  : bool
986  {
987  $email_input = $this->form->getItemByPostVar('usr_email');
988  if ($email_input !== null
989  && $email_input !== false
990  && !$email_input->getDisabled()
991  && $this->form->getInput('usr_email') !== $this->user->getEmail()) {
992  return true;
993  }
994 
995  return false;
996  }
user()
Definition: user.php:4
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ emailCompletionForced()

ilPersonalProfileGUI::emailCompletionForced ( )
private

Definition at line 998 of file class.ilPersonalProfileGUI.php.

References user().

Referenced by savePersonalData(), and savePersonalDataForm().

998  : bool
999  {
1000  $current_email = $this->user->getEmail();
1001  if (
1002  $this->user->getProfileIncomplete()
1003  && $this->setting->get('require_email') === '1'
1004  && ($current_email === null || $current_email === '')
1005  ) {
1006  return true;
1007  }
1008 
1009  return false;
1010  }
user()
Definition: user.php:4
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ executeCommand()

ilPersonalProfileGUI::executeCommand ( )

execute command

Definition at line 143 of file class.ilPersonalProfileGUI.php.

References $_GET, $DIC, $ilUser, $tpl, setHeader(), setTabs(), showChecklist(), and ilProfileChecklistStatus\STEP_VISIBILITY_OPTIONS.

144  {
145  global $DIC;
146 
147  $ilUser = $DIC['ilUser'];
148  $ilCtrl = $DIC['ilCtrl'];
149  $tpl = $DIC['tpl'];
150  $ilTabs = $DIC['ilTabs'];
151 
152  $next_class = $this->ctrl->getNextClass();
153 
154  switch ($next_class) {
155  case "ilpublicuserprofilegui":
156  include_once("./Services/User/classes/class.ilPublicUserProfileGUI.php");
157  $_GET["user_id"] = $ilUser->getId();
158  $pub_profile_gui = new ilPublicUserProfileGUI($_GET["user_id"]);
159  $pub_profile_gui->setBackUrl($ilCtrl->getLinkTarget($this, "showPersonalData"));
160  $ilCtrl->forwardCommand($pub_profile_gui);
161  $tpl->printToStdout();
162  break;
163 
164  case "iluserprivacysettingsgui":
165  $this->setHeader();
166  $this->setTabs();
167  $ilTabs->activateTab("visibility_settings");
169  $gui = new ilUserPrivacySettingsGUI();
170  $ilCtrl->forwardCommand($gui);
171  break;
172 
173  default:
174  $this->setTabs();
175  $cmd = $this->ctrl->getCmd("showPersonalData");
176  $this->$cmd();
177  break;
178  }
179  return true;
180  }
$_GET["client_id"]
GUI class for public user profile presentation.
showChecklist($active_step)
Show checklist.
global $DIC
Definition: goto.php:24
$ilUser
Definition: imgupload.php:18
User privacy settings (currently located under "Profile and Privacy")
+ Here is the call graph for this function:

◆ exportPersonalData()

ilPersonalProfileGUI::exportPersonalData ( )

Export personal data.

Definition at line 1639 of file class.ilPersonalProfileGUI.php.

References $DIC, and $ilUser.

1640  {
1641  global $DIC;
1642 
1643  $ilCtrl = $DIC['ilCtrl'];
1644  $ilUser = $DIC['ilUser'];
1645 
1646  $ilUser->exportPersonalData();
1647  $ilUser->sendPersonalDataFile();
1648  $ilCtrl->redirect($this, "showExportImport");
1649  }
global $DIC
Definition: goto.php:24
$ilUser
Definition: imgupload.php:18

◆ getCheckedValues()

ilPersonalProfileGUI::getCheckedValues ( )
protected

Get checked values.

Returns
array

Definition at line 1578 of file class.ilPersonalProfileGUI.php.

References $_POST.

Referenced by savePublicProfile().

1579  {
1580  $checked_values = [];
1581  foreach ($_POST as $k => $v) {
1582  if (substr($k, 0, 4) == "chk_") {
1583  $k = str_replace("-1", "", $k);
1584  $k = str_replace("-2", "", $k);
1585  $checked_values[$k] = $v;
1586  }
1587  }
1588  return $checked_values;
1589  }
$_POST["username"]
+ Here is the caller graph for this function:

◆ getProfilePortfolio()

ilPersonalProfileGUI::getProfilePortfolio ( )
protected

has profile set to a portfolio?

Returns
int

Definition at line 1226 of file class.ilPersonalProfileGUI.php.

References $DIC, $ilSetting, $ilUser, and ilObjPortfolio\getDefaultPortfolio().

Referenced by initPublicProfileForm().

1227  {
1228  global $DIC;
1229 
1230  $ilUser = $DIC['ilUser'];
1231  $ilSetting = $DIC['ilSetting'];
1232 
1233  if ($ilSetting->get('user_portfolios')) {
1234  include_once "Modules/Portfolio/classes/class.ilObjPortfolio.php";
1236  }
1237  }
global $DIC
Definition: goto.php:24
global $ilSetting
Definition: privfeed.php:17
static getDefaultPortfolio($a_user_id)
Get default portfolio of user.
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ goToEmailConfirmation()

ilPersonalProfileGUI::goToEmailConfirmation ( )

Definition at line 1071 of file class.ilPersonalProfileGUI.php.

References $token, initPersonalDataForm(), loginChanged(), savePersonalDataForm(), ilSession\SESSION_CLOSE_USER, ilSession\setClosingContext(), showPersonalData(), updateLoginOrSetErrorMessages(), and user().

1071  : void
1072  {
1073  $this->initPersonalDataForm();
1074  if (!$this->form->checkInput()
1075  || $this->loginChanged() && !$this->updateLoginOrSetErrorMessages()) {
1076  $this->form->setValuesByPost();
1077  $this->showPersonalData(true);
1078  return;
1079  }
1080  $this->savePersonalDataForm();
1081 
1083  $this->auth_session->logout();
1084  session_unset();
1085  $token = $this->change_mail_token_repo->getNewTokenForUser($this->user, $this->form->getInput('usr_email'));
1086  $this->ctrl->redirectToURL('login.php?cmd=force_login&target=usr_' . self::CHANGE_EMAIL_CMD . $token);
1087  }
showPersonalData($a_no_init=false, $a_migration_started=false)
Personal data form.
user()
Definition: user.php:4
$token
Definition: xapitoken.php:52
const SESSION_CLOSE_USER
initPersonalDataForm()
Init personal form.
static setClosingContext($a_context)
set closing context (for statistics)
+ Here is the call graph for this function:

◆ importPersonalData()

ilPersonalProfileGUI::importPersonalData ( )

Import personal data.

Parameters

Definition at line 1742 of file class.ilPersonalProfileGUI.php.

References $_POST, $DIC, $ilUser, $tpl, initPersonalDataImportForm(), and setHeader().

1743  {
1744  global $DIC;
1745 
1746  $ilUser = $DIC['ilUser'];
1747  $ilCtrl = $DIC['ilCtrl'];
1748  $tpl = $DIC['tpl'];
1749  $ilTabs = $DIC['ilTabs'];
1750 
1751  $this->initPersonalDataImportForm();
1752  if ($this->form->checkInput()) {
1753  $ilUser->importPersonalData(
1754  $_FILES["file"],
1755  (int) $_POST["profile_data"],
1756  (int) $_POST["settings"],
1757  (int) $_POST["notes"],
1758  (int) $_POST["calendar"]
1759  );
1760  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
1761  $ilCtrl->redirect($this, "");
1762  } else {
1763  $ilTabs->activateTab("export");
1764  $this->setHeader();
1765  $this->form->setValuesByPost();
1766  $tpl->setContent($this->form->getHtml());
1767  $tpl->printToStdout();
1768  }
1769  }
initPersonalDataImportForm()
Init personal data import form.
global $DIC
Definition: goto.php:24
$ilUser
Definition: imgupload.php:18
$_POST["username"]
+ Here is the call graph for this function:

◆ importPersonalDataSelection()

ilPersonalProfileGUI::importPersonalDataSelection ( )

Import personal data selection.

Parameters

Definition at line 1672 of file class.ilPersonalProfileGUI.php.

References $DIC, $lng, $tpl, initPersonalDataImportForm(), and setHeader().

1673  {
1674  global $DIC;
1675 
1676  $lng = $DIC['lng'];
1677  $ilCtrl = $DIC['ilCtrl'];
1678  $tpl = $DIC['tpl'];
1679  $ilTabs = $DIC['ilTabs'];
1680 
1681  $ilTabs->activateTab("export");
1682  $this->setHeader();
1683 
1684  $this->initPersonalDataImportForm();
1685 
1686  $tpl->setContent($this->form->getHTML());
1687  $tpl->printToStdout();
1688  }
initPersonalDataImportForm()
Init personal data import form.
global $DIC
Definition: goto.php:24
+ Here is the call graph for this function:

◆ initPersonalDataForm()

ilPersonalProfileGUI::initPersonalDataForm ( )

Init personal form.

Definition at line 913 of file class.ilPersonalProfileGUI.php.

References $DIC, $ilUser, $lng, addLocationToForm(), and ilCustomUserFieldsHelper\getInstance().

Referenced by goToEmailConfirmation(), savePersonalData(), and showPersonalData().

914  {
915  global $DIC;
916  $lng = $DIC['lng'];
917  $ilUser = $DIC['ilUser'];
918 
919  $this->form = new ilPropertyFormGUI();
920  $this->form->setFormAction($this->ctrl->getFormAction($this));
921  $this->form->setId(self::PERSONAL_DATA_FORM_ID);
922 
923  // user defined fields
924  $user_defined_data = $ilUser->getUserDefinedData();
925 
926 
927  foreach ($this->user_defined_fields->getVisibleDefinitions() as $field_id => $definition) {
928  $value = $user_defined_data["f_" . $field_id];
929 
930  include_once './Services/User/classes/class.ilCustomUserFieldsHelper.php';
931  $fprop = ilCustomUserFieldsHelper::getInstance()->getFormPropertyForDefinition(
932  $definition,
933  $definition['changeable'],
934  $value
935  );
936  if ($fprop instanceof ilFormPropertyGUI) {
937  $this->input['udf_' . $definition['field_id']] = $fprop;
938  }
939  }
940 
941  // standard fields
942  include_once("./Services/User/classes/class.ilUserProfile.php");
943  $up = new ilUserProfile();
944  $up->skipField("password");
945  $up->skipGroup("settings");
946  $up->skipGroup("preferences");
947 
948  $up->setAjaxCallback(
949  $this->ctrl->getLinkTargetByClass('ilPublicUserProfileGUI', 'doProfileAutoComplete', '', true)
950  );
951 
952  // standard fields
953  $up->addStandardFieldsToForm($this->form, $ilUser, $this->input);
954 
955  $this->addLocationToForm($this->form, $ilUser);
956 
957  $this->form->addCommandButton("savePersonalData", $lng->txt("user_save_continue"));
958  }
This class represents a property form user interface.
Class ilUserProfile.
global $DIC
Definition: goto.php:24
This class represents a property in a property form.
addLocationToForm(ilPropertyFormGUI $a_form, ilObjUser $a_user)
Add location fields to form if activated.
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initPersonalDataImportForm()

ilPersonalProfileGUI::initPersonalDataImportForm ( )

Init personal data import form.

Parameters

Definition at line 1696 of file class.ilPersonalProfileGUI.php.

References $DIC, $lng, ilFormPropertyGUI\setRequired(), and ilFormPropertyGUI\setTitle().

Referenced by importPersonalData(), and importPersonalDataSelection().

1697  {
1698  global $DIC;
1699 
1700  $lng = $DIC['lng'];
1701  $ilCtrl = $DIC['ilCtrl'];
1702 
1703  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1704  $this->form = new ilPropertyFormGUI();
1705 
1706  // input file
1707  $fi = new ilFileInputGUI($lng->txt("file"), "file");
1708  $fi->setRequired(true);
1709  $fi->setSuffixes(array("zip"));
1710  $this->form->addItem($fi);
1711 
1712  // profile data
1713  $cb = new ilCheckboxInputGUI($this->lng->txt("pd_profile_data"), "profile_data");
1714  $this->form->addItem($cb);
1715 
1716  // settings
1717  $cb = new ilCheckboxInputGUI($this->lng->txt("settings"), "settings");
1718  $this->form->addItem($cb);
1719 
1720  // personal notes
1721  $cb = new ilCheckboxInputGUI($this->lng->txt("notes"), "notes");
1722  $this->form->addItem($cb);
1723 
1724  // calendar entries
1725  $cb = new ilCheckboxInputGUI($this->lng->txt("pd_private_calendars"), "calendar");
1726  $this->form->addItem($cb);
1727 
1728  $this->form->addCommandButton("importPersonalData", $lng->txt("import"));
1729  $this->form->addCommandButton("showExportImport", $lng->txt("cancel"));
1730 
1731  $this->form->setTitle($lng->txt("pd_import_personal_data"));
1732  $this->form->setFormAction($ilCtrl->getFormAction($this));
1733  }
This class represents a property form user interface.
This class represents a file property in a property form.
This class represents a checkbox property in a property form.
setTitle($a_title)
Set Title.
global $DIC
Definition: goto.php:24
setRequired($a_required)
Set Required.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ initPublicProfileForm()

ilPersonalProfileGUI::initPublicProfileForm ( )

Init public profile form.

Parameters
int$a_modeEdit Mode

Definition at line 1244 of file class.ilPersonalProfileGUI.php.

References $DIC, $ilSetting, $ilUser, $lng, getProfilePortfolio(), ilFormPropertyGUI\setInfo(), and showPublicProfileFields().

Referenced by savePublicProfile(), and showPublicProfile().

1245  {
1246  global $DIC;
1247 
1248  $lng = $DIC['lng'];
1249  $ilUser = $DIC['ilUser'];
1250  $ilSetting = $DIC['ilSetting'];
1251 
1252  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1253  $this->form = new ilPropertyFormGUI();
1254 
1255  $this->form->setTitle($lng->txt("user_publish_options"));
1256  $this->form->setDescription($lng->txt("user_public_profile_info"));
1257  $this->form->setFormAction($this->ctrl->getFormAction($this));
1258 
1259  $portfolio_id = $this->getProfilePortfolio();
1260 
1261  if (!$portfolio_id) {
1262  // Activate public profile
1263  $radg = new ilRadioGroupInputGUI($lng->txt("user_activate_public_profile"), "public_profile");
1264  $info = $this->lng->txt("user_activate_public_profile_info");
1265  $profile_mode = new ilPersonalProfileMode($ilUser, $ilSetting);
1266  $pub_prof = $profile_mode->getMode();
1267  $radg->setValue($pub_prof);
1268  $op1 = new ilRadioOption($lng->txt("usr_public_profile_disabled"), "n", $lng->txt("usr_public_profile_disabled_info"));
1269  $radg->addOption($op1);
1270  $op2 = new ilRadioOption($lng->txt("usr_public_profile_logged_in"), "y");
1271  $radg->addOption($op2);
1272  if ($ilSetting->get('enable_global_profiles')) {
1273  $op3 = new ilRadioOption($lng->txt("usr_public_profile_global"), "g");
1274  $radg->addOption($op3);
1275  }
1276  $this->form->addItem($radg);
1277 
1278  // #11773
1279  if ($ilSetting->get('user_portfolios')) {
1280  // #10826
1281  $prtf = "<br />" . $lng->txt("user_profile_portfolio");
1282  $prtf .= "<br /><a href=\"ilias.php?baseClass=ilDashboardGUI&cmd=jumpToPortfolio\">&raquo; " .
1283  $lng->txt("user_portfolios") . "</a>";
1284  $info .= $prtf;
1285  }
1286 
1287  $radg->setInfo($info);
1288  } else {
1289  $prtf = $lng->txt("user_profile_portfolio_selected");
1290  $prtf .= "<br /><a href=\"ilias.php?baseClass=ilDashboardGUI&cmd=jumpToPortfolio&prt_id=" . $portfolio_id . "\">&raquo; " .
1291  $lng->txt("portfolio") . "</a>";
1292 
1293  $info = new ilCustomInputGUI($lng->txt("user_activate_public_profile"));
1294  $info->setHTML($prtf);
1295  $this->form->addItem($info);
1296  $this->showPublicProfileFields($this->form, $ilUser->prefs);
1297  }
1298 
1299  if (is_object($op2)) {
1300  $this->showPublicProfileFields($this->form, $ilUser->prefs, $op2, false, "-1");
1301  }
1302  if (is_object($op3)) {
1303  $this->showPublicProfileFields($this->form, $ilUser->prefs, $op3, false, "-2");
1304  }
1305  $this->form->setForceTopButtons(true);
1306  $this->form->addCommandButton("savePublicProfile", $lng->txt("user_save_continue"));
1307  }
This class represents an option in a radio group.
Personal profile publishing mode of a iser.
This class represents a property form user interface.
getProfilePortfolio()
has profile set to a portfolio?
setInfo($a_info)
Set Information Text.
This class represents a property in a property form.
showPublicProfileFields(ilPropertyformGUI $form, array $prefs, $parent=null, $anonymized=false, $key_suffix="")
Add fields to form.
global $DIC
Definition: goto.php:24
This class represents a custom property in a property form.
global $ilSetting
Definition: privfeed.php:17
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ loginChanged()

ilPersonalProfileGUI::loginChanged ( )
private

Definition at line 1033 of file class.ilPersonalProfileGUI.php.

References $login, and user().

Referenced by goToEmailConfirmation(), and savePersonalData().

1033  : bool
1034  {
1035  $login = $this->form->getInput('username');
1036  if ((int) $this->setting->get('allow_change_loginname')
1037  && $login !== $this->user->getLogin()) {
1038  return true;
1039  }
1040 
1041  return false;
1042  }
$login
Definition: cron.php:13
user()
Definition: user.php:4
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ removeUserPicture()

ilPersonalProfileGUI::removeUserPicture ( )

remove user image

Definition at line 280 of file class.ilPersonalProfileGUI.php.

References $DIC, $ilUser, and saveProfile().

281  {
282  global $DIC;
283 
284  $ilUser = $DIC['ilUser'];
285 
286  $ilUser->removeUserPicture();
287 
288  $this->saveProfile();
289  }
saveProfile()
save user profile data
global $DIC
Definition: goto.php:24
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:

◆ savePersonalData()

ilPersonalProfileGUI::savePersonalData ( )

Save personal data form.

Definition at line 964 of file class.ilPersonalProfileGUI.php.

References addEmailChangeModal(), emailChanged(), emailCompletionForced(), initPersonalDataForm(), loginChanged(), savePersonalDataForm(), showPersonalData(), ilProfileChecklistStatus\STEP_PROFILE_DATA, and updateLoginOrSetErrorMessages().

965  {
966  $this->initPersonalDataForm();
967 
968  if (!$this->form->checkInput()
969  || !$this->emailCompletionForced()
970  && $this->emailChanged()
971  && $this->addEmailChangeModal()
972  || $this->loginChanged() && !$this->updateLoginOrSetErrorMessages()) {
973  $this->form->setValuesByPost();
974  $this->showPersonalData(true);
975  return;
976  }
977  $this->savePersonalDataForm();
978 
979  $this->checklist_status->saveStepSucess(ilProfileChecklistStatus::STEP_PROFILE_DATA);
980  $this->tpl->setOnScreenMessage('success', $this->lng->txt("msg_obj_modified"), true);
981 
982  $this->ctrl->redirect($this, "showPublicProfile");
983  }
showPersonalData($a_no_init=false, $a_migration_started=false)
Personal data form.
initPersonalDataForm()
Init personal form.
+ Here is the call graph for this function:

◆ savePersonalDataForm()

ilPersonalProfileGUI::savePersonalDataForm ( )
private

Definition at line 1089 of file class.ilPersonalProfileGUI.php.

References Vendor\Package\$f, $location, emailCompletionForced(), IL_CAL_DATE, ilMapUtil\isActivated(), ilUtil\stripSlashes(), uploadUserPicture(), and user().

Referenced by goToEmailConfirmation(), and savePersonalData().

1089  : void
1090  {
1091  // if form field name differs from setter
1092  $map = [
1093  "firstname" => "FirstName",
1094  "lastname" => "LastName",
1095  "title" => "UTitle",
1096  "sel_country" => "SelectedCountry",
1097  "phone_office" => "PhoneOffice",
1098  "phone_home" => "PhoneHome",
1099  "phone_mobile" => "PhoneMobile",
1100  "referral_comment" => "Comment",
1101  "interests_general" => "GeneralInterests",
1102  "interests_help_offered" => "OfferingHelp",
1103  "interests_help_looking" => "LookingForHelp"
1104  ];
1105  $up = new ilUserProfile();
1106  foreach (array_keys($up->getStandardFields()) as $f) {
1107  // if item is part of form, it is currently valid (if not disabled)
1108  $item = $this->form->getItemByPostVar("usr_" . $f);
1109  if (!$item || $item->getDisabled()) {
1110  continue;
1111  }
1112 
1113  $value = $this->form->getInput("usr_" . $f);
1114  switch ($f) {
1115  case 'email':
1116  if ($this->emailCompletionForced()) {
1117  $this->user->setEmail($value);
1118  }
1119 
1120  break;
1121  case "birthday":
1122  $value = $item->getDate();
1123  $this->user->setBirthday($value
1124  ? $value->get(IL_CAL_DATE)
1125  : "");
1126  break;
1127  case "second_email":
1128  $this->user->setSecondEmail($value);
1129  break;
1130  default:
1131  $m = $map[$f] ?? ucfirst($f);
1132  $this->user->{"set" . $m}($value);
1133  break;
1134  }
1135  }
1136  $this->user->setFullname();
1137 
1138  // check map activation
1139  if (ilMapUtil::isActivated()) {
1140  // #17619 - proper escaping
1141  $location = $this->form->getInput("location");
1142  $lat = ilUtil::stripSlashes($location["latitude"]);
1143  $long = ilUtil::stripSlashes($location["longitude"]);
1144  $zoom = ilUtil::stripSlashes($location["zoom"]);
1145  $this->user->setLatitude(is_numeric($lat) ? $lat : null);
1146  $this->user->setLongitude(is_numeric($long) ? $long : null);
1147  $this->user->setLocationZoom(is_numeric($zoom) ? $zoom : null);
1148  }
1149 
1150  // Set user defined data
1151  $defs = $this->user_defined_fields->getVisibleDefinitions();
1152  $udf = [];
1153  foreach ($defs as $definition) {
1154  $f = "udf_" . $definition['field_id'];
1155  $item = $this->form->getItemByPostVar($f);
1156  if ($item && !$item->getDisabled()) {
1157  $udf[$definition['field_id']] = $this->form->getInput($f);
1158  }
1159  }
1160  $this->user->setUserDefinedData($udf);
1161 
1162  $this->uploadUserPicture();
1163 
1164  // profile ok
1165  $this->user->setProfileIncomplete(false);
1166 
1167  // save user data & object_data
1168  $this->user->setTitle($this->user->getFullname());
1169  $this->user->setDescription($this->user->getEmail());
1170 
1171  $this->user->update();
1172  }
$location
Definition: buildRTE.php:44
Class ilUserProfile.
uploadUserPicture()
Upload user image.
user()
Definition: user.php:4
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static isActivated()
Checks whether Map feature is activated.
const IL_CAL_DATE
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ saveProfile()

ilPersonalProfileGUI::saveProfile ( )

save user profile data

Definition at line 296 of file class.ilPersonalProfileGUI.php.

References $_POST, $DIC, $GLOBALS, $ilUser, __checkUserDefinedRequiredFields(), ilUtil\is_email(), ilUtil\sendFailure(), settings(), showProfile(), ilUtil\stripSlashes(), ilLuceneIndexer\updateLuceneIndex(), and workWithUserSetting().

Referenced by removeUserPicture().

297  {
298  global $DIC;
299 
300  $ilUser = $DIC['ilUser'];
301 
302  //init checking var
303  $form_valid = true;
304 
305  // testing by ratana ty:
306  // if people check on check box it will
307  // write some datata to table usr_pref
308  // if check on Public Profile
309  if (($_POST["chk_pub"]) == "on") {
310  $ilUser->setPref("public_profile", "y");
311  } else {
312  $ilUser->setPref("public_profile", "n");
313  }
314 
315  // if check on Institute
316  $val_array = array("institution", "department", "upload", "street",
317  "zip", "city", "country", "phone_office", "phone_home", "phone_mobile",
318  "fax", "email", "second_email", "hobby", "matriculation");
319 
320  // set public profile preferences
321  foreach ($val_array as $key => $value) {
322  if (($_POST["chk_" . $value]) == "on") {
323  $ilUser->setPref("public_" . $value, "y");
324  } else {
325  $ilUser->setPref("public_" . $value, "n");
326  }
327  }
328 
329  // check dynamically required fields
330  foreach ($this->settings as $key => $val) {
331  if (substr($key, 0, 8) == "require_") {
332  $require_keys[] = substr($key, 8);
333  }
334  }
335 
336  foreach ($require_keys as $key => $val) {
337  // exclude required system and registration-only fields
338  $system_fields = array("login", "default_role", "passwd", "passwd2");
339  if (!in_array($val, $system_fields)) {
340  if ($this->workWithUserSetting($val)) {
341  if (isset($this->settings["require_" . $val]) && $this->settings["require_" . $val]) {
342  if (empty($_POST["usr_" . $val])) {
343  ilUtil::sendFailure($this->lng->txt("fill_out_all_required_fields") . ": " . $this->lng->txt($val));
344  $form_valid = false;
345  }
346  }
347  }
348  }
349  }
350 
351  // Check user defined required fields
352  if ($form_valid and !$this->__checkUserDefinedRequiredFields()) {
353  ilUtil::sendFailure($this->lng->txt("fill_out_all_required_fields"));
354  $form_valid = false;
355  }
356 
357  // check email
358  if ($this->workWithUserSetting("email")) {
359  if (!ilUtil::is_email($_POST["usr_email"]) and !empty($_POST["usr_email"]) and $form_valid) {
360  ilUtil::sendFailure($this->lng->txt("email_not_valid"));
361  $form_valid = false;
362  }
363  }
364  // check second email
365  if ($this->workWithUserSetting("second_email")) {
366  if (!ilUtil::is_email($_POST["usr_second_email"]) and !empty($_POST["usr_second_email"]) and $form_valid) {
367  ilUtil::sendFailure($this->lng->txt("second_email_not_valid"));
368  $form_valid = false;
369  }
370  }
371 
372  //update user data (not saving!)
373  if ($this->workWithUserSetting("firstname")) {
374  $ilUser->setFirstName(ilUtil::stripSlashes($_POST["usr_firstname"]));
375  }
376  if ($this->workWithUserSetting("lastname")) {
377  $ilUser->setLastName(ilUtil::stripSlashes($_POST["usr_lastname"]));
378  }
379  if ($this->workWithUserSetting("gender")) {
380  $ilUser->setGender($_POST["usr_gender"]);
381  }
382  if ($this->workWithUserSetting("title")) {
383  $ilUser->setUTitle(ilUtil::stripSlashes($_POST["usr_title"]));
384  }
385  $ilUser->setFullname();
386  if ($this->workWithUserSetting("institution")) {
387  $ilUser->setInstitution(ilUtil::stripSlashes($_POST["usr_institution"]));
388  }
389  if ($this->workWithUserSetting("department")) {
390  $ilUser->setDepartment(ilUtil::stripSlashes($_POST["usr_department"]));
391  }
392  if ($this->workWithUserSetting("street")) {
393  $ilUser->setStreet(ilUtil::stripSlashes($_POST["usr_street"]));
394  }
395  if ($this->workWithUserSetting("zipcode")) {
396  $ilUser->setZipcode(ilUtil::stripSlashes($_POST["usr_zipcode"]));
397  }
398  if ($this->workWithUserSetting("city")) {
399  $ilUser->setCity(ilUtil::stripSlashes($_POST["usr_city"]));
400  }
401  if ($this->workWithUserSetting("country")) {
402  $ilUser->setCountry(ilUtil::stripSlashes($_POST["usr_country"]));
403  }
404  if ($this->workWithUserSetting("phone_office")) {
405  $ilUser->setPhoneOffice(ilUtil::stripSlashes($_POST["usr_phone_office"]));
406  }
407  if ($this->workWithUserSetting("phone_home")) {
408  $ilUser->setPhoneHome(ilUtil::stripSlashes($_POST["usr_phone_home"]));
409  }
410  if ($this->workWithUserSetting("phone_mobile")) {
411  $ilUser->setPhoneMobile(ilUtil::stripSlashes($_POST["usr_phone_mobile"]));
412  }
413  if ($this->workWithUserSetting("fax")) {
414  $ilUser->setFax(ilUtil::stripSlashes($_POST["usr_fax"]));
415  }
416  if ($this->workWithUserSetting("email")) {
417  $ilUser->setEmail(ilUtil::stripSlashes($_POST["usr_email"]));
418  }
419  if ($this->workWithUserSetting("second_email")) {
420  $ilUser->setSecondEmail(ilUtil::stripSlashes($_POST["usr_second_email"]));
421  }
422  if ($this->workWithUserSetting("hobby")) {
423  $ilUser->setHobby(ilUtil::stripSlashes($_POST["usr_hobby"]));
424  }
425  if ($this->workWithUserSetting("referral_comment")) {
426  $ilUser->setComment(ilUtil::stripSlashes($_POST["usr_referral_comment"]));
427  }
428  if ($this->workWithUserSetting("matriculation")) {
429  $ilUser->setMatriculation(ilUtil::stripSlashes($_POST["usr_matriculation"]));
430  }
431 
432  // Set user defined data
433  $ilUser->setUserDefinedData($_POST['udf']);
434 
435  // everthing's ok. save form data
436  if ($form_valid) {
437  // init reload var. page should only be reloaded if skin or style were changed
438  $reload = false;
439 
440  if ($this->workWithUserSetting("skin_style")) {
441  //set user skin and style
442  if ($_POST["usr_skin_style"] != "") {
443  $sknst = explode(":", $_POST["usr_skin_style"]);
444 
445  if ($ilUser->getPref("style") != $sknst[1] ||
446  $ilUser->getPref("skin") != $sknst[0]) {
447  $ilUser->setPref("skin", $sknst[0]);
448  $ilUser->setPref("style", $sknst[1]);
449  $reload = true;
450  }
451  }
452  }
453 
454  if ($this->workWithUserSetting("language")) {
455  // reload page if language was changed
456  //if ($_POST["usr_language"] != "" and $_POST["usr_language"] != $_SESSION['lang'])
457  // (this didn't work as expected, alex)
458  if ($_POST["usr_language"] != $ilUser->getLanguage()) {
459  $reload = true;
460  }
461 
462  // set user language
463  $ilUser->setLanguage($_POST["usr_language"]);
464  }
465  if ($this->workWithUserSetting("hits_per_page")) {
466  // set user hits per page
467  if ($_POST["hits_per_page"] != "") {
468  $ilUser->setPref("hits_per_page", $_POST["hits_per_page"]);
469  }
470  }
471 
472  // set show users online
473  /*if ($this->workWithUserSetting("show_users_online"))
474  {
475  $ilUser->setPref("show_users_online", $_POST["show_users_online"]);
476  }*/
477 
478  // set hide own online_status
479  if ($this->workWithUserSetting("hide_own_online_status")) {
480  if ($_POST["chk_hide_own_online_status"] != "") {
481  $ilUser->setPref("hide_own_online_status", "y");
482  } else {
483  $ilUser->setPref("hide_own_online_status", "n");
484  }
485  }
486 
487  // personal desktop items in news block
488  /* Subscription Concept is abandonded for now, we show all news of pd items (Alex)
489  if ($_POST["pd_items_news"] != "")
490  {
491  $ilUser->setPref("pd_items_news","y");
492  }
493  else
494  {
495  $ilUser->setPref("pd_items_news","n");
496  }
497  */
498 
499  // profile ok
500  $ilUser->setProfileIncomplete(false);
501 
502  // save user data & object_data
503  $ilUser->setTitle($ilUser->getFullname());
504  $ilUser->setDescription($ilUser->getEmail());
505 
506  $ilUser->update();
507 
508  // update lucene index
509  include_once './Services/Search/classes/Lucene/class.ilLuceneIndexer.php';
510  ilLuceneIndexer::updateLuceneIndex(array($GLOBALS['DIC']['ilUser']->getId()));
511 
512 
513  // reload page only if skin or style were changed
514  // feedback
515  if (!empty($this->password_error)) {
516  ilUtil::sendFailure($this->password_error, true);
517  } elseif (!empty($this->upload_error)) {
518  ilUtil::sendFailure($this->upload_error, true);
519  } elseif ($reload) {
520  // feedback
521  ilUtil::sendSuccess($this->lng->txt("saved_successfully"), true);
522  $this->ctrl->redirect($this, "");
523  } else {
524  ilUtil::sendSuccess($this->lng->txt("saved_successfully"), true);
525  }
526  }
527 
528  $this->showProfile();
529  }
settings()
Definition: settings.php:2
static is_email($a_email, ilMailRfc822AddressParserFactory $mailAddressParserFactory=null)
This preg-based function checks whether an e-mail address is formally valid.
static updateLuceneIndex($a_obj_ids)
Update lucene index.
global $DIC
Definition: goto.php:24
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
$ilUser
Definition: imgupload.php:18
$_POST["username"]
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ savePublicProfile()

ilPersonalProfileGUI::savePublicProfile ( )

Save public profile form.

Definition at line 1484 of file class.ilPersonalProfileGUI.php.

References $_POST, $_SESSION, $DIC, $GLOBALS, $ilUser, $lng, $tpl, ilSession\get(), getCheckedValues(), ilBadgeHandler\getInstance(), initPublicProfileForm(), ilUtil\redirect(), ilSession\set(), ilProfileChecklistStatus\STEP_PUBLISH_OPTIONS, ilLuceneIndexer\updateLuceneIndex(), and ilBadgeAssignment\updatePositions().

1485  {
1486  global $DIC;
1487 
1488  $tpl = $DIC['tpl'];
1489  $lng = $DIC['lng'];
1490  $ilCtrl = $DIC['ilCtrl'];
1491  $ilUser = $DIC['ilUser'];
1492 
1493  $this->initPublicProfileForm();
1494  if ($this->form->checkInput()) {
1495  // with active portfolio no options are presented
1496  if (isset($_POST["public_profile"])) {
1497  $ilUser->setPref("public_profile", $_POST["public_profile"]);
1498  }
1499 
1500  // if check on Institute
1501  $val_array = array("title", "birthday", "gender", "org_units", "institution", "department", "upload",
1502  "street", "zipcode", "city", "country", "sel_country", "phone_office", "phone_home", "phone_mobile",
1503  "fax", "email", "second_email", "hobby", "matriculation", "location",
1504  "interests_general", "interests_help_offered", "interests_help_looking");
1505 
1506  // set public profile preferences
1507  $checked_values = $this->getCheckedValues();
1508  foreach ($val_array as $key => $value) {
1509  if (($checked_values["chk_" . $value])) {
1510  $ilUser->setPref("public_" . $value, "y");
1511  } else {
1512  $ilUser->setPref("public_" . $value, "n");
1513  }
1514  }
1515 
1516  // additional defined user data fields
1517  foreach ($this->user_defined_fields->getVisibleDefinitions() as $field_id => $definition) {
1518  if (($checked_values["chk_udf_" . $definition["field_id"]])) {
1519  $ilUser->setPref("public_udf_" . $definition["field_id"], "y");
1520  } else {
1521  $ilUser->setPref("public_udf_" . $definition["field_id"], "n");
1522  }
1523  }
1524 
1525  $ilUser->update();
1526 
1527  switch ($_POST["public_profile"]) {
1528  case "y":
1529  $key_suffix = "-1";
1530  break;
1531  case "g":
1532  $key_suffix = "-2";
1533  break;
1534  }
1535 
1536  include_once "Services/Badge/classes/class.ilBadgeHandler.php";
1537  $handler = ilBadgeHandler::getInstance();
1538  if ($handler->isActive()) {
1539  $badgePositions = [];
1540  if (isset($_POST["bpos" . $key_suffix]) && is_array($_POST["bpos" . $key_suffix])) {
1541  $badgePositions = $_POST["bpos" . $key_suffix];
1542  }
1543 
1544  if (count($badgePositions) > 0) {
1545  include_once "Services/Badge/classes/class.ilBadgeAssignment.php";
1546  ilBadgeAssignment::updatePositions($ilUser->getId(), $badgePositions);
1547  }
1548  }
1549 
1550  // update lucene index
1551  include_once './Services/Search/classes/Lucene/class.ilLuceneIndexer.php';
1552  ilLuceneIndexer::updateLuceneIndex(array((int) $GLOBALS['DIC']['ilUser']->getId()));
1553 
1554  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1555 
1556  $this->checklist_status->saveStepSucess(ilProfileChecklistStatus::STEP_PUBLISH_OPTIONS);
1557 
1558  if (ilSession::get('orig_request_target')) {
1559  $target = ilSession::get('orig_request_target');
1560  ilSession::set('orig_request_target', '');
1561  ilUtil::redirect($target);
1562  } elseif ($redirect = $_SESSION['profile_complete_redirect']) {
1563  unset($_SESSION['profile_complete_redirect']);
1564  ilUtil::redirect($redirect);
1565  } else {
1566  $ilCtrl->redirectByClass("iluserprivacysettingsgui", "");
1567  }
1568  }
1569  $this->form->setValuesByPost();
1570  $tpl->showPublicProfile(true);
1571  }
$_SESSION["AccountId"]
initPublicProfileForm()
Init public profile form.
static get($a_var)
Get a value.
static set($a_var, $a_val)
Set a value.
static updateLuceneIndex($a_obj_ids)
Update lucene index.
getCheckedValues()
Get checked values.
global $DIC
Definition: goto.php:24
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
Definition: PEAR.php:64
static updatePositions($a_user_id, array $a_positions)
$ilUser
Definition: imgupload.php:18
static redirect($a_script)
$_POST["username"]
static getInstance()
Constructor.
+ Here is the call graph for this function:

◆ setHeader()

ilPersonalProfileGUI::setHeader ( )

Set header.

Definition at line 841 of file class.ilPersonalProfileGUI.php.

Referenced by executeCommand(), importPersonalData(), importPersonalDataSelection(), showExportImport(), showPersonalData(), and showPublicProfile().

842  {
843  $this->tpl->setTitle($this->lng->txt('personal_profile'));
844  }
+ Here is the caller graph for this function:

◆ setTabs()

ilPersonalProfileGUI::setTabs ( )

Definition at line 720 of file class.ilPersonalProfileGUI.php.

References $DIC.

Referenced by executeCommand().

721  {
722  global $DIC;
723 
724  $ilTabs = $DIC['ilTabs'];
725  $ilHelp = $DIC['ilHelp'];
726 
727  $ilHelp->setScreenIdComponent("user");
728 
729  // personal data
730  $ilTabs->addTab(
731  "personal_data",
732  $this->lng->txt("user_profile_data"),
733  $this->ctrl->getLinkTarget($this, "showPersonalData")
734  );
735 
736  // publishing options
737  $ilTabs->addTab(
738  "public_profile",
739  $this->lng->txt("user_publish_options"),
740  $this->ctrl->getLinkTarget($this, "showPublicProfile")
741  );
742 
743  // visibility settings
744  $txt_visibility = $this->checklist_status->anyVisibilitySettings()
745  ? $this->lng->txt("user_visibility_settings")
746  : $this->lng->txt("preview");
747  $ilTabs->addTab(
748  "visibility_settings",
749  $txt_visibility,
750  $this->ctrl->getLinkTargetByClass("ilUserPrivacySettingsGUI", "")
751  );
752 
753  // export
754  $ilTabs->addTab(
755  "export",
756  $this->lng->txt("export") . "/" . $this->lng->txt("import"),
757  $this->ctrl->getLinkTarget($this, "showExportImport")
758  );
759  }
global $DIC
Definition: goto.php:24
+ Here is the caller graph for this function:

◆ showChecklist()

ilPersonalProfileGUI::showChecklist (   $active_step)
protected

Show checklist.

Parameters
int

Definition at line 1776 of file class.ilPersonalProfileGUI.php.

References $tpl.

Referenced by executeCommand(), showPersonalData(), and showPublicProfile().

1777  {
1778  $main_tpl = $this->tpl;
1779 
1780  $main_tpl->setRightContent($this->checklist->render($active_step));
1781  }
+ Here is the caller graph for this function:

◆ showConsentWithdrawalConfirmation()

ilPersonalProfileGUI::showConsentWithdrawalConfirmation ( )
protected

Definition at line 583 of file class.ilPersonalProfileGUI.php.

References user().

583  : void
584  {
585  if (
586  !$this->user->getPref('consent_withdrawal_requested') ||
587  !$this->termsOfServiceHelper->isIncludedUser($this->user)
588  ) {
589  $this->errorHandler->raiseError($this->lng->txt('permission_denied'), $this->errorHandler->MESSAGE);
590  }
591 
592  $this->tabs->clearTargets();
593  $this->tabs->clearSubTabs();
594  $this->tpl->setTitle($this->lng->txt('refuse_tos_acceptance'));
595 
596  $tosWithdrawalGui = new ilTermsOfServiceWithdrawalGUIHelper($this->user);
597  $content = $tosWithdrawalGui->getConsentWithdrawalConfirmation($this);
598 
599  $this->tpl->setContent($content);
600  $this->tpl->setPermanentLink('usr', null, 'agreement');
601  $this->tpl->printToStdout();
602  }
user()
Definition: user.php:4
+ Here is the call graph for this function:

◆ showExportImport()

ilPersonalProfileGUI::showExportImport ( )

Show export/import.

Parameters

Definition at line 1598 of file class.ilPersonalProfileGUI.php.

References $DIC, $ilUser, $tpl, ilLinkButton\getInstance(), and setHeader().

1599  {
1600  global $DIC;
1601 
1602  $ilToolbar = $DIC['ilToolbar'];
1603  $ilCtrl = $DIC['ilCtrl'];
1604  $tpl = $DIC['tpl'];
1605  $ilTabs = $DIC['ilTabs'];
1606  $ilUser = $DIC['ilUser'];
1607 
1608  $ilTabs->activateTab("export");
1609  $this->setHeader();
1610 
1611  include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
1612  $button = ilLinkButton::getInstance();
1613  $button->setCaption("pd_export_profile");
1614  $button->setUrl($ilCtrl->getLinkTarget($this, "exportPersonalData"));
1615  $ilToolbar->addStickyItem($button);
1616 
1617  $exp_file = $ilUser->getPersonalDataExportFile();
1618  if ($exp_file != "") {
1619  $ilToolbar->addSeparator();
1620  $ilToolbar->addButton(
1621  $this->lng->txt("pd_download_last_export_file"),
1622  $ilCtrl->getLinkTarget($this, "downloadPersonalData")
1623  );
1624  }
1625 
1626  $ilToolbar->addSeparator();
1627  $ilToolbar->addButton(
1628  $this->lng->txt("pd_import_personal_data"),
1629  $ilCtrl->getLinkTarget($this, "importPersonalDataSelection")
1630  );
1631 
1632  $tpl->printToStdout();
1633  }
global $DIC
Definition: goto.php:24
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:

◆ showPersonalData()

ilPersonalProfileGUI::showPersonalData (   $a_no_init = false,
  $a_migration_started = false 
)

Personal data form.

Definition at line 855 of file class.ilPersonalProfileGUI.php.

References $_GET, $ctrl, $DIC, $ilUser, $lng, initPersonalDataForm(), ilUtil\sendInfo(), setHeader(), showChecklist(), and ilProfileChecklistStatus\STEP_PROFILE_DATA.

Referenced by goToEmailConfirmation(), savePersonalData(), and showProfile().

856  {
857  global $DIC;
858 
859  $ilUser = $DIC['ilUser'];
860  $lng = $DIC['lng'];
861  $ilTabs = $DIC['ilTabs'];
862  $prompt_service = new ilUserProfilePromptService();
863 
864  $ilTabs->activateTab("personal_data");
865  $ctrl = $DIC->ctrl();
866 
867  $it = "";
868  if ($_GET["prompted"] == 1) {
869  $it = $prompt_service->data()->getSettings()->getPromptText($ilUser->getLanguage());
870  }
871  if ($it === "") {
872  $it = $prompt_service->data()->getSettings()->getInfoText($ilUser->getLanguage());
873  }
874  if (trim($it) !== "") {
875  $pub_prof = in_array($ilUser->prefs["public_profile"], array("y", "n", "g"))
876  ? $ilUser->prefs["public_profile"]
877  : "n";
878  $box = $DIC->ui()->factory()->messageBox()->info($it);
879  if ($pub_prof === "n") {
880  $box = $box->withLinks(
881  [$DIC->ui()->factory()->link()->standard(
882  $lng->txt("user_make_profile_public"),
883  $ctrl->getLinkTarget($this, "showPublicProfile")
884  )]
885  );
886  }
887  $it = $DIC->ui()->renderer()->render($box);
888  }
889  $this->setHeader();
890 
892 
893  if (!$a_no_init) {
894  $this->initPersonalDataForm();
895  // catch feedback message
896  if ($ilUser->getProfileIncomplete()) {
897  ilUtil::sendInfo($lng->txt("profile_incomplete"));
898  }
899  }
900 
901  $modal = '';
902  if ($this->email_change_confirmation_modal !== null) {
903  $modal = $this->ui_renderer->render($this->email_change_confirmation_modal);
904  }
905 
906  $this->tpl->setContent($it . $this->form->getHTML() . $modal);
907  $this->tpl->printToStdout();
908  }
User profile prompt subservice.
$_GET["client_id"]
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
showChecklist($active_step)
Show checklist.
global $DIC
Definition: goto.php:24
initPersonalDataForm()
Init personal form.
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showProfile()

ilPersonalProfileGUI::showProfile ( )

show profile form

/OLD IMPLEMENTATION DEPRECATED

Definition at line 536 of file class.ilPersonalProfileGUI.php.

References showPersonalData().

Referenced by saveProfile().

537  {
538  $this->showPersonalData();
539  }
showPersonalData($a_no_init=false, $a_migration_started=false)
Personal data form.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showPublicProfile()

ilPersonalProfileGUI::showPublicProfile (   $a_no_init = false)

Public profile form.

Definition at line 1204 of file class.ilPersonalProfileGUI.php.

References $tabs, initPublicProfileForm(), setHeader(), showChecklist(), and ilProfileChecklistStatus\STEP_PUBLISH_OPTIONS.

Referenced by changeEmail().

1205  {
1206  $ilTabs = $this->tabs;
1207 
1208  $ilTabs->activateTab("public_profile");
1210 
1211  $this->setHeader();
1212 
1213  if (!$a_no_init) {
1214  $this->initPublicProfileForm();
1215  }
1216 
1217  $this->tpl->setContent($this->form->getHTML());
1218  $this->tpl->printToStdout();
1219  }
initPublicProfileForm()
Init public profile form.
showChecklist($active_step)
Show checklist.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showPublicProfileFields()

ilPersonalProfileGUI::showPublicProfileFields ( ilPropertyformGUI  $form,
array  $prefs,
  $parent = null,
  $anonymized = false,
  $key_suffix = "" 
)

Add fields to form.

Parameters
ilPropertyformGUI$form
array$prefs
object$parent
bool$a_anonymized

Definition at line 1317 of file class.ilPersonalProfileGUI.php.

References $DIC, $ilUser, ilLink\_getLink(), ilObjUser\_getPersonalPicturePath(), ilDatePresentation\formatDate(), ilBadgeHandler\getInstance(), ilBadgeAssignment\getInstancesByUserId(), ilBadge\getTitle(), IL_CAL_DATE, ilMapUtil\isActivated(), ilCheckboxInputGUI\setChecked(), ilFormPropertyGUI\setMultiValues(), ilNonEditableValueGUI\setValue(), user(), and userSettingVisible().

Referenced by initPublicProfileForm().

1323  {
1324  global $DIC;
1325 
1326  $ilUser = $DIC['ilUser'];
1327 
1328  $birthday = $ilUser->getBirthday();
1329  if ($birthday) {
1330  $birthday = ilDatePresentation::formatDate(new ilDate($birthday, IL_CAL_DATE));
1331  }
1332  $gender = $ilUser->getGender();
1333  if ($gender) {
1334  $gender = $this->lng->txt("gender_" . $gender);
1335  }
1336 
1337  if ($ilUser->getSelectedCountry() != "") {
1338  $this->lng->loadLanguageModule("meta");
1339  $txt_sel_country = $this->lng->txt("meta_c_" . $ilUser->getSelectedCountry());
1340  }
1341 
1342  // profile picture
1343  $pic = ilObjUser::_getPersonalPicturePath($ilUser->getId(), "xsmall", true, true);
1344  if ($pic) {
1345  $pic = "<img src=\"" . $pic . "\" />";
1346  }
1347 
1348  // personal data
1349  $val_array = array(
1350  "title" => $ilUser->getUTitle(),
1351  "birthday" => $birthday,
1352  "gender" => $gender,
1353  "upload" => $pic,
1354  "interests_general" => $ilUser->getGeneralInterestsAsText(),
1355  "interests_help_offered" => $ilUser->getOfferingHelpAsText(),
1356  "interests_help_looking" => $ilUser->getLookingForHelpAsText(),
1357  "org_units" => $ilUser->getOrgUnitsRepresentation(),
1358  "institution" => $ilUser->getInstitution(),
1359  "department" => $ilUser->getDepartment(),
1360  "street" => $ilUser->getStreet(),
1361  "zipcode" => $ilUser->getZipcode(),
1362  "city" => $ilUser->getCity(),
1363  "country" => $ilUser->getCountry(),
1364  "sel_country" => $txt_sel_country,
1365  "phone_office" => $ilUser->getPhoneOffice(),
1366  "phone_home" => $ilUser->getPhoneHome(),
1367  "phone_mobile" => $ilUser->getPhoneMobile(),
1368  "fax" => $ilUser->getFax(),
1369  "email" => $ilUser->getEmail(),
1370  "second_email" => $ilUser->getSecondEmail(),
1371  "hobby" => $ilUser->getHobby(),
1372  "matriculation" => $ilUser->getMatriculation()
1373  );
1374 
1375  // location
1376  include_once("./Services/Maps/classes/class.ilMapUtil.php");
1377  if (ilMapUtil::isActivated()) {
1378  $val_array["location"] = ((int) $ilUser->getLatitude() + (int) $ilUser->getLongitude() + (int) $ilUser->getLocationZoom() > 0)
1379  ? " "
1380  : "";
1381  }
1382  foreach ($val_array as $key => $value) {
1383  if (in_array($value, ["", "-"]) && !$anonymized) {
1384  continue;
1385  }
1386  if ($anonymized) {
1387  $value = null;
1388  }
1389 
1390  if ($this->userSettingVisible($key)) {
1391  // #18795 - we should use ilUserProfile
1392  switch ($key) {
1393  case "upload":
1394  $caption = "personal_picture";
1395  break;
1396 
1397  case "title":
1398  $caption = "person_title";
1399  break;
1400 
1401  default:
1402  $caption = $key;
1403  }
1404  $cb = new ilCheckboxInputGUI($this->lng->txt($caption), "chk_" . $key . $key_suffix);
1405  if ($prefs["public_" . $key] == "y") {
1406  $cb->setChecked(true);
1407  }
1408  //$cb->setInfo($value);
1409  $cb->setOptionTitle($value);
1410 
1411  if (!$parent) {
1412  $form->addItem($cb);
1413  } else {
1414  $parent->addSubItem($cb);
1415  }
1416  }
1417  }
1418 
1419  // additional defined user data fields
1420  $user_defined_data = array();
1421  if (!$anonymized) {
1422  $user_defined_data = $ilUser->getUserDefinedData();
1423  }
1424  foreach ($this->user_defined_fields->getVisibleDefinitions() as $field_id => $definition) {
1425  // public setting
1426  $cb = new ilCheckboxInputGUI($definition["field_name"], "chk_udf_" . $definition["field_id"]);
1427  $cb->setOptionTitle($user_defined_data["f_" . $definition["field_id"]]);
1428  if ($prefs["public_udf_" . $definition["field_id"]] == "y") {
1429  $cb->setChecked(true);
1430  }
1431 
1432  if (!$parent) {
1433  $form->addItem($cb);
1434  } else {
1435  $parent->addSubItem($cb);
1436  }
1437  }
1438 
1439  if (!$anonymized) {
1440  include_once "Services/Badge/classes/class.ilBadgeHandler.php";
1441  $handler = ilBadgeHandler::getInstance();
1442  if ($handler->isActive()) {
1443  $badge_options = array();
1444 
1445  include_once "Services/Badge/classes/class.ilBadgeAssignment.php";
1446  include_once "Services/Badge/classes/class.ilBadge.php";
1447  foreach (ilBadgeAssignment::getInstancesByUserId($ilUser->getId()) as $ass) {
1448  // only active
1449  if ($ass->getPosition()) {
1450  $badge = new ilBadge($ass->getBadgeId());
1451  $badge_options[] = $badge->getTitle();
1452  }
1453  }
1454 
1455  if (sizeof($badge_options) > 1) {
1456  $badge_order = new ilNonEditableValueGUI($this->lng->txt("obj_bdga"), "bpos" . $key_suffix);
1457  $badge_order->setMultiValues($badge_options);
1458  $badge_order->setValue(array_shift($badge_options));
1459  $badge_order->setMulti(true, true, false);
1460 
1461  if (!$parent) {
1462  $form->addItem($badge_order);
1463  } else {
1464  $parent->addSubItem($badge_order);
1465  }
1466  }
1467  }
1468  }
1469 
1470  // permalink
1471  $ne = new ilNonEditableValueGUI($this->lng->txt("perma_link"), "");
1472  $ne->setValue(ilLink::_getLink($this->user->getId(), "usr"));
1473  if (!$parent) {
1474  $form->addItem($ne);
1475  } else {
1476  $parent->addSubItem($ne);
1477  }
1478  }
This class represents a checkbox property in a property form.
setMultiValues(array $a_values)
Set multi values.
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date public.
user()
Definition: user.php:4
Class ilBadge.
setChecked($a_checked)
Set Checked.
Class for single dates.
global $DIC
Definition: goto.php:24
static _getPersonalPicturePath( $a_usr_id, $a_size="small", $a_force_pic=false, $a_prevent_no_photo_image=false, $html_export=false)
Get path to personal picture.
static isActivated()
Checks whether Map feature is activated.
const IL_CAL_DATE
This class represents a non editable value in a property form.
$ilUser
Definition: imgupload.php:18
static getInstancesByUserId($a_user_id)
static getInstance()
Constructor.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showUserAgreement()

ilPersonalProfileGUI::showUserAgreement ( )
protected

Definition at line 541 of file class.ilPersonalProfileGUI.php.

References $tpl, ilSystemSupportContacts\getMailsToAddress(), ilTermsOfServiceHelper\isEnabled(), ilUtil\prepareFormOutput(), and user().

542  {
543  $this->tabs->clearTargets();
544  $this->tabs->clearSubTabs();
545 
546  $tpl = new \ilTemplate('tpl.view_terms_of_service.html', true, true, 'Services/Init');
547 
548  $this->tpl->setTitle($this->lng->txt('usr_agreement'));
549 
550  $noAgreement = true;
551  if (!$this->user->isAnonymous() && (int) $this->user->getId() > 0 && $this->user->getAgreeDate()) {
552  $helper = new \ilTermsOfServiceHelper();
553 
554  $entity = $helper->getCurrentAcceptanceForUser($this->user);
555  if ($entity->getId()) {
556  $noAgreement = false;
557  $tpl->setVariable('TERMS_OF_SERVICE_CONTENT', $entity->getText());
558  }
559  } else {
560  $handleDocument = \ilTermsOfServiceHelper::isEnabled() && $this->termsOfServiceEvaluation->hasDocument();
561  if ($handleDocument) {
562  $noAgreement = false;
563  $document = $this->termsOfServiceEvaluation->document();
564  $tpl->setVariable('TERMS_OF_SERVICE_CONTENT', $document->content());
565  }
566  }
567 
568  if ($noAgreement) {
569  $tpl->setVariable(
570  'TERMS_OF_SERVICE_CONTENT',
571  sprintf(
572  $this->lng->txt('no_agreement_description'),
574  )
575  );
576  }
577 
578  $this->tpl->setContent($tpl->get());
579  $this->tpl->setPermanentLink('usr', null, 'agreement');
580  $this->tpl->printToStdout();
581  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
user()
Definition: user.php:4
static getMailsToAddress()
Get mailto: emails.
+ Here is the call graph for this function:

◆ updateLoginOrSetErrorMessages()

ilPersonalProfileGUI::updateLoginOrSetErrorMessages ( )
private

Definition at line 1044 of file class.ilPersonalProfileGUI.php.

References Vendor\Package\$e, $login, ilObjUser\_loginExists(), ilUtil\isLogin(), and user().

Referenced by goToEmailConfirmation(), and savePersonalData().

1044  : bool
1045  {
1046  $login = $this->form->getInput('username');
1047  if ($login === '' || !ilUtil::isLogin($login)) {
1048  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('form_input_not_valid'));
1049  $this->form->getItemByPostVar('username')->setAlert($this->lng->txt('login_invalid'));
1050  return false;
1051  }
1052 
1053  if (ilObjUser::_loginExists($login, $this->user->getId())) {
1054  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('form_input_not_valid'));
1055  $this->form->getItemByPostVar('username')->setAlert($this->lng->txt('loginname_already_exists'));
1056  return false;
1057  }
1058 
1059  $this->user->setLogin($login);
1060 
1061  try {
1062  $this->user->updateLogin($this->user->getLogin());
1063  return true;
1064  } catch (ilUserException $e) {
1065  $this->tpl->setOnScreenMessage('failure', $this->lng->txt('form_input_not_valid'));
1066  $this->form->getItemByPostVar('username')->setAlert($e->getMessage());
1067  return false;
1068  }
1069  }
Class for user related exception handling in ILIAS.
$login
Definition: cron.php:13
user()
Definition: user.php:4
static _loginExists($a_login, $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($a_login)
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ uploadUserPicture()

ilPersonalProfileGUI::uploadUserPicture ( )

Upload user image.

Definition at line 213 of file class.ilPersonalProfileGUI.php.

References $DIC, $ilUser, ilUtil\escapeShellArg(), ilUtil\execConvert(), ilUtil\getWebspaceDir(), ilUtil\isConvertVersionAtLeast(), ilUtil\sendFailure(), and workWithUserSetting().

Referenced by savePersonalDataForm().

214  {
215  global $DIC;
216 
217  $ilUser = $DIC['ilUser'];
218 
219  if ($this->workWithUserSetting("upload")) {
220  if (!$this->form->hasFileUpload("userfile")) {
221  if ($this->form->getItemByPostVar("userfile")->getDeletionFlag()) {
222  $ilUser->removeUserPicture();
223  }
224  return;
225  } else {
226  $webspace_dir = ilUtil::getWebspaceDir();
227  $image_dir = $webspace_dir . "/usr_images";
228  $store_file = "usr_" . $ilUser->getID() . "." . "jpg";
229 
230  // store filename
231  $ilUser->setPref("profile_image", $store_file);
232  $ilUser->update();
233 
234  // move uploaded file
235 
236  $pi = pathinfo($_FILES["userfile"]["name"]);
237  $uploaded_file = $this->form->moveFileUpload(
238  $image_dir,
239  "userfile",
240  "upload_" . $ilUser->getId() . "." . $pi["extension"]
241  );
242  if (!$uploaded_file) {
243  ilUtil::sendFailure($this->lng->txt("upload_error", true));
244  $this->ctrl->redirect($this, "showProfile");
245  }
246  chmod($uploaded_file, 0770);
247 
248  // take quality 100 to avoid jpeg artefacts when uploading jpeg files
249  // taking only frame [0] to avoid problems with animated gifs
250  $show_file = "$image_dir/usr_" . $ilUser->getId() . ".jpg";
251  $thumb_file = "$image_dir/usr_" . $ilUser->getId() . "_small.jpg";
252  $xthumb_file = "$image_dir/usr_" . $ilUser->getId() . "_xsmall.jpg";
253  $xxthumb_file = "$image_dir/usr_" . $ilUser->getId() . "_xxsmall.jpg";
254  $uploaded_file = ilUtil::escapeShellArg($uploaded_file);
255  $show_file = ilUtil::escapeShellArg($show_file);
256  $thumb_file = ilUtil::escapeShellArg($thumb_file);
257  $xthumb_file = ilUtil::escapeShellArg($xthumb_file);
258  $xxthumb_file = ilUtil::escapeShellArg($xxthumb_file);
259 
260  if (ilUtil::isConvertVersionAtLeast("6.3.8-3")) {
261  ilUtil::execConvert($uploaded_file . "[0] -geometry 200x200^ -gravity center -extent 200x200 -quality 100 JPEG:" . $show_file);
262  ilUtil::execConvert($uploaded_file . "[0] -geometry 100x100^ -gravity center -extent 100x100 -quality 100 JPEG:" . $thumb_file);
263  ilUtil::execConvert($uploaded_file . "[0] -geometry 75x75^ -gravity center -extent 75x75 -quality 100 JPEG:" . $xthumb_file);
264  ilUtil::execConvert($uploaded_file . "[0] -geometry 30x30^ -gravity center -extent 30x30 -quality 100 JPEG:" . $xxthumb_file);
265  } else {
266  ilUtil::execConvert($uploaded_file . "[0] -geometry 200x200 -quality 100 JPEG:" . $show_file);
267  ilUtil::execConvert($uploaded_file . "[0] -geometry 100x100 -quality 100 JPEG:" . $thumb_file);
268  ilUtil::execConvert($uploaded_file . "[0] -geometry 75x75 -quality 100 JPEG:" . $xthumb_file);
269  ilUtil::execConvert($uploaded_file . "[0] -geometry 30x30 -quality 100 JPEG:" . $xxthumb_file);
270  }
271  }
272  }
273 
274  // $this->saveProfile();
275  }
static isConvertVersionAtLeast($a_version)
Compare convert version numbers.
static execConvert($args)
execute convert command
global $DIC
Definition: goto.php:24
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static escapeShellArg($a_arg)
$ilUser
Definition: imgupload.php:18
static getWebspaceDir($mode="filesystem")
get webspace directory
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ userSettingEnabled()

ilPersonalProfileGUI::userSettingEnabled ( string  $setting)
Parameters
string$setting
Returns
bool

Definition at line 205 of file class.ilPersonalProfileGUI.php.

205  : bool
206  {
207  return $this->user_settings_config->isChangeable($setting);
208  }

◆ userSettingVisible()

ilPersonalProfileGUI::userSettingVisible ( string  $setting)
Parameters
string$setting
Returns
bool

Definition at line 196 of file class.ilPersonalProfileGUI.php.

Referenced by __showOtherInformations(), and showPublicProfileFields().

196  : bool
197  {
198  return $this->user_settings_config->isVisible($setting);
199  }
+ Here is the caller graph for this function:

◆ withdrawAcceptance()

ilPersonalProfileGUI::withdrawAcceptance ( )
protected

Definition at line 621 of file class.ilPersonalProfileGUI.php.

References AUTH_LDAP, AUTH_LOCAL, ilSession\SESSION_CLOSE_USER, ilSession\setClosingContext(), and user().

621  : void
622  {
623  if (
624  !$this->user->getPref('consent_withdrawal_requested') ||
625  !$this->termsOfServiceHelper->isIncludedUser($this->user)
626  ) {
627  $this->errorHandler->raiseError($this->lng->txt('permission_denied'), $this->errorHandler->MESSAGE);
628  }
629  $this->termsOfServiceHelper->resetAcceptance($this->user);
630 
631  $defaultAuth = AUTH_LOCAL;
632  if ($this->setting->get('auth_mode')) {
633  $defaultAuth = $this->setting->get('auth_mode');
634  }
635 
636  $withdrawalType = 0;
637  if (
638  $this->user->getAuthMode() == AUTH_LDAP ||
639  ($this->user->getAuthMode() === 'default' && $defaultAuth == AUTH_LDAP)
640  ) {
641  $withdrawalType = 2;
642  } elseif ((bool) $this->setting->get('tos_withdrawal_usr_deletion', false)) {
643  $withdrawalType = 1;
644  }
645 
646  $domainEvent = new ilTermsOfServiceEventWithdrawn($this->user);
647  $this->eventHandler->raise(
648  'Services/TermsOfService',
649  'ilTermsOfServiceEventWithdrawn',
650  ['event' => $domainEvent]
651  );
652 
654  $this->auth_session->logout();
655 
656  $this->ctrl->redirectToUrl('login.php?tos_withdrawal_type=' . $withdrawalType . '&cmd=force_login');
657  }
const AUTH_LDAP
user()
Definition: user.php:4
Class ilTermsOfServiceEventWithdrawn.
const SESSION_CLOSE_USER
const AUTH_LOCAL
static setClosingContext($a_context)
set closing context (for statistics)
+ Here is the call graph for this function:

◆ workWithUserSetting()

ilPersonalProfileGUI::workWithUserSetting ( string  $setting)
Parameters
string$setting
Returns
bool

Definition at line 187 of file class.ilPersonalProfileGUI.php.

Referenced by saveProfile(), and uploadUserPicture().

187  : bool
188  {
189  return $this->user_settings_config->isVisibleAndChangeable($setting);
190  }
+ Here is the caller graph for this function:

Field Documentation

◆ $auth_session

ilPersonalProfileGUI::$auth_session
protected

Definition at line 86 of file class.ilPersonalProfileGUI.php.

◆ $change_mail_token_repo

ilPersonalProfileGUI::$change_mail_token_repo
private

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

◆ $checklist

ilPersonalProfileGUI::$checklist
protected

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

◆ $checklist_status

ilPersonalProfileGUI::$checklist_status
protected

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

◆ $ctrl

ilPersonalProfileGUI::$ctrl
protected

Definition at line 53 of file class.ilPersonalProfileGUI.php.

Referenced by showPersonalData().

◆ $email_change_confirmation_modal

ilPersonalProfileGUI::$email_change_confirmation_modal = null
protected

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

◆ $errorHandler

ilPersonalProfileGUI::$errorHandler
protected

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

◆ $eventHandler

ilPersonalProfileGUI::$eventHandler
private

Definition at line 41 of file class.ilPersonalProfileGUI.php.

◆ $lng

◆ $tabs

ilPersonalProfileGUI::$tabs
protected

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

Referenced by showPublicProfile().

◆ $termsOfServiceEvaluation

ilPersonalProfileGUI::$termsOfServiceEvaluation
protected

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

Referenced by __construct().

◆ $termsOfServiceHelper

ilPersonalProfileGUI::$termsOfServiceHelper
protected

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

Referenced by __construct().

◆ $tpl

◆ $ui_factory

ilPersonalProfileGUI::$ui_factory
protected

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

◆ $ui_renderer

ilPersonalProfileGUI::$ui_renderer
protected

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

◆ $user_defined_fields

ilPersonalProfileGUI::$user_defined_fields = null

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

◆ $user_settings_config

ilPersonalProfileGUI::$user_settings_config
protected

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

◆ CHANGE_EMAIL_CMD

const ilPersonalProfileGUI::CHANGE_EMAIL_CMD = 'changeEmail'

Definition at line 36 of file class.ilPersonalProfileGUI.php.

Referenced by ilObjUserGUI\showUpperIcon().

◆ PERSONAL_DATA_FORM_ID

const ilPersonalProfileGUI::PERSONAL_DATA_FORM_ID = 'pd'
private

Definition at line 35 of file class.ilPersonalProfileGUI.php.


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