ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
ilPersonalProfileGUI Class Reference

GUI class for personal profile. More...

+ Collaboration diagram for ilPersonalProfileGUI:

Public Member Functions

 __construct ()
 constructor More...
 
 executeCommand ()
 execute command More...
 
 workWithUserSetting ($setting)
 Returns TRUE if working with the given user setting is allowed, FALSE otherwise. More...
 
 userSettingVisible ($setting)
 Returns TRUE if user setting is visible, FALSE otherwise. More...
 
 userSettingEnabled ($setting)
 Returns TRUE if user setting is enabled, FALSE otherwise. More...
 
 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)
 Personal data form. More...
 
 initPersonalDataForm ()
 Init personal form. More...
 
 savePersonalData ()
 Save personal data form. More...
 
 showPublicProfile ($a_no_init=false)
 Public profile form. More...
 
 initPublicProfileForm ()
 Init public profile form. More...
 
 showPublicProfileFields (ilPropertyformGUI $form, array $prefs, $parent=null, $anonymized=false)
 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

 $tpl
 
 $lng
 
 $ilias
 
 $ctrl
 
 $user_defined_fields = null
 

Protected Member Functions

 showUserAgreement ()
 
 getProfilePortfolio ()
 has profile set to a portfolio? More...
 

Protected Attributes

 $tabs
 

Detailed Description

GUI class for personal profile.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e
Version
$Id$

ilPersonalProfileGUI: ilPublicUserProfileGUI

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

Constructor & Destructor Documentation

◆ __construct()

ilPersonalProfileGUI::__construct ( )

constructor

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

References $ilCtrl, $ilias, $lng, $tpl, ilUserDefinedFields\_getInstance(), and settings().

31  {
32  global $ilias, $tpl, $lng, $ilCtrl, $ilTabs;
33 
34  include_once './Services/User/classes/class.ilUserDefinedFields.php';
35  $this->user_defined_fields =&ilUserDefinedFields::_getInstance();
36 
37  $this->tpl = $tpl;
38  $this->lng = $lng;
39  $this->ilias = $ilias;
40  $this->ctrl = $ilCtrl;
41  $this->tabs = $ilTabs;
42  $this->settings = $ilias->getAllSettings();
43  $lng->loadLanguageModule("jsmath");
44  $lng->loadLanguageModule("pd");
45  $this->upload_error = "";
46  $this->password_error = "";
47  $lng->loadLanguageModule("user");
48  // $ilCtrl->saveParameter($this, "user_page");
49  }
static _getInstance()
Get instance.
global $ilCtrl
Definition: ilias.php:18
redirection script todo: (a better solution should control the processing via a xml file) ...
settings()
Definition: settings.php:2
+ Here is the call graph for this function:

Member Function Documentation

◆ __checkUserDefinedRequiredFields()

ilPersonalProfileGUI::__checkUserDefinedRequiredFields ( )

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

References $_POST.

Referenced by saveProfile().

643  {
644  foreach ($this->user_defined_fields->getVisibleDefinitions() as $definition) {
645  $field_id = $definition['field_id'];
646  if ($definition['required'] and !strlen($_POST['udf'][$field_id])) {
647  return false;
648  }
649  }
650  return true;
651  }
$_POST["username"]
+ Here is the caller graph for this function:

◆ __showOtherInformations()

ilPersonalProfileGUI::__showOtherInformations ( )

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

References userSettingVisible().

580  {
581  $d_set = new ilSetting("delicous");
582  if ($this->userSettingVisible("matriculation") or count($this->user_defined_fields->getVisibleDefinitions())
583  or $d_set->get("user_profile") == "1") {
584  return true;
585  }
586  return false;
587  }
userSettingVisible($setting)
Returns TRUE if user setting is visible, FALSE otherwise.
+ Here is the call graph for this function:

◆ __showUserDefinedFields()

ilPersonalProfileGUI::__showUserDefinedFields ( )

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

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

590  {
591  global $ilUser;
592 
593  $user_defined_data = $ilUser->getUserDefinedData();
594  foreach ($this->user_defined_fields->getVisibleDefinitions() as $field_id => $definition) {
595  if ($definition['field_type'] == UDF_TYPE_TEXT) {
596  $this->tpl->setCurrentBlock("field_text");
597  $this->tpl->setVariable("FIELD_VALUE", ilUtil::prepareFormOutput($user_defined_data[$field_id]));
598  if (!$definition['changeable']) {
599  $this->tpl->setVariable("DISABLED_FIELD", 'disabled=\"disabled\"');
600  $this->tpl->setVariable("FIELD_NAME", 'udf[' . $definition['field_id'] . ']');
601  } else {
602  $this->tpl->setVariable("FIELD_NAME", 'udf[' . $definition['field_id'] . ']');
603  }
604  $this->tpl->parseCurrentBlock();
605  } else {
606  if ($definition['changeable']) {
607  $name = 'udf[' . $definition['field_id'] . ']';
608  $disabled = false;
609  } else {
610  $name = '';
611  $disabled = true;
612  }
613  $this->tpl->setCurrentBlock("field_select");
614  $this->tpl->setVariable("SELECT_BOX", ilUtil::formSelect(
615  $user_defined_data[$field_id],
616  $name,
617  $this->user_defined_fields->fieldValuesToSelectArray(
618  $definition['field_values']
619  ),
620  false,
621  true,
622  0,
623  '',
624  '',
625  $disabled
626  ));
627  $this->tpl->parseCurrentBlock();
628  }
629  $this->tpl->setCurrentBlock("user_defined");
630 
631  if ($definition['required']) {
632  $name = $definition['field_name'] . "<span class=\"asterisk\">*</span>";
633  } else {
634  $name = $definition['field_name'];
635  }
636  $this->tpl->setVariable("TXT_FIELD_NAME", $name);
637  $this->tpl->parseCurrentBlock();
638  }
639  return true;
640  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
if($format !==null) $name
Definition: metadata.php:146
const UDF_TYPE_TEXT
$ilUser
Definition: imgupload.php:18
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.
+ Here is the call 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 485 of file class.ilPersonalProfileGUI.php.

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

Referenced by initPersonalDataForm().

486  {
487  global $ilCtrl;
488 
489  // check map activation
490  include_once("./Services/Maps/classes/class.ilMapUtil.php");
491  if (!ilMapUtil::isActivated()) {
492  return;
493  }
494 
495  // Don't really know if this is still necessary...
496  $this->lng->loadLanguageModule("maps");
497 
498  // Get user settings
499  $latitude = $a_user->getLatitude();
500  $longitude = $a_user->getLongitude();
501  $zoom = $a_user->getLocationZoom();
502 
503  // Get Default settings, when nothing is set
504  if ($latitude == 0 && $longitude == 0 && $zoom == 0) {
506  $latitude = $def["latitude"];
507  $longitude = $def["longitude"];
508  $zoom = $def["zoom"];
509  }
510 
511  $street = $a_user->getStreet();
512  if (!$street) {
513  $street = $this->lng->txt("street");
514  }
515  $city = $a_user->getCity();
516  if (!$city) {
517  $city = $this->lng->txt("city");
518  }
519  $country = $a_user->getCountry();
520  if (!$country) {
521  $country = $this->lng->txt("country");
522  }
523 
524  // location property
525  $loc_prop = new ilLocationInputGUI(
526  $this->lng->txt("location"),
527  "location"
528  );
529  $loc_prop->setLatitude($latitude);
530  $loc_prop->setLongitude($longitude);
531  $loc_prop->setZoom($zoom);
532  $loc_prop->setAddress($street . "," . $city . "," . $country);
533 
534  $a_form->addItem($loc_prop);
535  }
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)
global $ilCtrl
Definition: ilias.php:18
getCity()
get city public
static getDefaultSettings()
Get default longitude, latitude and zoom.
This class represents a location property in a property form.
getLatitude()
Get Latitude.
static isActivated()
Checks whether Map feature is activated.
$def
Definition: croninfo.php:21
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ downloadPersonalData()

ilPersonalProfileGUI::downloadPersonalData ( )

Download personal data export file.

Parameters

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

References $ilUser.

1295  {
1296  global $ilUser;
1297 
1298  $ilUser->sendPersonalDataFile();
1299  }
$ilUser
Definition: imgupload.php:18

◆ executeCommand()

ilPersonalProfileGUI::executeCommand ( )

execute command

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

References $_GET, $ilCtrl, $ilUser, $lng, $tpl, and setTabs().

55  {
56  global $ilUser, $ilCtrl, $tpl, $ilTabs, $lng;
57 
58  $next_class = $this->ctrl->getNextClass();
59 
60  switch ($next_class) {
61  case "ilpublicuserprofilegui":
62  include_once("./Services/User/classes/class.ilPublicUserProfileGUI.php");
63  $_GET["user_id"] = $ilUser->getId();
64  $pub_profile_gui = new ilPublicUserProfileGUI($_GET["user_id"]);
65  $pub_profile_gui->setBackUrl($ilCtrl->getLinkTarget($this, "showPersonalData"));
66  $ilCtrl->forwardCommand($pub_profile_gui);
67  $tpl->show();
68  break;
69 
70  default:
71  $this->setTabs();
72  $cmd = $this->ctrl->getCmd("showPersonalData");
73  $this->$cmd();
74  break;
75  }
76  return true;
77  }
$_GET["client_id"]
global $ilCtrl
Definition: ilias.php:18
GUI class for public user profile presentation.
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:

◆ exportPersonalData()

ilPersonalProfileGUI::exportPersonalData ( )

Export personal data.

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

References $ilCtrl, and $ilUser.

1280  {
1281  global $ilCtrl, $ilUser;
1282 
1283  $ilUser->exportPersonalData();
1284  $ilUser->sendPersonalDataFile();
1285  $ilCtrl->redirect($this, "showExportImport");
1286  }
global $ilCtrl
Definition: ilias.php:18
$ilUser
Definition: imgupload.php:18

◆ getProfilePortfolio()

ilPersonalProfileGUI::getProfilePortfolio ( )
protected

has profile set to a portfolio?

Returns
int

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

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

Referenced by initPublicProfileForm(), and setTabs().

946  {
947  global $ilUser, $ilSetting;
948 
949  if ($ilSetting->get('user_portfolios')) {
950  include_once "Modules/Portfolio/classes/class.ilObjPortfolio.php";
951  return ilObjPortfolio::getDefaultPortfolio($ilUser->getId());
952  }
953  }
$ilUser
Definition: imgupload.php:18
global $ilSetting
Definition: privfeed.php:17
static getDefaultPortfolio($a_user_id)
Get default portfolio of user.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ importPersonalData()

ilPersonalProfileGUI::importPersonalData ( )

Import personal data.

Parameters

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

References $_POST, $ilCtrl, $ilUser, $tpl, initPersonalDataImportForm(), ilUtil\sendSuccess(), and setHeader().

1374  {
1375  global $ilUser, $ilCtrl, $tpl, $ilTabs;
1376 
1377  $this->initPersonalDataImportForm();
1378  if ($this->form->checkInput()) {
1379  $ilUser->importPersonalData(
1380  $_FILES["file"],
1381  (int) $_POST["profile_data"],
1382  (int) $_POST["settings"],
1383  (int) $_POST["bookmarks"],
1384  (int) $_POST["notes"],
1385  (int) $_POST["calendar"]
1386  );
1387  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
1388  $ilCtrl->redirect($this, "");
1389  } else {
1390  $ilTabs->activateTab("export");
1391  $this->setHeader();
1392  $this->form->setValuesByPost();
1393  $tpl->setContent($this->form->getHtml());
1394  $tpl->show();
1395  }
1396  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
initPersonalDataImportForm()
Init personal data import form.
global $ilCtrl
Definition: ilias.php:18
$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 1307 of file class.ilPersonalProfileGUI.php.

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

1308  {
1309  global $lng, $ilCtrl, $tpl, $ilTabs;
1310 
1311  $ilTabs->activateTab("export");
1312  $this->setHeader();
1313 
1314  $this->initPersonalDataImportForm();
1315 
1316  $tpl->setContent($this->form->getHTML());
1317  $tpl->show();
1318  }
initPersonalDataImportForm()
Init personal data import form.
global $ilCtrl
Definition: ilias.php:18
+ Here is the call graph for this function:

◆ initPersonalDataForm()

ilPersonalProfileGUI::initPersonalDataForm ( )

Init personal form.

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

References $ilSetting, $ilUser, $lng, $options, addLocationToForm(), UDF_TYPE_SELECT, UDF_TYPE_TEXT, and UDF_TYPE_WYSIWYG.

Referenced by savePersonalData(), and showPersonalData().

712  {
713  global $ilSetting, $lng, $ilUser, $styleDefinition, $rbacreview;
714 
715  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
716  $this->form = new ilPropertyFormGUI();
717  $this->form->setFormAction($this->ctrl->getFormAction($this));
718 
719  // user defined fields
720  $user_defined_data = $ilUser->getUserDefinedData();
721 
722  foreach ($this->user_defined_fields->getVisibleDefinitions() as $field_id => $definition) {
723  if ($definition['field_type'] == UDF_TYPE_TEXT) {
724  $this->input["udf_" . $definition['field_id']] =
725  new ilTextInputGUI($definition['field_name'], "udf_" . $definition['field_id']);
726  $this->input["udf_" . $definition['field_id']]->setMaxLength(255);
727  $this->input["udf_" . $definition['field_id']]->setSize(40);
728  } elseif ($definition['field_type'] == UDF_TYPE_WYSIWYG) {
729  $this->input["udf_" . $definition['field_id']] =
730  new ilTextAreaInputGUI($definition['field_name'], "udf_" . $definition['field_id']);
731  $this->input["udf_" . $definition['field_id']]->setUseRte(true);
732  } else {
733  $options = $this->user_defined_fields->fieldValuesToSelectArray($definition['field_values']);
734  $this->input["udf_" . $definition['field_id']] =
735  new ilSelectInputGUI($definition['field_name'], "udf_" . $definition['field_id']);
736  $this->input["udf_" . $definition['field_id']]->setOptions($options);
737  }
738 
739  $value = $user_defined_data["f_" . $field_id];
740  $this->input["udf_" . $definition['field_id']]->setValue($value);
741 
742  if ($definition['required']) {
743  $this->input["udf_" . $definition['field_id']]->setRequired(true);
744  }
745  if (!$definition['changeable'] && (!$definition['required'] || $value)) {
746  $this->input["udf_" . $definition['field_id']]->setDisabled(true);
747  }
748 
749  if ($definition['field_type'] == UDF_TYPE_SELECT && !$value) {
750  $this->input["udf_" . $definition['field_id']]->setOptions($options);
751  }
752  }
753 
754  // standard fields
755  include_once("./Services/User/classes/class.ilUserProfile.php");
756  $up = new ilUserProfile();
757  $up->skipField("password");
758  $up->skipGroup("settings");
759  $up->skipGroup("preferences");
760 
761  $up->setAjaxCallback(
762  $this->ctrl->getLinkTargetByClass('ilPublicUserProfileGUI', 'doProfileAutoComplete', '', true)
763  );
764 
765  // standard fields
766  $up->addStandardFieldsToForm($this->form, $ilUser, $this->input);
767 
768  $this->addLocationToForm($this->form, $ilUser);
769 
770  $this->form->addCommandButton("savePersonalData", $lng->txt("save"));
771  }
const UDF_TYPE_SELECT
This class represents a selection list property in a property form.
This class represents a property form user interface.
Class ilUserProfile.
const UDF_TYPE_TEXT
This class represents a text property in a property form.
$ilUser
Definition: imgupload.php:18
const UDF_TYPE_WYSIWYG
global $ilSetting
Definition: privfeed.php:17
This class represents a text area property in a property form.
addLocationToForm(ilPropertyFormGUI $a_form, ilObjUser $a_user)
Add location fields to form if activated.
if(!isset($_REQUEST['ReturnTo'])) if(!isset($_REQUEST['AuthId'])) $options
Definition: as_login.php:20
+ 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 1326 of file class.ilPersonalProfileGUI.php.

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

Referenced by importPersonalData(), and importPersonalDataSelection().

1327  {
1328  global $lng, $ilCtrl;
1329 
1330  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1331  $this->form = new ilPropertyFormGUI();
1332 
1333  // input file
1334  $fi = new ilFileInputGUI($lng->txt("file"), "file");
1335  $fi->setRequired(true);
1336  $fi->setSuffixes(array("zip"));
1337  $this->form->addItem($fi);
1338 
1339  // profile data
1340  $cb = new ilCheckboxInputGUI($this->lng->txt("pd_profile_data"), "profile_data");
1341  $this->form->addItem($cb);
1342 
1343  // settings
1344  $cb = new ilCheckboxInputGUI($this->lng->txt("settings"), "settings");
1345  $this->form->addItem($cb);
1346 
1347  // bookmarks
1348  $cb = new ilCheckboxInputGUI($this->lng->txt("pd_bookmarks"), "bookmarks");
1349  $this->form->addItem($cb);
1350 
1351  // personal notes
1352  $cb = new ilCheckboxInputGUI($this->lng->txt("pd_notes"), "notes");
1353  $this->form->addItem($cb);
1354 
1355  // calendar entries
1356  $cb = new ilCheckboxInputGUI($this->lng->txt("pd_private_calendars"), "calendar");
1357  $this->form->addItem($cb);
1358 
1359  $this->form->addCommandButton("importPersonalData", $lng->txt("import"));
1360  $this->form->addCommandButton("showExportImport", $lng->txt("cancel"));
1361 
1362  $this->form->setTitle($lng->txt("pd_import_personal_data"));
1363  $this->form->setFormAction($ilCtrl->getFormAction($this));
1364  }
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.
global $ilCtrl
Definition: ilias.php:18
setTitle($a_title)
Set Title.
Create styles array
The data for the language used.
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 960 of file class.ilPersonalProfileGUI.php.

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

Referenced by savePublicProfile(), and showPublicProfile().

961  {
962  global $lng, $ilUser, $ilSetting;
963 
964  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
965  $this->form = new ilPropertyFormGUI();
966 
967  $this->form->setTitle($lng->txt("public_profile"));
968  $this->form->setDescription($lng->txt("user_public_profile_info"));
969  $this->form->setFormAction($this->ctrl->getFormAction($this));
970 
971  $portfolio_id = $this->getProfilePortfolio();
972 
973  if (!$portfolio_id) {
974  // Activate public profile
975  $radg = new ilRadioGroupInputGUI($lng->txt("user_activate_public_profile"), "public_profile");
976  $info = $this->lng->txt("user_activate_public_profile_info");
977  $pub_prof = in_array($ilUser->prefs["public_profile"], array("y", "n", "g"))
978  ? $ilUser->prefs["public_profile"]
979  : "n";
980  if (!$ilSetting->get('enable_global_profiles') && $pub_prof == "g") {
981  $pub_prof = "y";
982  }
983  $radg->setValue($pub_prof);
984  $op1 = new ilRadioOption($lng->txt("usr_public_profile_disabled"), "n", $lng->txt("usr_public_profile_disabled_info"));
985  $radg->addOption($op1);
986  $op2 = new ilRadioOption($lng->txt("usr_public_profile_logged_in"), "y");
987  $radg->addOption($op2);
988  if ($ilSetting->get('enable_global_profiles')) {
989  $op3 = new ilRadioOption($lng->txt("usr_public_profile_global"), "g");
990  $radg->addOption($op3);
991  }
992  $this->form->addItem($radg);
993 
994  // #11773
995  if ($ilSetting->get('user_portfolios')) {
996  // #10826
997  $prtf = "<br />" . $lng->txt("user_profile_portfolio");
998  $prtf .= "<br /><a href=\"ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToPortfolio\">&raquo; " .
999  $lng->txt("user_portfolios") . "</a>";
1000  $info .= $prtf;
1001  }
1002 
1003  $radg->setInfo($info);
1004  } else {
1005  $prtf = $lng->txt("user_profile_portfolio_selected");
1006  $prtf .= "<br /><a href=\"ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToPortfolio&prt_id=" . $portfolio_id . "\">&raquo; " .
1007  $lng->txt("portfolio") . "</a>";
1008 
1009  $info = new ilCustomInputGUI($lng->txt("user_activate_public_profile"));
1010  $info->setHTML($prtf);
1011  $this->form->addItem($info);
1012  }
1013 
1014  $this->showPublicProfileFields($this->form, $ilUser->prefs);
1015 
1016  $this->form->addCommandButton("savePublicProfile", $lng->txt("save"));
1017  }
This class represents an option in a radio group.
showPublicProfileFields(ilPropertyformGUI $form, array $prefs, $parent=null, $anonymized=false)
Add fields to form.
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.
$ilUser
Definition: imgupload.php:18
Create styles array
The data for the language used.
This class represents a custom property in a property form.
global $ilSetting
Definition: privfeed.php:17
$info
Definition: index.php:5
+ 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 191 of file class.ilPersonalProfileGUI.php.

References $ilUser, and saveProfile().

192  {
193  global $ilUser;
194 
195  $ilUser->removeUserPicture();
196 
197  $this->saveProfile();
198  }
saveProfile()
save user profile data
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:

◆ savePersonalData()

ilPersonalProfileGUI::savePersonalData ( )

Save personal data form.

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

References $_SESSION, $ilCtrl, $ilSetting, $ilUser, $lng, $location, $m, $target, $tpl, ilObjUser\_loginExists(), array, ilSession\get(), IL_CAL_DATE, initPersonalDataForm(), ilMapUtil\isActivated(), ilUtil\isLogin(), ilUtil\redirect(), ilUtil\sendFailure(), ilUtil\sendSuccess(), ilSession\set(), showPersonalData(), ilUtil\stripSlashes(), and uploadUserPicture().

778  {
779  global $tpl, $lng, $ilCtrl, $ilUser, $ilSetting;
780 
781  $this->initPersonalDataForm();
782  if ($this->form->checkInput()) {
783  $form_valid = true;
784 
785  // if form field name differs from setter
786  $map = array(
787  "firstname" => "FirstName",
788  "lastname" => "LastName",
789  "title" => "UTitle",
790  "sel_country" => "SelectedCountry",
791  "phone_office" => "PhoneOffice",
792  "phone_home" => "PhoneHome",
793  "phone_mobile" => "PhoneMobile",
794  "referral_comment" => "Comment",
795  "interests_general" => "GeneralInterests",
796  "interests_help_offered" => "OfferingHelp",
797  "interests_help_looking" => "LookingForHelp"
798  );
799  include_once("./Services/User/classes/class.ilUserProfile.php");
800  $up = new ilUserProfile();
801  foreach ($up->getStandardFields() as $f => $p) {
802  // if item is part of form, it is currently valid (if not disabled)
803  $item = $this->form->getItemByPostVar("usr_" . $f);
804  if ($item && !$item->getDisabled()) {
805  $value = $this->form->getInput("usr_" . $f);
806  switch ($f) {
807  case "birthday":
808  $value = $item->getDate();
809  $ilUser->setBirthday($value
810  ? $value->get(IL_CAL_DATE)
811  : "");
812  break;
813  case "second_email":
814  $ilUser->setSecondEmail($value);
815  break;
816  default:
817  $m = ucfirst($f);
818  if (isset($map[$f])) {
819  $m = $map[$f];
820  }
821  $ilUser->{"set" . $m}($value);
822  break;
823  }
824  }
825  }
826  $ilUser->setFullname();
827 
828  // check map activation
829  include_once("./Services/Maps/classes/class.ilMapUtil.php");
830  if (ilMapUtil::isActivated()) {
831  // #17619 - proper escaping
832  $location = $this->form->getInput("location");
833  $lat = ilUtil::stripSlashes($location["latitude"]);
834  $long = ilUtil::stripSlashes($location["longitude"]);
835  $zoom = ilUtil::stripSlashes($location["zoom"]);
836  $ilUser->setLatitude(is_numeric($lat) ? $lat : null);
837  $ilUser->setLongitude(is_numeric($long) ? $long : null);
838  $ilUser->setLocationZoom(is_numeric($zoom) ? $zoom : null);
839  }
840 
841  // Set user defined data
842  $defs = $this->user_defined_fields->getVisibleDefinitions();
843  $udf = array();
844  foreach ($defs as $definition) {
845  $f = "udf_" . $definition['field_id'];
846  $item = $this->form->getItemByPostVar($f);
847  if ($item && !$item->getDisabled()) {
848  $udf[$definition['field_id']] = $this->form->getInput($f);
849  }
850  }
851  $ilUser->setUserDefinedData($udf);
852 
853  // if loginname is changeable -> validate
854  $un = $this->form->getInput('username');
855  if ((int) $ilSetting->get('allow_change_loginname') &&
856  $un != $ilUser->getLogin()) {
857  if (!strlen($un) || !ilUtil::isLogin($un)) {
858  ilUtil::sendFailure($lng->txt('form_input_not_valid'));
859  $this->form->getItemByPostVar('username')->setAlert($this->lng->txt('login_invalid'));
860  $form_valid = false;
861  } elseif (ilObjUser::_loginExists($un, $ilUser->getId())) {
862  ilUtil::sendFailure($lng->txt('form_input_not_valid'));
863  $this->form->getItemByPostVar('username')->setAlert($this->lng->txt('loginname_already_exists'));
864  $form_valid = false;
865  } else {
866  $ilUser->setLogin($un);
867 
868  try {
869  $ilUser->updateLogin($ilUser->getLogin());
870  } catch (ilUserException $e) {
871  ilUtil::sendFailure($lng->txt('form_input_not_valid'));
872  $this->form->getItemByPostVar('username')->setAlert($e->getMessage());
873  $form_valid = false;
874  }
875  }
876  }
877 
878  // everthing's ok. save form data
879  if ($form_valid) {
880  $this->uploadUserPicture();
881 
882  // profile ok
883  $ilUser->setProfileIncomplete(false);
884 
885  // save user data & object_data
886  $ilUser->setTitle($ilUser->getFullname());
887  $ilUser->setDescription($ilUser->getEmail());
888 
889  $ilUser->update();
890 
891  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
892 
893  if (ilSession::get('orig_request_target')) {
894  $target = ilSession::get('orig_request_target');
895  ilSession::set('orig_request_target', '');
897  } elseif ($redirect = $_SESSION['profile_complete_redirect']) {
898  unset($_SESSION['profile_complete_redirect']);
899  ilUtil::redirect($redirect);
900  } else {
901  $ilCtrl->redirect($this, "showPersonalData");
902  }
903  }
904  }
905 
906  $this->form->setValuesByPost();
907  $this->showPersonalData(true);
908  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
Class for user related exception handling in ILIAS.
$_SESSION["AccountId"]
showPersonalData($a_no_init=false)
Personal data form.
$location
Definition: buildRTE.php:44
static get($a_var)
Get a value.
Class ilUserProfile.
static set($a_var, $a_val)
Set a value.
uploadUserPicture()
Upload user image.
global $ilCtrl
Definition: ilias.php:18
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...
$ilUser
Definition: imgupload.php:18
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static isActivated()
Checks whether Map feature is activated.
const IL_CAL_DATE
initPersonalDataForm()
Init personal form.
static isLogin($a_login)
global $ilSetting
Definition: privfeed.php:17
static redirect($a_script)
+ Here is the call graph for this function:

◆ saveProfile()

ilPersonalProfileGUI::saveProfile ( )

save user profile data

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

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

Referenced by removeUserPicture().

206  {
207  global $ilUser ,$ilSetting, $ilAuth;
208 
209  //init checking var
210  $form_valid = true;
211 
212  // testing by ratana ty:
213  // if people check on check box it will
214  // write some datata to table usr_pref
215  // if check on Public Profile
216  if (($_POST["chk_pub"])=="on") {
217  $ilUser->setPref("public_profile", "y");
218  } else {
219  $ilUser->setPref("public_profile", "n");
220  }
221 
222  // if check on Institute
223  $val_array = array("institution", "department", "upload", "street",
224  "zip", "city", "country", "phone_office", "phone_home", "phone_mobile",
225  "fax", "email", "second_email", "hobby", "matriculation");
226 
227  // set public profile preferences
228  foreach ($val_array as $key => $value) {
229  if (($_POST["chk_" . $value]) == "on") {
230  $ilUser->setPref("public_" . $value, "y");
231  } else {
232  $ilUser->setPref("public_" . $value, "n");
233  }
234  }
235 
236  // check dynamically required fields
237  foreach ($this->settings as $key => $val) {
238  if (substr($key, 0, 8) == "require_") {
239  $require_keys[] = substr($key, 8);
240  }
241  }
242 
243  foreach ($require_keys as $key => $val) {
244  // exclude required system and registration-only fields
245  $system_fields = array("login", "default_role", "passwd", "passwd2");
246  if (!in_array($val, $system_fields)) {
247  if ($this->workWithUserSetting($val)) {
248  if (isset($this->settings["require_" . $val]) && $this->settings["require_" . $val]) {
249  if (empty($_POST["usr_" . $val])) {
250  ilUtil::sendFailure($this->lng->txt("fill_out_all_required_fields") . ": " . $this->lng->txt($val));
251  $form_valid = false;
252  }
253  }
254  }
255  }
256  }
257 
258  // Check user defined required fields
259  if ($form_valid and !$this->__checkUserDefinedRequiredFields()) {
260  ilUtil::sendFailure($this->lng->txt("fill_out_all_required_fields"));
261  $form_valid = false;
262  }
263 
264  // check email
265  if ($this->workWithUserSetting("email")) {
266  if (!ilUtil::is_email($_POST["usr_email"]) and !empty($_POST["usr_email"]) and $form_valid) {
267  ilUtil::sendFailure($this->lng->txt("email_not_valid"));
268  $form_valid = false;
269  }
270  }
271  // check second email
272  if ($this->workWithUserSetting("second_email")) {
273  if (!ilUtil::is_email($_POST["usr_second_email"]) and !empty($_POST["usr_second_email"]) and $form_valid) {
274  ilUtil::sendFailure($this->lng->txt("second_email_not_valid"));
275  $form_valid = false;
276  }
277  }
278 
279  //update user data (not saving!)
280  if ($this->workWithUserSetting("firstname")) {
281  $ilUser->setFirstName(ilUtil::stripSlashes($_POST["usr_firstname"]));
282  }
283  if ($this->workWithUserSetting("lastname")) {
284  $ilUser->setLastName(ilUtil::stripSlashes($_POST["usr_lastname"]));
285  }
286  if ($this->workWithUserSetting("gender")) {
287  $ilUser->setGender($_POST["usr_gender"]);
288  }
289  if ($this->workWithUserSetting("title")) {
290  $ilUser->setUTitle(ilUtil::stripSlashes($_POST["usr_title"]));
291  }
292  $ilUser->setFullname();
293  if ($this->workWithUserSetting("institution")) {
294  $ilUser->setInstitution(ilUtil::stripSlashes($_POST["usr_institution"]));
295  }
296  if ($this->workWithUserSetting("department")) {
297  $ilUser->setDepartment(ilUtil::stripSlashes($_POST["usr_department"]));
298  }
299  if ($this->workWithUserSetting("street")) {
300  $ilUser->setStreet(ilUtil::stripSlashes($_POST["usr_street"]));
301  }
302  if ($this->workWithUserSetting("zipcode")) {
303  $ilUser->setZipcode(ilUtil::stripSlashes($_POST["usr_zipcode"]));
304  }
305  if ($this->workWithUserSetting("city")) {
306  $ilUser->setCity(ilUtil::stripSlashes($_POST["usr_city"]));
307  }
308  if ($this->workWithUserSetting("country")) {
309  $ilUser->setCountry(ilUtil::stripSlashes($_POST["usr_country"]));
310  }
311  if ($this->workWithUserSetting("phone_office")) {
312  $ilUser->setPhoneOffice(ilUtil::stripSlashes($_POST["usr_phone_office"]));
313  }
314  if ($this->workWithUserSetting("phone_home")) {
315  $ilUser->setPhoneHome(ilUtil::stripSlashes($_POST["usr_phone_home"]));
316  }
317  if ($this->workWithUserSetting("phone_mobile")) {
318  $ilUser->setPhoneMobile(ilUtil::stripSlashes($_POST["usr_phone_mobile"]));
319  }
320  if ($this->workWithUserSetting("fax")) {
321  $ilUser->setFax(ilUtil::stripSlashes($_POST["usr_fax"]));
322  }
323  if ($this->workWithUserSetting("email")) {
324  $ilUser->setEmail(ilUtil::stripSlashes($_POST["usr_email"]));
325  }
326  if ($this->workWithUserSetting("second_email")) {
327  $ilUser->setSecondEmail(ilUtil::stripSlashes($_POST["usr_second_email"]));
328  }
329  if ($this->workWithUserSetting("hobby")) {
330  $ilUser->setHobby(ilUtil::stripSlashes($_POST["usr_hobby"]));
331  }
332  if ($this->workWithUserSetting("referral_comment")) {
333  $ilUser->setComment(ilUtil::stripSlashes($_POST["usr_referral_comment"]));
334  }
335  if ($this->workWithUserSetting("matriculation")) {
336  $ilUser->setMatriculation(ilUtil::stripSlashes($_POST["usr_matriculation"]));
337  }
338 
339  // Set user defined data
340  $ilUser->setUserDefinedData($_POST['udf']);
341 
342  // everthing's ok. save form data
343  if ($form_valid) {
344  // init reload var. page should only be reloaded if skin or style were changed
345  $reload = false;
346 
347  if ($this->workWithUserSetting("skin_style")) {
348  //set user skin and style
349  if ($_POST["usr_skin_style"] != "") {
350  $sknst = explode(":", $_POST["usr_skin_style"]);
351 
352  if ($ilUser->getPref("style") != $sknst[1] ||
353  $ilUser->getPref("skin") != $sknst[0]) {
354  $ilUser->setPref("skin", $sknst[0]);
355  $ilUser->setPref("style", $sknst[1]);
356  $reload = true;
357  }
358  }
359  }
360 
361  if ($this->workWithUserSetting("language")) {
362  // reload page if language was changed
363  //if ($_POST["usr_language"] != "" and $_POST["usr_language"] != $_SESSION['lang'])
364  // (this didn't work as expected, alex)
365  if ($_POST["usr_language"] != $ilUser->getLanguage()) {
366  $reload = true;
367  }
368 
369  // set user language
370  $ilUser->setLanguage($_POST["usr_language"]);
371  }
372  if ($this->workWithUserSetting("hits_per_page")) {
373  // set user hits per page
374  if ($_POST["hits_per_page"] != "") {
375  $ilUser->setPref("hits_per_page", $_POST["hits_per_page"]);
376  }
377  }
378 
379  // set show users online
380  /*if ($this->workWithUserSetting("show_users_online"))
381  {
382  $ilUser->setPref("show_users_online", $_POST["show_users_online"]);
383  }*/
384 
385  // set hide own online_status
386  if ($this->workWithUserSetting("hide_own_online_status")) {
387  if ($_POST["chk_hide_own_online_status"] != "") {
388  $ilUser->setPref("hide_own_online_status", "y");
389  } else {
390  $ilUser->setPref("hide_own_online_status", "n");
391  }
392  }
393 
394  // personal desktop items in news block
395  /* Subscription Concept is abandonded for now, we show all news of pd items (Alex)
396  if ($_POST["pd_items_news"] != "")
397  {
398  $ilUser->setPref("pd_items_news","y");
399  }
400  else
401  {
402  $ilUser->setPref("pd_items_news","n");
403  }
404  */
405 
406  // profile ok
407  $ilUser->setProfileIncomplete(false);
408 
409  // save user data & object_data
410  $ilUser->setTitle($ilUser->getFullname());
411  $ilUser->setDescription($ilUser->getEmail());
412 
413  $ilUser->update();
414 
415  // update lucene index
416  include_once './Services/Search/classes/Lucene/class.ilLuceneIndexer.php';
418 
419 
420  // reload page only if skin or style were changed
421  // feedback
422  if (!empty($this->password_error)) {
423  ilUtil::sendFailure($this->password_error, true);
424  } elseif (!empty($this->upload_error)) {
425  ilUtil::sendFailure($this->upload_error, true);
426  } elseif ($reload) {
427  // feedback
428  ilUtil::sendSuccess($this->lng->txt("saved_successfully"), true);
429  $this->ctrl->redirect($this, "");
430  } else {
431  ilUtil::sendSuccess($this->lng->txt("saved_successfully"), true);
432  }
433  }
434 
435  $this->showProfile();
436  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
static is_email($a_email, ilMailRfc822AddressParserFactory $mailAddressParserFactory=null)
This preg-based function checks whether an e-mail address is formally valid.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
static updateLuceneIndex($a_obj_ids)
Update lucene index.
$ilUser
Definition: imgupload.php:18
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
Create styles array
The data for the language used.
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
settings()
Definition: settings.php:2
global $ilSetting
Definition: privfeed.php:17
$key
Definition: croninfo.php:18
$_POST["username"]
workWithUserSetting($setting)
Returns TRUE if working with the given user setting is allowed, FALSE otherwise.
+ 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 1175 of file class.ilPersonalProfileGUI.php.

References $_POST, $GLOBALS, $handler, $ilCtrl, $ilUser, $key, $lng, $tpl, array, ilBadgeHandler\getInstance(), initPublicProfileForm(), ilUtil\sendSuccess(), ilLuceneIndexer\updateLuceneIndex(), and ilBadgeAssignment\updatePositions().

1176  {
1177  global $tpl, $lng, $ilCtrl, $ilUser;
1178 
1179  $this->initPublicProfileForm();
1180  if ($this->form->checkInput()) {
1181  // with active portfolio no options are presented
1182  if (isset($_POST["public_profile"])) {
1183  $ilUser->setPref("public_profile", $_POST["public_profile"]);
1184  }
1185 
1186  // if check on Institute
1187  $val_array = array("title", "birthday", "gender", "org_units", "institution", "department", "upload",
1188  "street", "zipcode", "city", "country", "sel_country", "phone_office", "phone_home", "phone_mobile",
1189  "fax", "email", "second_email", "hobby", "matriculation", "location",
1190  "interests_general", "interests_help_offered", "interests_help_looking");
1191 
1192  // set public profile preferences
1193  foreach ($val_array as $key => $value) {
1194  if (($_POST["chk_" . $value])) {
1195  $ilUser->setPref("public_" . $value, "y");
1196  } else {
1197  $ilUser->setPref("public_" . $value, "n");
1198  }
1199  }
1200 
1201  // additional defined user data fields
1202  foreach ($this->user_defined_fields->getVisibleDefinitions() as $field_id => $definition) {
1203  if (($_POST["chk_udf_" . $definition["field_id"]])) {
1204  $ilUser->setPref("public_udf_" . $definition["field_id"], "y");
1205  } else {
1206  $ilUser->setPref("public_udf_" . $definition["field_id"], "n");
1207  }
1208  }
1209 
1210  $ilUser->update();
1211 
1212  // :TODO: badges
1213  include_once "Services/Badge/classes/class.ilBadgeHandler.php";
1215  if ($handler->isActive()) {
1216  $badgePositions = [];
1217  if (isset($_POST["bpos"]) && is_array($_POST["bpos"])) {
1218  $badgePositions = $_POST["bpos"];
1219  }
1220 
1221  if (count($badgePositions) > 0) {
1222  include_once "Services/Badge/classes/class.ilBadgeAssignment.php";
1223  ilBadgeAssignment::updatePositions($ilUser->getId(), $badgePositions);
1224  }
1225  }
1226 
1227  // update lucene index
1228  include_once './Services/Search/classes/Lucene/class.ilLuceneIndexer.php';
1229  ilLuceneIndexer::updateLuceneIndex(array((int) $GLOBALS['ilUser']->getId()));
1230 
1231  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1232  $ilCtrl->redirect($this, "showPublicProfile");
1233  }
1234  $this->form->setValuesByPost();
1235  $tpl->showPublicProfile(true);
1236  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
initPublicProfileForm()
Init public profile form.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
static updateLuceneIndex($a_obj_ids)
Update lucene index.
global $ilCtrl
Definition: ilias.php:18
$ilUser
Definition: imgupload.php:18
Create styles array
The data for the language used.
static updatePositions($a_user_id, array $a_positions)
$handler
$key
Definition: croninfo.php:18
$_POST["username"]
static getInstance()
Constructor.
+ Here is the call graph for this function:

◆ setHeader()

ilPersonalProfileGUI::setHeader ( )

Set header.

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

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

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

◆ setTabs()

ilPersonalProfileGUI::setTabs ( )

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

References $ilUser, and getProfilePortfolio().

Referenced by executeCommand().

539  {
540  global $ilTabs, $ilUser, $ilHelp;
541 
542  $ilHelp->setScreenIdComponent("user");
543 
544  // personal data
545  $ilTabs->addTab(
546  "personal_data",
547  $this->lng->txt("personal_data"),
548  $this->ctrl->getLinkTarget($this, "showPersonalData")
549  );
550 
551  // public profile
552  $ilTabs->addTab(
553  "public_profile",
554  $this->lng->txt("public_profile"),
555  $this->ctrl->getLinkTarget($this, "showPublicProfile")
556  );
557 
558  // export
559  $ilTabs->addTab(
560  "export",
561  $this->lng->txt("export") . "/" . $this->lng->txt("import"),
562  $this->ctrl->getLinkTarget($this, "showExportImport")
563  );
564 
565  // #17570
566  if (($ilUser->getPref("public_profile") &&
567  $ilUser->getPref("public_profile") != "n") ||
568  $this->getProfilePortfolio()) {
569  // profile preview
570  $ilTabs->addNonTabbedLink(
571  "profile_preview",
572  $this->lng->txt("user_profile_preview"),
573  $this->ctrl->getLinkTargetByClass("ilpublicuserprofilegui", "view")
574  );
575  }
576  }
getProfilePortfolio()
has profile set to a portfolio?
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ showExportImport()

ilPersonalProfileGUI::showExportImport ( )

Show export/import.

Parameters

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

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

1245  {
1246  global $ilToolbar, $ilCtrl, $tpl, $ilTabs, $ilUser;
1247 
1248  $ilTabs->activateTab("export");
1249  $this->setHeader();
1250 
1251  include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
1252  $button = ilLinkButton::getInstance();
1253  $button->setCaption("pd_export_profile");
1254  $button->setUrl($ilCtrl->getLinkTarget($this, "exportPersonalData"));
1255  $ilToolbar->addStickyItem($button);
1256 
1257  $exp_file = $ilUser->getPersonalDataExportFile();
1258  if ($exp_file != "") {
1259  $ilToolbar->addSeparator();
1260  $ilToolbar->addButton(
1261  $this->lng->txt("pd_download_last_export_file"),
1262  $ilCtrl->getLinkTarget($this, "downloadPersonalData")
1263  );
1264  }
1265 
1266  $ilToolbar->addSeparator();
1267  $ilToolbar->addButton(
1268  $this->lng->txt("pd_import_personal_data"),
1269  $ilCtrl->getLinkTarget($this, "importPersonalDataSelection")
1270  );
1271 
1272  $tpl->show();
1273  }
global $ilCtrl
Definition: ilias.php:18
$ilUser
Definition: imgupload.php:18
+ Here is the call graph for this function:

◆ showPersonalData()

ilPersonalProfileGUI::showPersonalData (   $a_no_init = false)

Personal data form.

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

References $ctrl, $DIC, $ilUser, $lng, array, initPersonalDataForm(), ilUtil\sendInfo(), and setHeader().

Referenced by savePersonalData(), and showProfile().

671  {
672  global $ilUser, $lng, $ilTabs, $DIC;
673 
674  $ilTabs->activateTab("personal_data");
675  $ctrl = $DIC->ctrl();
676 
677  $setting = new ilSetting("user");
678  $it = $setting->get("user_profile_info_" . $ilUser->getLanguage());
679  if (trim($it) != "") {
680  $pub_prof = in_array($ilUser->prefs["public_profile"], array("y", "n", "g"))
681  ? $ilUser->prefs["public_profile"]
682  : "n";
683  if ($pub_prof == "n") {
684  $button = $DIC->ui()->factory()->button()->shy(
685  "» " . $lng->txt("user_make_profile_public"),
686  $ctrl->getLinkTarget($this, "showPublicProfile")
687  );
688  $it.= "<br><br>" . $DIC->ui()->renderer()->render($button);
689  }
690 
691  ilUtil::sendInfo(nl2br($it));
692  }
693 
694  $this->setHeader();
695 
696  if (!$a_no_init) {
697  $this->initPersonalDataForm();
698  // catch feedback message
699  if ($ilUser->getProfileIncomplete()) {
700  ilUtil::sendInfo($lng->txt("profile_incomplete"));
701  }
702  }
703  $this->tpl->setContent($this->form->getHTML());
704 
705  $this->tpl->show();
706  }
global $DIC
Definition: saml.php:7
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$ilUser
Definition: imgupload.php:18
Create styles array
The data for the language used.
initPersonalDataForm()
Init personal form.
+ 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 443 of file class.ilPersonalProfileGUI.php.

References showPersonalData().

Referenced by saveProfile().

444  {
445  $this->showPersonalData();
446  }
showPersonalData($a_no_init=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 919 of file class.ilPersonalProfileGUI.php.

References $ilSetting, $ilUser, $lng, initPublicProfileForm(), and setHeader().

920  {
921  global $ilUser, $lng, $ilSetting, $ilTabs;
922 
923  $ilTabs->activateTab("public_profile");
924 
925  $this->setHeader();
926 
927  if (!$a_no_init) {
928  $this->initPublicProfileForm();
929  }
930 
931  $ptpl = new ilTemplate("tpl.edit_personal_profile.html", true, true, "Services/User");
932  $ptpl->setVariable("FORM", $this->form->getHTML());
933  include_once("./Services/User/classes/class.ilPublicUserProfileGUI.php");
934  $pub_profile = new ilPublicUserProfileGUI($ilUser->getId());
935  $ptpl->setVariable("PREVIEW", $pub_profile->getEmbeddable());
936  $this->tpl->setContent($ptpl->get());
937  $this->tpl->show();
938  }
initPublicProfileForm()
Init public profile form.
GUI class for public user profile presentation.
special template class to simplify handling of ITX/PEAR
$ilUser
Definition: imgupload.php:18
global $ilSetting
Definition: privfeed.php:17
+ Here is the call graph for this function:

◆ showPublicProfileFields()

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

Add fields to form.

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

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

References $handler, $ilUser, $key, array, ilDatePresentation\formatDate(), ilBadgeHandler\getInstance(), ilBadgeAssignment\getInstancesByUserId(), ilBadge\getTitle(), IL_CAL_DATE, ilMapUtil\isActivated(), ilCheckboxInputGUI\setChecked(), ilFormPropertyGUI\setMultiValues(), and userSettingVisible().

Referenced by initPublicProfileForm().

1028  {
1029  global $ilUser;
1030 
1031  $birthday = $ilUser->getBirthday();
1032  if ($birthday) {
1033  $birthday = ilDatePresentation::formatDate(new ilDate($birthday, IL_CAL_DATE));
1034  }
1035  $gender = $ilUser->getGender();
1036  if ($gender) {
1037  $gender = $this->lng->txt("gender_" . $gender);
1038  }
1039 
1040  if ($ilUser->getSelectedCountry() != "") {
1041  $this->lng->loadLanguageModule("meta");
1042  $txt_sel_country = $this->lng->txt("meta_c_" . $ilUser->getSelectedCountry());
1043  }
1044 
1045  // profile picture
1046  $pic = ilObjUser::_getPersonalPicturePath($ilUser->getId(), "xsmall", true, true);
1047  if ($pic) {
1048  $pic = "<img src=\"" . $pic . "\" />";
1049  }
1050 
1051  // personal data
1052  $val_array = array(
1053  "title" => $ilUser->getUTitle(),
1054  "birthday" => $birthday,
1055  "gender" => $gender,
1056  "upload" => $pic,
1057  "interests_general" => $ilUser->getGeneralInterestsAsText(),
1058  "interests_help_offered" => $ilUser->getOfferingHelpAsText(),
1059  "interests_help_looking" => $ilUser->getLookingForHelpAsText(),
1060  "org_units" => $ilUser->getOrgUnitsRepresentation(),
1061  "institution" => $ilUser->getInstitution(),
1062  "department" => $ilUser->getDepartment(),
1063  "street" => $ilUser->getStreet(),
1064  "zipcode" => $ilUser->getZipcode(),
1065  "city" => $ilUser->getCity(),
1066  "country" => $ilUser->getCountry(),
1067  "sel_country" => $txt_sel_country,
1068  "phone_office" => $ilUser->getPhoneOffice(),
1069  "phone_home" => $ilUser->getPhoneHome(),
1070  "phone_mobile" => $ilUser->getPhoneMobile(),
1071  "fax" => $ilUser->getFax(),
1072  "email" => $ilUser->getEmail(),
1073  "second_email" => $ilUser->getSecondEmail(),
1074  "hobby" => $ilUser->getHobby(),
1075  "matriculation" => $ilUser->getMatriculation()
1076  );
1077 
1078  // location
1079  include_once("./Services/Maps/classes/class.ilMapUtil.php");
1080  if (ilMapUtil::isActivated()) {
1081  $val_array["location"] = "";
1082  }
1083 
1084  foreach ($val_array as $key => $value) {
1085  if ($anonymized) {
1086  $value = null;
1087  }
1088 
1089  if ($this->userSettingVisible($key)) {
1090  // #18795 - we should use ilUserProfile
1091  switch ($key) {
1092  case "upload":
1093  $caption = "personal_picture";
1094  break;
1095 
1096  case "title":
1097  $caption = "person_title";
1098  break;
1099 
1100  default:
1101  $caption = $key;
1102  }
1103  $cb = new ilCheckboxInputGUI($this->lng->txt($caption), "chk_" . $key);
1104  if ($prefs["public_" . $key] == "y") {
1105  $cb->setChecked(true);
1106  }
1107  //$cb->setInfo($value);
1108  $cb->setOptionTitle($value);
1109 
1110  if (!$parent) {
1111  $form->addItem($cb);
1112  } else {
1113  $parent->addSubItem($cb);
1114  }
1115  }
1116  }
1117 
1118  // additional defined user data fields
1119  $user_defined_data = array();
1120  if (!$anonymized) {
1121  $user_defined_data = $ilUser->getUserDefinedData();
1122  }
1123  foreach ($this->user_defined_fields->getVisibleDefinitions() as $field_id => $definition) {
1124  // public setting
1125  $cb = new ilCheckboxInputGUI($definition["field_name"], "chk_udf_" . $definition["field_id"]);
1126  $cb->setOptionTitle($user_defined_data["f_" . $definition["field_id"]]);
1127  if ($prefs["public_udf_" . $definition["field_id"]] == "y") {
1128  $cb->setChecked(true);
1129  }
1130 
1131  if (!$parent) {
1132  $form->addItem($cb);
1133  } else {
1134  $parent->addSubItem($cb);
1135  }
1136  }
1137 
1138  // :TODO: badges
1139  if (!$anonymized) {
1140  include_once "Services/Badge/classes/class.ilBadgeHandler.php";
1142  if ($handler->isActive()) {
1143  $badge_options = array();
1144 
1145  include_once "Services/Badge/classes/class.ilBadgeAssignment.php";
1146  include_once "Services/Badge/classes/class.ilBadge.php";
1147  foreach (ilBadgeAssignment::getInstancesByUserId($ilUser->getId()) as $ass) {
1148  // only active
1149  if ($ass->getPosition()) {
1150  $badge = new ilBadge($ass->getBadgeId());
1151  $badge_options[] = $badge->getTitle();
1152  }
1153  }
1154 
1155  if (sizeof($badge_options) > 1) {
1156  $badge_order = new ilNonEditableValueGUI($this->lng->txt("obj_bdga"), "bpos");
1157  $badge_order->setMultiValues($badge_options);
1158  $badge_order->setValue(array_shift($badge_options));
1159  $badge_order->setMulti(true, true, false);
1160 
1161  if (!$parent) {
1162  $form->addItem($badge_order);
1163  } else {
1164  $parent->addSubItem($badge_order);
1165  }
1166  }
1167  }
1168  }
1169  }
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false)
Format a date public.
This class represents a checkbox property in a property form.
setMultiValues(array $a_values)
Set multi values.
setChecked($a_checked)
Set Checked.
Class for single dates.
if(isset($_POST['submit'])) $form
$ilUser
Definition: imgupload.php:18
Create styles array
The data for the language used.
static isActivated()
Checks whether Map feature is activated.
const IL_CAL_DATE
This class represents a non editable value in a property form.
userSettingVisible($setting)
Returns TRUE if user setting is visible, FALSE otherwise.
$handler
$key
Definition: croninfo.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 451 of file class.ilPersonalProfileGUI.php.

References $tpl, ilTermsOfServiceSignableDocumentFactory\getByLanguageObject(), ilSystemSupportContacts\getMailToAddress(), and ilUtil\prepareFormOutput().

452  {
453  $this->tabs->clearTargets();
454  $this->tabs->clearSubTabs();
455 
456  $this->tpl->setTitle($this->lng->txt('usr_agreement'));
457 
458  $tpl = new \ilTemplate('tpl.view_terms_of_service.html', true, true, 'Services/Init');
459 
461  if ($document->exists()) {
462  $tpl->setVariable('TERMS_OF_SERVICE_CONTENT', $document->getContent());
463  } else {
464  $tpl->setVariable(
465  'TERMS_OF_SERVICE_CONTENT',
466  sprintf(
467  $this->lng->txt('no_agreement_description'),
469  )
470  );
471  }
472 
473  $this->tpl->setContent($tpl->get());
474 
475  $this->tpl->setPermanentLink('usr', null, 'agreement');
476  $this->tpl->show();
477  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
static getMailToAddress()
Get mailto: email.
+ Here is the call graph for this function:

◆ uploadUserPicture()

ilPersonalProfileGUI::uploadUserPicture ( )

Upload user image.

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

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

Referenced by savePersonalData().

127  {
128  global $ilUser;
129 
130  if ($this->workWithUserSetting("upload")) {
131  if (!$this->form->hasFileUpload("userfile")) {
132  if ($this->form->getItemByPostVar("userfile")->getDeletionFlag()) {
133  $ilUser->removeUserPicture();
134  }
135  return;
136  } else {
137  $webspace_dir = ilUtil::getWebspaceDir();
138  $image_dir = $webspace_dir . "/usr_images";
139  $store_file = "usr_" . $ilUser->getID() . "." . "jpg";
140 
141  // store filename
142  $ilUser->setPref("profile_image", $store_file);
143  $ilUser->update();
144 
145  // move uploaded file
146 
147  $pi = pathinfo($_FILES["userfile"]["name"]);
148  $uploaded_file = $this->form->moveFileUpload(
149  $image_dir,
150  "userfile",
151  "upload_" . $ilUser->getId() . "." . $pi["extension"]
152  );
153  if (!$uploaded_file) {
154  ilUtil::sendFailure($this->lng->txt("upload_error", true));
155  $this->ctrl->redirect($this, "showProfile");
156  }
157  chmod($uploaded_file, 0770);
158 
159  // take quality 100 to avoid jpeg artefacts when uploading jpeg files
160  // taking only frame [0] to avoid problems with animated gifs
161  $show_file = "$image_dir/usr_" . $ilUser->getId() . ".jpg";
162  $thumb_file = "$image_dir/usr_" . $ilUser->getId() . "_small.jpg";
163  $xthumb_file = "$image_dir/usr_" . $ilUser->getId() . "_xsmall.jpg";
164  $xxthumb_file = "$image_dir/usr_" . $ilUser->getId() . "_xxsmall.jpg";
165  $uploaded_file = ilUtil::escapeShellArg($uploaded_file);
166  $show_file = ilUtil::escapeShellArg($show_file);
167  $thumb_file = ilUtil::escapeShellArg($thumb_file);
168  $xthumb_file = ilUtil::escapeShellArg($xthumb_file);
169  $xxthumb_file = ilUtil::escapeShellArg($xxthumb_file);
170 
171  if (ilUtil::isConvertVersionAtLeast("6.3.8-3")) {
172  ilUtil::execConvert($uploaded_file . "[0] -geometry 200x200^ -gravity center -extent 200x200 -quality 100 JPEG:" . $show_file);
173  ilUtil::execConvert($uploaded_file . "[0] -geometry 100x100^ -gravity center -extent 100x100 -quality 100 JPEG:" . $thumb_file);
174  ilUtil::execConvert($uploaded_file . "[0] -geometry 75x75^ -gravity center -extent 75x75 -quality 100 JPEG:" . $xthumb_file);
175  ilUtil::execConvert($uploaded_file . "[0] -geometry 30x30^ -gravity center -extent 30x30 -quality 100 JPEG:" . $xxthumb_file);
176  } else {
177  ilUtil::execConvert($uploaded_file . "[0] -geometry 200x200 -quality 100 JPEG:" . $show_file);
178  ilUtil::execConvert($uploaded_file . "[0] -geometry 100x100 -quality 100 JPEG:" . $thumb_file);
179  ilUtil::execConvert($uploaded_file . "[0] -geometry 75x75 -quality 100 JPEG:" . $xthumb_file);
180  ilUtil::execConvert($uploaded_file . "[0] -geometry 30x30 -quality 100 JPEG:" . $xxthumb_file);
181  }
182  }
183  }
184 
185  // $this->saveProfile();
186  }
static isConvertVersionAtLeast($a_version)
Compare convert version numbers.
static execConvert($args)
execute convert command
$ilUser
Definition: imgupload.php:18
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static escapeShellArg($a_arg)
static getWebspaceDir($mode="filesystem")
get webspace directory
workWithUserSetting($setting)
Returns TRUE if working with the given user setting is allowed, FALSE otherwise.
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ userSettingEnabled()

ilPersonalProfileGUI::userSettingEnabled (   $setting)

Returns TRUE if user setting is enabled, FALSE otherwise.

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

References $result, and settings().

115  {
116  $result = true;
117  if ($this->settings["usr_settings_disable_" . $setting] == 1) {
118  $result = false;
119  }
120  return $result;
121  }
$result
settings()
Definition: settings.php:2
+ Here is the call graph for this function:

◆ userSettingVisible()

ilPersonalProfileGUI::userSettingVisible (   $setting)

Returns TRUE if user setting is visible, FALSE otherwise.

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

References $result, and settings().

Referenced by __showOtherInformations(), and showPublicProfileFields().

101  {
102  $result = true;
103  if (isset($this->settings["usr_settings_hide_" . $setting]) &&
104  $this->settings["usr_settings_hide_" . $setting] == 1) {
105  $result = false;
106  }
107  return $result;
108  }
$result
settings()
Definition: settings.php:2
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ workWithUserSetting()

ilPersonalProfileGUI::workWithUserSetting (   $setting)

Returns TRUE if working with the given user setting is allowed, FALSE otherwise.

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

References $result, and settings().

Referenced by saveProfile(), and uploadUserPicture().

85  {
86  $result = true;
87  if ($this->settings["usr_settings_hide_" . $setting] == 1) {
88  $result = false;
89  }
90  if ($this->settings["usr_settings_disable_" . $setting] == 1) {
91  $result = false;
92  }
93  return $result;
94  }
$result
settings()
Definition: settings.php:2
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

ilPersonalProfileGUI::$ctrl

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

Referenced by showPersonalData().

◆ $ilias

ilPersonalProfileGUI::$ilias

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

Referenced by __construct().

◆ $lng

◆ $tabs

ilPersonalProfileGUI::$tabs
protected

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

◆ $tpl

◆ $user_defined_fields

ilPersonalProfileGUI::$user_defined_fields = null

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


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