ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
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$

@ilCtrl_Calls ilPersonalProfileGUI: ilPublicUserProfileGUI

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

Member Function Documentation

◆ __checkUserDefinedRequiredFields()

ilPersonalProfileGUI::__checkUserDefinedRequiredFields ( )

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

699 {
700 foreach($this->user_defined_fields->getVisibleDefinitions() as $definition)
701 {
702 $field_id = $definition['field_id'];
703 if($definition['required'] and !strlen($_POST['udf'][$field_id]))
704 {
705 return false;
706 }
707 }
708 return true;
709 }
$_POST['username']
Definition: cron.php:12

References $_POST.

Referenced by saveProfile().

+ Here is the caller graph for this function:

◆ __showOtherInformations()

ilPersonalProfileGUI::__showOtherInformations ( )

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

629 {
630 $d_set = new ilSetting("delicous");
631 if($this->userSettingVisible("matriculation") or count($this->user_defined_fields->getVisibleDefinitions())
632 or $d_set->get("user_profile") == "1")
633 {
634 return true;
635 }
636 return false;
637 }
userSettingVisible($setting)
Returns TRUE if user setting is visible, FALSE otherwise.
ILIAS Setting Class.

References userSettingVisible().

+ Here is the call graph for this function:

◆ __showUserDefinedFields()

ilPersonalProfileGUI::__showUserDefinedFields ( )

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

640 {
641 global $ilUser;
642
643 $user_defined_data = $ilUser->getUserDefinedData();
644 foreach($this->user_defined_fields->getVisibleDefinitions() as $field_id => $definition)
645 {
646 if($definition['field_type'] == UDF_TYPE_TEXT)
647 {
648 $this->tpl->setCurrentBlock("field_text");
649 $this->tpl->setVariable("FIELD_VALUE",ilUtil::prepareFormOutput($user_defined_data[$field_id]));
650 if(!$definition['changeable'])
651 {
652 $this->tpl->setVariable("DISABLED_FIELD",'disabled=\"disabled\"');
653 $this->tpl->setVariable("FIELD_NAME",'udf['.$definition['field_id'].']');
654 }
655 else
656 {
657 $this->tpl->setVariable("FIELD_NAME",'udf['.$definition['field_id'].']');
658 }
659 $this->tpl->parseCurrentBlock();
660 }
661 else
662 {
663 if($definition['changeable'])
664 {
665 $name = 'udf['.$definition['field_id'].']';
666 $disabled = false;
667 }
668 else
669 {
670 $name = '';
671 $disabled = true;
672 }
673 $this->tpl->setCurrentBlock("field_select");
674 $this->tpl->setVariable("SELECT_BOX",ilUtil::formSelect($user_defined_data[$field_id],
675 $name,
676 $this->user_defined_fields->fieldValuesToSelectArray(
677 $definition['field_values']),
678 false,
679 true,0,'','',$disabled));
680 $this->tpl->parseCurrentBlock();
681 }
682 $this->tpl->setCurrentBlock("user_defined");
683
684 if($definition['required'])
685 {
686 $name = $definition['field_name']."<span class=\"asterisk\">*</span>";
687 }
688 else
689 {
690 $name = $definition['field_name'];
691 }
692 $this->tpl->setVariable("TXT_FIELD_NAME",$name);
693 $this->tpl->parseCurrentBlock();
694 }
695 return true;
696 }
const UDF_TYPE_TEXT
static formSelect($selected, $varname, $options, $multiple=false, $direct_text=false, $size="0", $style_class="", $attribs="", $disabled=false)
Builds a select form field with options and shows the selected option first.
static prepareFormOutput($a_str, $a_strip=false)
prepares string output for html forms @access public
global $ilUser
Definition: imgupload.php:15

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

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

539 {
540 global $ilCtrl;
541
542 // check map activation
543 include_once("./Services/Maps/classes/class.ilMapUtil.php");
545 {
546 return;
547 }
548
549 // Don't really know if this is still necessary...
550 $this->lng->loadLanguageModule("maps");
551
552 // Get user settings
553 $latitude = $a_user->getLatitude();
554 $longitude = $a_user->getLongitude();
555 $zoom = $a_user->getLocationZoom();
556
557 // Get Default settings, when nothing is set
558 if ($latitude == 0 && $longitude == 0 && $zoom == 0)
559 {
561 $latitude = $def["latitude"];
562 $longitude = $def["longitude"];
563 $zoom = $def["zoom"];
564 }
565
566 $street = $a_user->getStreet();
567 if (!$street)
568 {
569 $street = $this->lng->txt("street");
570 }
571 $city = $a_user->getCity();
572 if (!$city)
573 {
574 $city = $this->lng->txt("city");
575 }
576 $country = $a_user->getCountry();
577 if (!$country)
578 {
579 $country = $this->lng->txt("country");
580 }
581
582 // location property
583 $loc_prop = new ilLocationInputGUI($this->lng->txt("location"),
584 "location");
585 $loc_prop->setLatitude($latitude);
586 $loc_prop->setLongitude($longitude);
587 $loc_prop->setZoom($zoom);
588 $loc_prop->setAddress($street.",".$city.",".$country);
589
590 $a_form->addItem($loc_prop);
591 }
This class represents a location property in a property form.
static isActivated()
Checks whether Map feature is activated.
static getDefaultSettings()
Get default longitude, latitude and zoom.
getLatitude()
Get Latitude.
getCountry()
Get country (free text)
getLongitude()
Get Longitude.
getLocationZoom()
Get Location Zoom.
getStreet()
get street @access public
getCity()
get city @access public
addItem($a_item)
Add Item (Property, SectionHeader).
global $ilCtrl
Definition: ilias.php:18

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

Referenced by initPersonalDataForm().

+ 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

return

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

1440 {
1441 global $ilUser;
1442
1443 $ilUser->sendPersonalDataFile();
1444 }

References $ilUser.

◆ executeCommand()

& ilPersonalProfileGUI::executeCommand ( )

execute command

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

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"]
GUI class for public user profile presentation.
$cmd
Definition: sahs_server.php:35

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

+ Here is the call graph for this function:

◆ exportPersonalData()

ilPersonalProfileGUI::exportPersonalData ( )

Export personal data.

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

1425 {
1426 global $ilCtrl, $ilUser;
1427
1428 $ilUser->exportPersonalData();
1429 $ilUser->sendPersonalDataFile();
1430 $ilCtrl->redirect($this, "showExportImport");
1431 }

References $ilCtrl, and $ilUser.

◆ getProfilePortfolio()

ilPersonalProfileGUI::getProfilePortfolio ( )
protected

has profile set to a portfolio?

Returns
int

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

1052 {
1053 global $ilUser, $ilSetting;
1054
1055 if ($ilSetting->get('user_portfolios'))
1056 {
1057 include_once "Modules/Portfolio/classes/class.ilObjPortfolio.php";
1059 }
1060 }
static getDefaultPortfolio($a_user_id)
Get default portfolio of user.
global $ilSetting
Definition: privfeed.php:40

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

+ Here is the call graph for this function:

◆ ilPersonalProfileGUI()

ilPersonalProfileGUI::ilPersonalProfileGUI ( )

constructor

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

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.
redirection script todo: (a better solution should control the processing via a xml file)

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

+ Here is the call graph for this function:

◆ importPersonalData()

ilPersonalProfileGUI::importPersonalData ( )

Import personal data.

Parameters

return

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

1520 {
1521 global $ilUser, $ilCtrl, $tpl, $ilTabs;
1522
1524 if ($this->form->checkInput())
1525 {
1526 $ilUser->importPersonalData($_FILES["file"],
1527 (int) $_POST["profile_data"],
1528 (int) $_POST["settings"],
1529 (int) $_POST["bookmarks"],
1530 (int) $_POST["notes"],
1531 (int) $_POST["calendar"]
1532 );
1533 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
1534 $ilCtrl->redirect($this, "");
1535 }
1536 else
1537 {
1538 $ilTabs->activateTab("export");
1539 $this->setHeader();
1540 $this->form->setValuesByPost();
1541 $tpl->setContent($this->form->getHtml());
1542 $tpl->show();
1543 }
1544 }
initPersonalDataImportForm()
Init personal data import form.
static sendSuccess($a_info="", $a_keep=false)
Send Success Message to Screen.

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

+ Here is the call graph for this function:

◆ importPersonalDataSelection()

ilPersonalProfileGUI::importPersonalDataSelection ( )

Import personal data selection.

Parameters

return

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

1453 {
1454 global $lng, $ilCtrl, $tpl, $ilTabs;
1455
1456 $ilTabs->activateTab("export");
1457 $this->setHeader();
1458
1460
1461 $tpl->setContent($this->form->getHTML());
1462 $tpl->show();
1463 }

References $ilCtrl, $lng, and $tpl.

◆ initPersonalDataForm()

ilPersonalProfileGUI::initPersonalDataForm ( )

Init personal form.

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

756 {
757 global $ilSetting, $lng, $ilUser, $styleDefinition, $rbacreview;
758
759 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
760 $this->form = new ilPropertyFormGUI();
761 $this->form->setFormAction($this->ctrl->getFormAction($this));
762
763 // user defined fields
764 $user_defined_data = $ilUser->getUserDefinedData();
765
766 foreach($this->user_defined_fields->getVisibleDefinitions() as $field_id => $definition)
767 {
768 if($definition['field_type'] == UDF_TYPE_TEXT)
769 {
770 $this->input["udf_".$definition['field_id']] =
771 new ilTextInputGUI($definition['field_name'], "udf_".$definition['field_id']);
772 $this->input["udf_".$definition['field_id']]->setMaxLength(255);
773 $this->input["udf_".$definition['field_id']]->setSize(40);
774 }
775 else if($definition['field_type'] == UDF_TYPE_WYSIWYG)
776 {
777 $this->input["udf_".$definition['field_id']] =
778 new ilTextAreaInputGUI($definition['field_name'], "udf_".$definition['field_id']);
779 $this->input["udf_".$definition['field_id']]->setUseRte(true);
780 }
781 else
782 {
783 $options = $this->user_defined_fields->fieldValuesToSelectArray($definition['field_values']);
784 $this->input["udf_".$definition['field_id']] =
785 new ilSelectInputGUI($definition['field_name'], "udf_".$definition['field_id']);
786 $this->input["udf_".$definition['field_id']]->setOptions($options);
787 }
788
789 $value = $user_defined_data["f_".$field_id];
790 $this->input["udf_".$definition['field_id']]->setValue($value);
791
792 if($definition['required'])
793 {
794 $this->input["udf_".$definition['field_id']]->setRequired(true);
795 }
796 if(!$definition['changeable'] && (!$definition['required'] || $value))
797 {
798 $this->input["udf_".$definition['field_id']]->setDisabled(true);
799 }
800
801 // add "please select" if no current value
802 if($definition['field_type'] == UDF_TYPE_SELECT && !$value)
803 {
804 $options = array(""=>$lng->txt("please_select")) + $options;
805 $this->input["udf_".$definition['field_id']]->setOptions($options);
806 }
807 }
808
809 // standard fields
810 include_once("./Services/User/classes/class.ilUserProfile.php");
811 $up = new ilUserProfile();
812 $up->skipField("password");
813 $up->skipGroup("settings");
814 $up->skipGroup("preferences");
815
816 $up->setAjaxCallback(
817 $this->ctrl->getLinkTargetByClass('ilPublicUserProfileGUI', 'doProfileAutoComplete', '', true)
818 );
819
820 // standard fields
821 $up->addStandardFieldsToForm($this->form, $ilUser, $this->input);
822
823 $this->addLocationToForm($this->form, $ilUser);
824
825 $this->form->addCommandButton("savePersonalData", $lng->txt("save"));
826
827 }
const UDF_TYPE_SELECT
const UDF_TYPE_WYSIWYG
addLocationToForm(ilPropertyFormGUI $a_form, ilObjUser $a_user)
Add location fields to form if activated.
This class represents a property form user interface.
This class represents a selection list property in a property form.
This class represents a text area property in a property form.
This class represents a text property in a property form.
Class ilUserProfile.
if(!is_array($argv)) $options

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

Referenced by savePersonalData(), and showPersonalData().

+ 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

return

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

1472 {
1473 global $lng, $ilCtrl;
1474
1475 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1476 $this->form = new ilPropertyFormGUI();
1477
1478 // input file
1479 $fi = new ilFileInputGUI($lng->txt("file"), "file");
1480 $fi->setRequired(true);
1481 $fi->setSuffixes(array("zip"));
1482 $this->form->addItem($fi);
1483
1484 // profile data
1485 $cb = new ilCheckboxInputGUI($this->lng->txt("pd_profile_data"), "profile_data");
1486 $this->form->addItem($cb);
1487
1488 // settings
1489 $cb = new ilCheckboxInputGUI($this->lng->txt("settings"), "settings");
1490 $this->form->addItem($cb);
1491
1492 // bookmarks
1493 $cb = new ilCheckboxInputGUI($this->lng->txt("pd_bookmarks"), "bookmarks");
1494 $this->form->addItem($cb);
1495
1496 // personal notes
1497 $cb = new ilCheckboxInputGUI($this->lng->txt("pd_notes"), "notes");
1498 $this->form->addItem($cb);
1499
1500 // calendar entries
1501 $cb = new ilCheckboxInputGUI($this->lng->txt("pd_private_calendars"), "calendar");
1502 $this->form->addItem($cb);
1503
1504 $this->form->addCommandButton("importPersonalData", $lng->txt("import"));
1505 $this->form->addCommandButton("showExportImport", $lng->txt("cancel"));
1506
1507 $this->form->setTitle($lng->txt("pd_import_personal_data"));
1508 $this->form->setFormAction($ilCtrl->getFormAction($this));
1509
1510 }
This class represents a checkbox property in a property form.
This class represents a file property in a property form.

References $ilCtrl, and $lng.

◆ initPublicProfileForm()

ilPersonalProfileGUI::initPublicProfileForm ( )

Init public profile form.

Parameters
int$a_modeEdit Mode

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

1068 {
1069 global $lng, $ilUser, $ilSetting;
1070
1071 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1072 $this->form = new ilPropertyFormGUI();
1073
1074 $this->form->setTitle($lng->txt("public_profile"));
1075 $this->form->setDescription($lng->txt("user_public_profile_info"));
1076 $this->form->setFormAction($this->ctrl->getFormAction($this));
1077
1078 $portfolio_id = $this->getProfilePortfolio();
1079
1080 if(!$portfolio_id)
1081 {
1082 // Activate public profile
1083 $radg = new ilRadioGroupInputGUI($lng->txt("user_activate_public_profile"), "public_profile");
1084 $info = $this->lng->txt("user_activate_public_profile_info");
1085 $pub_prof = in_array($ilUser->prefs["public_profile"], array("y", "n", "g"))
1086 ? $ilUser->prefs["public_profile"]
1087 : "n";
1088 if (!$ilSetting->get('enable_global_profiles') && $pub_prof == "g")
1089 {
1090 $pub_prof = "y";
1091 }
1092 $radg->setValue($pub_prof);
1093 $op1 = new ilRadioOption($lng->txt("usr_public_profile_disabled"), "n",$lng->txt("usr_public_profile_disabled_info"));
1094 $radg->addOption($op1);
1095 $op2 = new ilRadioOption($lng->txt("usr_public_profile_logged_in"), "y");
1096 $radg->addOption($op2);
1097 if ($ilSetting->get('enable_global_profiles'))
1098 {
1099 $op3 = new ilRadioOption($lng->txt("usr_public_profile_global"), "g");
1100 $radg->addOption($op3);
1101 }
1102 $this->form->addItem($radg);
1103
1104 // #11773
1105 if ($ilSetting->get('user_portfolios'))
1106 {
1107 // #10826
1108 $prtf = "<br />".$lng->txt("user_profile_portfolio");
1109 $prtf .= "<br /><a href=\"ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToPortfolio\">&raquo; ".
1110 $lng->txt("user_portfolios")."</a>";
1111 $info .= $prtf;
1112 }
1113
1114 $radg->setInfo($info);
1115 }
1116 else
1117 {
1118 $prtf = $lng->txt("user_profile_portfolio_selected");
1119 $prtf .= "<br /><a href=\"ilias.php?baseClass=ilPersonalDesktopGUI&cmd=jumpToPortfolio&prt_id=".$portfolio_id."\">&raquo; ".
1120 $lng->txt("portfolio")."</a>";
1121
1122 $info = new ilCustomInputGUI($lng->txt("user_activate_public_profile"));
1123 $info->setHTML($prtf);
1124 $this->form->addItem($info);
1125 }
1126
1127 $this->showPublicProfileFields($this->form, $ilUser->prefs);
1128
1129 $this->form->addCommandButton("savePublicProfile", $lng->txt("save"));
1130 }
This class represents a custom property in a property form.
showPublicProfileFields(ilPropertyformGUI $form, array $prefs, $parent=null, $anonymized=false)
Add fields to form.
getProfilePortfolio()
has profile set to a portfolio?
This class represents a property in a property form.
This class represents an option in a radio group.
$info
Definition: example_052.php:80

References $ilSetting, $ilUser, $info, and $lng.

◆ removeUserPicture()

ilPersonalProfileGUI::removeUserPicture ( )

remove user image

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

197 {
198 global $ilUser;
199
200 $ilUser->removeUserPicture();
201
202 $this->saveProfile();
203 }
saveProfile()
save user profile data

References $ilUser, and saveProfile().

+ Here is the call graph for this function:

◆ savePersonalData()

ilPersonalProfileGUI::savePersonalData ( )

Save personal data form.

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

834 {
835 global $tpl, $lng, $ilCtrl, $ilUser, $ilSetting, $ilAuth;
836
837 $this->initPersonalDataForm();
838 if ($this->form->checkInput())
839 {
840 $form_valid = true;
841
842 // if form field name differs from setter
843 $map = array(
844 "firstname" => "FirstName",
845 "lastname" => "LastName",
846 "title" => "UTitle",
847 "sel_country" => "SelectedCountry",
848 "phone_office" => "PhoneOffice",
849 "phone_home" => "PhoneHome",
850 "phone_mobile" => "PhoneMobile",
851 "referral_comment" => "Comment",
852 "interests_general" => "GeneralInterests",
853 "interests_help_offered" => "OfferingHelp",
854 "interests_help_looking" => "LookingForHelp"
855 );
856 include_once("./Services/User/classes/class.ilUserProfile.php");
857 $up = new ilUserProfile();
858 foreach($up->getStandardFields() as $f => $p)
859 {
860 // if item is part of form, it is currently valid (if not disabled)
861 $item = $this->form->getItemByPostVar("usr_".$f);
862 if($item && !$item->getDisabled())
863 {
864 $value = $this->form->getInput("usr_".$f);
865 switch($f)
866 {
867 case "birthday":
868 if (is_array($value))
869 {
870 if (is_array($value['date']))
871 {
872 if (($value['d'] > 0) && ($value['m'] > 0) && ($value['y'] > 0))
873 {
874 $ilUser->setBirthday(sprintf("%04d-%02d-%02d", $value['y'], $value['m'], $value['d']));
875 }
876 else
877 {
878 $ilUser->setBirthday("");
879 }
880 }
881 else
882 {
883 $ilUser->setBirthday($value['date']);
884 }
885 }
886 break;
887
888 default:
889 $m = ucfirst($f);
890 if(isset($map[$f]))
891 {
892 $m = $map[$f];
893 }
894 $ilUser->{"set".$m}($value);
895 break;
896 }
897 }
898 }
899 $ilUser->setFullname();
900
901 // set instant messengers
902 if ($this->workWithUserSetting("instant_messengers"))
903 {
904 $ilUser->setInstantMessengerId('icq', $this->form->getInput("usr_im_icq"));
905 $ilUser->setInstantMessengerId('yahoo', $this->form->getInput("usr_im_yahoo"));
906 $ilUser->setInstantMessengerId('msn', $this->form->getInput("usr_im_msn"));
907 $ilUser->setInstantMessengerId('aim', $this->form->getInput("usr_im_aim"));
908 $ilUser->setInstantMessengerId('skype', $this->form->getInput("usr_im_skype"));
909 $ilUser->setInstantMessengerId('jabber', $this->form->getInput("usr_im_jabber"));
910 $ilUser->setInstantMessengerId('voip', $this->form->getInput("usr_im_voip"));
911 }
912
913 // check map activation
914 include_once("./Services/Maps/classes/class.ilMapUtil.php");
916 {
917 // #17619 - proper escaping
918 $location = $this->form->getInput("location");
919 $lat = ilUtil::stripSlashes($location["latitude"]);
920 $long = ilUtil::stripSlashes($location["longitude"]);
921 $zoom = ilUtil::stripSlashes($location["zoom"]);
922 $ilUser->setLatitude(is_numeric($lat) ? $lat : null);
923 $ilUser->setLongitude(is_numeric($long) ? $long : null);
924 $ilUser->setLocationZoom(is_numeric($zoom) ? $zoom : null);
925 }
926
927 // Set user defined data
928 $defs = $this->user_defined_fields->getVisibleDefinitions();
929 $udf = array();
930 foreach ($defs as $definition)
931 {
932 $f = "udf_".$definition['field_id'];
933 $item = $this->form->getItemByPostVar($f);
934 if ($item && !$item->getDisabled())
935 {
936 $udf[$definition['field_id']] = $this->form->getInput($f);
937 }
938 }
939 $ilUser->setUserDefinedData($udf);
940
941 // if loginname is changeable -> validate
942 $un = $this->form->getInput('username');
943 if((int)$ilSetting->get('allow_change_loginname') &&
944 $un != $ilUser->getLogin())
945 {
946 if(!strlen($un) || !ilUtil::isLogin($un))
947 {
948 ilUtil::sendFailure($lng->txt('form_input_not_valid'));
949 $this->form->getItemByPostVar('username')->setAlert($this->lng->txt('login_invalid'));
950 $form_valid = false;
951 }
952 else if(ilObjUser::_loginExists($un, $ilUser->getId()))
953 {
954 ilUtil::sendFailure($lng->txt('form_input_not_valid'));
955 $this->form->getItemByPostVar('username')->setAlert($this->lng->txt('loginname_already_exists'));
956 $form_valid = false;
957 }
958 else
959 {
960 $ilUser->setLogin($un);
961
962 try
963 {
964 $ilUser->updateLogin($ilUser->getLogin());
965 $ilAuth->setAuth($ilUser->getLogin());
966 $ilAuth->start();
967 }
968 catch (ilUserException $e)
969 {
970 ilUtil::sendFailure($lng->txt('form_input_not_valid'));
971 $this->form->getItemByPostVar('username')->setAlert($e->getMessage());
972 $form_valid = false;
973 }
974 }
975 }
976
977 // everthing's ok. save form data
978 if ($form_valid)
979 {
980 $this->uploadUserPicture();
981
982 // profile ok
983 $ilUser->setProfileIncomplete(false);
984
985 // save user data & object_data
986 $ilUser->setTitle($ilUser->getFullname());
987 $ilUser->setDescription($ilUser->getEmail());
988
989 $ilUser->update();
990
991 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
992
993 if(ilSession::get('orig_request_target'))
994 {
995 $target = ilSession::get('orig_request_target');
996 ilSession::set('orig_request_target', '');
997 ilUtil::redirect($target);
998 }
999 else if($redirect = $_SESSION['profile_complete_redirect'])
1000 {
1001 unset($_SESSION['profile_complete_redirect']);
1003 }
1004 else
1005 {
1006 $ilCtrl->redirect($this, "showPersonalData");
1007 }
1008 }
1009 }
1010
1011 $this->form->setValuesByPost();
1012 $this->showPersonalData(true);
1013 }
$location
Definition: buildRTE.php:44
$_SESSION["AccountId"]
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...
workWithUserSetting($setting)
Returns TRUE if working with the given user setting is allowed, FALSE otherwise.
showPersonalData($a_no_init=false)
Personal data form.
initPersonalDataForm()
Init personal form.
uploadUserPicture()
Upload user image.
static set($a_var, $a_val)
Set a value.
static get($a_var)
Get a value.
Class for user related exception handling in ILIAS.
isLogin($a_login)
static redirect($a_script)
http redirect to other script
static sendFailure($a_info="", $a_keep=false)
Send Failure Message to Screen.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
$redirect
Definition: index.php:18

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

+ Here is the call graph for this function:

◆ saveProfile()

ilPersonalProfileGUI::saveProfile ( )

save user profile data

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

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

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

Referenced by removeUserPicture().

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

1300 {
1301 global $tpl, $lng, $ilCtrl, $ilUser;
1302
1303 $this->initPublicProfileForm();
1304 if ($this->form->checkInput())
1305 {
1306 // with active portfolio no options are presented
1307 if(isset($_POST["public_profile"]))
1308 {
1309 $ilUser->setPref("public_profile", $_POST["public_profile"]);
1310 }
1311
1312 // if check on Institute
1313 $val_array = array("title", "birthday", "gender", "institution", "department", "upload", "street",
1314 "zipcode", "city", "country", "sel_country", "phone_office", "phone_home", "phone_mobile",
1315 "fax", "email", "hobby", "matriculation", "location",
1316 "interests_general", "interests_help_offered", "interests_help_looking");
1317
1318 // set public profile preferences
1319 foreach($val_array as $key => $value)
1320 {
1321 if (($_POST["chk_".$value]))
1322 {
1323 $ilUser->setPref("public_".$value,"y");
1324 }
1325 else
1326 {
1327 $ilUser->setPref("public_".$value,"n");
1328 }
1329 }
1330
1331 $im_arr = array("icq","yahoo","msn","aim","skype","jabber","voip");
1332 if ($this->userSettingVisible("instant_messengers"))
1333 {
1334 foreach ($im_arr as $im)
1335 {
1336 if (($_POST["chk_im_".$im]))
1337 {
1338 $ilUser->setPref("public_im_".$im,"y");
1339 }
1340 else
1341 {
1342 $ilUser->setPref("public_im_".$im,"n");
1343 }
1344 }
1345 }
1346
1347// $d_set = new ilSetting("delicious");
1348// if ($d_set->get("user_profile"))
1349// {
1350 if (($_POST["chk_delicious"]))
1351 {
1352 $ilUser->setPref("public_delicious","y");
1353 }
1354 else
1355 {
1356 $ilUser->setPref("public_delicious","n");
1357 }
1358// }
1359
1360 // additional defined user data fields
1361 foreach($this->user_defined_fields->getVisibleDefinitions() as $field_id => $definition)
1362 {
1363 if (($_POST["chk_udf_".$definition["field_id"]]))
1364 {
1365 $ilUser->setPref("public_udf_".$definition["field_id"], "y");
1366 }
1367 else
1368 {
1369 $ilUser->setPref("public_udf_".$definition["field_id"], "n");
1370 }
1371 }
1372
1373 $ilUser->update();
1374
1375 // update lucene index
1376 include_once './Services/Search/classes/Lucene/class.ilLuceneIndexer.php';
1377 ilLuceneIndexer::updateLuceneIndex(array((int) $GLOBALS['ilUser']->getId()));
1378
1379 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1380 $ilCtrl->redirect($this, "showPublicProfile");
1381 }
1382 $this->form->setValuesByPost();
1383 $tpl->showPublicProfile(true);
1384 }
initPublicProfileForm()
Init public profile form.

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

+ Here is the call graph for this function:

◆ setHeader()

ilPersonalProfileGUI::setHeader ( )

Set header.

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

715 {
716 $this->tpl->setTitle($this->lng->txt('personal_profile'));
717 }

Referenced by showPersonalData().

+ Here is the caller graph for this function:

◆ setTabs()

ilPersonalProfileGUI::setTabs ( )

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

595 {
596 global $ilTabs, $ilUser, $ilHelp;
597
598 $ilHelp->setScreenIdComponent("user");
599
600 // personal data
601 $ilTabs->addTab("personal_data",
602 $this->lng->txt("personal_data"),
603 $this->ctrl->getLinkTarget($this, "showPersonalData"));
604
605 // public profile
606 $ilTabs->addTab("public_profile",
607 $this->lng->txt("public_profile"),
608 $this->ctrl->getLinkTarget($this, "showPublicProfile"));
609
610 // export
611 $ilTabs->addTab("export",
612 $this->lng->txt("export")."/".$this->lng->txt("import"),
613 $this->ctrl->getLinkTarget($this, "showExportImport"));
614
615 // #17570
616 if(($ilUser->getPref("public_profile") &&
617 $ilUser->getPref("public_profile") != "n") ||
618 $this->getProfilePortfolio())
619 {
620 // profile preview
621 $ilTabs->addNonTabbedLink("profile_preview",
622 $this->lng->txt("user_profile_preview"),
623 $this->ctrl->getLinkTargetByClass("ilpublicuserprofilegui", "view"));
624 }
625 }

References $ilUser.

Referenced by executeCommand().

+ Here is the caller graph for this function:

◆ showExportImport()

ilPersonalProfileGUI::showExportImport ( )

Show export/import.

Parameters

return

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

1393 {
1394 global $ilToolbar, $ilCtrl, $tpl, $ilTabs, $ilUser;
1395
1396 $ilTabs->activateTab("export");
1397 $this->setHeader();
1398
1399 include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
1400 $button = ilLinkButton::getInstance();
1401 $button->setCaption("pd_export_profile");
1402 $button->setUrl($ilCtrl->getLinkTarget($this, "exportPersonalData"));
1403 $ilToolbar->addStickyItem($button);
1404
1405 $exp_file = $ilUser->getPersonalDataExportFile();
1406 if ($exp_file != "")
1407 {
1408 $ilToolbar->addSeparator();
1409 $ilToolbar->addButton($this->lng->txt("pd_download_last_export_file"),
1410 $ilCtrl->getLinkTarget($this, "downloadPersonalData"));
1411 }
1412
1413 $ilToolbar->addSeparator();
1414 $ilToolbar->addButton($this->lng->txt("pd_import_personal_data"),
1415 $ilCtrl->getLinkTarget($this, "importPersonalDataSelection"));
1416
1417 $tpl->show();
1418 }
static getInstance()
Factory.

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

+ Here is the call graph for this function:

◆ showPersonalData()

ilPersonalProfileGUI::showPersonalData (   $a_no_init = false)

Personal data form.

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

729 {
730 global $ilUser, $styleDefinition, $rbacreview, $ilias, $lng, $ilSetting, $ilTabs;
731
732 $ilTabs->activateTab("personal_data");
733
734 $settings = $ilias->getAllSettings();
735
736 $this->setHeader();
737
738 if (!$a_no_init)
739 {
740 $this->initPersonalDataForm();
741 // catch feedback message
742 if ($ilUser->getProfileIncomplete())
743 {
744 ilUtil::sendInfo($lng->txt("profile_incomplete"));
745 }
746 }
747 $this->tpl->setContent($this->form->getHTML());
748
749 $this->tpl->show();
750 }
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.

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

Referenced by showProfile().

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

528 {
529 $this->showPersonalData();
530 }

References showPersonalData().

Referenced by saveProfile().

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

1025 {
1026 global $ilUser, $lng, $ilSetting, $ilTabs;
1027
1028 $ilTabs->activateTab("public_profile");
1029
1030 $this->setHeader();
1031
1032 if (!$a_no_init)
1033 {
1034 $this->initPublicProfileForm();
1035 }
1036
1037 $ptpl = new ilTemplate("tpl.edit_personal_profile.html", true, true, "Services/User");
1038 $ptpl->setVariable("FORM", $this->form->getHTML());
1039 include_once("./Services/User/classes/class.ilPublicUserProfileGUI.php");
1040 $pub_profile = new ilPublicUserProfileGUI($ilUser->getId());
1041 $ptpl->setVariable("PREVIEW", $pub_profile->getEmbeddable());
1042 $this->tpl->setContent($ptpl->get());
1043 $this->tpl->show();
1044 }
special template class to simplify handling of ITX/PEAR

References $ilSetting, $ilUser, and $lng.

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

1141 {
1142 global $ilUser;
1143
1144 $birthday = $ilUser->getBirthday();
1145 if($birthday)
1146 {
1147 $birthday = ilDatePresentation::formatDate(new ilDate($birthday, IL_CAL_DATE));
1148 }
1149 $gender = $ilUser->getGender();
1150 if($gender)
1151 {
1152 $gender = $this->lng->txt("gender_".$gender);
1153 }
1154
1155 if ($ilUser->getSelectedCountry() != "")
1156 {
1157 $this->lng->loadLanguageModule("meta");
1158 $txt_sel_country = $this->lng->txt("meta_c_".$ilUser->getSelectedCountry());
1159 }
1160
1161 // profile picture
1162 $pic = ilObjUser::_getPersonalPicturePath($ilUser->getId(), "xsmall", true, true);
1163 if($pic)
1164 {
1165 $pic = "<img src=\"".$pic."\" />";
1166 }
1167
1168 // personal data
1169 $val_array = array(
1170 "title" => $ilUser->getUTitle(),
1171 "birthday" => $birthday,
1172 "gender" => $gender,
1173 "upload" => $pic,
1174 "interests_general" => $ilUser->getGeneralInterestsAsText(),
1175 "interests_help_offered" => $ilUser->getOfferingHelpAsText(),
1176 "interests_help_looking" => $ilUser->getLookingForHelpAsText(),
1177 "institution" => $ilUser->getInstitution(),
1178 "department" => $ilUser->getDepartment(),
1179 "street" => $ilUser->getStreet(),
1180 "zipcode" => $ilUser->getZipcode(),
1181 "city" => $ilUser->getCity(),
1182 "country" => $ilUser->getCountry(),
1183 "sel_country" => $txt_sel_country,
1184 "phone_office" => $ilUser->getPhoneOffice(),
1185 "phone_home" => $ilUser->getPhoneHome(),
1186 "phone_mobile" => $ilUser->getPhoneMobile(),
1187 "fax" => $ilUser->getFax(),
1188 "email" => $ilUser->getEmail(),
1189 "hobby" => $ilUser->getHobby(),
1190 "matriculation" => $ilUser->getMatriculation(),
1191 "delicious" => $ilUser->getDelicious()
1192 );
1193
1194 // location
1195 include_once("./Services/Maps/classes/class.ilMapUtil.php");
1197 {
1198 $val_array["location"] = "";
1199 }
1200
1201 foreach($val_array as $key => $value)
1202 {
1203 if($anonymized)
1204 {
1205 $value = null;
1206 }
1207
1208 if ($this->userSettingVisible($key))
1209 {
1210 // #18795 - we should use ilUserProfile
1211 switch($key)
1212 {
1213 case "upload":
1214 $caption = "personal_picture";
1215 break;
1216
1217 case "title":
1218 $caption = "person_title";
1219 break;
1220
1221 default:
1222 $caption = $key;
1223 }
1224 $cb = new ilCheckboxInputGUI($this->lng->txt($caption), "chk_".$key);
1225 if ($prefs["public_".$key] == "y")
1226 {
1227 $cb->setChecked(true);
1228 }
1229 //$cb->setInfo($value);
1230 $cb->setOptionTitle($value);
1231
1232 if(!$parent)
1233 {
1234 $form->addItem($cb);
1235 }
1236 else
1237 {
1238 $parent->addSubItem($cb);
1239 }
1240 }
1241 }
1242
1243 $im_arr = array("icq","yahoo","msn","aim","skype","jabber","voip");
1244 if ($this->userSettingVisible("instant_messengers"))
1245 {
1246 foreach ($im_arr as $im)
1247 {
1248 // public setting
1249 $cb = new ilCheckboxInputGUI($this->lng->txt("im_".$im), "chk_im_".$im);
1250 //$cb->setInfo($ilUser->getInstantMessengerId($im));
1251 $cb->setOptionTitle($ilUser->getInstantMessengerId($im));
1252 if ($prefs["public_im_".$im] != "n")
1253 {
1254 $cb->setChecked(true);
1255 }
1256
1257 if(!$parent)
1258 {
1259 $form->addItem($cb);
1260 }
1261 else
1262 {
1263 $parent->addSubItem($cb);
1264 }
1265 }
1266 }
1267
1268 // additional defined user data fields
1269 $user_defined_data = array();
1270 if(!$anonymized)
1271 {
1272 $user_defined_data = $ilUser->getUserDefinedData();
1273 }
1274 foreach($this->user_defined_fields->getVisibleDefinitions() as $field_id => $definition)
1275 {
1276 // public setting
1277 $cb = new ilCheckboxInputGUI($definition["field_name"], "chk_udf_".$definition["field_id"]);
1278 $cb->setOptionTitle($user_defined_data["f_".$definition["field_id"]]);
1279 if ($prefs["public_udf_".$definition["field_id"]] == "y")
1280 {
1281 $cb->setChecked(true);
1282 }
1283
1284 if(!$parent)
1285 {
1286 $form->addItem($cb);
1287 }
1288 else
1289 {
1290 $parent->addSubItem($cb);
1291 }
1292 }
1293 }
const IL_CAL_DATE
static formatDate(ilDateTime $date)
Format a date @access public.
Class for single dates.
static _getPersonalPicturePath($a_usr_id, $a_size="small", $a_force_pic=false, $a_prevent_no_photo_image=false)
Get path to personal picture.

References $ilUser, ilObjUser\_getPersonalPicturePath(), ilDatePresentation\formatDate(), IL_CAL_DATE, and ilMapUtil\isActivated().

+ Here is the call graph for this function:

◆ uploadUserPicture()

ilPersonalProfileGUI::uploadUserPicture ( )

Upload user image.

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

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
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 escapeShellArg($a_arg)
static getWebspaceDir($mode="filesystem")
get webspace directory
static execConvert($args)
execute convert command

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

Referenced by savePersonalData().

+ 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.

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

References $result.

◆ userSettingVisible()

ilPersonalProfileGUI::userSettingVisible (   $setting)

Returns TRUE if user setting is visible, FALSE otherwise.

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

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 }

References $result.

Referenced by __showOtherInformations().

+ 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.

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 }

References $result.

Referenced by savePersonalData(), saveProfile(), and uploadUserPicture().

+ 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

ilPersonalProfileGUI::$lng

◆ $tpl

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