ILIAS  release_4-4 Revision
ilPersonalProfileGUI Class Reference

GUI class for personal profile. More...

+ Collaboration diagram for ilPersonalProfileGUI:

Public Member Functions

 ilPersonalProfileGUI ()
 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.

Member Function Documentation

◆ __checkUserDefinedRequiredFields()

ilPersonalProfileGUI::__checkUserDefinedRequiredFields ( )

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

References $_POST.

Referenced by saveProfile().

694  {
695  foreach($this->user_defined_fields->getVisibleDefinitions() as $definition)
696  {
697  $field_id = $definition['field_id'];
698  if($definition['required'] and !strlen($_POST['udf'][$field_id]))
699  {
700  return false;
701  }
702  }
703  return true;
704  }
$_POST['username']
Definition: cron.php:12
+ Here is the caller graph for this function:

◆ __showOtherInformations()

ilPersonalProfileGUI::__showOtherInformations ( )

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

References userSettingVisible().

624  {
625  $d_set = new ilSetting("delicous");
626  if($this->userSettingVisible("matriculation") or count($this->user_defined_fields->getVisibleDefinitions())
627  or $d_set->get("user_profile") == "1")
628  {
629  return true;
630  }
631  return false;
632  }
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 634 of file class.ilPersonalProfileGUI.php.

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

635  {
636  global $ilUser;
637 
638  $user_defined_data = $ilUser->getUserDefinedData();
639  foreach($this->user_defined_fields->getVisibleDefinitions() as $field_id => $definition)
640  {
641  if($definition['field_type'] == UDF_TYPE_TEXT)
642  {
643  $this->tpl->setCurrentBlock("field_text");
644  $this->tpl->setVariable("FIELD_VALUE",ilUtil::prepareFormOutput($user_defined_data[$field_id]));
645  if(!$definition['changeable'])
646  {
647  $this->tpl->setVariable("DISABLED_FIELD",'disabled=\"disabled\"');
648  $this->tpl->setVariable("FIELD_NAME",'udf['.$definition['field_id'].']');
649  }
650  else
651  {
652  $this->tpl->setVariable("FIELD_NAME",'udf['.$definition['field_id'].']');
653  }
654  $this->tpl->parseCurrentBlock();
655  }
656  else
657  {
658  if($definition['changeable'])
659  {
660  $name = 'udf['.$definition['field_id'].']';
661  $disabled = false;
662  }
663  else
664  {
665  $name = '';
666  $disabled = true;
667  }
668  $this->tpl->setCurrentBlock("field_select");
669  $this->tpl->setVariable("SELECT_BOX",ilUtil::formSelect($user_defined_data[$field_id],
670  $name,
671  $this->user_defined_fields->fieldValuesToSelectArray(
672  $definition['field_values']),
673  false,
674  true,0,'','',$disabled));
675  $this->tpl->parseCurrentBlock();
676  }
677  $this->tpl->setCurrentBlock("user_defined");
678 
679  if($definition['required'])
680  {
681  $name = $definition['field_name']."<span class=\"asterisk\">*</span>";
682  }
683  else
684  {
685  $name = $definition['field_name'];
686  }
687  $this->tpl->setVariable("TXT_FIELD_NAME",$name);
688  $this->tpl->parseCurrentBlock();
689  }
690  return true;
691  }
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
global $ilUser
Definition: imgupload.php:15
+ 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 537 of file class.ilPersonalProfileGUI.php.

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

Referenced by initPersonalDataForm().

538  {
539  global $ilCtrl;
540 
541  // check google map activation
542  include_once("./Services/GoogleMaps/classes/class.ilGoogleMapUtil.php");
544  {
545  return;
546  }
547 
548  $this->lng->loadLanguageModule("gmaps");
549 
550  // Get user settings
551  $latitude = $a_user->getLatitude();
552  $longitude = $a_user->getLongitude();
553  $zoom = $a_user->getLocationZoom();
554 
555  // Get Default settings, when nothing is set
556  if ($latitude == 0 && $longitude == 0 && $zoom == 0)
557  {
559  $latitude = $def["latitude"];
560  $longitude = $def["longitude"];
561  $zoom = $def["zoom"];
562  }
563 
564  $street = $a_user->getStreet();
565  if (!$street)
566  {
567  $street = $this->lng->txt("street");
568  }
569  $city = $a_user->getCity();
570  if (!$city)
571  {
572  $city = $this->lng->txt("city");
573  }
574  $country = $a_user->getCountry();
575  if (!$country)
576  {
577  $country = $this->lng->txt("country");
578  }
579 
580  // location property
581  $loc_prop = new ilLocationInputGUI($this->lng->txt("location"),
582  "location");
583  $loc_prop->setLatitude($latitude);
584  $loc_prop->setLongitude($longitude);
585  $loc_prop->setZoom($zoom);
586  $loc_prop->setAddress($street.",".$city.",".$country);
587 
588  $a_form->addItem($loc_prop);
589  }
setLatitude($a_latitude)
Set Latitude.
static getDefaultSettings()
Get default longitude, latitude and zoom.
static isActivated()
Checks whether Google Map feature is activated.
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
This class represents a location property in a property form.
getLatitude()
Get Latitude.
+ 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 1411 of file class.ilPersonalProfileGUI.php.

References $ilUser.

1412  {
1413  global $ilUser;
1414 
1415  $ilUser->sendPersonalDataFile();
1416  }
global $ilUser
Definition: imgupload.php:15

◆ 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.
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:

◆ exportPersonalData()

ilPersonalProfileGUI::exportPersonalData ( )

Export personal data.

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

References $ilCtrl, and $ilUser.

1397  {
1398  global $ilCtrl, $ilUser;
1399 
1400  $ilUser->exportPersonalData();
1401  $ilUser->sendPersonalDataFile();
1402  $ilCtrl->redirect($this, "showExportImport");
1403  }
global $ilCtrl
Definition: ilias.php:18
global $ilUser
Definition: imgupload.php:15

◆ getProfilePortfolio()

ilPersonalProfileGUI::getProfilePortfolio ( )
protected

has profile set to a portfolio?

Returns
int

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

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

Referenced by initPublicProfileForm(), and setTabs().

1037  {
1038  global $ilUser, $ilSetting;
1039 
1040  if ($ilSetting->get('user_portfolios'))
1041  {
1042  include_once "Modules/Portfolio/classes/class.ilObjPortfolio.php";
1043  return ilObjPortfolio::getDefaultPortfolio($ilUser->getId());
1044  }
1045  }
global $ilUser
Definition: imgupload.php:15
global $ilSetting
Definition: privfeed.php:40
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:

◆ ilPersonalProfileGUI()

ilPersonalProfileGUI::ilPersonalProfileGUI ( )

constructor

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

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

26  {
27  global $ilias, $tpl, $lng, $rbacsystem, $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) ...
+ Here is the call graph for this function:

◆ importPersonalData()

ilPersonalProfileGUI::importPersonalData ( )

Import personal data.

Parameters

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

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

1492  {
1493  global $ilUser, $ilCtrl, $tpl, $ilTabs;
1494 
1495  $this->initPersonalDataImportForm();
1496  if ($this->form->checkInput())
1497  {
1498  $ilUser->importPersonalData($_FILES["file"],
1499  (int) $_POST["profile_data"],
1500  (int) $_POST["settings"],
1501  (int) $_POST["bookmarks"],
1502  (int) $_POST["notes"],
1503  (int) $_POST["calendar"]
1504  );
1505  ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
1506  $ilCtrl->redirect($this, "");
1507  }
1508  else
1509  {
1510  $ilTabs->activateTab("export");
1511  $this->setHeader();
1512  $this->form->setValuesByPost();
1513  $tpl->setContent($this->form->getHtml());
1514  $tpl->show();
1515  }
1516  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
initPersonalDataImportForm()
Init personal data import form.
global $ilCtrl
Definition: ilias.php:18
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:

◆ importPersonalDataSelection()

ilPersonalProfileGUI::importPersonalDataSelection ( )

Import personal data selection.

Parameters

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

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

1425  {
1426  global $lng, $ilCtrl, $tpl, $ilTabs;
1427 
1428  $ilTabs->activateTab("export");
1429  $this->setHeader();
1430 
1431  $this->initPersonalDataImportForm();
1432 
1433  $tpl->setContent($this->form->getHTML());
1434  $tpl->show();
1435  }
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 751 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().

752  {
753  global $ilSetting, $lng, $ilUser, $styleDefinition, $rbacreview;
754 
755  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
756  $this->form = new ilPropertyFormGUI();
757  $this->form->setFormAction($this->ctrl->getFormAction($this));
758 
759  // user defined fields
760  $user_defined_data = $ilUser->getUserDefinedData();
761 
762  foreach($this->user_defined_fields->getVisibleDefinitions() as $field_id => $definition)
763  {
764  if($definition['field_type'] == UDF_TYPE_TEXT)
765  {
766  $this->input["udf_".$definition['field_id']] =
767  new ilTextInputGUI($definition['field_name'], "udf_".$definition['field_id']);
768  $this->input["udf_".$definition['field_id']]->setMaxLength(255);
769  $this->input["udf_".$definition['field_id']]->setSize(40);
770  }
771  else if($definition['field_type'] == UDF_TYPE_WYSIWYG)
772  {
773  $this->input["udf_".$definition['field_id']] =
774  new ilTextAreaInputGUI($definition['field_name'], "udf_".$definition['field_id']);
775  $this->input["udf_".$definition['field_id']]->setUseRte(true);
776  }
777  else
778  {
779  $options = $this->user_defined_fields->fieldValuesToSelectArray($definition['field_values']);
780  $this->input["udf_".$definition['field_id']] =
781  new ilSelectInputGUI($definition['field_name'], "udf_".$definition['field_id']);
782  $this->input["udf_".$definition['field_id']]->setOptions($options);
783  }
784 
785  $value = $user_defined_data["f_".$field_id];
786  $this->input["udf_".$definition['field_id']]->setValue($value);
787 
788  if($definition['required'])
789  {
790  $this->input["udf_".$definition['field_id']]->setRequired(true);
791  }
792  if(!$definition['changeable'] && (!$definition['required'] || $value))
793  {
794  $this->input["udf_".$definition['field_id']]->setDisabled(true);
795  }
796 
797  // add "please select" if no current value
798  if($definition['field_type'] == UDF_TYPE_SELECT && !$value)
799  {
800  $options = array(""=>$lng->txt("please_select")) + $options;
801  $this->input["udf_".$definition['field_id']]->setOptions($options);
802  }
803  }
804 
805  // standard fields
806  include_once("./Services/User/classes/class.ilUserProfile.php");
807  $up = new ilUserProfile();
808  $up->skipField("password");
809  $up->skipGroup("settings");
810  $up->skipGroup("preferences");
811 
812  // standard fields
813  $up->addStandardFieldsToForm($this->form, $ilUser, $this->input);
814 
815  $this->addLocationToForm($this->form, $ilUser);
816 
817  $this->form->addCommandButton("savePersonalData", $lng->txt("save"));
818 
819  }
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
const UDF_TYPE_TEXT
This class represents a text property in a property form.
const UDF_TYPE_WYSIWYG
global $ilUser
Definition: imgupload.php:15
global $ilSetting
Definition: privfeed.php:40
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 1443 of file class.ilPersonalProfileGUI.php.

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

Referenced by importPersonalData(), and importPersonalDataSelection().

1444  {
1445  global $lng, $ilCtrl;
1446 
1447  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1448  $this->form = new ilPropertyFormGUI();
1449 
1450  // input file
1451  $fi = new ilFileInputGUI($lng->txt("file"), "file");
1452  $fi->setRequired(true);
1453  $fi->setSuffixes(array("zip"));
1454  $this->form->addItem($fi);
1455 
1456  // profile data
1457  $cb = new ilCheckboxInputGUI($this->lng->txt("pd_profile_data"), "profile_data");
1458  $this->form->addItem($cb);
1459 
1460  // settings
1461  $cb = new ilCheckboxInputGUI($this->lng->txt("settings"), "settings");
1462  $this->form->addItem($cb);
1463 
1464  // bookmarks
1465  $cb = new ilCheckboxInputGUI($this->lng->txt("pd_bookmarks"), "bookmarks");
1466  $this->form->addItem($cb);
1467 
1468  // personal notes
1469  $cb = new ilCheckboxInputGUI($this->lng->txt("pd_notes"), "notes");
1470  $this->form->addItem($cb);
1471 
1472  // calendar entries
1473  $cb = new ilCheckboxInputGUI($this->lng->txt("pd_private_calendars"), "calendar");
1474  $this->form->addItem($cb);
1475 
1476  $this->form->addCommandButton("importPersonalData", $lng->txt("import"));
1477  $this->form->addCommandButton("showExportImport", $lng->txt("cancel"));
1478 
1479  $this->form->setTitle($lng->txt("pd_import_personal_data"));
1480  $this->form->setFormAction($ilCtrl->getFormAction($this));
1481 
1482  }
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.
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 1052 of file class.ilPersonalProfileGUI.php.

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

Referenced by savePublicProfile(), and showPublicProfile().

1053  {
1054  global $lng, $ilUser, $ilSetting;
1055 
1056  include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1057  $this->form = new ilPropertyFormGUI();
1058 
1059  $this->form->setTitle($lng->txt("public_profile"));
1060  $this->form->setDescription($lng->txt("user_public_profile_info"));
1061  $this->form->setFormAction($this->ctrl->getFormAction($this));
1062 
1063  $portfolio_id = $this->getProfilePortfolio();
1064 
1065  if(!$portfolio_id)
1066  {
1067  // Activate public profile
1068  $radg = new ilRadioGroupInputGUI($lng->txt("user_activate_public_profile"), "public_profile");
1069  $info = $this->lng->txt("user_activate_public_profile_info");
1070  $pub_prof = in_array($ilUser->prefs["public_profile"], array("y", "n", "g"))
1071  ? $ilUser->prefs["public_profile"]
1072  : "n";
1073  if (!$ilSetting->get('enable_global_profiles') && $pub_prof == "g")
1074  {
1075  $pub_prof = "y";
1076  }
1077  $radg->setValue($pub_prof);
1078  $op1 = new ilRadioOption($lng->txt("usr_public_profile_disabled"), "n",$lng->txt("usr_public_profile_disabled_info"));
1079  $radg->addOption($op1);
1080  $op2 = new ilRadioOption($lng->txt("usr_public_profile_logged_in"), "y");
1081  $radg->addOption($op2);
1082  if ($ilSetting->get('enable_global_profiles'))
1083  {
1084  $op3 = new ilRadioOption($lng->txt("usr_public_profile_global"), "g");
1085  $radg->addOption($op3);
1086  }
1087  $this->form->addItem($radg);
1088 
1089  // #11773
1090  if ($ilSetting->get('user_portfolios'))
1091  {
1092  // #10826
1093  $prtf = "<br />".$lng->txt("user_profile_portfolio");
1094  $prtf .= "<br /><a href=\"ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToPortfolio\">&raquo; ".
1095  $lng->txt("user_portfolios")."</a>";
1096  $info .= $prtf;
1097  }
1098 
1099  $radg->setInfo($info);
1100  }
1101  else
1102  {
1103  $prtf = $lng->txt("user_profile_portfolio_selected");
1104  $prtf .= "<br /><a href=\"ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToPortfolio&prt_id=".$portfolio_id."\">&raquo; ".
1105  $lng->txt("portfolio")."</a>";
1106 
1107  $info = new ilCustomInputGUI($lng->txt("user_activate_public_profile"));
1108  $info->setHTML($prtf);
1109  $this->form->addItem($info);
1110  }
1111 
1112  $this->showPublicProfileFields($this->form, $ilUser->prefs);
1113 
1114  $this->form->addCommandButton("savePublicProfile", $lng->txt("save"));
1115  }
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.
This class represents a custom property in a property form.
global $ilUser
Definition: imgupload.php:15
global $ilSetting
Definition: privfeed.php:40
+ 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 195 of file class.ilPersonalProfileGUI.php.

References $ilUser, and saveProfile().

196  {
197  global $ilUser;
198 
199  $ilUser->removeUserPicture();
200 
201  $this->saveProfile();
202  }
saveProfile()
save user profile data
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:

◆ savePersonalData()

ilPersonalProfileGUI::savePersonalData ( )

Save personal data form.

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

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

826  {
827  global $tpl, $lng, $ilCtrl, $ilUser, $ilSetting, $ilAuth;
828 
829  $this->initPersonalDataForm();
830  if ($this->form->checkInput())
831  {
832  $form_valid = true;
833 
834  // if form field name differs from setter
835  $map = array(
836  "firstname" => "FirstName",
837  "lastname" => "LastName",
838  "title" => "UTitle",
839  "sel_country" => "SelectedCountry",
840  "phone_office" => "PhoneOffice",
841  "phone_home" => "PhoneHome",
842  "phone_mobile" => "PhoneMobile",
843  "referral_comment" => "Comment"
844  );
845  include_once("./Services/User/classes/class.ilUserProfile.php");
846  $up = new ilUserProfile();
847  foreach($up->getStandardFields() as $f => $p)
848  {
849  // if item is part of form, it is currently valid (if not disabled)
850  $item = $this->form->getItemByPostVar("usr_".$f);
851  if($item && !$item->getDisabled())
852  {
853  $value = $this->form->getInput("usr_".$f);
854  switch($f)
855  {
856  case "birthday":
857  if (is_array($value))
858  {
859  if (is_array($value['date']))
860  {
861  if (($value['d'] > 0) && ($value['m'] > 0) && ($value['y'] > 0))
862  {
863  $ilUser->setBirthday(sprintf("%04d-%02d-%02d", $value['y'], $value['m'], $value['d']));
864  }
865  else
866  {
867  $ilUser->setBirthday("");
868  }
869  }
870  else
871  {
872  $ilUser->setBirthday($value['date']);
873  }
874  }
875  break;
876 
877  default:
878  $m = ucfirst($f);
879  if(isset($map[$f]))
880  {
881  $m = $map[$f];
882  }
883  $ilUser->{"set".$m}($value);
884  break;
885  }
886  }
887  }
888  $ilUser->setFullname();
889 
890  // set instant messengers
891  if ($this->workWithUserSetting("instant_messengers"))
892  {
893  $ilUser->setInstantMessengerId('icq', $this->form->getInput("usr_im_icq"));
894  $ilUser->setInstantMessengerId('yahoo', $this->form->getInput("usr_im_yahoo"));
895  $ilUser->setInstantMessengerId('msn', $this->form->getInput("usr_im_msn"));
896  $ilUser->setInstantMessengerId('aim', $this->form->getInput("usr_im_aim"));
897  $ilUser->setInstantMessengerId('skype', $this->form->getInput("usr_im_skype"));
898  $ilUser->setInstantMessengerId('jabber', $this->form->getInput("usr_im_jabber"));
899  $ilUser->setInstantMessengerId('voip', $this->form->getInput("usr_im_voip"));
900  }
901 
902  // check google map activation
903  include_once("./Services/GoogleMaps/classes/class.ilGoogleMapUtil.php");
905  {
906  $location = $this->form->getInput("location");
907  $ilUser->setLatitude(ilUtil::stripSlashes($location["latitude"]));
908  $ilUser->setLongitude(ilUtil::stripSlashes($location["longitude"]));
909  $ilUser->setLocationZoom(ilUtil::stripSlashes($location["zoom"]));
910  }
911 
912  // Set user defined data
913  $defs = $this->user_defined_fields->getVisibleDefinitions();
914  $udf = array();
915  foreach ($defs as $definition)
916  {
917  $f = "udf_".$definition['field_id'];
918  $item = $this->form->getItemByPostVar($f);
919  if ($item && !$item->getDisabled())
920  {
921  $udf[$definition['field_id']] = $this->form->getInput($f);
922  }
923  }
924  $ilUser->setUserDefinedData($udf);
925 
926  // if loginname is changeable -> validate
927  $un = $this->form->getInput('username');
928  if((int)$ilSetting->get('allow_change_loginname') &&
929  $un != $ilUser->getLogin())
930  {
931  if(!strlen($un) || !ilUtil::isLogin($un))
932  {
933  ilUtil::sendFailure($lng->txt('form_input_not_valid'));
934  $this->form->getItemByPostVar('username')->setAlert($this->lng->txt('login_invalid'));
935  $form_valid = false;
936  }
937  else if(ilObjUser::_loginExists($un, $ilUser->getId()))
938  {
939  ilUtil::sendFailure($lng->txt('form_input_not_valid'));
940  $this->form->getItemByPostVar('username')->setAlert($this->lng->txt('loginname_already_exists'));
941  $form_valid = false;
942  }
943  else
944  {
945  $ilUser->setLogin($un);
946 
947  try
948  {
949  $ilUser->updateLogin($ilUser->getLogin());
950  $ilAuth->setAuth($ilUser->getLogin());
951  $ilAuth->start();
952  }
953  catch (ilUserException $e)
954  {
955  ilUtil::sendFailure($lng->txt('form_input_not_valid'));
956  $this->form->getItemByPostVar('username')->setAlert($e->getMessage());
957  $form_valid = false;
958  }
959  }
960  }
961 
962  // everthing's ok. save form data
963  if ($form_valid)
964  {
965  $this->uploadUserPicture();
966 
967  // profile ok
968  $ilUser->setProfileIncomplete(false);
969 
970  // save user data & object_data
971  $ilUser->setTitle($ilUser->getFullname());
972  $ilUser->setDescription($ilUser->getEmail());
973 
974  $ilUser->update();
975 
976  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
977 
978  if(ilSession::get('orig_request_target'))
979  {
980  $target = ilSession::get('orig_request_target');
981  ilSession::set('orig_request_target', '');
982  ilUtil::redirect($target);
983  }
984  else if($redirect = $_SESSION['profile_complete_redirect'])
985  {
986  unset($_SESSION['profile_complete_redirect']);
988  }
989  else
990  {
991  $ilCtrl->redirect($this, "showPersonalData");
992  }
993  }
994  }
995 
996  $this->form->setValuesByPost();
997  $this->showPersonalData(true);
998  }
< a tabindex="-1" style="border-style: none;" href="#" title="Refresh Image" onclick="document.getElementById('siimage').src = './securimage_show.php?sid=' + Math.random(); this.blur(); return false">< img src="./images/refresh.png" alt="Reload Image" height="32" width="32" onclick="this.blur()" align="bottom" border="0"/></a >< br/>< strong > Enter Code *if($_SERVER['REQUEST_METHOD']=='POST' &&@ $_POST['do']=='contact') $_SESSION['ctform']['success']
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
Class for user related exception handling in ILIAS.
showPersonalData($a_no_init=false)
Personal data form.
$location
Definition: buildRTE.php:44
static isActivated()
Checks whether Google Map feature is activated.
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...
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
global $ilUser
Definition: imgupload.php:15
initPersonalDataForm()
Init personal form.
$redirect
Definition: index.php:18
isLogin($a_login)
global $ilSetting
Definition: privfeed.php:40
static redirect($a_script)
http redirect to other script
workWithUserSetting($setting)
Returns TRUE if working with the given user setting is allowed, FALSE otherwise.
+ Here is the call graph for this function:

◆ saveProfile()

ilPersonalProfileGUI::saveProfile ( )

save user profile data

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

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

Referenced by removeUserPicture().

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

References $_POST, $GLOBALS, $ilCtrl, $ilUser, $lng, $tpl, initPublicProfileForm(), ilUtil\sendSuccess(), ilLuceneIndexer\updateLuceneIndex(), and userSettingVisible().

1276  {
1277  global $tpl, $lng, $ilCtrl, $ilUser;
1278 
1279  $this->initPublicProfileForm();
1280  if ($this->form->checkInput())
1281  {
1282  // with active portfolio no options are presented
1283  if(isset($_POST["public_profile"]))
1284  {
1285  $ilUser->setPref("public_profile", $_POST["public_profile"]);
1286  }
1287 
1288  // if check on Institute
1289  $val_array = array("title", "birthday", "gender", "institution", "department", "upload", "street",
1290  "zipcode", "city", "country", "sel_country", "phone_office", "phone_home", "phone_mobile",
1291  "fax", "email", "hobby", "matriculation", "location");
1292 
1293  // set public profile preferences
1294  foreach($val_array as $key => $value)
1295  {
1296  if (($_POST["chk_".$value]))
1297  {
1298  $ilUser->setPref("public_".$value,"y");
1299  }
1300  else
1301  {
1302  $ilUser->setPref("public_".$value,"n");
1303  }
1304  }
1305 
1306  $im_arr = array("icq","yahoo","msn","aim","skype","jabber","voip");
1307  if ($this->userSettingVisible("instant_messengers"))
1308  {
1309  foreach ($im_arr as $im)
1310  {
1311  if (($_POST["chk_im_".$im]))
1312  {
1313  $ilUser->setPref("public_im_".$im,"y");
1314  }
1315  else
1316  {
1317  $ilUser->setPref("public_im_".$im,"n");
1318  }
1319  }
1320  }
1321 
1322 // $d_set = new ilSetting("delicious");
1323 // if ($d_set->get("user_profile"))
1324 // {
1325  if (($_POST["chk_delicious"]))
1326  {
1327  $ilUser->setPref("public_delicious","y");
1328  }
1329  else
1330  {
1331  $ilUser->setPref("public_delicious","n");
1332  }
1333 // }
1334 
1335  // additional defined user data fields
1336  foreach($this->user_defined_fields->getVisibleDefinitions() as $field_id => $definition)
1337  {
1338  if (($_POST["chk_udf_".$definition["field_id"]]))
1339  {
1340  $ilUser->setPref("public_udf_".$definition["field_id"], "y");
1341  }
1342  else
1343  {
1344  $ilUser->setPref("public_udf_".$definition["field_id"], "n");
1345  }
1346  }
1347 
1348  $ilUser->update();
1349 
1350  // update lucene index
1351  include_once './Services/Search/classes/Lucene/class.ilLuceneIndexer.php';
1352  ilLuceneIndexer::updateLuceneIndex(array((int) $GLOBALS['ilUser']->getId()));
1353 
1354  ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1355  $ilCtrl->redirect($this, "showPublicProfile");
1356  }
1357  $this->form->setValuesByPost();
1358  $tpl->showPublicProfile(true);
1359  }
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.
$_POST['username']
Definition: cron.php:12
initPublicProfileForm()
Init public profile form.
static updateLuceneIndex($a_obj_ids)
Update lucene index.
global $ilCtrl
Definition: ilias.php:18
$GLOBALS['ct_recipient']
global $ilUser
Definition: imgupload.php:15
userSettingVisible($setting)
Returns TRUE if user setting is visible, FALSE otherwise.
+ Here is the call graph for this function:

◆ setHeader()

ilPersonalProfileGUI::setHeader ( )

Set header.

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

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

710  {
711 // $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_pd_b.png"), "");
712  $this->tpl->setTitle($this->lng->txt('personal_profile'));
713  }
+ Here is the caller graph for this function:

◆ setTabs()

ilPersonalProfileGUI::setTabs ( )

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

References $ilUser, and getProfilePortfolio().

Referenced by executeCommand().

593  {
594  global $ilTabs, $ilUser, $ilHelp;
595 
596  $ilHelp->setScreenIdComponent("user");
597 
598  // personal data
599  $ilTabs->addTab("personal_data",
600  $this->lng->txt("personal_data"),
601  $this->ctrl->getLinkTarget($this, "showPersonalData"));
602 
603  // public profile
604  $ilTabs->addTab("public_profile",
605  $this->lng->txt("public_profile"),
606  $this->ctrl->getLinkTarget($this, "showPublicProfile"));
607 
608  // export
609  $ilTabs->addTab("export",
610  $this->lng->txt("export")."/".$this->lng->txt("import"),
611  $this->ctrl->getLinkTarget($this, "showExportImport"));
612 
613  if($ilUser->getPref("public_profile") != "n" || $this->getProfilePortfolio())
614  {
615  // profile preview
616  $ilTabs->addNonTabbedLink("profile_preview",
617  $this->lng->txt("user_profile_preview"),
618  $this->ctrl->getLinkTargetByClass("ilpublicuserprofilegui", "view"));
619  }
620  }
getProfilePortfolio()
has profile set to a portfolio?
global $ilUser
Definition: imgupload.php:15
+ 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 1367 of file class.ilPersonalProfileGUI.php.

References $ilCtrl, $ilUser, $tpl, and setHeader().

1368  {
1369  global $ilToolbar, $ilCtrl, $tpl, $ilTabs, $ilUser;
1370 
1371  $ilTabs->activateTab("export");
1372  $this->setHeader();
1373 
1374  $ilToolbar->addButton($this->lng->txt("pd_export_profile"),
1375  $ilCtrl->getLinkTarget($this, "exportPersonalData"));
1376 
1377  $exp_file = $ilUser->getPersonalDataExportFile();
1378  if ($exp_file != "")
1379  {
1380  $ilToolbar->addSeparator();
1381  $ilToolbar->addButton($this->lng->txt("pd_download_last_export_file"),
1382  $ilCtrl->getLinkTarget($this, "downloadPersonalData"));
1383  }
1384 
1385  $ilToolbar->addSeparator();
1386  $ilToolbar->addButton($this->lng->txt("pd_import_personal_data"),
1387  $ilCtrl->getLinkTarget($this, "importPersonalDataSelection"));
1388 
1389  $tpl->show();
1390  }
global $ilCtrl
Definition: ilias.php:18
global $ilUser
Definition: imgupload.php:15
+ Here is the call graph for this function:

◆ showPersonalData()

ilPersonalProfileGUI::showPersonalData (   $a_no_init = false)

Personal data form.

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

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

Referenced by savePersonalData(), and showProfile().

725  {
726  global $ilUser, $styleDefinition, $rbacreview, $ilias, $lng, $ilSetting, $ilTabs;
727 
728  $ilTabs->activateTab("personal_data");
729 
730  $settings = $ilias->getAllSettings();
731 
732  $this->setHeader();
733 
734  if (!$a_no_init)
735  {
736  $this->initPersonalDataForm();
737  // catch feedback message
738  if ($ilUser->getProfileIncomplete())
739  {
740  ilUtil::sendInfo($lng->txt("profile_incomplete"));
741  }
742  }
743  $this->tpl->setContent($this->form->getHTML());
744 
745  $this->tpl->show();
746  }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.
global $ilUser
Definition: imgupload.php:15
initPersonalDataForm()
Init personal form.
global $ilSetting
Definition: privfeed.php:40
+ 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 526 of file class.ilPersonalProfileGUI.php.

References showPersonalData().

Referenced by saveProfile().

527  {
528  $this->showPersonalData();
529  }
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 1009 of file class.ilPersonalProfileGUI.php.

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

1010  {
1011  global $ilUser, $lng, $ilSetting, $ilTabs;
1012 
1013  $ilTabs->activateTab("public_profile");
1014 
1015  $this->setHeader();
1016 
1017  if (!$a_no_init)
1018  {
1019  $this->initPublicProfileForm();
1020  }
1021 
1022  $ptpl = new ilTemplate("tpl.edit_personal_profile.html", true, true, "Services/User");
1023  $ptpl->setVariable("FORM", $this->form->getHTML());
1024  include_once("./Services/User/classes/class.ilPublicUserProfileGUI.php");
1025  $pub_profile = new ilPublicUserProfileGUI($ilUser->getId());
1026  $ptpl->setVariable("PREVIEW", $pub_profile->getEmbeddable());
1027  $this->tpl->setContent($ptpl->get());
1028  $this->tpl->show();
1029  }
initPublicProfileForm()
Init public profile form.
GUI class for public user profile presentation.
special template class to simplify handling of ITX/PEAR
global $ilUser
Definition: imgupload.php:15
global $ilSetting
Definition: privfeed.php:40
+ 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 1125 of file class.ilPersonalProfileGUI.php.

References $ilUser, ilObjUser\_getPersonalPicturePath(), ilDatePresentation\formatDate(), IL_CAL_DATE, ilGoogleMapUtil\isActivated(), ilCheckboxInputGUI\setChecked(), ilCheckboxInputGUI\setOptionTitle(), and userSettingVisible().

Referenced by initPublicProfileForm().

1126  {
1127  global $ilUser;
1128 
1129  $birthday = $ilUser->getBirthday();
1130  if($birthday)
1131  {
1132  $birthday = ilDatePresentation::formatDate(new ilDate($birthday, IL_CAL_DATE));
1133  }
1134  $gender = $ilUser->getGender();
1135  if($gender)
1136  {
1137  $gender = $this->lng->txt("gender_".$gender);
1138  }
1139 
1140  if ($ilUser->getSelectedCountry() != "")
1141  {
1142  $this->lng->loadLanguageModule("meta");
1143  $txt_sel_country = $this->lng->txt("meta_c_".$ilUser->getSelectedCountry());
1144  }
1145 
1146  // profile picture
1147  $pic = ilObjUser::_getPersonalPicturePath($ilUser->getId(), "xsmall", true, true);
1148  if($pic)
1149  {
1150  $pic = "<img src=\"".$pic."\" />";
1151  }
1152 
1153  // personal data
1154  $val_array = array(
1155  "title" => $ilUser->getUTitle(),
1156  "birthday" => $birthday,
1157  "gender" => $gender,
1158  "institution" => $ilUser->getInstitution(),
1159  "department" => $ilUser->getDepartment(),
1160  "upload" => $pic,
1161  "street" => $ilUser->getStreet(),
1162  "zipcode" => $ilUser->getZipcode(),
1163  "city" => $ilUser->getCity(),
1164  "country" => $ilUser->getCountry(),
1165  "sel_country" => $txt_sel_country,
1166  "phone_office" => $ilUser->getPhoneOffice(),
1167  "phone_home" => $ilUser->getPhoneHome(),
1168  "phone_mobile" => $ilUser->getPhoneMobile(),
1169  "fax" => $ilUser->getFax(),
1170  "email" => $ilUser->getEmail(),
1171  "hobby" => $ilUser->getHobby(),
1172  "matriculation" => $ilUser->getMatriculation(),
1173  "delicious" => $ilUser->getDelicious()
1174  );
1175 
1176  // location
1177  include_once("./Services/GoogleMaps/classes/class.ilGoogleMapUtil.php");
1179  {
1180  $val_array["location"] = "";
1181  }
1182 
1183  foreach($val_array as $key => $value)
1184  {
1185  if($anonymized)
1186  {
1187  $value = null;
1188  }
1189 
1190  if ($this->userSettingVisible($key))
1191  {
1192  // public setting
1193  if ($key == "upload")
1194  {
1195  $cb = new ilCheckboxInputGUI($this->lng->txt("personal_picture"), "chk_".$key);
1196  }
1197  else
1198  {
1199  $cb = new ilCheckboxInputGUI($this->lng->txt($key), "chk_".$key);
1200  }
1201  if ($prefs["public_".$key] == "y")
1202  {
1203  $cb->setChecked(true);
1204  }
1205  //$cb->setInfo($value);
1206  $cb->setOptionTitle($value);
1207 
1208  if(!$parent)
1209  {
1210  $form->addItem($cb);
1211  }
1212  else
1213  {
1214  $parent->addSubItem($cb);
1215  }
1216  }
1217  }
1218 
1219  $im_arr = array("icq","yahoo","msn","aim","skype","jabber","voip");
1220  if ($this->userSettingVisible("instant_messengers"))
1221  {
1222  foreach ($im_arr as $im)
1223  {
1224  // public setting
1225  $cb = new ilCheckboxInputGUI($this->lng->txt("im_".$im), "chk_im_".$im);
1226  //$cb->setInfo($ilUser->getInstantMessengerId($im));
1227  $cb->setOptionTitle($ilUser->getInstantMessengerId($im));
1228  if ($prefs["public_im_".$im] != "n")
1229  {
1230  $cb->setChecked(true);
1231  }
1232 
1233  if(!$parent)
1234  {
1235  $form->addItem($cb);
1236  }
1237  else
1238  {
1239  $parent->addSubItem($cb);
1240  }
1241  }
1242  }
1243 
1244  // additional defined user data fields
1245  $user_defined_data = array();
1246  if(!$anonymized)
1247  {
1248  $user_defined_data = $ilUser->getUserDefinedData();
1249  }
1250  foreach($this->user_defined_fields->getVisibleDefinitions() as $field_id => $definition)
1251  {
1252  // public setting
1253  $cb = new ilCheckboxInputGUI($definition["field_name"], "chk_udf_".$definition["field_id"]);
1254  $cb->setOptionTitle($user_defined_data["f_".$definition["field_id"]]);
1255  if ($prefs["public_udf_".$definition["field_id"]] == "y")
1256  {
1257  $cb->setChecked(true);
1258  }
1259 
1260  if(!$parent)
1261  {
1262  $form->addItem($cb);
1263  }
1264  else
1265  {
1266  $parent->addSubItem($cb);
1267  }
1268  }
1269  }
static isActivated()
Checks whether Google Map feature is activated.
This class represents a checkbox property in a property form.
setChecked($a_checked)
Set Checked.
Class for single dates.
static formatDate(ilDateTime $date)
Format a date public.
const IL_CAL_DATE
global $ilUser
Definition: imgupload.php:15
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.
setOptionTitle($a_optiontitle)
Set Option Title (optional).
+ 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  $uploaded_file = $this->form->moveFileUpload($image_dir,
151  "userfile", "upload_".$ilUser->getId()."pic");
152 
153  if (!$uploaded_file)
154  {
155  ilUtil::sendFailure($this->lng->txt("upload_error", true));
156  $this->ctrl->redirect($this, "showProfile");
157  }
158  chmod($uploaded_file, 0770);
159 
160  // take quality 100 to avoid jpeg artefacts when uploading jpeg files
161  // taking only frame [0] to avoid problems with animated gifs
162  $show_file = "$image_dir/usr_".$ilUser->getId().".jpg";
163  $thumb_file = "$image_dir/usr_".$ilUser->getId()."_small.jpg";
164  $xthumb_file = "$image_dir/usr_".$ilUser->getId()."_xsmall.jpg";
165  $xxthumb_file = "$image_dir/usr_".$ilUser->getId()."_xxsmall.jpg";
166  $uploaded_file = ilUtil::escapeShellArg($uploaded_file);
167  $show_file = ilUtil::escapeShellArg($show_file);
168  $thumb_file = ilUtil::escapeShellArg($thumb_file);
169  $xthumb_file = ilUtil::escapeShellArg($xthumb_file);
170  $xxthumb_file = ilUtil::escapeShellArg($xxthumb_file);
171 
172  if(ilUtil::isConvertVersionAtLeast("6.3.8-3"))
173  {
174  ilUtil::execConvert($uploaded_file . "[0] -geometry 200x200^ -gravity center -extent 200x200 -quality 100 JPEG:".$show_file);
175  ilUtil::execConvert($uploaded_file . "[0] -geometry 100x100^ -gravity center -extent 100x100 -quality 100 JPEG:".$thumb_file);
176  ilUtil::execConvert($uploaded_file . "[0] -geometry 75x75^ -gravity center -extent 75x75 -quality 100 JPEG:".$xthumb_file);
177  ilUtil::execConvert($uploaded_file . "[0] -geometry 30x30^ -gravity center -extent 30x30 -quality 100 JPEG:".$xxthumb_file);
178  }
179  else
180  {
181  ilUtil::execConvert($uploaded_file . "[0] -geometry 200x200 -quality 100 JPEG:".$show_file);
182  ilUtil::execConvert($uploaded_file . "[0] -geometry 100x100 -quality 100 JPEG:".$thumb_file);
183  ilUtil::execConvert($uploaded_file . "[0] -geometry 75x75 -quality 100 JPEG:".$xthumb_file);
184  ilUtil::execConvert($uploaded_file . "[0] -geometry 30x30 -quality 100 JPEG:".$xxthumb_file);
185  }
186  }
187  }
188 
189 // $this->saveProfile();
190  }
static isConvertVersionAtLeast($a_version)
Compare convert version numbers.
static execConvert($args)
execute convert command
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
global $ilUser
Definition: imgupload.php:15
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.

113  {
114  $result = TRUE;
115  if ($this->settings["usr_settings_disable_".$setting] == 1)
116  {
117  $result = FALSE;
118  }
119  return $result;
120  }
$result

◆ userSettingVisible()

ilPersonalProfileGUI::userSettingVisible (   $setting)

Returns TRUE if user setting is visible, FALSE otherwise.

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

References $result.

Referenced by __showOtherInformations(), savePublicProfile(), 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
+ 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.

Referenced by savePersonalData(), 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
+ 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 ilPersonalProfileGUI(), 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: