ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
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

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

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 25 of file class.ilPersonalProfileGUI.php.

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

26  {
27  global $ilias, $tpl, $lng, $ilCtrl;
28 
29  include_once './Services/User/classes/class.ilUserDefinedFields.php';
30  $this->user_defined_fields =& ilUserDefinedFields::_getInstance();
31 
32  $this->tpl = $tpl;
33  $this->lng = $lng;
34  $this->ilias = $ilias;
35  $this->ctrl = $ilCtrl;
36  $this->settings = $ilias->getAllSettings();
37  $lng->loadLanguageModule("jsmath");
38  $lng->loadLanguageModule("pd");
39  $this->upload_error = "";
40  $this->password_error = "";
41  $lng->loadLanguageModule("user");
42  // $ilCtrl->saveParameter($this, "user_page");
43  }
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 664 of file class.ilPersonalProfileGUI.php.

References $_POST.

Referenced by saveProfile().

665  {
666  foreach($this->user_defined_fields->getVisibleDefinitions() as $definition)
667  {
668  $field_id = $definition['field_id'];
669  if($definition['required'] and !strlen($_POST['udf'][$field_id]))
670  {
671  return false;
672  }
673  }
674  return true;
675  }
$_POST["username"]
+ Here is the caller graph for this function:

◆ __showOtherInformations()

ilPersonalProfileGUI::__showOtherInformations ( )

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

References userSettingVisible().

595  {
596  $d_set = new ilSetting("delicous");
597  if($this->userSettingVisible("matriculation") or count($this->user_defined_fields->getVisibleDefinitions())
598  or $d_set->get("user_profile") == "1")
599  {
600  return true;
601  }
602  return false;
603  }
ILIAS Setting Class.
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 605 of file class.ilPersonalProfileGUI.php.

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

606  {
607  global $ilUser;
608 
609  $user_defined_data = $ilUser->getUserDefinedData();
610  foreach($this->user_defined_fields->getVisibleDefinitions() as $field_id => $definition)
611  {
612  if($definition['field_type'] == UDF_TYPE_TEXT)
613  {
614  $this->tpl->setCurrentBlock("field_text");
615  $this->tpl->setVariable("FIELD_VALUE",ilUtil::prepareFormOutput($user_defined_data[$field_id]));
616  if(!$definition['changeable'])
617  {
618  $this->tpl->setVariable("DISABLED_FIELD",'disabled=\"disabled\"');
619  $this->tpl->setVariable("FIELD_NAME",'udf['.$definition['field_id'].']');
620  }
621  else
622  {
623  $this->tpl->setVariable("FIELD_NAME",'udf['.$definition['field_id'].']');
624  }
625  $this->tpl->parseCurrentBlock();
626  }
627  else
628  {
629  if($definition['changeable'])
630  {
631  $name = 'udf['.$definition['field_id'].']';
632  $disabled = false;
633  }
634  else
635  {
636  $name = '';
637  $disabled = true;
638  }
639  $this->tpl->setCurrentBlock("field_select");
640  $this->tpl->setVariable("SELECT_BOX",ilUtil::formSelect($user_defined_data[$field_id],
641  $name,
642  $this->user_defined_fields->fieldValuesToSelectArray(
643  $definition['field_values']),
644  false,
645  true,0,'','',$disabled));
646  $this->tpl->parseCurrentBlock();
647  }
648  $this->tpl->setCurrentBlock("user_defined");
649 
650  if($definition['required'])
651  {
652  $name = $definition['field_name']."<span class=\"asterisk\">*</span>";
653  }
654  else
655  {
656  $name = $definition['field_name'];
657  }
658  $this->tpl->setVariable("TXT_FIELD_NAME",$name);
659  $this->tpl->parseCurrentBlock();
660  }
661  return true;
662  }
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms public
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.
const UDF_TYPE_TEXT
$ilUser
Definition: imgupload.php:18
+ 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 504 of file class.ilPersonalProfileGUI.php.

References $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().

505  {
506  global $ilCtrl;
507 
508  // check map activation
509  include_once("./Services/Maps/classes/class.ilMapUtil.php");
510  if (!ilMapUtil::isActivated())
511  {
512  return;
513  }
514 
515  // Don't really know if this is still necessary...
516  $this->lng->loadLanguageModule("maps");
517 
518  // Get user settings
519  $latitude = $a_user->getLatitude();
520  $longitude = $a_user->getLongitude();
521  $zoom = $a_user->getLocationZoom();
522 
523  // Get Default settings, when nothing is set
524  if ($latitude == 0 && $longitude == 0 && $zoom == 0)
525  {
527  $latitude = $def["latitude"];
528  $longitude = $def["longitude"];
529  $zoom = $def["zoom"];
530  }
531 
532  $street = $a_user->getStreet();
533  if (!$street)
534  {
535  $street = $this->lng->txt("street");
536  }
537  $city = $a_user->getCity();
538  if (!$city)
539  {
540  $city = $this->lng->txt("city");
541  }
542  $country = $a_user->getCountry();
543  if (!$country)
544  {
545  $country = $this->lng->txt("country");
546  }
547 
548  // location property
549  $loc_prop = new ilLocationInputGUI($this->lng->txt("location"),
550  "location");
551  $loc_prop->setLatitude($latitude);
552  $loc_prop->setLongitude($longitude);
553  $loc_prop->setZoom($zoom);
554  $loc_prop->setAddress($street.",".$city.",".$country);
555 
556  $a_form->addItem($loc_prop);
557  }
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.
+ 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 1378 of file class.ilPersonalProfileGUI.php.

References $ilUser.

1379  {
1380  global $ilUser;
1381 
1382  $ilUser->sendPersonalDataFile();
1383  }
$ilUser
Definition: imgupload.php:18

◆ executeCommand()

ilPersonalProfileGUI::executeCommand ( )

execute command

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

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

49  {
50  global $ilUser, $ilCtrl, $tpl, $ilTabs, $lng;
51 
52  $next_class = $this->ctrl->getNextClass();
53 
54  switch($next_class)
55  {
56  case "ilpublicuserprofilegui":
57  include_once("./Services/User/classes/class.ilPublicUserProfileGUI.php");
58  $_GET["user_id"] = $ilUser->getId();
59  $pub_profile_gui = new ilPublicUserProfileGUI($_GET["user_id"]);
60  $pub_profile_gui->setBackUrl($ilCtrl->getLinkTarget($this, "showPersonalData"));
61  $ilCtrl->forwardCommand($pub_profile_gui);
62  $tpl->show();
63  break;
64 
65  default:
66  $this->setTabs();
67  $cmd = $this->ctrl->getCmd("showPersonalData");
68  $this->$cmd();
69  break;
70  }
71  return true;
72  }
$_GET["client_id"]
$cmd
Definition: sahs_server.php:35
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 1363 of file class.ilPersonalProfileGUI.php.

References $ilCtrl, and $ilUser.

1364  {
1365  global $ilCtrl, $ilUser;
1366 
1367  $ilUser->exportPersonalData();
1368  $ilUser->sendPersonalDataFile();
1369  $ilCtrl->redirect($this, "showExportImport");
1370  }
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 989 of file class.ilPersonalProfileGUI.php.

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

Referenced by initPublicProfileForm(), and setTabs().

990  {
991  global $ilUser, $ilSetting;
992 
993  if ($ilSetting->get('user_portfolios'))
994  {
995  include_once "Modules/Portfolio/classes/class.ilObjPortfolio.php";
996  return ilObjPortfolio::getDefaultPortfolio($ilUser->getId());
997  }
998  }
$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 1458 of file class.ilPersonalProfileGUI.php.

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

1459  {
1460  global $ilUser, $ilCtrl, $tpl, $ilTabs;
1461 
1462  $this->initPersonalDataImportForm();
1463  if ($this->form->checkInput())
1464  {
1465  $ilUser->importPersonalData($_FILES["file"],
1466  (int) $_POST["profile_data"],
1467  (int) $_POST["settings"],
1468  (int) $_POST["bookmarks"],
1469  (int) $_POST["notes"],
1470  (int) $_POST["calendar"]
1471  );
1472  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
1473  $ilCtrl->redirect($this, "");
1474  }
1475  else
1476  {
1477  $ilTabs->activateTab("export");
1478  $this->setHeader();
1479  $this->form->setValuesByPost();
1480  $tpl->setContent($this->form->getHtml());
1481  $tpl->show();
1482  }
1483  }
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 1391 of file class.ilPersonalProfileGUI.php.

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

1392  {
1393  global $lng, $ilCtrl, $tpl, $ilTabs;
1394 
1395  $ilTabs->activateTab("export");
1396  $this->setHeader();
1397 
1398  $this->initPersonalDataImportForm();
1399 
1400  $tpl->setContent($this->form->getHTML());
1401  $tpl->show();
1402  }
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 721 of file class.ilPersonalProfileGUI.php.

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

Referenced by savePersonalData(), and showPersonalData().

722  {
723  global $ilSetting, $lng, $ilUser, $styleDefinition, $rbacreview;
724 
725  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
726  $this->form = new ilPropertyFormGUI();
727  $this->form->setFormAction($this->ctrl->getFormAction($this));
728 
729  // user defined fields
730  $user_defined_data = $ilUser->getUserDefinedData();
731 
732  foreach($this->user_defined_fields->getVisibleDefinitions() as $field_id => $definition)
733  {
734  if($definition['field_type'] == UDF_TYPE_TEXT)
735  {
736  $this->input["udf_".$definition['field_id']] =
737  new ilTextInputGUI($definition['field_name'], "udf_".$definition['field_id']);
738  $this->input["udf_".$definition['field_id']]->setMaxLength(255);
739  $this->input["udf_".$definition['field_id']]->setSize(40);
740  }
741  else if($definition['field_type'] == UDF_TYPE_WYSIWYG)
742  {
743  $this->input["udf_".$definition['field_id']] =
744  new ilTextAreaInputGUI($definition['field_name'], "udf_".$definition['field_id']);
745  $this->input["udf_".$definition['field_id']]->setUseRte(true);
746  }
747  else
748  {
749  $options = $this->user_defined_fields->fieldValuesToSelectArray($definition['field_values']);
750  $this->input["udf_".$definition['field_id']] =
751  new ilSelectInputGUI($definition['field_name'], "udf_".$definition['field_id']);
752  $this->input["udf_".$definition['field_id']]->setOptions($options);
753  }
754 
755  $value = $user_defined_data["f_".$field_id];
756  $this->input["udf_".$definition['field_id']]->setValue($value);
757 
758  if($definition['required'])
759  {
760  $this->input["udf_".$definition['field_id']]->setRequired(true);
761  }
762  if(!$definition['changeable'] && (!$definition['required'] || $value))
763  {
764  $this->input["udf_".$definition['field_id']]->setDisabled(true);
765  }
766 
767  // add "please select" if no current value
768  if($definition['field_type'] == UDF_TYPE_SELECT && !$value)
769  {
770  $options = array(""=>$lng->txt("please_select")) + $options;
771  $this->input["udf_".$definition['field_id']]->setOptions($options);
772  }
773  }
774 
775  // standard fields
776  include_once("./Services/User/classes/class.ilUserProfile.php");
777  $up = new ilUserProfile();
778  $up->skipField("password");
779  $up->skipGroup("settings");
780  $up->skipGroup("preferences");
781 
782  $up->setAjaxCallback(
783  $this->ctrl->getLinkTargetByClass('ilPublicUserProfileGUI', 'doProfileAutoComplete', '', true)
784  );
785 
786  // standard fields
787  $up->addStandardFieldsToForm($this->form, $ilUser, $this->input);
788 
789  $this->addLocationToForm($this->form, $ilUser);
790 
791  $this->form->addCommandButton("savePersonalData", $lng->txt("save"));
792 
793  }
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.
if(!is_array($argv)) $options
input
Definition: langcheck.php:166
const UDF_TYPE_TEXT
This class represents a text property in a property form.
$ilUser
Definition: imgupload.php:18
const UDF_TYPE_WYSIWYG
Create styles array
The data for the language used.
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.
+ 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 1410 of file class.ilPersonalProfileGUI.php.

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

Referenced by importPersonalData(), and importPersonalDataSelection().

1411  {
1412  global $lng, $ilCtrl;
1413 
1414  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1415  $this->form = new ilPropertyFormGUI();
1416 
1417  // input file
1418  $fi = new ilFileInputGUI($lng->txt("file"), "file");
1419  $fi->setRequired(true);
1420  $fi->setSuffixes(array("zip"));
1421  $this->form->addItem($fi);
1422 
1423  // profile data
1424  $cb = new ilCheckboxInputGUI($this->lng->txt("pd_profile_data"), "profile_data");
1425  $this->form->addItem($cb);
1426 
1427  // settings
1428  $cb = new ilCheckboxInputGUI($this->lng->txt("settings"), "settings");
1429  $this->form->addItem($cb);
1430 
1431  // bookmarks
1432  $cb = new ilCheckboxInputGUI($this->lng->txt("pd_bookmarks"), "bookmarks");
1433  $this->form->addItem($cb);
1434 
1435  // personal notes
1436  $cb = new ilCheckboxInputGUI($this->lng->txt("pd_notes"), "notes");
1437  $this->form->addItem($cb);
1438 
1439  // calendar entries
1440  $cb = new ilCheckboxInputGUI($this->lng->txt("pd_private_calendars"), "calendar");
1441  $this->form->addItem($cb);
1442 
1443  $this->form->addCommandButton("importPersonalData", $lng->txt("import"));
1444  $this->form->addCommandButton("showExportImport", $lng->txt("cancel"));
1445 
1446  $this->form->setTitle($lng->txt("pd_import_personal_data"));
1447  $this->form->setFormAction($ilCtrl->getFormAction($this));
1448 
1449  }
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 1005 of file class.ilPersonalProfileGUI.php.

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

Referenced by savePublicProfile(), and showPublicProfile().

1006  {
1007  global $lng, $ilUser, $ilSetting;
1008 
1009  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1010  $this->form = new ilPropertyFormGUI();
1011 
1012  $this->form->setTitle($lng->txt("public_profile"));
1013  $this->form->setDescription($lng->txt("user_public_profile_info"));
1014  $this->form->setFormAction($this->ctrl->getFormAction($this));
1015 
1016  $portfolio_id = $this->getProfilePortfolio();
1017 
1018  if(!$portfolio_id)
1019  {
1020  // Activate public profile
1021  $radg = new ilRadioGroupInputGUI($lng->txt("user_activate_public_profile"), "public_profile");
1022  $info = $this->lng->txt("user_activate_public_profile_info");
1023  $pub_prof = in_array($ilUser->prefs["public_profile"], array("y", "n", "g"))
1024  ? $ilUser->prefs["public_profile"]
1025  : "n";
1026  if (!$ilSetting->get('enable_global_profiles') && $pub_prof == "g")
1027  {
1028  $pub_prof = "y";
1029  }
1030  $radg->setValue($pub_prof);
1031  $op1 = new ilRadioOption($lng->txt("usr_public_profile_disabled"), "n",$lng->txt("usr_public_profile_disabled_info"));
1032  $radg->addOption($op1);
1033  $op2 = new ilRadioOption($lng->txt("usr_public_profile_logged_in"), "y");
1034  $radg->addOption($op2);
1035  if ($ilSetting->get('enable_global_profiles'))
1036  {
1037  $op3 = new ilRadioOption($lng->txt("usr_public_profile_global"), "g");
1038  $radg->addOption($op3);
1039  }
1040  $this->form->addItem($radg);
1041 
1042  // #11773
1043  if ($ilSetting->get('user_portfolios'))
1044  {
1045  // #10826
1046  $prtf = "<br />".$lng->txt("user_profile_portfolio");
1047  $prtf .= "<br /><a href=\"ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToPortfolio\">&raquo; ".
1048  $lng->txt("user_portfolios")."</a>";
1049  $info .= $prtf;
1050  }
1051 
1052  $radg->setInfo($info);
1053  }
1054  else
1055  {
1056  $prtf = $lng->txt("user_profile_portfolio_selected");
1057  $prtf .= "<br /><a href=\"ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToPortfolio&prt_id=".$portfolio_id."\">&raquo; ".
1058  $lng->txt("portfolio")."</a>";
1059 
1060  $info = new ilCustomInputGUI($lng->txt("user_activate_public_profile"));
1061  $info->setHTML($prtf);
1062  $this->form->addItem($info);
1063  }
1064 
1065  $this->showPublicProfileFields($this->form, $ilUser->prefs);
1066 
1067  $this->form->addCommandButton("savePublicProfile", $lng->txt("save"));
1068  }
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.
$info
Definition: example_052.php:80
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
+ 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 196 of file class.ilPersonalProfileGUI.php.

References $ilUser, and saveProfile().

197  {
198  global $ilUser;
199 
200  $ilUser->removeUserPicture();
201 
202  $this->saveProfile();
203  }
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 799 of file class.ilPersonalProfileGUI.php.

References $_SESSION, $ilCtrl, $ilSetting, $ilUser, $lng, $location, $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().

800  {
801  global $tpl, $lng, $ilCtrl, $ilUser, $ilSetting;
802 
803  $this->initPersonalDataForm();
804  if ($this->form->checkInput())
805  {
806  $form_valid = true;
807 
808  // if form field name differs from setter
809  $map = array(
810  "firstname" => "FirstName",
811  "lastname" => "LastName",
812  "title" => "UTitle",
813  "sel_country" => "SelectedCountry",
814  "phone_office" => "PhoneOffice",
815  "phone_home" => "PhoneHome",
816  "phone_mobile" => "PhoneMobile",
817  "referral_comment" => "Comment",
818  "interests_general" => "GeneralInterests",
819  "interests_help_offered" => "OfferingHelp",
820  "interests_help_looking" => "LookingForHelp"
821  );
822  include_once("./Services/User/classes/class.ilUserProfile.php");
823  $up = new ilUserProfile();
824  foreach($up->getStandardFields() as $f => $p)
825  {
826  // if item is part of form, it is currently valid (if not disabled)
827  $item = $this->form->getItemByPostVar("usr_".$f);
828  if($item && !$item->getDisabled())
829  {
830  $value = $this->form->getInput("usr_".$f);
831  switch($f)
832  {
833  case "birthday":
834  $value = $item->getDate();
835  $ilUser->setBirthday($value
836  ? $value->get(IL_CAL_DATE)
837  : "");
838  break;
839 
840  default:
841  $m = ucfirst($f);
842  if(isset($map[$f]))
843  {
844  $m = $map[$f];
845  }
846  $ilUser->{"set".$m}($value);
847  break;
848  }
849  }
850  }
851  $ilUser->setFullname();
852 
853  // check map activation
854  include_once("./Services/Maps/classes/class.ilMapUtil.php");
856  {
857  // #17619 - proper escaping
858  $location = $this->form->getInput("location");
859  $lat = ilUtil::stripSlashes($location["latitude"]);
860  $long = ilUtil::stripSlashes($location["longitude"]);
861  $zoom = ilUtil::stripSlashes($location["zoom"]);
862  $ilUser->setLatitude(is_numeric($lat) ? $lat : null);
863  $ilUser->setLongitude(is_numeric($long) ? $long : null);
864  $ilUser->setLocationZoom(is_numeric($zoom) ? $zoom : null);
865  }
866 
867  // Set user defined data
868  $defs = $this->user_defined_fields->getVisibleDefinitions();
869  $udf = array();
870  foreach ($defs as $definition)
871  {
872  $f = "udf_".$definition['field_id'];
873  $item = $this->form->getItemByPostVar($f);
874  if ($item && !$item->getDisabled())
875  {
876  $udf[$definition['field_id']] = $this->form->getInput($f);
877  }
878  }
879  $ilUser->setUserDefinedData($udf);
880 
881  // if loginname is changeable -> validate
882  $un = $this->form->getInput('username');
883  if((int)$ilSetting->get('allow_change_loginname') &&
884  $un != $ilUser->getLogin())
885  {
886  if(!strlen($un) || !ilUtil::isLogin($un))
887  {
888  ilUtil::sendFailure($lng->txt('form_input_not_valid'));
889  $this->form->getItemByPostVar('username')->setAlert($this->lng->txt('login_invalid'));
890  $form_valid = false;
891  }
892  else if(ilObjUser::_loginExists($un, $ilUser->getId()))
893  {
894  ilUtil::sendFailure($lng->txt('form_input_not_valid'));
895  $this->form->getItemByPostVar('username')->setAlert($this->lng->txt('loginname_already_exists'));
896  $form_valid = false;
897  }
898  else
899  {
900  $ilUser->setLogin($un);
901 
902  try
903  {
904  $ilUser->updateLogin($ilUser->getLogin());
905  }
906  catch (ilUserException $e)
907  {
908  ilUtil::sendFailure($lng->txt('form_input_not_valid'));
909  $this->form->getItemByPostVar('username')->setAlert($e->getMessage());
910  $form_valid = false;
911  }
912  }
913  }
914 
915  // everthing's ok. save form data
916  if ($form_valid)
917  {
918  $this->uploadUserPicture();
919 
920  // profile ok
921  $ilUser->setProfileIncomplete(false);
922 
923  // save user data & object_data
924  $ilUser->setTitle($ilUser->getFullname());
925  $ilUser->setDescription($ilUser->getEmail());
926 
927  $ilUser->update();
928 
929  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
930 
931  if(ilSession::get('orig_request_target'))
932  {
933  $target = ilSession::get('orig_request_target');
934  ilSession::set('orig_request_target', '');
936  }
937  else if($redirect = $_SESSION['profile_complete_redirect'])
938  {
939  unset($_SESSION['profile_complete_redirect']);
940  ilUtil::redirect($redirect);
941  }
942  else
943  {
944  $ilCtrl->redirect($this, "showPersonalData");
945  }
946  }
947  }
948 
949  $this->form->setValuesByPost();
950  $this->showPersonalData(true);
951  }
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)
http redirect to other script
+ Here is the call graph for this function:

◆ saveProfile()

ilPersonalProfileGUI::saveProfile ( )

save user profile data

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

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

Referenced by removeUserPicture().

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

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

1253  {
1254  global $tpl, $lng, $ilCtrl, $ilUser;
1255 
1256  $this->initPublicProfileForm();
1257  if ($this->form->checkInput())
1258  {
1259  // with active portfolio no options are presented
1260  if(isset($_POST["public_profile"]))
1261  {
1262  $ilUser->setPref("public_profile", $_POST["public_profile"]);
1263  }
1264 
1265  // if check on Institute
1266  $val_array = array("title", "birthday", "gender", "org_units", "institution", "department", "upload",
1267  "street", "zipcode", "city", "country", "sel_country", "phone_office", "phone_home", "phone_mobile",
1268  "fax", "email", "hobby", "matriculation", "location",
1269  "interests_general", "interests_help_offered", "interests_help_looking");
1270 
1271  // set public profile preferences
1272  foreach($val_array as $key => $value)
1273  {
1274  if (($_POST["chk_".$value]))
1275  {
1276  $ilUser->setPref("public_".$value,"y");
1277  }
1278  else
1279  {
1280  $ilUser->setPref("public_".$value,"n");
1281  }
1282  }
1283 
1284  // additional defined user data fields
1285  foreach($this->user_defined_fields->getVisibleDefinitions() as $field_id => $definition)
1286  {
1287  if (($_POST["chk_udf_".$definition["field_id"]]))
1288  {
1289  $ilUser->setPref("public_udf_".$definition["field_id"], "y");
1290  }
1291  else
1292  {
1293  $ilUser->setPref("public_udf_".$definition["field_id"], "n");
1294  }
1295  }
1296 
1297  $ilUser->update();
1298 
1299  // :TODO: badges
1300  include_once "Services/Badge/classes/class.ilBadgeHandler.php";
1301  $handler = ilBadgeHandler::getInstance();
1302  if($handler->isActive())
1303  {
1304  if(sizeof($_POST["bpos"]))
1305  {
1306  include_once "Services/Badge/classes/class.ilBadgeAssignment.php";
1307  ilBadgeAssignment::updatePositions($ilUser->getId(), $_POST["bpos"]);
1308  }
1309  }
1310 
1311  // update lucene index
1312  include_once './Services/Search/classes/Lucene/class.ilLuceneIndexer.php';
1313  ilLuceneIndexer::updateLuceneIndex(array((int) $GLOBALS['ilUser']->getId()));
1314 
1315  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1316  $ilCtrl->redirect($this, "showPublicProfile");
1317  }
1318  $this->form->setValuesByPost();
1319  $tpl->showPublicProfile(true);
1320 
1321 
1322 
1323  }
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)
$_POST["username"]
static getInstance()
Constructor.
+ Here is the call graph for this function:

◆ setHeader()

ilPersonalProfileGUI::setHeader ( )

Set header.

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

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

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

◆ setTabs()

ilPersonalProfileGUI::setTabs ( )

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

References $ilUser, and getProfilePortfolio().

Referenced by executeCommand().

561  {
562  global $ilTabs, $ilUser, $ilHelp;
563 
564  $ilHelp->setScreenIdComponent("user");
565 
566  // personal data
567  $ilTabs->addTab("personal_data",
568  $this->lng->txt("personal_data"),
569  $this->ctrl->getLinkTarget($this, "showPersonalData"));
570 
571  // public profile
572  $ilTabs->addTab("public_profile",
573  $this->lng->txt("public_profile"),
574  $this->ctrl->getLinkTarget($this, "showPublicProfile"));
575 
576  // export
577  $ilTabs->addTab("export",
578  $this->lng->txt("export")."/".$this->lng->txt("import"),
579  $this->ctrl->getLinkTarget($this, "showExportImport"));
580 
581  // #17570
582  if(($ilUser->getPref("public_profile") &&
583  $ilUser->getPref("public_profile") != "n") ||
584  $this->getProfilePortfolio())
585  {
586  // profile preview
587  $ilTabs->addNonTabbedLink("profile_preview",
588  $this->lng->txt("user_profile_preview"),
589  $this->ctrl->getLinkTargetByClass("ilpublicuserprofilegui", "view"));
590  }
591  }
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 1331 of file class.ilPersonalProfileGUI.php.

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

1332  {
1333  global $ilToolbar, $ilCtrl, $tpl, $ilTabs, $ilUser;
1334 
1335  $ilTabs->activateTab("export");
1336  $this->setHeader();
1337 
1338  include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
1339  $button = ilLinkButton::getInstance();
1340  $button->setCaption("pd_export_profile");
1341  $button->setUrl($ilCtrl->getLinkTarget($this, "exportPersonalData"));
1342  $ilToolbar->addStickyItem($button);
1343 
1344  $exp_file = $ilUser->getPersonalDataExportFile();
1345  if ($exp_file != "")
1346  {
1347  $ilToolbar->addSeparator();
1348  $ilToolbar->addButton($this->lng->txt("pd_download_last_export_file"),
1349  $ilCtrl->getLinkTarget($this, "downloadPersonalData"));
1350  }
1351 
1352  $ilToolbar->addSeparator();
1353  $ilToolbar->addButton($this->lng->txt("pd_import_personal_data"),
1354  $ilCtrl->getLinkTarget($this, "importPersonalDataSelection"));
1355 
1356  $tpl->show();
1357  }
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 694 of file class.ilPersonalProfileGUI.php.

References $ilias, $ilSetting, $ilUser, $lng, initPersonalDataForm(), ilUtil\sendInfo(), and setHeader().

Referenced by savePersonalData(), and showProfile().

695  {
696  global $ilUser, $styleDefinition, $rbacreview, $ilias, $lng, $ilSetting, $ilTabs;
697 
698  $ilTabs->activateTab("personal_data");
699 
700  $settings = $ilias->getAllSettings();
701 
702  $this->setHeader();
703 
704  if (!$a_no_init)
705  {
706  $this->initPersonalDataForm();
707  // catch feedback message
708  if ($ilUser->getProfileIncomplete())
709  {
710  ilUtil::sendInfo($lng->txt("profile_incomplete"));
711  }
712  }
713  $this->tpl->setContent($this->form->getHTML());
714 
715  $this->tpl->show();
716  }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
$ilUser
Definition: imgupload.php:18
initPersonalDataForm()
Init personal form.
global $ilSetting
Definition: privfeed.php:17
+ 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 493 of file class.ilPersonalProfileGUI.php.

References showPersonalData().

Referenced by saveProfile().

494  {
495  $this->showPersonalData();
496  }
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 962 of file class.ilPersonalProfileGUI.php.

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

963  {
964  global $ilUser, $lng, $ilSetting, $ilTabs;
965 
966  $ilTabs->activateTab("public_profile");
967 
968  $this->setHeader();
969 
970  if (!$a_no_init)
971  {
972  $this->initPublicProfileForm();
973  }
974 
975  $ptpl = new ilTemplate("tpl.edit_personal_profile.html", true, true, "Services/User");
976  $ptpl->setVariable("FORM", $this->form->getHTML());
977  include_once("./Services/User/classes/class.ilPublicUserProfileGUI.php");
978  $pub_profile = new ilPublicUserProfileGUI($ilUser->getId());
979  $ptpl->setVariable("PREVIEW", $pub_profile->getEmbeddable());
980  $this->tpl->setContent($ptpl->get());
981  $this->tpl->show();
982  }
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 1078 of file class.ilPersonalProfileGUI.php.

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

Referenced by initPublicProfileForm().

1079  {
1080  global $ilUser;
1081 
1082  $birthday = $ilUser->getBirthday();
1083  if($birthday)
1084  {
1085  $birthday = ilDatePresentation::formatDate(new ilDate($birthday, IL_CAL_DATE));
1086  }
1087  $gender = $ilUser->getGender();
1088  if($gender)
1089  {
1090  $gender = $this->lng->txt("gender_".$gender);
1091  }
1092 
1093  if ($ilUser->getSelectedCountry() != "")
1094  {
1095  $this->lng->loadLanguageModule("meta");
1096  $txt_sel_country = $this->lng->txt("meta_c_".$ilUser->getSelectedCountry());
1097  }
1098 
1099  // profile picture
1100  $pic = ilObjUser::_getPersonalPicturePath($ilUser->getId(), "xsmall", true, true);
1101  if($pic)
1102  {
1103  $pic = "<img src=\"".$pic."\" />";
1104  }
1105 
1106  // personal data
1107  $val_array = array(
1108  "title" => $ilUser->getUTitle(),
1109  "birthday" => $birthday,
1110  "gender" => $gender,
1111  "upload" => $pic,
1112  "interests_general" => $ilUser->getGeneralInterestsAsText(),
1113  "interests_help_offered" => $ilUser->getOfferingHelpAsText(),
1114  "interests_help_looking" => $ilUser->getLookingForHelpAsText(),
1115  "org_units" => $ilUser->getOrgUnitsRepresentation(),
1116  "institution" => $ilUser->getInstitution(),
1117  "department" => $ilUser->getDepartment(),
1118  "street" => $ilUser->getStreet(),
1119  "zipcode" => $ilUser->getZipcode(),
1120  "city" => $ilUser->getCity(),
1121  "country" => $ilUser->getCountry(),
1122  "sel_country" => $txt_sel_country,
1123  "phone_office" => $ilUser->getPhoneOffice(),
1124  "phone_home" => $ilUser->getPhoneHome(),
1125  "phone_mobile" => $ilUser->getPhoneMobile(),
1126  "fax" => $ilUser->getFax(),
1127  "email" => $ilUser->getEmail(),
1128  "hobby" => $ilUser->getHobby(),
1129  "matriculation" => $ilUser->getMatriculation()
1130  );
1131 
1132  // location
1133  include_once("./Services/Maps/classes/class.ilMapUtil.php");
1134  if (ilMapUtil::isActivated())
1135  {
1136  $val_array["location"] = "";
1137  }
1138 
1139  foreach($val_array as $key => $value)
1140  {
1141  if($anonymized)
1142  {
1143  $value = null;
1144  }
1145 
1146  if ($this->userSettingVisible($key))
1147  {
1148  // #18795 - we should use ilUserProfile
1149  switch($key)
1150  {
1151  case "upload":
1152  $caption = "personal_picture";
1153  break;
1154 
1155  case "title":
1156  $caption = "person_title";
1157  break;
1158 
1159  default:
1160  $caption = $key;
1161  }
1162  $cb = new ilCheckboxInputGUI($this->lng->txt($caption), "chk_".$key);
1163  if ($prefs["public_".$key] == "y")
1164  {
1165  $cb->setChecked(true);
1166  }
1167  //$cb->setInfo($value);
1168  $cb->setOptionTitle($value);
1169 
1170  if(!$parent)
1171  {
1172  $form->addItem($cb);
1173  }
1174  else
1175  {
1176  $parent->addSubItem($cb);
1177  }
1178  }
1179  }
1180 
1181  // additional defined user data fields
1182  $user_defined_data = array();
1183  if(!$anonymized)
1184  {
1185  $user_defined_data = $ilUser->getUserDefinedData();
1186  }
1187  foreach($this->user_defined_fields->getVisibleDefinitions() as $field_id => $definition)
1188  {
1189  // public setting
1190  $cb = new ilCheckboxInputGUI($definition["field_name"], "chk_udf_".$definition["field_id"]);
1191  $cb->setOptionTitle($user_defined_data["f_".$definition["field_id"]]);
1192  if ($prefs["public_udf_".$definition["field_id"]] == "y")
1193  {
1194  $cb->setChecked(true);
1195  }
1196 
1197  if(!$parent)
1198  {
1199  $form->addItem($cb);
1200  }
1201  else
1202  {
1203  $parent->addSubItem($cb);
1204  }
1205  }
1206 
1207  // :TODO: badges
1208  if(!$anonymized)
1209  {
1210  include_once "Services/Badge/classes/class.ilBadgeHandler.php";
1211  $handler = ilBadgeHandler::getInstance();
1212  if($handler->isActive())
1213  {
1214  $badge_options = array();
1215 
1216  include_once "Services/Badge/classes/class.ilBadgeAssignment.php";
1217  include_once "Services/Badge/classes/class.ilBadge.php";
1218  foreach(ilBadgeAssignment::getInstancesByUserId($ilUser->getId()) as $ass)
1219  {
1220  // only active
1221  if($ass->getPosition())
1222  {
1223  $badge = new ilBadge($ass->getBadgeId());
1224  $badge_options[] = $badge->getTitle();
1225  }
1226  }
1227 
1228  if(sizeof($badge_options) > 1)
1229  {
1230  $badge_order = new ilNonEditableValueGUI($this->lng->txt("obj_bdga"), "bpos");
1231  $badge_order->setMultiValues($badge_options);
1232  $badge_order->setValue(array_shift($badge_options));
1233  $badge_order->setMulti(true, true, false);
1234 
1235  if(!$parent)
1236  {
1237  $form->addItem($badge_order);
1238  }
1239  else
1240  {
1241  $parent->addSubItem($badge_order);
1242  }
1243  }
1244  }
1245  }
1246  }
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.
static formatDate(ilDateTime $date)
Format a date public.
$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.
static _getPersonalPicturePath($a_usr_id, $a_size="small", $a_force_pic=false, $a_prevent_no_photo_image=false)
Get path to personal picture.
userSettingVisible($setting)
Returns TRUE if user setting is visible, FALSE otherwise.
static getInstancesByUserId($a_user_id)
static getInstance()
Constructor.
+ 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 125 of file class.ilPersonalProfileGUI.php.

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

Referenced by savePersonalData().

126  {
127  global $ilUser;
128 
129  if ($this->workWithUserSetting("upload"))
130  {
131  if (!$this->form->hasFileUpload("userfile"))
132  {
133  if ($this->form->getItemByPostVar("userfile")->getDeletionFlag())
134  {
135  $ilUser->removeUserPicture();
136  }
137  return;
138  }
139  else
140  {
141  $webspace_dir = ilUtil::getWebspaceDir();
142  $image_dir = $webspace_dir."/usr_images";
143  $store_file = "usr_".$ilUser->getID()."."."jpg";
144 
145  // store filename
146  $ilUser->setPref("profile_image", $store_file);
147  $ilUser->update();
148 
149  // move uploaded file
150 
151  $pi = pathinfo($_FILES["userfile"]["name"]);
152  $uploaded_file = $this->form->moveFileUpload($image_dir,
153  "userfile", "upload_".$ilUser->getId().".".$pi["extension"]);
154  if (!$uploaded_file)
155  {
156  ilUtil::sendFailure($this->lng->txt("upload_error", true));
157  $this->ctrl->redirect($this, "showProfile");
158  }
159  chmod($uploaded_file, 0770);
160 
161  // take quality 100 to avoid jpeg artefacts when uploading jpeg files
162  // taking only frame [0] to avoid problems with animated gifs
163  $show_file = "$image_dir/usr_".$ilUser->getId().".jpg";
164  $thumb_file = "$image_dir/usr_".$ilUser->getId()."_small.jpg";
165  $xthumb_file = "$image_dir/usr_".$ilUser->getId()."_xsmall.jpg";
166  $xxthumb_file = "$image_dir/usr_".$ilUser->getId()."_xxsmall.jpg";
167  $uploaded_file = ilUtil::escapeShellArg($uploaded_file);
168  $show_file = ilUtil::escapeShellArg($show_file);
169  $thumb_file = ilUtil::escapeShellArg($thumb_file);
170  $xthumb_file = ilUtil::escapeShellArg($xthumb_file);
171  $xxthumb_file = ilUtil::escapeShellArg($xxthumb_file);
172 
173  if(ilUtil::isConvertVersionAtLeast("6.3.8-3"))
174  {
175  ilUtil::execConvert($uploaded_file . "[0] -geometry 200x200^ -gravity center -extent 200x200 -quality 100 JPEG:".$show_file);
176  ilUtil::execConvert($uploaded_file . "[0] -geometry 100x100^ -gravity center -extent 100x100 -quality 100 JPEG:".$thumb_file);
177  ilUtil::execConvert($uploaded_file . "[0] -geometry 75x75^ -gravity center -extent 75x75 -quality 100 JPEG:".$xthumb_file);
178  ilUtil::execConvert($uploaded_file . "[0] -geometry 30x30^ -gravity center -extent 30x30 -quality 100 JPEG:".$xxthumb_file);
179  }
180  else
181  {
182  ilUtil::execConvert($uploaded_file . "[0] -geometry 200x200 -quality 100 JPEG:".$show_file);
183  ilUtil::execConvert($uploaded_file . "[0] -geometry 100x100 -quality 100 JPEG:".$thumb_file);
184  ilUtil::execConvert($uploaded_file . "[0] -geometry 75x75 -quality 100 JPEG:".$xthumb_file);
185  ilUtil::execConvert($uploaded_file . "[0] -geometry 30x30 -quality 100 JPEG:".$xxthumb_file);
186  }
187  }
188  }
189 
190 // $this->saveProfile();
191  }
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 112 of file class.ilPersonalProfileGUI.php.

References $result, and settings().

113  {
114  $result = TRUE;
115  if ($this->settings["usr_settings_disable_".$setting] == 1)
116  {
117  $result = FALSE;
118  }
119  return $result;
120  }
$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 97 of file class.ilPersonalProfileGUI.php.

References $result, and settings().

Referenced by __showOtherInformations(), and showPublicProfileFields().

98  {
99  $result = TRUE;
100  if (isset($this->settings["usr_settings_hide_".$setting]) &&
101  $this->settings["usr_settings_hide_".$setting] == 1)
102  {
103  $result = FALSE;
104  }
105  return $result;
106  }
$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 79 of file class.ilPersonalProfileGUI.php.

References $result, and settings().

Referenced by saveProfile(), and uploadUserPicture().

80  {
81  $result = TRUE;
82  if ($this->settings["usr_settings_hide_".$setting] == 1)
83  {
84  $result = FALSE;
85  }
86  if ($this->settings["usr_settings_disable_".$setting] == 1)
87  {
88  $result = FALSE;
89  }
90  return $result;
91  }
$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.

◆ $ilias

ilPersonalProfileGUI::$ilias

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

Referenced by __construct(), and showPersonalData().

◆ $lng

◆ $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: