00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00035 class ilPersonalProfileGUI
00036 {
00037 var $tpl;
00038 var $lng;
00039 var $ilias;
00040 var $ctrl;
00041
00042
00046 function ilPersonalProfileGUI()
00047 {
00048 global $ilias, $tpl, $lng, $rbacsystem, $ilCtrl;
00049
00050
00051 $this->tpl =& $tpl;
00052 $this->lng =& $lng;
00053 $this->ilias =& $ilias;
00054 $this->ctrl =& $ilCtrl;
00055 $this->settings = $ilias->getAllSettings();
00056 $this->upload_error = "";
00057 $this->password_error = "";
00058 }
00059
00063 function &executeCommand()
00064 {
00065 $next_class = $this->ctrl->getNextClass();
00066
00067 switch($next_class)
00068 {
00069 default:
00070
00071 $cmd = $this->ctrl->getCmd("showProfile");
00072 $this->$cmd();
00073 break;
00074 }
00075 return true;
00076 }
00077
00078
00079
00084 function workWithUserSetting($setting)
00085 {
00086 $result = TRUE;
00087 if ($this->settings["usr_settings_hide_".$setting] == 1)
00088 {
00089 $result = FALSE;
00090 }
00091 if ($this->settings["usr_settings_disable_".$setting] == 1)
00092 {
00093 $result = FALSE;
00094 }
00095 return $result;
00096 }
00097
00102 function userSettingVisible($setting)
00103 {
00104 $result = TRUE;
00105 if ($this->settings["usr_settings_hide_".$setting] == 1)
00106 {
00107 $result = FALSE;
00108 }
00109 return $result;
00110 }
00111
00116 function userSettingEnabled($setting)
00117 {
00118 $result = TRUE;
00119 if ($this->settings["usr_settings_disable_".$setting] == 1)
00120 {
00121 $result = FALSE;
00122 }
00123 return $result;
00124 }
00125
00131 function uploadUserPicture()
00132 {
00133 global $ilUser;
00134
00135 if ($this->workWithUserSetting("upload"))
00136 {
00137
00138 if ($_FILES["userfile"]["size"] == 0)
00139 {
00140 $this->upload_error = $this->lng->txt("msg_no_file");
00141 }
00142 else
00143 {
00144
00145 $webspace_dir = ilUtil::getWebspaceDir();
00146 $image_dir = $webspace_dir."/usr_images";
00147 $store_file = "usr_".$ilUser->getID()."."."jpg";
00148
00149
00150 $ilUser->setPref("profile_image", $store_file);
00151 $ilUser->update();
00152
00153
00154 $uploaded_file = $image_dir."/upload_".$ilUser->getId()."pic";
00155 if (!ilUtil::moveUploadedFile($_FILES["userfile"]["tmp_name"], $_FILES["userfile"]["name"],
00156 $uploaded_file, false))
00157 {
00158 sendInfo($this->lng->txt("upload_error", true));
00159 $this->ctrl->redirect($this, "showProfile");
00160 }
00161 chmod($uploaded_file, 0770);
00162
00163
00164
00165 $show_file = "$image_dir/usr_".$ilUser->getId().".jpg";
00166 $thumb_file = "$image_dir/usr_".$ilUser->getId()."_small.jpg";
00167 $xthumb_file = "$image_dir/usr_".$ilUser->getId()."_xsmall.jpg";
00168 $xxthumb_file = "$image_dir/usr_".$ilUser->getId()."_xxsmall.jpg";
00169 $uploaded_file = ilUtil::escapeShellArg($uploaded_file);
00170 $show_file = ilUtil::escapeShellArg($show_file);
00171 $thumb_file = ilUtil::escapeShellArg($thumb_file);
00172 $xthumb_file = ilUtil::escapeShellArg($xthumb_file);
00173 $xxthumb_file = ilUtil::escapeShellArg($xxthumb_file);
00174
00175 system(ilUtil::getConvertCmd()." $uploaded_file" . "[0] -geometry 200x200 -quality 100 JPEG:$show_file");
00176 system(ilUtil::getConvertCmd()." $uploaded_file" . "[0] -geometry 100x100 -quality 100 JPEG:$thumb_file");
00177 system(ilUtil::getConvertCmd()." $uploaded_file" . "[0] -geometry 75x75 -quality 100 JPEG:$xthumb_file");
00178 system(ilUtil::getConvertCmd()." $uploaded_file" . "[0] -geometry 30x30 -quality 100 JPEG:$xxthumb_file");
00179 }
00180 }
00181
00182 $this->saveProfile();
00183 }
00184
00188 function removeUserPicture()
00189 {
00190 global $ilUser;
00191
00192 $webspace_dir = ilUtil::getWebspaceDir();
00193 $image_dir = $webspace_dir."/usr_images";
00194 $file = $image_dir."/usr_".$ilUser->getID()."."."jpg";
00195 $thumb_file = $image_dir."/usr_".$ilUser->getID()."_small.jpg";
00196 $xthumb_file = $image_dir."/usr_".$ilUser->getID()."_xsmall.jpg";
00197 $xxthumb_file = $image_dir."/usr_".$ilUser->getID()."_xxsmall.jpg";
00198 $upload_file = $image_dir."/upload_".$ilUser->getID();
00199
00200
00201 $ilUser->setPref("profile_image", "");
00202 $ilUser->update();
00203
00204 if (@is_file($file))
00205 {
00206 unlink($file);
00207 }
00208 if (@is_file($thumb_file))
00209 {
00210 unlink($thumb_file);
00211 }
00212 if (@is_file($xthumb_file))
00213 {
00214 unlink($xthumb_file);
00215 }
00216 if (@is_file($xxthumb_file))
00217 {
00218 unlink($xxthumb_file);
00219 }
00220 if (@is_file($upload_file))
00221 {
00222 unlink($upload_file);
00223 }
00224
00225 $this->saveProfile();
00226 }
00227
00228
00232 function changeUserPassword()
00233 {
00234 global $ilUser;
00235
00236
00237 if ($ilUser->getAuthMode(true) != AUTH_LOCAL)
00238 {
00239 $this->password_error = $this->lng->txt("not_changeable_for_non_local_auth");
00240 }
00241
00242
00243 if ($this->ilias->getSetting("passwd_auto_generate") == 1)
00244 {
00245
00246 if (md5($_POST["current_password"]) != $ilUser->getPasswd())
00247 {
00248 $this->password_error = $this->lng->txt("passwd_wrong");
00249 }
00250
00251 if (!ilUtil::isPassword($_POST["new_passwd"]))
00252 {
00253 $this->password_error = $this->lng->txt("passwd_not_selected");
00254 }
00255
00256 if (empty($this->password_error))
00257 {
00258 sendInfo($this->lng->txt("saved_successfully"));
00259 $ilUser->updatePassword($_POST["current_password"], $_POST["new_passwd"], $_POST["new_passwd"]);
00260 }
00261 }
00262 else
00263 {
00264
00265 if (md5($_POST["current_password"]) != $ilUser->getPasswd())
00266 {
00267 $this->password_error = $this->lng->txt("passwd_wrong");
00268 }
00269
00270 else if ($_POST["desired_password"] != $_POST["retype_password"])
00271 {
00272 $this->password_error = $this->lng->txt("passwd_not_match");
00273 }
00274
00275 else if (!ilUtil::isPassword($_POST["desired_password"]))
00276 {
00277 $this->password_error = $this->lng->txt("passwd_invalid");
00278 }
00279 else if ($_POST["current_password"] != "" and empty($this->password_error))
00280 {
00281 sendInfo($this->lng->txt("saved_successfully"));
00282 $ilUser->updatePassword($_POST["current_password"], $_POST["desired_password"], $_POST["retype_password"]);
00283 }
00284 }
00285
00286 $this->saveProfile();
00287 }
00288
00289
00290
00294 function saveProfile()
00295 {
00296 global $ilUser;
00297
00298
00299 $form_valid = true;
00300
00301
00302
00303
00304
00305 if (($_POST["chk_pub"])=="on")
00306 {
00307 $ilUser->setPref("public_profile","y");
00308 }
00309 else
00310 {
00311 $ilUser->setPref("public_profile","n");
00312 }
00313
00314
00315 $val_array = array("institution", "department", "upload", "street",
00316 "zip", "city", "country", "phone_office", "phone_home", "phone_mobile",
00317 "fax", "email", "hobby", "matriculation");
00318
00319
00320 foreach($val_array as $key => $value)
00321 {
00322 if (($_POST["chk_".$value]) == "on")
00323 {
00324 $ilUser->setPref("public_".$value,"y");
00325 }
00326 else
00327 {
00328 $ilUser->setPref("public_".$value,"n");
00329 }
00330 }
00331
00332
00333 foreach($this->settings as $key => $val)
00334 {
00335 if (substr($key,0,8) == "require_")
00336 {
00337 $require_keys[] = substr($key,8);
00338 }
00339 }
00340
00341 foreach($require_keys as $key => $val)
00342 {
00343
00344 $system_fields = array("login", "default_role", "passwd", "passwd2");
00345 if (!in_array($val, $system_fields))
00346 {
00347 if ($this->workWithUserSetting($val))
00348 {
00349 if (isset($this->settings["require_" . $val]) && $this->settings["require_" . $val])
00350 {
00351 if (empty($_POST["usr_" . $val]))
00352 {
00353 sendInfo($this->lng->txt("fill_out_all_required_fields") . ": " . $this->lng->txt($val));
00354 $form_valid = false;
00355 }
00356 }
00357 }
00358 }
00359 }
00360
00361
00362 if ($this->workWithUserSetting("email"))
00363 {
00364 if (!ilUtil::is_email($_POST["usr_email"]) and !empty($_POST["usr_email"]) and $form_valid)
00365 {
00366 sendInfo($this->lng->txt("email_not_valid"));
00367 $form_valid = false;
00368 }
00369 }
00370
00371
00372 if ($this->workWithUserSetting("firstname"))
00373 {
00374 $ilUser->setFirstName(ilUtil::stripSlashes($_POST["usr_firstname"]));
00375 }
00376 if ($this->workWithUserSetting("lastname"))
00377 {
00378 $ilUser->setLastName(ilUtil::stripSlashes($_POST["usr_lastname"]));
00379 }
00380 if ($this->workWithUserSetting("gender"))
00381 {
00382 $ilUser->setGender($_POST["usr_gender"]);
00383 }
00384 if ($this->workWithUserSetting("title"))
00385 {
00386 $ilUser->setUTitle(ilUtil::stripSlashes($_POST["usr_title"]));
00387 }
00388 $ilUser->setFullname();
00389 if ($this->workWithUserSetting("institution"))
00390 {
00391 $ilUser->setInstitution(ilUtil::stripSlashes($_POST["usr_institution"]));
00392 }
00393 if ($this->workWithUserSetting("department"))
00394 {
00395 $ilUser->setDepartment(ilUtil::stripSlashes($_POST["usr_department"]));
00396 }
00397 if ($this->workWithUserSetting("street"))
00398 {
00399 $ilUser->setStreet(ilUtil::stripSlashes($_POST["usr_street"]));
00400 }
00401 if ($this->workWithUserSetting("zipcode"))
00402 {
00403 $ilUser->setZipcode(ilUtil::stripSlashes($_POST["usr_zipcode"]));
00404 }
00405 if ($this->workWithUserSetting("city"))
00406 {
00407 $ilUser->setCity(ilUtil::stripSlashes($_POST["usr_city"]));
00408 }
00409 if ($this->workWithUserSetting("country"))
00410 {
00411 $ilUser->setCountry(ilUtil::stripSlashes($_POST["usr_country"]));
00412 }
00413 if ($this->workWithUserSetting("phone_office"))
00414 {
00415 $ilUser->setPhoneOffice(ilUtil::stripSlashes($_POST["usr_phone_office"]));
00416 }
00417 if ($this->workWithUserSetting("phone_home"))
00418 {
00419 $ilUser->setPhoneHome(ilUtil::stripSlashes($_POST["usr_phone_home"]));
00420 }
00421 if ($this->workWithUserSetting("phone_mobile"))
00422 {
00423 $ilUser->setPhoneMobile(ilUtil::stripSlashes($_POST["usr_phone_mobile"]));
00424 }
00425 if ($this->workWithUserSetting("fax"))
00426 {
00427 $ilUser->setFax(ilUtil::stripSlashes($_POST["usr_fax"]));
00428 }
00429 if ($this->workWithUserSetting("email"))
00430 {
00431 $ilUser->setEmail(ilUtil::stripSlashes($_POST["usr_email"]));
00432 }
00433 if ($this->workWithUserSetting("hobby"))
00434 {
00435 $ilUser->setHobby(ilUtil::stripSlashes($_POST["usr_hobby"]));
00436 }
00437 if ($this->workWithUserSetting("referral_comment"))
00438 {
00439 $ilUser->setComment(ilUtil::stripSlashes($_POST["usr_referral_comment"]));
00440 }
00441 if ($this->workWithUserSetting("matriculation"))
00442 {
00443 $ilUser->setMatriculation(ilUtil::stripSlashes($_POST["usr_matriculation"]));
00444 }
00445
00446
00447 if ($form_valid)
00448 {
00449
00450 $reload = false;
00451
00452 if ($this->workWithUserSetting("skin_style"))
00453 {
00454
00455 if ($_POST["usr_skin_style"] != "")
00456 {
00457 $sknst = explode(":", $_POST["usr_skin_style"]);
00458
00459 if ($ilUser->getPref("style") != $sknst[1] ||
00460 $ilUser->getPref("skin") != $sknst[0])
00461 {
00462 $ilUser->setPref("skin", $sknst[0]);
00463 $ilUser->setPref("style", $sknst[1]);
00464 $reload = true;
00465 }
00466 }
00467 }
00468
00469 if ($this->workWithUserSetting("language"))
00470 {
00471
00472
00473
00474 if ($_POST["usr_language"] != $ilUser->getLanguage())
00475 {
00476 $reload = true;
00477 }
00478
00479
00480 $ilUser->setLanguage($_POST["usr_language"]);
00481
00482 }
00483 if ($this->workWithUserSetting("hits_per_page"))
00484 {
00485
00486 if ($_POST["hits_per_page"] != "")
00487 {
00488 $ilUser->setPref("hits_per_page",$_POST["hits_per_page"]);
00489 }
00490 }
00491
00492
00493 if ($this->workWithUserSetting("show_users_online"))
00494 {
00495 $ilUser->setPref("show_users_online", $_POST["show_users_online"]);
00496 }
00497
00498
00499 if ($_POST["chk_notes"] != "")
00500 {
00501 $ilUser->setPref("show_notes","y");
00502 }
00503 else
00504 {
00505 $ilUser->setPref("show_notes","n");
00506 }
00507
00508
00509
00510 $ilUser->setTitle($ilUser->getFullname());
00511 $ilUser->setDescription($ilUser->getEmail());
00512 $ilUser->update();
00513
00514
00515
00516 if (!empty($this->password_error))
00517 {
00518 sendInfo($this->password_error,true);
00519 }
00520 elseif (!empty($this->upload_error))
00521 {
00522 sendInfo($this->upload_error,true);
00523 }
00524 else if ($reload)
00525 {
00526
00527 sendInfo($this->lng->txt("saved_successfully"),true);
00528 $this->tpl->setVariable("RELOAD","<script language=\"Javascript\">\ntop.location.href = \"./start.php\";\n</script>\n");
00529 }
00530 else
00531 {
00532 sendInfo($this->lng->txt("saved_successfully"),true);
00533 }
00534 }
00535
00536 $this->showProfile();
00537 }
00538
00542 function showProfile()
00543 {
00544 global $ilUser, $styleDefinition, $rbacreview, $ilias;
00545
00546 $settings = $ilias->getAllSettings();
00547
00548 $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.usr_profile.html");
00549
00550
00551 $this->tpl->setVariable("TXT_LOCATOR", $this->lng->txt("locator"));
00552 $this->tpl->touchBlock("locator_separator");
00553 $this->tpl->setCurrentBlock("locator_item");
00554 $this->tpl->setVariable("ITEM", $this->lng->txt("personal_desktop"));
00555 $this->tpl->setVariable("LINK_ITEM",
00556 $this->ctrl->getLinkTargetByClass("ilpersonaldesktopgui"));
00557 $this->tpl->parseCurrentBlock();
00558
00559 $this->tpl->setCurrentBlock("locator_item");
00560 $this->tpl->setVariable("ITEM", $this->lng->txt("personal_profile"));
00561 $this->tpl->setVariable("LINK_ITEM",
00562 $this->ctrl->getLinkTargetByClass("ilpersonalprofilegui", "showProfile"));
00563 $this->tpl->parseCurrentBlock();
00564
00565
00566 sendInfo();
00567
00568 infoPanel();
00569
00570 if ($this->userSettingVisible("language"))
00571 {
00572
00573 $languages = $this->lng->getInstalledLanguages();
00574
00575
00576 $selected_lang = (isset($_POST["usr_language"]))
00577 ? $_POST["usr_language"]
00578 : $ilUser->getLanguage();
00579
00580
00581 foreach($languages as $lang_key)
00582 {
00583 $this->tpl->setCurrentBlock("sel_lang");
00584
00585 $this->tpl->setVariable("LANG", ilLanguage::_lookupEntry($lang_key,"meta", "meta_l_".$lang_key));
00586 $this->tpl->setVariable("LANGSHORT", $lang_key);
00587
00588 if ($selected_lang == $lang_key)
00589 {
00590 $this->tpl->setVariable("SELECTED_LANG", "selected=\"selected\"");
00591 }
00592
00593 $this->tpl->parseCurrentBlock();
00594 }
00595 }
00596
00597
00598 include_once("classes/class.ilObjStyleSettings.php");
00599 $templates = $styleDefinition->getAllTemplates();
00600
00601 if ($this->userSettingVisible("skin_style"))
00602 {
00603 foreach($templates as $template)
00604 {
00605
00606 $styleDef =& new ilStyleDefinition($template["id"]);
00607 $styleDef->startParsing();
00608 $styles = $styleDef->getStyles();
00609
00610 foreach($styles as $style)
00611 {
00612 if (!ilObjStyleSettings::_lookupActivatedStyle($template["id"],$style["id"]))
00613 {
00614 continue;
00615 }
00616
00617 $this->tpl->setCurrentBlock("selectskin");
00618
00619 if ($ilUser->skin == $template["id"] &&
00620 $ilUser->prefs["style"] == $style["id"])
00621 {
00622 $this->tpl->setVariable("SKINSELECTED", "selected=\"selected\"");
00623 }
00624
00625 $this->tpl->setVariable("SKINVALUE", $template["id"].":".$style["id"]);
00626 $this->tpl->setVariable("SKINOPTION", $styleDef->getTemplateName()." / ".$style["name"]);
00627 $this->tpl->parseCurrentBlock();
00628 }
00629 }
00630 }
00631
00632
00633 if ($this->userSettingVisible("hits_per_page"))
00634 {
00635 $hits_options = array(2,10,15,20,30,40,50,100,9999);
00636
00637 foreach($hits_options as $hits_option)
00638 {
00639 $this->tpl->setCurrentBlock("selecthits");
00640
00641 if ($ilUser->prefs["hits_per_page"] == $hits_option)
00642 {
00643 $this->tpl->setVariable("HITSSELECTED", "selected=\"selected\"");
00644 }
00645
00646 $this->tpl->setVariable("HITSVALUE", $hits_option);
00647
00648 if ($hits_option == 9999)
00649 {
00650 $hits_option = $this->lng->txt("no_limit");
00651 }
00652
00653 $this->tpl->setVariable("HITSOPTION", $hits_option);
00654 $this->tpl->parseCurrentBlock();
00655 }
00656 }
00657
00658
00659 if ($this->userSettingVisible("show_users_online"))
00660 {
00661 $users_online_options = array("y","associated","n");
00662 $selected_option = $ilUser->prefs["show_users_online"];
00663 foreach($users_online_options as $an_option)
00664 {
00665 $this->tpl->setCurrentBlock("select_users_online");
00666
00667 if ($selected_option == $an_option)
00668 {
00669 $this->tpl->setVariable("USERS_ONLINE_SELECTED", "selected=\"selected\"");
00670 }
00671
00672 $this->tpl->setVariable("USERS_ONLINE_VALUE", $an_option);
00673
00674 $this->tpl->setVariable("USERS_ONLINE_OPTION", $this->lng->txt("users_online_show_".$an_option));
00675 $this->tpl->parseCurrentBlock();
00676 }
00677 }
00678
00679
00680 if ($ilUser->prefs["show_notes"] != "n")
00681 {
00682 $this->tpl->setVariable("CHK_NOTES", "checked");
00683 }
00684 $this->tpl->setVariable("TXT_SHOW_NOTES", $this->lng->txt("show_notes_on_pd"));
00685
00686 if ($ilUser->getAuthMode(true) == AUTH_LOCAL and $this->userSettingVisible('password'))
00687 {
00688 if($this->ilias->getSetting('usr_settings_disable_password'))
00689 {
00690 $this->tpl->setCurrentBlock("disabled_password");
00691 $this->tpl->setVariable("TXT_DISABLED_PASSWORD", $this->lng->txt("chg_password"));
00692 $this->tpl->setVariable("TXT_DISABLED_CURRENT_PASSWORD", $this->lng->txt("current_password"));
00693 $this->tpl->parseCurrentBlock();
00694 }
00695 elseif ($settings["passwd_auto_generate"] == 1)
00696 {
00697 $passwd_list = ilUtil::generatePasswords(5);
00698
00699 foreach ($passwd_list as $passwd)
00700 {
00701 $passwd_choice .= ilUtil::formRadioButton(0,"new_passwd",$passwd)." ".$passwd."<br/>";
00702 }
00703
00704 $this->tpl->setCurrentBlock("select_password");
00705 $this->tpl->setVariable("TXT_CHANGE_PASSWORD", $this->lng->txt("chg_password"));
00706 $this->tpl->setVariable("TXT_CURRENT_PASSWORD", $this->lng->txt("current_password"));
00707 $this->tpl->setVariable("TXT_SELECT_PASSWORD", $this->lng->txt("select_password"));
00708 $this->tpl->setVariable("PASSWORD_CHOICE", $passwd_choice);
00709 $this->tpl->setVariable("TXT_NEW_LIST_PASSWORD", $this->lng->txt("new_list_password"));
00710 $this->tpl->parseCurrentBlock();
00711 }
00712 else
00713 {
00714 $this->tpl->setCurrentBlock("change_password");
00715 $this->tpl->setVariable("TXT_CHANGE_PASSWORD", $this->lng->txt("chg_password"));
00716 $this->tpl->setVariable("TXT_CURRENT_PW", $this->lng->txt("current_password"));
00717 $this->tpl->setVariable("TXT_DESIRED_PW", $this->lng->txt("desired_password"));
00718 $this->tpl->setVariable("TXT_RETYPE_PW", $this->lng->txt("retype_password"));
00719 $this->tpl->setVariable("CHANGE_PASSWORD", $this->lng->txt("chg_password"));
00720 $this->tpl->parseCurrentBlock();
00721 }
00722 }
00723
00724 $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_pd_b.gif"),
00725 $this->lng->txt("personal_desktop"));
00726
00727 $this->tpl->setCurrentBlock("content");
00728 $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
00729
00730 $this->tpl->setVariable("HEADER", $this->lng->txt("personal_desktop"));
00731 $this->tpl->setVariable("TXT_OF",strtolower($this->lng->txt("of")));
00732 $this->tpl->setVariable("USR_FULLNAME",$ilUser->getFullname());
00733
00734 $this->tpl->setVariable("TXT_USR_DATA", $this->lng->txt("userdata"));
00735 $this->tpl->setVariable("TXT_NICKNAME", $this->lng->txt("username"));
00736 $this->tpl->setVariable("TXT_PUBLIC_PROFILE", $this->lng->txt("public_profile"));
00737
00738 $data = array();
00739 $data["fields"] = array();
00740 $data["fields"]["gender"] = "";
00741 $data["fields"]["firstname"] = "";
00742 $data["fields"]["lastname"] = "";
00743 $data["fields"]["title"] = "";
00744 $data["fields"]["institution"] = "";
00745 $data["fields"]["department"] = "";
00746 $data["fields"]["street"] = "";
00747 $data["fields"]["city"] = "";
00748 $data["fields"]["zipcode"] = "";
00749 $data["fields"]["country"] = "";
00750 $data["fields"]["phone_office"] = "";
00751 $data["fields"]["phone_home"] = "";
00752 $data["fields"]["phone_mobile"] = "";
00753 $data["fields"]["fax"] = "";
00754 $data["fields"]["email"] = "";
00755 $data["fields"]["hobby"] = "";
00756 $data["fields"]["referral_comment"] = "";
00757 $data["fields"]["matriculation"] = "";
00758 $data["fields"]["create_date"] = "";
00759 $data["fields"]["approve_date"] = "";
00760 $data["fields"]["active"] = "";
00761
00762 $data["fields"]["default_role"] = $role;
00763
00764 foreach($data["fields"] as $key => $val)
00765 {
00766
00767 if ($key != "title")
00768 {
00769 $str = $this->lng->txt($key);
00770 }
00771 else
00772 {
00773 $str = $this->lng->txt("person_title");
00774 }
00775
00776
00777 if (isset($this->settings["require_" . $key]) && $this->settings["require_" . $key])
00778 {
00779 $str = $str . '<span class="asterisk">*</span>';
00780 }
00781
00782 if ($this->userSettingVisible("$key"))
00783 {
00784 $this->tpl->setVariable("TXT_".strtoupper($key), $str);
00785 }
00786 }
00787
00788 if ($this->userSettingVisible("gender"))
00789 {
00790 $this->tpl->setVariable("TXT_GENDER_F",$this->lng->txt("gender_f"));
00791 $this->tpl->setVariable("TXT_GENDER_M",$this->lng->txt("gender_m"));
00792 }
00793
00794
00795 if ($this->userSettingVisible("upload"))
00796 {
00797 $this->tpl->setVariable("TXT_UPLOAD",$this->lng->txt("personal_picture"));
00798 $webspace_dir = ilUtil::getWebspaceDir("output");
00799 $full_img = $ilUser->getPref("profile_image");
00800 $last_dot = strrpos($full_img, ".");
00801 $small_img = substr($full_img, 0, $last_dot).
00802 "_small".substr($full_img, $last_dot, strlen($full_img) - $last_dot);
00803 $image_file = $webspace_dir."/usr_images/".$small_img;
00804
00805 if (@is_file($image_file))
00806 {
00807 $this->tpl->setCurrentBlock("pers_image");
00808 $this->tpl->setVariable("IMG_PERSONAL", $image_file."?dummy=".rand(1,99999));
00809 $this->tpl->setVariable("ALT_IMG_PERSONAL",$this->lng->txt("personal_picture"));
00810 $this->tpl->parseCurrentBlock();
00811 if ($this->userSettingEnabled("upload"))
00812 {
00813 $this->tpl->setCurrentBlock("remove_pic");
00814 $this->tpl->setVariable("TXT_REMOVE_PIC", $this->lng->txt("remove_personal_picture"));
00815 }
00816 $this->tpl->parseCurrentBlock();
00817 $this->tpl->setCurrentBlock("content");
00818 }
00819
00820 if ($this->userSettingEnabled("upload"))
00821 {
00822 $this->tpl->setCurrentBlock("upload_pic");
00823 $this->tpl->setVariable("UPLOAD", $this->lng->txt("upload"));
00824 }
00825 $this->tpl->setVariable("TXT_FILE", $this->lng->txt("userfile"));
00826 $this->tpl->setVariable("USER_FILE", $this->lng->txt("user_file"));
00827 }
00828
00829
00830 if ($this->userSettingVisible("upload") and $this->ilias->getSetting("ilinc_active"))
00831 {
00832 $ilinc_data = $ilUser->getiLincData();
00833
00834 if ($ilinc_data["id"])
00835 {
00836 include_once ('ilinc/classes/class.ilnetucateXMLAPI.php');
00837 $ilincAPI = new ilnetucateXMLAPI();
00838
00839 $ilincAPI->uploadPicture($ilUser);
00840 $response = $ilincAPI->sendRequest("uploadPicture");
00841
00842
00843 $url = trim($response->data['url']['cdata']);
00844
00845 $this->tpl->setCurrentBlock("ilinc_upload_pic");
00846 $this->tpl->setVariable("TXT_ILINC_UPLOAD", $this->lng->txt("ilinc_upload_pic_text"));
00847 $this->tpl->setVariable("ILINC_UPLOAD_LINK", $url);
00848 $this->tpl->setVariable("ILINC_UPLOAD_LINKTXT", $this->lng->txt("ilinc_upload_pic_linktext"));
00849 $this->tpl->parseCurrentBlock();
00850 }
00851 }
00852
00853
00854 if ($this->userSettingVisible("language"))
00855 {
00856 $this->tpl->setVariable("TXT_LANGUAGE", $this->lng->txt("language"));
00857 }
00858 if ($this->userSettingVisible("show_users_online"))
00859 {
00860 $this->tpl->setVariable("TXT_SHOW_USERS_ONLINE", $this->lng->txt("show_users_online"));
00861 }
00862 if ($this->userSettingVisible("skin_style"))
00863 {
00864 $this->tpl->setVariable("TXT_USR_SKIN_STYLE", $this->lng->txt("usr_skin_style"));
00865 }
00866 if ($this->userSettingVisible("hits_per_page"))
00867 {
00868 $this->tpl->setVariable("TXT_HITS_PER_PAGE", $this->lng->txt("usr_hits_per_page"));
00869 }
00870 if ($this->userSettingVisible("show_users_online"))
00871 {
00872 $this->tpl->setVariable("TXT_SHOW_USERS_ONLINE", $this->lng->txt("show_users_online"));
00873 }
00874 $this->tpl->setVariable("TXT_PERSONAL_DATA", $this->lng->txt("personal_data"));
00875 $this->tpl->setVariable("TXT_SYSTEM_INFO", $this->lng->txt("system_information"));
00876 $this->tpl->setVariable("TXT_CONTACT_DATA", $this->lng->txt("contact_data"));
00877 if ($this->userSettingVisible("matriculation"))
00878 {
00879 $this->tpl->setVariable("TXT_OTHER", $this->lng->txt("user_profile_other"));
00880 }
00881 $this->tpl->setVariable("TXT_SETTINGS", $this->lng->txt("settings"));
00882
00883
00884 $this->tpl->setVariable("NICKNAME", ilUtil::prepareFormOutput($ilUser->getLogin()));
00885
00886 if ($this->userSettingVisible("firstname"))
00887 {
00888 $this->tpl->setVariable("FIRSTNAME", ilUtil::prepareFormOutput($ilUser->getFirstname()));
00889 }
00890 if ($this->userSettingVisible("lastname"))
00891 {
00892 $this->tpl->setVariable("LASTNAME", ilUtil::prepareFormOutput($ilUser->getLastname()));
00893 }
00894
00895 if ($this->userSettingVisible("gender"))
00896 {
00897
00898 $gender = strtoupper($ilUser->getGender());
00899
00900 if (!empty($gender))
00901 {
00902 $this->tpl->setVariable("BTN_GENDER_".$gender,"checked=\"checked\"");
00903 }
00904 }
00905
00906 $this->tpl->setVariable("CREATE_DATE", $ilUser->getCreateDate());
00907 $this->tpl->setVariable("APPROVE_DATE", $ilUser->getApproveDate());
00908
00909 if ($ilUser->getActive())
00910 {
00911 $this->tpl->setVariable("ACTIVE", "checked=\"checked\"");
00912 }
00913
00914 if ($this->userSettingVisible("title"))
00915 {
00916 $this->tpl->setVariable("TITLE", ilUtil::prepareFormOutput($ilUser->getUTitle()));
00917 }
00918 if ($this->userSettingVisible("institution"))
00919 {
00920 $this->tpl->setVariable("INSTITUTION", ilUtil::prepareFormOutput($ilUser->getInstitution()));
00921 }
00922 if ($this->userSettingVisible("department"))
00923 {
00924 $this->tpl->setVariable("DEPARTMENT", ilUtil::prepareFormOutput($ilUser->getDepartment()));
00925 }
00926 if ($this->userSettingVisible("street"))
00927 {
00928 $this->tpl->setVariable("STREET", ilUtil::prepareFormOutput($ilUser->getStreet()));
00929 }
00930 if ($this->userSettingVisible("zipcode"))
00931 {
00932 $this->tpl->setVariable("ZIPCODE", ilUtil::prepareFormOutput($ilUser->getZipcode()));
00933 }
00934 if ($this->userSettingVisible("city"))
00935 {
00936 $this->tpl->setVariable("CITY", ilUtil::prepareFormOutput($ilUser->getCity()));
00937 }
00938 if ($this->userSettingVisible("country"))
00939 {
00940 $this->tpl->setVariable("COUNTRY", ilUtil::prepareFormOutput($ilUser->getCountry()));
00941 }
00942 if ($this->userSettingVisible("phone_office"))
00943 {
00944 $this->tpl->setVariable("PHONE_OFFICE", ilUtil::prepareFormOutput($ilUser->getPhoneOffice()));
00945 }
00946 if ($this->userSettingVisible("phone_home"))
00947 {
00948 $this->tpl->setVariable("PHONE_HOME", ilUtil::prepareFormOutput($ilUser->getPhoneHome()));
00949 }
00950 if ($this->userSettingVisible("phone_mobile"))
00951 {
00952 $this->tpl->setVariable("PHONE_MOBILE", ilUtil::prepareFormOutput($ilUser->getPhoneMobile()));
00953 }
00954 if ($this->userSettingVisible("fax"))
00955 {
00956 $this->tpl->setVariable("FAX", ilUtil::prepareFormOutput($ilUser->getFax()));
00957 }
00958 if ($this->userSettingVisible("email"))
00959 {
00960 $this->tpl->setVariable("EMAIL", ilUtil::prepareFormOutput($ilUser->getEmail()));
00961 }
00962 if ($this->userSettingVisible("hobby"))
00963 {
00964 $this->tpl->setVariable("HOBBY", ilUtil::prepareFormOutput($ilUser->getHobby()));
00965 }
00966 if ($this->userSettingVisible("referral_comment"))
00967 {
00968 $this->tpl->setVariable("REFERRAL_COMMENT", ilUtil::prepareFormOutput($ilUser->getComment()));
00969 }
00970 if ($this->userSettingVisible("matriculation"))
00971 {
00972 $this->tpl->setVariable("MATRICULATION", ilUtil::prepareFormOutput($ilUser->getMatriculation()));
00973 }
00974
00975
00976 $global_roles = $rbacreview->getGlobalRoles();
00977
00978 foreach($global_roles as $role_id)
00979 {
00980 if (in_array($role_id, $_SESSION["RoleId"]))
00981 {
00982 $roleObj = $this->ilias->obj_factory->getInstanceByObjId($role_id);
00983 $role_names .= $roleObj->getTitle().", ";
00984 unset($roleObj);
00985 }
00986 }
00987
00988 $this->tpl->setVariable("TXT_DEFAULT_ROLES", $this->lng->txt("default_roles"));
00989 $this->tpl->setVariable("DEFAULT_ROLES", substr($role_names,0,-2));
00990
00991 $this->tpl->setVariable("TXT_REQUIRED_FIELDS", $this->lng->txt("required_field"));
00992
00993
00994 $this->tpl->setVariable("TXT_SAVE", $this->lng->txt("save"));
00995
00996
00997 if ($this->userSettingEnabled("upload"))
00998 {
00999 $this->tpl->setVariable("UPLOAD", $this->lng->txt("upload"));
01000 }
01001
01002
01003 if ($ilUser->prefs["public_profile"] == "y")
01004 {
01005 $this->tpl->setVariable("CHK_PUB","checked");
01006 }
01007 $val_array = array("institution", "department", "upload", "street",
01008 "zip", "city", "country", "phone_office", "phone_home", "phone_mobile",
01009 "fax", "email", "hobby", "matriculation", "show_users_online");
01010 foreach($val_array as $key => $value)
01011 {
01012 if ($this->userSettingVisible("$value"))
01013 {
01014 if ($ilUser->prefs["public_".$value] == "y")
01015 {
01016 $this->tpl->setVariable("CHK_".strtoupper($value), "checked");
01017 }
01018 }
01019 }
01020
01021
01022
01023
01024 $profile_fields = array(
01025 "gender",
01026 "firstname",
01027 "lastname",
01028 "title",
01029 "upload",
01030 "institution",
01031 "department",
01032 "street",
01033 "city",
01034 "zipcode",
01035 "country",
01036 "phone_office",
01037 "phone_home",
01038 "phone_mobile",
01039 "fax",
01040 "email",
01041 "hobby",
01042 "matriculation",
01043 "referral_comment",
01044 "language",
01045 "skin_style",
01046 "hits_per_page",
01047 "show_users_online"
01048 );
01049 foreach ($profile_fields as $field)
01050 {
01051 if (!$this->ilias->getSetting("usr_settings_hide_" . $field))
01052 {
01053 if ($this->ilias->getSetting("usr_settings_disable_" . $field))
01054 {
01055 $this->tpl->setVariable("DISABLED_" . strtoupper($field), " disabled=\"disabled\"");
01056 }
01057 }
01058 }
01059
01060 $this->tpl->parseCurrentBlock();
01061 $this->tpl->show();
01062 }
01063 }
01064 ?>