ILIAS  release_5-4 Revision v5.4.26-12-gabc799a52e6
ilPersonalProfileGUI Class Reference

GUI class for personal profile. More...

+ Collaboration diagram for ilPersonalProfileGUI:

Public Member Functions

 __construct (\ilTermsOfServiceDocumentEvaluation $termsOfServiceEvaluation=null)
 constructor 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, $a_migration_started=false)
 Personal data form. More...
 
 initPersonalDataForm ()
 Init personal form. More...
 
 savePersonalData ()
 Save personal data form. More...
 
 showPublicProfile ($a_no_init=false)
 Public profile form. More...
 
 initPublicProfileForm ()
 Init public profile form. More...
 
 showPublicProfileFields (ilPropertyformGUI $form, array $prefs, $parent=null, $anonymized=false)
 Add fields to form. More...
 
 savePublicProfile ()
 Save public profile form. More...
 
 showExportImport ()
 Show export/import. More...
 
 exportPersonalData ()
 Export personal data. More...
 
 downloadPersonalData ()
 Download personal data export file. More...
 
 importPersonalDataSelection ()
 Import personal data selection. More...
 
 initPersonalDataImportForm ()
 Init personal data import form. More...
 
 importPersonalData ()
 Import personal data. More...
 

Data Fields

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

Protected Member Functions

 showUserAgreement ()
 
 getProfilePortfolio ()
 has profile set to a portfolio? More...
 
 renderCertificateMigration (\ilObjUser $user, bool $migrationIsStartedInRequest)
 

Protected Attributes

 $tabs
 
 $termsOfServiceEvaluation
 

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, ilCertificateMigrationGUI

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

Constructor & Destructor Documentation

◆ __construct()

ilPersonalProfileGUI::__construct ( \ilTermsOfServiceDocumentEvaluation  $termsOfServiceEvaluation = null)

constructor

Parameters
\ilTermsOfServiceDocumentEvaluation | null$termsOfServiceEvaluation

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

33 {
34 global $DIC;
35
36 $ilias = $DIC['ilias'];
37 $tpl = $DIC['tpl'];
38 $lng = $DIC['lng'];
39 $ilCtrl = $DIC['ilCtrl'];
40 $this->tabs = $DIC->tabs();
41
42 if ($termsOfServiceEvaluation === null) {
43 $termsOfServiceEvaluation = $DIC['tos.document.evaluator'];
44 }
45 $this->termsOfServiceEvaluation = $termsOfServiceEvaluation;
46
47 include_once './Services/User/classes/class.ilUserDefinedFields.php';
48 $this->user_defined_fields = &ilUserDefinedFields::_getInstance();
49
50 $this->tpl = $tpl;
51 $this->lng = $lng;
52 $this->ilias = $ilias;
53 $this->ctrl = $ilCtrl;
54 $this->settings = $ilias->getAllSettings();
55 $lng->loadLanguageModule("jsmath");
56 $lng->loadLanguageModule("pd");
57 $this->upload_error = "";
58 $this->password_error = "";
59 $lng->loadLanguageModule("user");
60 $ilCtrl->saveParameter($this, "prompted");
61 // $ilCtrl->saveParameter($this, "user_page");
62 }
static _getInstance()
Get instance.
global $ilCtrl
Definition: ilias.php:18
redirection script todo: (a better solution should control the processing via a xml file)
global $DIC
Definition: saml.php:7
settings()
Definition: settings.php:2

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

+ Here is the call graph for this function:

Member Function Documentation

◆ __checkUserDefinedRequiredFields()

ilPersonalProfileGUI::__checkUserDefinedRequiredFields ( )

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

686 {
687 foreach ($this->user_defined_fields->getVisibleDefinitions() as $definition) {
688 $field_id = $definition['field_id'];
689 if ($definition['required'] and !strlen($_POST['udf'][$field_id])) {
690 return false;
691 }
692 }
693 return true;
694 }
$_POST["username"]

References $_POST.

Referenced by saveProfile().

+ Here is the caller graph for this function:

◆ __showOtherInformations()

ilPersonalProfileGUI::__showOtherInformations ( )

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

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

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

References $DIC, $ilUser, $name, 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 520 of file class.ilPersonalProfileGUI.php.

521 {
522 global $DIC;
523
524 $ilCtrl = $DIC['ilCtrl'];
525
526 // check map activation
527 include_once("./Services/Maps/classes/class.ilMapUtil.php");
528 if (!ilMapUtil::isActivated()) {
529 return;
530 }
531
532 // Don't really know if this is still necessary...
533 $this->lng->loadLanguageModule("maps");
534
535 // Get user settings
536 $latitude = $a_user->getLatitude();
537 $longitude = $a_user->getLongitude();
538 $zoom = $a_user->getLocationZoom();
539
540 // Get Default settings, when nothing is set
541 if ($latitude == 0 && $longitude == 0 && $zoom == 0) {
543 $latitude = $def["latitude"];
544 $longitude = $def["longitude"];
545 $zoom = $def["zoom"];
546 }
547
548 $street = $a_user->getStreet();
549 if (!$street) {
550 $street = $this->lng->txt("street");
551 }
552 $city = $a_user->getCity();
553 if (!$city) {
554 $city = $this->lng->txt("city");
555 }
556 $country = $a_user->getCountry();
557 if (!$country) {
558 $country = $this->lng->txt("country");
559 }
560
561 // location property
562 $loc_prop = new ilLocationInputGUI(
563 $this->lng->txt("location"),
564 "location"
565 );
566 $loc_prop->setLatitude($latitude);
567 $loc_prop->setLongitude($longitude);
568 $loc_prop->setZoom($zoom);
569 $loc_prop->setAddress($street . "," . $city . "," . $country);
570
571 $a_form->addItem($loc_prop);
572 }
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).
$def
Definition: croninfo.php:21

References $def, $DIC, $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 1375 of file class.ilPersonalProfileGUI.php.

1376 {
1377 global $DIC;
1378
1379 $ilUser = $DIC['ilUser'];
1380
1381 $ilUser->sendPersonalDataFile();
1382 }

References $DIC, and $ilUser.

◆ exportPersonalData()

ilPersonalProfileGUI::exportPersonalData ( )

Export personal data.

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

1358 {
1359 global $DIC;
1360
1361 $ilCtrl = $DIC['ilCtrl'];
1362 $ilUser = $DIC['ilUser'];
1363
1364 $ilUser->exportPersonalData();
1365 $ilUser->sendPersonalDataFile();
1366 $ilCtrl->redirect($this, "showExportImport");
1367 }

References $DIC, $ilCtrl, and $ilUser.

◆ getProfilePortfolio()

ilPersonalProfileGUI::getProfilePortfolio ( )
protected

has profile set to a portfolio?

Returns
int

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

994 {
995 global $DIC;
996
997 $ilUser = $DIC['ilUser'];
998 $ilSetting = $DIC['ilSetting'];
999
1000 if ($ilSetting->get('user_portfolios')) {
1001 include_once "Modules/Portfolio/classes/class.ilObjPortfolio.php";
1003 }
1004 }
static getDefaultPortfolio($a_user_id)
Get default portfolio of user.
global $ilSetting
Definition: privfeed.php:17

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

+ Here is the call graph for this function:

◆ importPersonalData()

ilPersonalProfileGUI::importPersonalData ( )

Import personal data.

Parameters

return

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

1465 {
1466 global $DIC;
1467
1468 $ilUser = $DIC['ilUser'];
1469 $ilCtrl = $DIC['ilCtrl'];
1470 $tpl = $DIC['tpl'];
1471 $ilTabs = $DIC['ilTabs'];
1472
1474 if ($this->form->checkInput()) {
1475 $ilUser->importPersonalData(
1476 $_FILES["file"],
1477 (int) $_POST["profile_data"],
1478 (int) $_POST["settings"],
1479 (int) $_POST["bookmarks"],
1480 (int) $_POST["notes"],
1481 (int) $_POST["calendar"]
1482 );
1483 ilUtil::sendSuccess($this->lng->txt("msg_obj_modified"), true);
1484 $ilCtrl->redirect($this, "");
1485 } else {
1486 $ilTabs->activateTab("export");
1487 $this->setHeader();
1488 $this->form->setValuesByPost();
1489 $tpl->setContent($this->form->getHtml());
1490 $tpl->show();
1491 }
1492 }
initPersonalDataImportForm()
Init personal data import form.

References $_POST, $DIC, $ilCtrl, $ilUser, $tpl, and Sabre\HTTP\setHeader().

+ Here is the call graph for this function:

◆ importPersonalDataSelection()

ilPersonalProfileGUI::importPersonalDataSelection ( )

Import personal data selection.

Parameters

return

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

1391 {
1392 global $DIC;
1393
1394 $lng = $DIC['lng'];
1395 $ilCtrl = $DIC['ilCtrl'];
1396 $tpl = $DIC['tpl'];
1397 $ilTabs = $DIC['ilTabs'];
1398
1399 $ilTabs->activateTab("export");
1400 $this->setHeader();
1401
1403
1404 $tpl->setContent($this->form->getHTML());
1405 $tpl->show();
1406 }

References $DIC, $ilCtrl, $lng, $tpl, and Sabre\HTTP\setHeader().

+ Here is the call graph for this function:

◆ initPersonalDataForm()

ilPersonalProfileGUI::initPersonalDataForm ( )

Init personal form.

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

769 {
770 global $DIC;
771
772 $ilSetting = $DIC['ilSetting'];
773 $lng = $DIC['lng'];
774 $ilUser = $DIC['ilUser'];
775 $styleDefinition = $DIC['styleDefinition'];
776 $rbacreview = $DIC['rbacreview'];
777
778 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
779 $this->form = new ilPropertyFormGUI();
780 $this->form->setFormAction($this->ctrl->getFormAction($this));
781
782 // user defined fields
783 $user_defined_data = $ilUser->getUserDefinedData();
784
785
786 foreach ($this->user_defined_fields->getVisibleDefinitions() as $field_id => $definition) {
787 $value = $user_defined_data["f_" . $field_id];
788
789 include_once './Services/User/classes/class.ilCustomUserFieldsHelper.php';
790 $fprop = ilCustomUserFieldsHelper::getInstance()->getFormPropertyForDefinition(
791 $definition,
792 $definition['changeable'],
793 $value
794 );
795 if ($fprop instanceof ilFormPropertyGUI) {
796 $this->input['udf_' . $definition['field_id']] = $fprop;
797 }
798 }
799
800 // standard fields
801 include_once("./Services/User/classes/class.ilUserProfile.php");
802 $up = new ilUserProfile();
803 $up->skipField("password");
804 $up->skipGroup("settings");
805 $up->skipGroup("preferences");
806
807 $up->setAjaxCallback(
808 $this->ctrl->getLinkTargetByClass('ilPublicUserProfileGUI', 'doProfileAutoComplete', '', true)
809 );
810
811 // standard fields
812 $up->addStandardFieldsToForm($this->form, $ilUser, $this->input);
813
814 $this->addLocationToForm($this->form, $ilUser);
815
816 $this->form->addCommandButton("savePersonalData", $lng->txt("save"));
817 }
This class represents a property in a property form.
addLocationToForm(ilPropertyFormGUI $a_form, ilObjUser $a_user)
Add location fields to form if activated.
This class represents a property form user interface.
Class ilUserProfile.
input
Definition: langcheck.php:166

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

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

1415 {
1416 global $DIC;
1417
1418 $lng = $DIC['lng'];
1419 $ilCtrl = $DIC['ilCtrl'];
1420
1421 include_once("Services/Form/classes/class.ilPropertyFormGUI.php");
1422 $this->form = new ilPropertyFormGUI();
1423
1424 // input file
1425 $fi = new ilFileInputGUI($lng->txt("file"), "file");
1426 $fi->setRequired(true);
1427 $fi->setSuffixes(array("zip"));
1428 $this->form->addItem($fi);
1429
1430 // profile data
1431 $cb = new ilCheckboxInputGUI($this->lng->txt("pd_profile_data"), "profile_data");
1432 $this->form->addItem($cb);
1433
1434 // settings
1435 $cb = new ilCheckboxInputGUI($this->lng->txt("settings"), "settings");
1436 $this->form->addItem($cb);
1437
1438 // bookmarks
1439 $cb = new ilCheckboxInputGUI($this->lng->txt("pd_bookmarks"), "bookmarks");
1440 $this->form->addItem($cb);
1441
1442 // personal notes
1443 $cb = new ilCheckboxInputGUI($this->lng->txt("pd_notes"), "notes");
1444 $this->form->addItem($cb);
1445
1446 // calendar entries
1447 $cb = new ilCheckboxInputGUI($this->lng->txt("pd_private_calendars"), "calendar");
1448 $this->form->addItem($cb);
1449
1450 $this->form->addCommandButton("importPersonalData", $lng->txt("import"));
1451 $this->form->addCommandButton("showExportImport", $lng->txt("cancel"));
1452
1453 $this->form->setTitle($lng->txt("pd_import_personal_data"));
1454 $this->form->setFormAction($ilCtrl->getFormAction($this));
1455 }
This class represents a checkbox property in a property form.
This class represents a file property in a property form.

References $DIC, $ilCtrl, and $lng.

◆ initPublicProfileForm()

ilPersonalProfileGUI::initPublicProfileForm ( )

Init public profile form.

Parameters
int$a_modeEdit Mode

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

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

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

◆ removeUserPicture()

ilPersonalProfileGUI::removeUserPicture ( )

remove user image

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

222 {
223 global $DIC;
224
225 $ilUser = $DIC['ilUser'];
226
227 $ilUser->removeUserPicture();
228
229 $this->saveProfile();
230 }
saveProfile()
save user profile data

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

+ Here is the call graph for this function:

◆ renderCertificateMigration()

ilPersonalProfileGUI::renderCertificateMigration ( \ilObjUser  $user,
bool  $migrationIsStartedInRequest 
)
protected
Parameters

ilObjUser

Parameters
bool$migrationIsStartedInRequest

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

1499 {
1500 $migrationVisibleValidator = new ilCertificateMigrationValidator(new \ilSetting('certificate'));
1501
1502 $showMigrationBox = $migrationVisibleValidator->isMigrationAvailable(
1503 $user,
1504 new \ilCertificateMigration($user->getId())
1505 );
1506 if (!$migrationIsStartedInRequest && true === $showMigrationBox) {
1507 $migrationUiEl = new \ilCertificateMigrationUIElements();
1508
1509 $startMigrationCommand = $this->ctrl->getLinkTargetByClass(
1510 ['ilCertificateMigrationGUI'],
1511 'startMigrationAndReturnMessage',
1512 false,
1513 true,
1514 false
1515 );
1516 $messageBoxHtml = $migrationUiEl->getMigrationMessageBox($startMigrationCommand);
1517
1518 $this->tpl->setCurrentBlock('mess');
1519 $this->tpl->setVariable('MESSAGE', $messageBoxHtml);
1520 $this->tpl->parseCurrentBlock('mess');
1521 }
1522 }
Class ilCertificateMigration.
$user
Definition: migrateto20.php:57

References $user.

Referenced by showPersonalData().

+ Here is the caller graph for this function:

◆ savePersonalData()

ilPersonalProfileGUI::savePersonalData ( )

Save personal data form.

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

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

References $DIC, $f, $ilCtrl, $ilSetting, $ilUser, $lng, $location, $m, $map, $tpl, ilObjUser\_loginExists(), IL_CAL_DATE, initPersonalDataForm(), ilMapUtil\isActivated(), ilUtil\isLogin(), ilUtil\sendFailure(), ilUtil\stripSlashes(), and uploadUserPicture().

+ Here is the call graph for this function:

◆ saveProfile()

ilPersonalProfileGUI::saveProfile ( )

save user profile data

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

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

References $_POST, $DIC, $GLOBALS, $ilSetting, $ilUser, $key, __checkUserDefinedRequiredFields(), ilUtil\is_email(), ilUtil\sendFailure(), settings(), 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 1232 of file class.ilPersonalProfileGUI.php.

1233 {
1234 global $DIC;
1235
1236 $tpl = $DIC['tpl'];
1237 $lng = $DIC['lng'];
1238 $ilCtrl = $DIC['ilCtrl'];
1239 $ilUser = $DIC['ilUser'];
1240
1241 $this->initPublicProfileForm();
1242 if ($this->form->checkInput()) {
1243 // with active portfolio no options are presented
1244 if (isset($_POST["public_profile"])) {
1245 $ilUser->setPref("public_profile", $_POST["public_profile"]);
1246 }
1247
1248 // if check on Institute
1249 $val_array = array("title", "birthday", "gender", "org_units", "institution", "department", "upload",
1250 "street", "zipcode", "city", "country", "sel_country", "phone_office", "phone_home", "phone_mobile",
1251 "fax", "email", "second_email", "hobby", "matriculation", "location",
1252 "interests_general", "interests_help_offered", "interests_help_looking");
1253
1254 // set public profile preferences
1255 foreach ($val_array as $key => $value) {
1256 if (($_POST["chk_" . $value])) {
1257 $ilUser->setPref("public_" . $value, "y");
1258 } else {
1259 $ilUser->setPref("public_" . $value, "n");
1260 }
1261 }
1262
1263 // additional defined user data fields
1264 foreach ($this->user_defined_fields->getVisibleDefinitions() as $field_id => $definition) {
1265 if (($_POST["chk_udf_" . $definition["field_id"]])) {
1266 $ilUser->setPref("public_udf_" . $definition["field_id"], "y");
1267 } else {
1268 $ilUser->setPref("public_udf_" . $definition["field_id"], "n");
1269 }
1270 }
1271
1272 $ilUser->update();
1273
1274 // :TODO: badges
1275 include_once "Services/Badge/classes/class.ilBadgeHandler.php";
1277 if ($handler->isActive()) {
1278 $badgePositions = [];
1279 if (isset($_POST["bpos"]) && is_array($_POST["bpos"])) {
1280 $badgePositions = $_POST["bpos"];
1281 }
1282
1283 if (count($badgePositions) > 0) {
1284 include_once "Services/Badge/classes/class.ilBadgeAssignment.php";
1285 ilBadgeAssignment::updatePositions($ilUser->getId(), $badgePositions);
1286 }
1287 }
1288
1289 // update lucene index
1290 include_once './Services/Search/classes/Lucene/class.ilLuceneIndexer.php';
1291 ilLuceneIndexer::updateLuceneIndex(array((int) $GLOBALS['DIC']['ilUser']->getId()));
1292
1293 ilUtil::sendSuccess($lng->txt("msg_obj_modified"), true);
1294
1295 if (ilSession::get('orig_request_target')) {
1296 $target = ilSession::get('orig_request_target');
1297 ilSession::set('orig_request_target', '');
1299 } elseif ($redirect = $_SESSION['profile_complete_redirect']) {
1300 unset($_SESSION['profile_complete_redirect']);
1301 ilUtil::redirect($redirect);
1302 } else {
1303 $ilCtrl->redirect($this, "showPublicProfile");
1304 }
1305 }
1306 $this->form->setValuesByPost();
1307 $tpl->showPublicProfile(true);
1308 }
$_SESSION["AccountId"]
static updatePositions($a_user_id, array $a_positions)
static getInstance()
Constructor.
initPublicProfileForm()
Init public profile form.
static set($a_var, $a_val)
Set a value.
static get($a_var)
Get a value.
static redirect($a_script)
$target
Definition: test.php:19
$handler

References $_POST, $_SESSION, $DIC, $GLOBALS, $handler, $ilCtrl, $ilUser, $key, $lng, $target, $tpl, ilSession\get(), ilBadgeHandler\getInstance(), ilUtil\redirect(), ilSession\set(), ilLuceneIndexer\updateLuceneIndex(), and ilBadgeAssignment\updatePositions().

+ Here is the call graph for this function:

◆ setHeader()

ilPersonalProfileGUI::setHeader ( )

Set header.

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

700 {
701 $this->tpl->setTitle($this->lng->txt('personal_profile'));
702 }

Referenced by showPersonalData().

+ Here is the caller graph for this function:

◆ setTabs()

ilPersonalProfileGUI::setTabs ( )

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

576 {
577 global $DIC;
578
579 $ilTabs = $DIC['ilTabs'];
580 $ilUser = $DIC['ilUser'];
581 $ilHelp = $DIC['ilHelp'];
582
583 $ilHelp->setScreenIdComponent("user");
584
585 // personal data
586 $ilTabs->addTab(
587 "personal_data",
588 $this->lng->txt("personal_data"),
589 $this->ctrl->getLinkTarget($this, "showPersonalData")
590 );
591
592 // public profile
593 $ilTabs->addTab(
594 "public_profile",
595 $this->lng->txt("public_profile"),
596 $this->ctrl->getLinkTarget($this, "showPublicProfile")
597 );
598
599 // export
600 $ilTabs->addTab(
601 "export",
602 $this->lng->txt("export") . "/" . $this->lng->txt("import"),
603 $this->ctrl->getLinkTarget($this, "showExportImport")
604 );
605
606 // #17570
607 if (($ilUser->getPref("public_profile") &&
608 $ilUser->getPref("public_profile") != "n") ||
609 $this->getProfilePortfolio()) {
610 // profile preview
611 $ilTabs->addNonTabbedLink(
612 "profile_preview",
613 $this->lng->txt("user_profile_preview"),
614 $this->ctrl->getLinkTargetByClass("ilpublicuserprofilegui", "view")
615 );
616 }
617 }

References $DIC, and $ilUser.

◆ showExportImport()

ilPersonalProfileGUI::showExportImport ( )

Show export/import.

Parameters

return

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

1317 {
1318 global $DIC;
1319
1320 $ilToolbar = $DIC['ilToolbar'];
1321 $ilCtrl = $DIC['ilCtrl'];
1322 $tpl = $DIC['tpl'];
1323 $ilTabs = $DIC['ilTabs'];
1324 $ilUser = $DIC['ilUser'];
1325
1326 $ilTabs->activateTab("export");
1327 $this->setHeader();
1328
1329 include_once "Services/UIComponent/Button/classes/class.ilLinkButton.php";
1330 $button = ilLinkButton::getInstance();
1331 $button->setCaption("pd_export_profile");
1332 $button->setUrl($ilCtrl->getLinkTarget($this, "exportPersonalData"));
1333 $ilToolbar->addStickyItem($button);
1334
1335 $exp_file = $ilUser->getPersonalDataExportFile();
1336 if ($exp_file != "") {
1337 $ilToolbar->addSeparator();
1338 $ilToolbar->addButton(
1339 $this->lng->txt("pd_download_last_export_file"),
1340 $ilCtrl->getLinkTarget($this, "downloadPersonalData")
1341 );
1342 }
1343
1344 $ilToolbar->addSeparator();
1345 $ilToolbar->addButton(
1346 $this->lng->txt("pd_import_personal_data"),
1347 $ilCtrl->getLinkTarget($this, "importPersonalDataSelection")
1348 );
1349
1350 $tpl->show();
1351 }
static getInstance()
Factory.

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

+ Here is the call graph for this function:

◆ showPersonalData()

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

Personal data form.

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

714 {
715 global $DIC;
716
717 $ilUser = $DIC['ilUser'];
718 $lng = $DIC['lng'];
719 $ilTabs = $DIC['ilTabs'];
720 $prompt_service = new ilUserProfilePromptService();
721
722 $ilTabs->activateTab("personal_data");
723 $ctrl = $DIC->ctrl();
724
725 $setting = new ilSetting("user");
726 $it = "";
727 if ($_GET["prompted"] == 1) {
728 $it = $prompt_service->data()->getSettings()->getPromptText($ilUser->getLanguage());
729 }
730 if ($it == "") {
731 $it = $prompt_service->data()->getSettings()->getInfoText($ilUser->getLanguage());
732 }
733 if (trim($it) != "") {
734 $pub_prof = in_array($ilUser->prefs["public_profile"], array("y", "n", "g"))
735 ? $ilUser->prefs["public_profile"]
736 : "n";
737 if ($pub_prof == "n") {
738 $button = $DIC->ui()->factory()->button()->shy(
739 "» " . $lng->txt("user_make_profile_public"),
740 $ctrl->getLinkTarget($this, "showPublicProfile")
741 );
742 $it .= "<br><br>" . $DIC->ui()->renderer()->render($button);
743 }
744
745 ilUtil::sendInfo(nl2br($it));
746 }
747
748 $this->setHeader();
749
750 if (!$a_no_init) {
751 $this->initPersonalDataForm();
752 // catch feedback message
753 if ($ilUser->getProfileIncomplete()) {
754 ilUtil::sendInfo($lng->txt("profile_incomplete"));
755 }
756 }
757
758 $this->renderCertificateMigration($ilUser, $a_migration_started);
759
760 $this->tpl->setContent($this->form->getHTML());
761
762 $this->tpl->show();
763 }
$_GET["client_id"]
renderCertificateMigration(\ilObjUser $user, bool $migrationIsStartedInRequest)
static sendInfo($a_info="", $a_keep=false)
Send Info Message to Screen.

References $_GET, $ctrl, $DIC, $ilUser, $lng, initPersonalDataForm(), renderCertificateMigration(), 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 478 of file class.ilPersonalProfileGUI.php.

479 {
480 $this->showPersonalData();
481 }

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

963 {
964 global $DIC;
965
966 $ilUser = $DIC['ilUser'];
967 $lng = $DIC['lng'];
968 $ilSetting = $DIC['ilSetting'];
969 $ilTabs = $DIC['ilTabs'];
970
971 $ilTabs->activateTab("public_profile");
972
973 $this->setHeader();
974
975 if (!$a_no_init) {
976 $this->initPublicProfileForm();
977 }
978
979 $ptpl = new ilTemplate("tpl.edit_personal_profile.html", true, true, "Services/User");
980 $ptpl->setVariable("FORM", $this->form->getHTML());
981 include_once("./Services/User/classes/class.ilPublicUserProfileGUI.php");
982 $pub_profile = new ilPublicUserProfileGUI($ilUser->getId());
983 $ptpl->setVariable("PREVIEW", $pub_profile->getEmbeddable());
984 $this->tpl->setContent($ptpl->get());
985 $this->tpl->show();
986 }
GUI class for public user profile presentation.
special template class to simplify handling of ITX/PEAR

References $DIC, $ilSetting, $ilUser, $lng, and Sabre\HTTP\setHeader().

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

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

References $DIC, $form, $handler, $ilUser, $key, ilDatePresentation\formatDate(), ilBadgeHandler\getInstance(), ilBadgeAssignment\getInstancesByUserId(), IL_CAL_DATE, and ilMapUtil\isActivated().

+ Here is the call graph for this function:

◆ showUserAgreement()

ilPersonalProfileGUI::showUserAgreement ( )
protected

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

487 {
488 $this->tabs->clearTargets();
489 $this->tabs->clearSubTabs();
490
491 $tpl = new \ilTemplate('tpl.view_terms_of_service.html', true, true, 'Services/Init');
492
493 $this->tpl->setTitle($this->lng->txt('usr_agreement'));
494
495 $handleDocument = \ilTermsOfServiceHelper::isEnabled() && $this->termsOfServiceEvaluation->hasDocument();
496 if ($handleDocument) {
497 $document = $this->termsOfServiceEvaluation->document();
498 $tpl->setVariable('TERMS_OF_SERVICE_CONTENT', $document->content());
499 } else {
500 $tpl->setVariable(
501 'TERMS_OF_SERVICE_CONTENT',
502 sprintf(
503 $this->lng->txt('no_agreement_description'),
505 )
506 );
507 }
508
509 $this->tpl->setContent($tpl->get());
510 $this->tpl->setPermanentLink('usr', null, 'agreement');
511 $this->tpl->show();
512 }
static getMailToAddress()
Get mailto: email.

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

+ Here is the call graph for this function:

◆ uploadUserPicture()

ilPersonalProfileGUI::uploadUserPicture ( )

Upload user image.

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

155 {
156 global $DIC;
157
158 $ilUser = $DIC['ilUser'];
159
160 if ($this->workWithUserSetting("upload")) {
161 if (!$this->form->hasFileUpload("userfile")) {
162 if ($this->form->getItemByPostVar("userfile")->getDeletionFlag()) {
163 $ilUser->removeUserPicture();
164 }
165 return;
166 } else {
167 $webspace_dir = ilUtil::getWebspaceDir();
168 $image_dir = $webspace_dir . "/usr_images";
169 $store_file = "usr_" . $ilUser->getID() . "." . "jpg";
170
171 // store filename
172 $ilUser->setPref("profile_image", $store_file);
173 $ilUser->update();
174
175 // move uploaded file
176
177 $pi = pathinfo($_FILES["userfile"]["name"]);
178 $uploaded_file = $this->form->moveFileUpload(
179 $image_dir,
180 "userfile",
181 "upload_" . $ilUser->getId() . "." . $pi["extension"]
182 );
183 if (!$uploaded_file) {
184 ilUtil::sendFailure($this->lng->txt("upload_error", true));
185 $this->ctrl->redirect($this, "showProfile");
186 }
187 chmod($uploaded_file, 0770);
188
189 // take quality 100 to avoid jpeg artefacts when uploading jpeg files
190 // taking only frame [0] to avoid problems with animated gifs
191 $show_file = "$image_dir/usr_" . $ilUser->getId() . ".jpg";
192 $thumb_file = "$image_dir/usr_" . $ilUser->getId() . "_small.jpg";
193 $xthumb_file = "$image_dir/usr_" . $ilUser->getId() . "_xsmall.jpg";
194 $xxthumb_file = "$image_dir/usr_" . $ilUser->getId() . "_xxsmall.jpg";
195 $uploaded_file = ilUtil::escapeShellArg($uploaded_file);
196 $show_file = ilUtil::escapeShellArg($show_file);
197 $thumb_file = ilUtil::escapeShellArg($thumb_file);
198 $xthumb_file = ilUtil::escapeShellArg($xthumb_file);
199 $xxthumb_file = ilUtil::escapeShellArg($xxthumb_file);
200
201 if (ilUtil::isConvertVersionAtLeast("6.3.8-3")) {
202 ilUtil::execConvert($uploaded_file . "[0] -geometry 200x200^ -gravity center -extent 200x200 -quality 100 JPEG:" . $show_file);
203 ilUtil::execConvert($uploaded_file . "[0] -geometry 100x100^ -gravity center -extent 100x100 -quality 100 JPEG:" . $thumb_file);
204 ilUtil::execConvert($uploaded_file . "[0] -geometry 75x75^ -gravity center -extent 75x75 -quality 100 JPEG:" . $xthumb_file);
205 ilUtil::execConvert($uploaded_file . "[0] -geometry 30x30^ -gravity center -extent 30x30 -quality 100 JPEG:" . $xxthumb_file);
206 } else {
207 ilUtil::execConvert($uploaded_file . "[0] -geometry 200x200 -quality 100 JPEG:" . $show_file);
208 ilUtil::execConvert($uploaded_file . "[0] -geometry 100x100 -quality 100 JPEG:" . $thumb_file);
209 ilUtil::execConvert($uploaded_file . "[0] -geometry 75x75 -quality 100 JPEG:" . $xthumb_file);
210 ilUtil::execConvert($uploaded_file . "[0] -geometry 30x30 -quality 100 JPEG:" . $xxthumb_file);
211 }
212 }
213 }
214
215 // $this->saveProfile();
216 }
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 $DIC, $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 142 of file class.ilPersonalProfileGUI.php.

143 {
144 $result = true;
145 if ($this->settings["usr_settings_disable_" . $setting] == 1) {
146 $result = false;
147 }
148 return $result;
149 }
$result

References $result, and settings().

+ Here is the call graph for this function:

◆ userSettingVisible()

ilPersonalProfileGUI::userSettingVisible (   $setting)

Returns TRUE if user setting is visible, FALSE otherwise.

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

129 {
130 $result = true;
131 if (isset($this->settings["usr_settings_hide_" . $setting]) &&
132 $this->settings["usr_settings_hide_" . $setting] == 1) {
133 $result = false;
134 }
135 return $result;
136 }

References $result, and settings().

Referenced by __showOtherInformations().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ workWithUserSetting()

ilPersonalProfileGUI::workWithUserSetting (   $setting)

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

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

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

References $result, and settings().

Referenced by saveProfile(), and uploadUserPicture().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $ctrl

ilPersonalProfileGUI::$ctrl

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

Referenced by showPersonalData().

◆ $ilias

ilPersonalProfileGUI::$ilias

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

Referenced by __construct().

◆ $lng

ilPersonalProfileGUI::$lng

◆ $tabs

ilPersonalProfileGUI::$tabs
protected

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

◆ $termsOfServiceEvaluation

ilPersonalProfileGUI::$termsOfServiceEvaluation
protected

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

Referenced by __construct().

◆ $tpl

ilPersonalProfileGUI::$tpl

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

Referenced by __construct(), savePersonalData(), and showUserAgreement().

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