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
00037 require_once "./classes/class.ilObjectGUI.php";
00038
00039 class ilObjUserGUI extends ilObjectGUI
00040 {
00041 var $ilCtrl;
00042
00048 var $gender;
00049
00055 var $type;
00056
00062 var $user_ref_id;
00063
00068 function ilObjUserGUI($a_data,$a_id,$a_call_by_reference = false, $a_prepare_output = true)
00069 {
00070 global $ilCtrl;
00071
00072 define('USER_FOLDER_ID',7);
00073
00074 $this->type = "usr";
00075 $this->ilObjectGUI($a_data,$a_id,$a_call_by_reference, false);
00076 $this->usrf_ref_id =& $this->ref_id;
00077
00078 $this->ctrl =& $ilCtrl;
00079 $this->ctrl->saveParameter($this,'obj_id');
00080
00081
00082
00083 $this->gender = array(
00084 'm' => "salutation_m",
00085 'f' => "salutation_f"
00086 );
00087 }
00088
00089 function &executeCommand()
00090 {
00091 global $rbacsystem;
00092
00093 $next_class = $this->ctrl->getNextClass($this);
00094 $cmd = $this->ctrl->getCmd();
00095
00096 if ($cmd != "deliverVCard" && $cmd != "getPublicProfile")
00097 {
00098 $this->prepareOutput();
00099 }
00100
00101 switch($next_class)
00102 {
00103 case "illearningprogressgui":
00104 include_once './Services/Tracking/classes/class.ilLearningProgressGUI.php';
00105 $new_gui =& new ilLearningProgressGUI(LP_MODE_USER_FOLDER,USER_FOLDER_ID,$this->object->getId());
00106 $this->ctrl->forwardCommand($new_gui);
00107 break;
00108
00109 case "ilobjilincusergui":
00110 include_once './ilinc/classes/class.ilObjiLincUserGUI.php';
00111 $new_gui =& new ilObjiLincUserGUI($this->object,$this->usrf_ref_id);
00112 $this->ctrl->forwardCommand($new_gui);
00113 break;
00114
00115
00116 default:
00117 if($cmd == "" || $cmd == "view")
00118 {
00119 $cmd = "edit";
00120 }
00121 $cmd .= "Object";
00122 $return = $this->$cmd();
00123
00124 break;
00125 }
00126 return $return;
00127 }
00128
00129
00130
00131 function setTitleAndDescription()
00132 {
00133 if(strtolower(get_class($this->object)) == 'ilobjuser')
00134 {
00135 $this->tpl->setTitle('['.$this->object->getLogin().'] '.$this->object->getTitle());
00136 $this->tpl->setDescription($this->object->getLongDescription());
00137 $this->tpl->setTitleIcon(ilUtil::getImagePath("icon_".$this->object->getType()."_b.gif"), $this->lng->txt("obj_" . $this->object->getType()));
00138 }
00139 else
00140 {
00141 parent::setTitleAndDescription();
00142 }
00143 }
00144
00145
00146
00147 function cancelObject()
00148 {
00149 session_unregister("saved_post");
00150
00151 ilUtil::sendInfo($this->lng->txt("msg_cancel"),true);
00152
00153 if(strtolower($_GET["baseClass"]) == 'iladministrationgui')
00154 {
00155 $this->ctrl->redirectByClass("ilobjuserfoldergui", "view");
00156
00157
00158 }
00159 else
00160 {
00161 $this->ctrl->redirectByClass('ilobjcategorygui','listUsers');
00162 }
00163 }
00164
00168 function getAdminTabs(&$tabs_gui)
00169 {
00170 $this->getTabs($tabs_gui);
00171 }
00172
00176 function getTabs(&$tabs_gui)
00177 {
00178 global $rbacsystem;
00179
00180 $tabs_gui->clearTargets();
00181
00182 if ($_GET["search"])
00183 {
00184 $tabs_gui->setBackTarget(
00185 $this->lng->txt("search_results"),$_SESSION["usr_search_link"]);
00186
00187 $tabs_gui->addTarget("properties",
00188 $this->ctrl->getLinkTarget($this, "edit"), array("edit","","view"), get_class($this),"",true);
00189 }
00190 else
00191 {
00192 $tabs_gui->addTarget("properties",
00193 $this->ctrl->getLinkTarget($this, "edit"), array("edit","","view"), get_class($this));
00194 }
00195
00196 $tabs_gui->addTarget("role_assignment",
00197 $this->ctrl->getLinkTarget($this, "roleassignment"), array("roleassignment"), get_class($this));
00198
00199
00200 include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
00201 if($rbacsystem->checkAccess('read',$this->ref_id) and ilObjUserTracking::_enabledLearningProgress())
00202 {
00203
00204 $tabs_gui->addTarget('learning_progress',
00205 $this->ctrl->getLinkTargetByClass('illearningprogressgui',''),
00206 '',
00207 array('illplistofobjectsgui','illplistofsettingsgui','illearningprogressgui','illplistofprogressgui'));
00208 }
00209
00210 if ($this->ilias->getSetting("ilinc_active"))
00211 {
00212 $tabs_gui->addTarget("extt_ilinc",
00213 $this->ctrl->getLinkTargetByClass('ilobjilincusergui',''),
00214 '',
00215 array('ilobjilincusergui'));
00216 }
00217 }
00218
00222 function setBackTarget($a_text, $a_link)
00223 {
00224 $this->back_target = array("text" => $a_text,
00225 "link" => $a_link);
00226 }
00227
00231 function createObject()
00232 {
00233 global $ilias, $rbacsystem, $rbacreview, $styleDefinition, $ilSetting,$ilUser;
00234
00235
00236 $settings = $ilias->getAllSettings();
00237
00238 if (!$rbacsystem->checkAccess('create_user', $this->usrf_ref_id) and
00239 !$rbacsystem->checkAccess('cat_administrate_users',$this->usrf_ref_id))
00240 {
00241 $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
00242 }
00243
00244 if($this->usrf_ref_id != USER_FOLDER_ID)
00245 {
00246 $this->tabs_gui->clearTargets();
00247 }
00248
00249
00250 $obj_list = $rbacreview->getRoleListByObject(ROLE_FOLDER_ID);
00251 $rol = array();
00252 foreach ($obj_list as $obj_data)
00253 {
00254
00255 if($this->object->getRefId() != USER_FOLDER_ID and !in_array(SYSTEM_ROLE_ID,$rbacreview->assignedRoles($ilUser->getId())))
00256 {
00257 include_once './classes/class.ilObjRole.php';
00258
00259 if(!ilObjRole::_getAssignUsersStatus($obj_data['obj_id']))
00260 {
00261 continue;
00262 }
00263 }
00264
00265 if ($obj_data["obj_id"] != ANONYMOUS_ROLE_ID)
00266 {
00267
00268 if ($obj_data["obj_id"] != SYSTEM_ROLE_ID or in_array(SYSTEM_ROLE_ID,$rbacreview->assignedRoles($ilUser->getId())))
00269 {
00270 $rol[$obj_data["obj_id"]] = $obj_data["title"];
00271 }
00272 }
00273 }
00274
00275
00276 if(!count($rol))
00277 {
00278 $this->ilias->raiseError($this->lng->txt("msg_no_roles_users_can_be_assigned_to"),$this->ilias->error_obj->MESSAGE);
00279 }
00280
00281 $keys = array_keys($rol);
00282
00283
00284 if (in_array(4,$keys))
00285 {
00286 $default_role = 4;
00287 }
00288 else
00289 {
00290 if (count($keys) > 1 and in_array(2,$keys))
00291 {
00292
00293 foreach ($keys as $key => $val)
00294 {
00295 if ($val == 2)
00296 {
00297 unset($keys[$key]);
00298 break;
00299 }
00300 }
00301 }
00302
00303 $default_role = array_shift($keys);
00304 }
00305
00306 $pre_selected_role = (isset($_SESSION["error_post_vars"]["Fobject"]["default_role"])) ? $_SESSION["error_post_vars"]["Fobject"]["default_role"] : $default_role;
00307
00308 $roles = ilUtil::formSelect($pre_selected_role,"Fobject[default_role]",$rol,false,true);
00309
00310 $data = array();
00311 $data["fields"] = array();
00312 $data["fields"]["login"] = "";
00313 $data["fields"]["passwd"] = "";
00314 #$data["fields"]["passwd2"] = "";
00315 $data["fields"]["title"] = "";
00316 $data["fields"]["ext_account"] = "";
00317 $data["fields"]["gender"] = "";
00318 $data["fields"]["firstname"] = "";
00319 $data["fields"]["lastname"] = "";
00320 $data["fields"]["institution"] = "";
00321 $data["fields"]["department"] = "";
00322 $data["fields"]["street"] = "";
00323 $data["fields"]["city"] = "";
00324 $data["fields"]["zipcode"] = "";
00325 $data["fields"]["country"] = "";
00326 $data["fields"]["phone_office"] = "";
00327 $data["fields"]["phone_home"] = "";
00328 $data["fields"]["phone_mobile"] = "";
00329 $data["fields"]["fax"] = "";
00330 $data["fields"]["email"] = "";
00331 $data["fields"]["hobby"] = "";
00332 $data["fields"]["im_icq"] = "";
00333 $data["fields"]["im_yahoo"] = "";
00334 $data["fields"]["im_msn"] = "";
00335 $data["fields"]["im_aim"] = "";
00336 $data["fields"]["im_skype"] = "";
00337 $data["fields"]["matriculation"] = "";
00338 $data["fields"]["client_ip"] = "";
00339 $data["fields"]["referral_comment"] = "";
00340 $data["fields"]["create_date"] = "";
00341 $data["fields"]["approve_date"] = "";
00342 $data["fields"]["active"] = " checked=\"checked\"";
00343 $data["fields"]["default_role"] = $roles;
00344 $data["fields"]["auth_mode"] = "";
00345
00346 $this->getTemplateFile("edit","usr");
00347
00348
00349 foreach ($data["fields"] as $key => $val)
00350 {
00351 $str = $this->lng->txt($key);
00352 if ($key == "title")
00353 {
00354 $str = $this->lng->txt("person_title");
00355 }
00356 if ($key == "ext_account")
00357 {
00358 continue;
00359 }
00360 if($key == 'passwd')
00361 {
00362 $this->tpl->setCurrentBlock('passwords_visible');
00363 $this->tpl->setVariable('VISIBLE_TXT_PASSWD',$this->lng->txt('passwd'));
00364 $this->tpl->setVariable('VISIBLE_TXT_PASSWD2',$this->lng->txt('retype_password'));
00365 $this->tpl->setVariable('VISIBLE_PASSWD',$_SESSION['error_post_vars']['Fobject']['passwd']);
00366 $this->tpl->setVariable('VISIBLE_PASSWD2',$_SESSION['error_post_vars']['Fobject']['passwd2']);
00367 $this->tpl->parseCurrentBlock();
00368 }
00369
00370
00371 if (isset($settings["require_" . $key]) && $settings["require_" . $key])
00372 {
00373 $str = $str . '<span class="asterisk">*</span>';
00374 }
00375
00376 $this->tpl->setVariable("TXT_".strtoupper($key), $str);
00377
00378 if ($key == "default_role")
00379 {
00380 $this->tpl->setVariable(strtoupper($key), $val);
00381 }
00382 else
00383 {
00384 $this->tpl->setVariable(strtoupper($key), ilUtil::prepareFormOutput($val));
00385 }
00386
00387 if ($this->prepare_output)
00388 {
00389 $this->tpl->parseCurrentBlock();
00390 }
00391 }
00392
00393
00394 include_once './Services/User/classes/class.ilObjUserFolder.php';
00395 $amail = ilObjUserFolder::_lookupNewAccountMail($this->lng->getDefaultLanguage());
00396 if (trim($amail["body"]) != "" && trim($amail["subject"]) != "")
00397 {
00398 $this->tpl->setCurrentBlock("inform_user");
00399 if (true)
00400 {
00401 $this->tpl->setVariable("SEND_MAIL", " checked=\"checked\"");
00402 }
00403 $this->tpl->setVariable("TXT_INFORM_USER_MAIL",
00404 $this->lng->txt("user_send_new_account_mail"));
00405 $this->tpl->parseCurrentBlock();
00406 }
00407
00408 $this->ctrl->setParameter($this,'new_type',$this->type);
00409 $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
00410 $this->tpl->setVariable("TXT_HEADER", $this->lng->txt($this->type."_new"));
00411 $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
00412 $this->tpl->setVariable("TXT_SUBMIT", $this->lng->txt($this->type."_add"));
00413 $this->tpl->setVariable("CMD_SUBMIT", "save");
00414 $this->tpl->setVariable("TARGET", $this->getTargetFrame("save"));
00415 $this->tpl->setVariable("TXT_REQUIRED_FLD", $this->lng->txt("required_field"));
00416
00417 $this->tpl->setVariable("TXT_LOGIN_DATA", $this->lng->txt("login_data"));
00418 $this->tpl->setVariable("TXT_SYSTEM_INFO", $this->lng->txt("system_information"));
00419 $this->tpl->setVariable("TXT_PERSONAL_DATA", $this->lng->txt("personal_data"));
00420 $this->tpl->setVariable("TXT_CONTACT_DATA", $this->lng->txt("contact_data"));
00421 $this->tpl->setVariable("TXT_SETTINGS", $this->lng->txt("settings"));
00422 $this->tpl->setVariable("TXT_PASSWD2", $this->lng->txt("retype_password"));
00423 $this->tpl->setVariable("TXT_LANGUAGE",$this->lng->txt("language"));
00424 $this->tpl->setVariable("TXT_SKIN_STYLE",$this->lng->txt("usr_skin_style"));
00425 $this->tpl->setVariable("TXT_HITS_PER_PAGE",$this->lng->txt("usr_hits_per_page"));
00426 $this->tpl->setVariable("TXT_SHOW_USERS_ONLINE",$this->lng->txt("show_users_online"));
00427 $this->tpl->setVariable("TXT_GENDER_F",$this->lng->txt("gender_f"));
00428 $this->tpl->setVariable("TXT_GENDER_M",$this->lng->txt("gender_m"));
00429 $this->tpl->setVariable("TXT_OTHER",$this->lng->txt("user_profile_other"));
00430 $this->tpl->setVariable("TXT_INSTANT_MESSENGERS",$this->lng->txt("user_profile_instant_messengers"));
00431 $this->tpl->setVariable("TXT_IM_ICQ",$this->lng->txt("im_icq"));
00432 $this->tpl->setVariable("TXT_IM_YAHOO",$this->lng->txt("im_yahoo"));
00433 $this->tpl->setVariable("TXT_IM_MSN",$this->lng->txt("im_msn"));
00434 $this->tpl->setVariable("TXT_IM_AIM",$this->lng->txt("im_aim"));
00435 $this->tpl->setVariable("TXT_IM_SKYPE",$this->lng->txt("im_skype"));
00436
00437 include_once('./Services/Authentication/classes/class.ilAuthUtils.php');
00438 if(ilAuthUtils::_isExternalAccountEnabled())
00439 {
00440 $this->tpl->setCurrentBlock("ext_account");
00441 $this->tpl->setVariable("TXT_EXT_ACCOUNT",$this->lng->txt("user_ext_account"));
00442 $this->tpl->setVariable("TXT_EXT_ACCOUNT_DESC",$this->lng->txt("user_ext_account_desc"));
00443 if (isset($_SESSION["error_post_vars"]["Fobject"]["ext_account"]))
00444 {
00445 $this->tpl->setVariable("EXT_ACCOUNT_VAL",
00446 $_SESSION["error_post_vars"]["Fobject"]["ext_account"]);
00447 }
00448 $this->tpl->parseCurrentBlock();
00449 }
00450
00451
00452
00453
00454 $this->tpl->setVariable("TXT_CURRENT_IP_ALERT",$this->lng->txt("current_ip_alert"));
00455
00456
00457 if (isset($_SESSION["error_post_vars"]["Fobject"]))
00458 {
00459 if (!isset($_SESSION["error_post_vars"]["Fobject"]["active"]))
00460 {
00461 $_SESSION["error_post_vars"]["Fobject"]["active"] = 0;
00462 }
00463
00464 foreach ($_SESSION["error_post_vars"]["Fobject"] as $key => $val)
00465 {
00466 if ($key != "default_role" and $key != "language"
00467 and $key != "skin_style" and $key != "hits_per_page"
00468 and $key != "show_users_online" and $key != 'passwd' and $key != 'passwd2')
00469 {
00470 $this->tpl->setVariable(strtoupper($key), ilUtil::prepareFormOutput($val));
00471 }
00472 }
00473
00474
00475 $gender = strtoupper($_SESSION["error_post_vars"]["Fobject"]["gender"]);
00476
00477 if (!empty($gender))
00478 {
00479 $this->tpl->setVariable("BTN_GENDER_".$gender,"checked=\"checked\"");
00480 }
00481
00482 $active = $_SESSION["error_post_vars"]["Fobject"]["active"];
00483 if ($active)
00484 {
00485 $this->tpl->setVariable("ACTIVE", "checked=\"checked\"");
00486 }
00487 }
00488
00489
00490 include_once('./Services/Authentication/classes/class.ilAuthUtils.php');
00491 $active_auth_modes = ilAuthUtils::_getActiveAuthModes();
00492
00493
00494 $selected_auth_mode = (isset($_SESSION["error_post_vars"]["Fobject"]["auth_mode"])) ?
00495 $_SESSION["error_post_vars"]["Fobject"]["auth_mode"] : 'default';
00496
00497 foreach ($active_auth_modes as $auth_name => $auth_key)
00498 {
00499 $this->tpl->setCurrentBlock("auth_mode_selection");
00500
00501 if ($auth_name == 'default')
00502 {
00503 $name = $this->lng->txt('auth_'.$auth_name)." (".$this->lng->txt('auth_'.ilAuthUtils::_getAuthModeName($auth_key)).")";
00504 }
00505 else
00506 {
00507 $name = $this->lng->txt('auth_'.$auth_name);
00508 }
00509
00510 $this->tpl->setVariable("AUTH_MODE_NAME", $name);
00511
00512 $this->tpl->setVariable("AUTH_MODE", $auth_name);
00513
00514 if ($selected_auth_mode == $auth_name)
00515 {
00516 $this->tpl->setVariable("SELECTED_AUTH_MODE", "selected=\"selected\"");
00517 }
00518
00519 $this->tpl->parseCurrentBlock();
00520 }
00521
00522
00523 $languages = $this->lng->getInstalledLanguages();
00524
00525
00526 $selected_lang = (isset($_SESSION["error_post_vars"]["Fobject"]["language"])) ?
00527 $_SESSION["error_post_vars"]["Fobject"]["language"] : $this->ilias->getSetting("language");
00528
00529 foreach ($languages as $lang_key)
00530 {
00531 $this->tpl->setCurrentBlock("language_selection");
00532 $this->tpl->setVariable("LANG", $this->lng->txt("lang_".$lang_key));
00533 $this->tpl->setVariable("LANGSHORT", $lang_key);
00534
00535 if ($selected_lang == $lang_key)
00536 {
00537 $this->tpl->setVariable("SELECTED_LANG", "selected=\"selected\"");
00538 }
00539
00540 $this->tpl->parseCurrentBlock();
00541 }
00542
00543
00544 $templates = $styleDefinition->getAllTemplates();
00545
00546
00547
00548 if (isset($_SESSION["error_post_vars"]["Fobject"]["skin_style"]))
00549 {
00550 $sknst = explode(":", $_SESSION["error_post_vars"]["Fobject"]["skin_style"]);
00551
00552 $selected_style = $sknst[1];
00553 $selected_skin = $sknst[0];
00554 }
00555 else
00556 {
00557 $selected_style = $this->ilias->ini->readVariable("layout","style");;
00558 $selected_skin = $this->ilias->ini->readVariable("layout","skin");;
00559 }
00560 include_once("classes/class.ilObjStyleSettings.php");
00561 foreach ($templates as $template)
00562 {
00563
00564
00565 $styleDef =& new ilStyleDefinition($template["id"]);
00566 $styleDef->startParsing();
00567 $styles = $styleDef->getStyles();
00568
00569 foreach($styles as $style)
00570 {
00571 if (!ilObjStyleSettings::_lookupActivatedStyle($template["id"],$style["id"]))
00572 {
00573 continue;
00574 }
00575
00576 $this->tpl->setCurrentBlock("selectskin");
00577
00578 if ($selected_skin == $template["id"] &&
00579 $selected_style == $style["id"])
00580 {
00581 $this->tpl->setVariable("SKINSELECTED", "selected=\"selected\"");
00582 }
00583
00584 $this->tpl->setVariable("SKINVALUE", $template["id"].":".$style["id"]);
00585 $this->tpl->setVariable("SKINOPTION", $styleDef->getTemplateName()." / ".$style["name"]);
00586 $this->tpl->parseCurrentBlock();
00587 }
00588 }
00589
00590
00591 $hits_options = array(2,10,15,20,30,40,50,100,9999);
00592
00593 if (isset($_SESSION["error_post_vars"]["Fobject"]["hits_per_page"]))
00594 {
00595 $selected_option = $_SESSION["error_post_vars"]["Fobject"]["hits_per_page"];
00596 }
00597 else
00598 {
00599 $selected_option = $this->ilias->getSetting("hits_per_page");
00600 }
00601 foreach($hits_options as $hits_option)
00602 {
00603 $this->tpl->setCurrentBlock("selecthits");
00604
00605 if ($hits_option == $selected_option)
00606 {
00607 $this->tpl->setVariable("HITSSELECTED", "selected=\"selected\"");
00608 }
00609
00610 $this->tpl->setVariable("HITSVALUE", $hits_option);
00611
00612 if ($hits_option == 9999)
00613 {
00614 $hits_option = $this->lng->txt("no_limit");
00615 }
00616
00617 $this->tpl->setVariable("HITSOPTION", $hits_option);
00618 $this->tpl->parseCurrentBlock();
00619 }
00620
00621
00622
00623
00624 if (isset($_SESSION["error_post_vars"]["Fobject"]["show_users_online"]))
00625 {
00626 $selected_option = $_SESSION["error_post_vars"]["Fobject"]["show_users_online"];
00627 }
00628 else
00629 {
00630 $selected_option = $this->ilias->getSetting("show_users_online");
00631 }
00632 $users_online_options = array("y","associated","n");
00633 foreach($users_online_options as $an_option)
00634 {
00635 $this->tpl->setCurrentBlock("show_users_online");
00636
00637 if ($selected_option == $an_option)
00638 {
00639 $this->tpl->setVariable("USERS_ONLINE_SELECTED", "selected=\"selected\"");
00640 }
00641
00642 $this->tpl->setVariable("USERS_ONLINE_VALUE", $an_option);
00643
00644 $this->tpl->setVariable("USERS_ONLINE_OPTION", $this->lng->txt("users_online_show_".$an_option));
00645 $this->tpl->parseCurrentBlock();
00646 }
00647
00648
00649
00650
00651 if (isset($_SESSION["error_post_vars"]["Fobject"]["hide_own_online_status"]))
00652 {
00653 $hide_own_online_status = $_SESSION["error_post_vars"]["Fobject"]["hide_own_online_status"];
00654 }
00655 else
00656 {
00657 $hide_own_online_status = $this->ilias->getSetting("hide_own_online_status");
00658 }
00659
00660 $this->tpl->setCurrentBlock("hide_own_online_status");
00661 $this->tpl->setVariable("TXT_HIDE_OWN_ONLINE_STATUS", $this->lng->txt("hide_own_online_status"));
00662 if ($hide_own_online_status == "y") {
00663 $this->tpl->setVariable("CHK_HIDE_OWN_ONLINE_STATUS", "checked=\"checked\"");
00664 }
00665 else {
00666 $this->tpl->setVariable("CHK_HIDE_OWN_ONLINE_STATUS", "");
00667 }
00668 $this->tpl->parseCurrentBlock();
00669
00670
00671
00672 if (is_array($_SESSION["error_post_vars"]))
00673 {
00674 $time_limit_unlimited = $_SESSION["error_post_vars"]["time_limit"]["unlimited"];
00675 }
00676 else
00677 {
00678 $time_limit_unlimited = 1;
00679 }
00680
00681 $time_limit_from = $_SESSION["error_post_vars"]["time_limit"]["from"] ?
00682 $this->__toUnix($_SESSION["error_post_vars"]["time_limit"]["from"]) :
00683 time();
00684
00685 $time_limit_until = $_SESSION["error_post_vars"]["time_limit"]["until"] ?
00686 $this->__toUnix($_SESSION["error_post_vars"]["time_limit"]["until"]) :
00687 time();
00688
00689 $this->lng->loadLanguageModule('crs');
00690
00691 $this->tpl->setCurrentBlock("time_limit");
00692 $this->tpl->setVariable("TXT_TIME_LIMIT", $this->lng->txt("time_limit"));
00693 $this->tpl->setVariable("TXT_TIME_LIMIT_UNLIMITED", $this->lng->txt("crs_unlimited"));
00694 $this->tpl->setVariable("TXT_TIME_LIMIT_FROM", $this->lng->txt("crs_from"));
00695 $this->tpl->setVariable("TXT_TIME_LIMIT_UNTIL", $this->lng->txt("crs_to"));
00696 $this->tpl->setVariable("TXT_TIME_LIMIT_CLOCK", $this->lng->txt("clock"));
00697 $this->tpl->setVariable("TIME_LIMIT_UNLIMITED",ilUtil::formCheckbox($time_limit_unlimited,"time_limit[unlimited]",1));
00698 $this->tpl->setVariable("SELECT_TIME_LIMIT_FROM_MINUTE",$this->__getDateSelect("minute","time_limit[from][minute]",
00699 date("i",$time_limit_from)));
00700 $this->tpl->setVariable("SELECT_TIME_LIMIT_FROM_HOUR",$this->__getDateSelect("hour","time_limit[from][hour]",
00701 date("G",$time_limit_from)));
00702 $this->tpl->setVariable("SELECT_TIME_LIMIT_FROM_DAY",$this->__getDateSelect("day","time_limit[from][day]",
00703 date("d",$time_limit_from)));
00704 $this->tpl->setVariable("SELECT_TIME_LIMIT_FROM_MONTH",$this->__getDateSelect("month","time_limit[from][month]",
00705 date("m",$time_limit_from)));
00706 $this->tpl->setVariable("SELECT_TIME_LIMIT_FROM_YEAR",$this->__getDateSelect("year","time_limit[from][year]",
00707 date("Y",$time_limit_from)));
00708 $this->tpl->setVariable("SELECT_TIME_LIMIT_UNTIL_MINUTE",$this->__getDateSelect("minute","time_limit[until][minute]",
00709 date("i",$time_limit_until)));
00710 $this->tpl->setVariable("SELECT_TIME_LIMIT_UNTIL_HOUR",$this->__getDateSelect("hour","time_limit[until][hour]",
00711 date("G",$time_limit_until)));
00712 $this->tpl->setVariable("SELECT_TIME_LIMIT_UNTIL_DAY",$this->__getDateSelect("day","time_limit[until][day]",
00713 date("d",$time_limit_until)));
00714 $this->tpl->setVariable("SELECT_TIME_LIMIT_UNTIL_MONTH",$this->__getDateSelect("month","time_limit[until][month]",
00715 date("m",$time_limit_until)));
00716 $this->tpl->setVariable("SELECT_TIME_LIMIT_UNTIL_YEAR",$this->__getDateSelect("year","time_limit[until][year]",
00717 date("Y",$time_limit_until)));
00718 $this->tpl->parseCurrentBlock();
00719
00720
00721 $this->__showUserDefinedFields();
00722
00723 }
00724
00725 function __checkUserDefinedRequiredFields()
00726 {
00727 include_once './Services/User/classes/class.ilUserDefinedFields.php';
00728 $this->user_defined_fields =& ilUserDefinedFields::_getInstance();
00729
00730 foreach($this->user_defined_fields->getDefinitions() as $field_id => $definition)
00731 {
00732 if($definition['required'] and !strlen($_POST['udf'][$field_id]))
00733 {
00734 return false;
00735 }
00736 }
00737 return true;
00738 }
00739
00740
00741 function __showUserDefinedFields()
00742 {
00743 include_once './Services/User/classes/class.ilUserDefinedFields.php';
00744 $this->user_defined_fields =& ilUserDefinedFields::_getInstance();
00745
00746 if($this->object->getType() == 'usr')
00747 {
00748 $user_defined_data = $this->object->getUserDefinedData();
00749 }
00750 foreach($this->user_defined_fields->getDefinitions() as $field_id => $definition)
00751 {
00752 $old = isset($_SESSION["error_post_vars"]["udf"][$field_id]) ?
00753 $_SESSION["error_post_vars"]["udf"][$field_id] : $user_defined_data[$field_id];
00754
00755 if($definition['field_type'] == UDF_TYPE_TEXT)
00756 {
00757 $this->tpl->setCurrentBlock("field_text");
00758 $this->tpl->setVariable("FIELD_NAME",'udf['.$definition['field_id'].']');
00759 $this->tpl->setVariable("FIELD_VALUE",ilUtil::prepareFormOutput($old));
00760 $this->tpl->parseCurrentBlock();
00761 }
00762 else
00763 {
00764 $this->tpl->setCurrentBlock("field_select");
00765 $this->tpl->setVariable("SELECT_BOX",ilUtil::formSelect($old,
00766 'udf['.$definition['field_id'].']',
00767 $this->user_defined_fields->fieldValuesToSelectArray(
00768 $definition['field_values']),
00769 false,
00770 true));
00771 $this->tpl->parseCurrentBlock();
00772 }
00773 $this->tpl->setCurrentBlock("user_defined");
00774
00775 if($definition['required'])
00776 {
00777 $name = $definition['field_name']."<span class=\"asterisk\">*</span>";
00778 }
00779 else
00780 {
00781 $name = $definition['field_name'];
00782 }
00783 $this->tpl->setVariable("TXT_FIELD_NAME",$name);
00784 $this->tpl->parseCurrentBlock();
00785 }
00786 return true;
00787 }
00788
00789
00914 function editObject()
00915 {
00916 global $ilias, $rbacsystem, $rbacreview, $rbacadmin, $styleDefinition, $ilUser
00917 ,$ilSetting;
00918
00919 include_once('./Services/Authentication/classes/class.ilAuthUtils.php');
00920
00921
00922
00923 $settings = $ilias->getAllSettings();
00924
00925
00926 if($this->usrf_ref_id == USER_FOLDER_ID and !$rbacsystem->checkAccess('visible,read',$this->usrf_ref_id))
00927 {
00928 $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"),$this->ilias->error_obj->MESSAGE);
00929 }
00930
00931
00932 if($this->usrf_ref_id != USER_FOLDER_ID)
00933 {
00934
00935 if(!$rbacsystem->checkAccess('cat_administrate_users',$this->object->getTimeLimitOwner()))
00936 {
00937 $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"),$this->ilias->error_obj->MESSAGE);
00938 }
00939 }
00940
00941 if($this->usrf_ref_id != USER_FOLDER_ID)
00942 {
00943 $this->tabs_gui->clearTargets();
00944 }
00945
00946 $data = array();
00947 $data["fields"] = array();
00948 $data["fields"]["login"] = $this->object->getLogin();
00949 $data["fields"]["passwd"] = "********";
00950 #$data["fields"]["passwd2"] = "********"; // will not be saved
00951 $data["fields"]["ext_account"] = $this->object->getExternalAccount();
00952 $data["fields"]["title"] = $this->object->getUTitle();
00953 $data["fields"]["gender"] = $this->object->getGender();
00954 $data["fields"]["firstname"] = $this->object->getFirstname();
00955 $data["fields"]["lastname"] = $this->object->getLastname();
00956 $data["fields"]["institution"] = $this->object->getInstitution();
00957 $data["fields"]["department"] = $this->object->getDepartment();
00958 $data["fields"]["street"] = $this->object->getStreet();
00959 $data["fields"]["city"] = $this->object->getCity();
00960 $data["fields"]["zipcode"] = $this->object->getZipcode();
00961 $data["fields"]["country"] = $this->object->getCountry();
00962 $data["fields"]["phone_office"] = $this->object->getPhoneOffice();
00963 $data["fields"]["phone_home"] = $this->object->getPhoneHome();
00964 $data["fields"]["phone_mobile"] = $this->object->getPhoneMobile();
00965 $data["fields"]["fax"] = $this->object->getFax();
00966 $data["fields"]["email"] = $this->object->getEmail();
00967 $data["fields"]["hobby"] = $this->object->getHobby();
00968 $data["fields"]["im_icq"] = $this->object->getInstantMessengerId('icq');
00969 $data["fields"]["im_yahoo"] = $this->object->getInstantMessengerId('yahoo');
00970 $data["fields"]["im_msn"] = $this->object->getInstantMessengerId('msn');
00971 $data["fields"]["im_aim"] = $this->object->getInstantMessengerId('aim');
00972 $data["fields"]["im_skype"] = $this->object->getInstantMessengerId('skype');
00973 $data["fields"]["matriculation"] = $this->object->getMatriculation();
00974 $data["fields"]["client_ip"] = $this->object->getClientIP();
00975 $data["fields"]["referral_comment"] = $this->object->getComment();
00976 $data["fields"]["create_date"] = $this->object->getCreateDate();
00977 $data["fields"]["approve_date"] = $this->object->getApproveDate();
00978 $data["fields"]["active"] = $this->object->getActive();
00979 $data["fields"]["auth_mode"] = $this->object->getAuthMode();
00980 $data["fields"]["ext_account"] = $this->object->getExternalAccount();
00981
00982 if (!count($user_online = ilUtil::getUsersOnline($this->object->getId())) == 1)
00983 {
00984 $user_is_online = false;
00985 }
00986 else
00987 {
00988 $user_is_online = true;
00989
00990
00991 preg_match("/RoleId.*?;\}/",$user_online[$this->object->getId()]["data"],$matches);
00992
00993 $active_roles = unserialize(substr($matches[0],7));
00994
00995
00996 $assigned_roles = $rbacreview->assignedRoles($this->object->getId());
00997
00998 foreach ($assigned_roles as $key => $role)
00999 {
01000 $roleObj = $this->ilias->obj_factory->getInstanceByObjId($role);
01001
01002
01003 $rolf = $rbacreview->getFoldersAssignedToRole($role,true);
01004
01005
01006 if (count($rolf) > 0)
01007 {
01008 if (!$rbacreview->isDeleted($rolf[0]))
01009 {
01010 $path = "";
01011
01012 if ($this->tree->isInTree($rolf[0]))
01013 {
01014 $tmpPath = $this->tree->getPathFull($rolf[0]);
01015
01016
01017 for ($i = 0; $i < (count($tmpPath)-1); $i++)
01018 {
01019 if ($path != "")
01020 {
01021 $path .= " > ";
01022 }
01023
01024 $path .= $tmpPath[$i]["title"];
01025 }
01026 }
01027 else
01028 {
01029 $path = "<b>Rolefolder ".$rolf[0]." not found in tree! (Role ".$role.")</b>";
01030 }
01031 $active_roles = $active_roles ? $active_roles : array();
01032 if (in_array($role,$active_roles))
01033 {
01034 $data["active_role"][$role]["active"] = true;
01035 }
01036
01037 $data["active_role"][$role]["title"] = $roleObj->getTitle();
01038 $data["active_role"][$role]["context"] = $path;
01039
01040 unset($roleObj);
01041 }
01042 }
01043 else
01044 {
01045 $path = "<b>No role folder found for role ".$role."!</b>";
01046 }
01047 }
01048 }
01049
01050 $this->getTemplateFile("edit","usr");
01051
01052
01053 if (isset($_SESSION["error_post_vars"]["Fobject"]))
01054 {
01055 if (!isset($_SESSION["error_post_vars"]["Fobject"]["active"]))
01056 {
01057 $_SESSION["error_post_vars"]["Fobject"]["active"] = 0;
01058 }
01059
01060 foreach ($_SESSION["error_post_vars"]["Fobject"] as $key => $val)
01061 {
01062 $str = $this->lng->txt($key);
01063 if ($key == "title")
01064 {
01065 $str = $this->lng->txt("person_title");
01066 }
01067 if($key == 'passwd2')
01068 {
01069 continue;
01070 }
01071 if($key == 'passwd')
01072 {
01073 if(ilAuthUtils::_allowPasswordModificationByAuthMode(
01074 ilAuthUtils::_getAuthMode($_SESSION['error_post_vars']['Fobject']['auth_mode'])))
01075 {
01076 $this->tpl->setCurrentBlock('passwords_visible');
01077 $this->tpl->setVariable('VISIBLE_TXT_PASSWD',$this->lng->txt('passwd'));
01078 $this->tpl->setVariable('VISIBLE_TXT_PASSWD2',$this->lng->txt('retype_password'));
01079 $this->tpl->setVariable('VISIBLE_PASSWD',$_SESSION['error_post_vars']['Fobject']['passwd']);
01080 $this->tpl->setVariable('VISIBLE_PASSWD2',$_SESSION['error_post_vars']['Fobject']['passwd2']);
01081 $this->tpl->parseCurrentBlock();
01082 }
01083 else
01084 {
01085 $this->tpl->setCurrentBlock('passwords_invisible');
01086 $this->tpl->setVariable('INVISIBLE_TXT_PASSWD',$this->lng->txt('passwd'));
01087 $this->tpl->setVariable('INVISIBLE_TXT_PASSWD2',$this->lng->txt('retype_password'));
01088 $this->tpl->setVariable('INVISIBLE_PASSWD',strlen($this->object->getPasswd()) ?
01089 "********" :
01090 "");
01091 $this->tpl->setVariable('INVISIBLE_PASSWD2',strlen($this->object->getPasswd()) ?
01092 "********" :
01093 "");
01094 $this->tpl->setVariable('INVISIBLE_PASSWD_HIDDEN',"********");
01095 $this->tpl->parseCurrentBlock();
01096
01097 }
01098 continue;
01099 }
01100
01101
01102 if (isset($settings["require_" . $key]) && $settings["require_" . $key])
01103 {
01104 $str = $str . '<span class="asterisk">*</span>';
01105 }
01106
01107 $this->tpl->setVariable("TXT_".strtoupper($key), $str);
01108
01109 if ($key != "default_role" and $key != "language"
01110 and $key != "skin_style" and $key != "hits_per_page"
01111 and $key != "show_users_online")
01112 {
01113 $this->tpl->setVariable(strtoupper($key), ilUtil::prepareFormOutput($val,true));
01114 }
01115 }
01116
01117
01118 $gender = strtoupper($_SESSION["error_post_vars"]["Fobject"]["gender"]);
01119
01120
01121 if (!empty($gender))
01122 {
01123 $this->tpl->setVariable("BTN_GENDER_".$gender,"checked=\"checked\"");
01124 }
01125
01126 $active = $_SESSION["error_post_vars"]["Fobject"]["active"];
01127 if ($active)
01128 {
01129 $this->tpl->setVariable("ACTIVE", "checked=\"checked\"");
01130 }
01131 }
01132 else
01133 {
01134 if (!isset($data["fields"]["active"]))
01135 {
01136 $data["fields"]["active"] = 0;
01137 }
01138
01139 foreach ($data["fields"] as $key => $val)
01140 {
01141 $str = $this->lng->txt($key);
01142 if ($key == "title")
01143 {
01144 $str = $this->lng->txt("person_title");
01145 }
01146 if ($key == "ext_account")
01147 {
01148 continue;
01149 }
01150 if($key == 'passwd')
01151 {
01152 $auth_mode = $this->object->getAuthMode(true);
01153 if(ilAuthUtils::_allowPasswordModificationByAuthMode($auth_mode))
01154 {
01155 $this->tpl->setCurrentBlock('passwords_visible');
01156 $this->tpl->setVariable('VISIBLE_TXT_PASSWD',$this->lng->txt('passwd'));
01157 $this->tpl->setVariable('VISIBLE_TXT_PASSWD2',$this->lng->txt('retype_password'));
01158 $this->tpl->setVariable('VISIBLE_PASSWD',"********");
01159 $this->tpl->setVariable('VISIBLE_PASSWD2',"********");
01160 $this->tpl->parseCurrentBlock();
01161 }
01162 else
01163 {
01164 $this->tpl->setCurrentBlock('passwords_invisible');
01165 $this->tpl->setVariable('INVISIBLE_TXT_PASSWD',$this->lng->txt('passwd'));
01166 $this->tpl->setVariable('INVISIBLE_TXT_PASSWD2',$this->lng->txt('retype_password'));
01167 $this->tpl->setVariable('INVISIBLE_PASSWD',strlen($this->object->getPasswd()) ?
01168 "********" :
01169 "");
01170 $this->tpl->setVariable('INVISIBLE_PASSWD2',strlen($this->object->getPasswd()) ?
01171 "********" :
01172 "");
01173 $this->tpl->setVariable('INVISIBLE_PASSWD_HIDDEN',"********");
01174 $this->tpl->parseCurrentBlock();
01175 }
01176 continue;
01177 }
01178
01179
01180 if (isset($settings["require_" . $key]) && $settings["require_" . $key])
01181 {
01182 $str = $str . '<span class="asterisk">*</span>';
01183 }
01184
01185 $this->tpl->setVariable("TXT_".strtoupper($key), $str);
01186
01187 $this->tpl->setVariable(strtoupper($key), ilUtil::prepareFormOutput($val));
01188 #$this->tpl->parseCurrentBlock();
01189 }
01190
01191
01192 $gender = strtoupper($data["fields"]["gender"]);
01193
01194 if (!empty($gender))
01195 {
01196 $this->tpl->setVariable("BTN_GENDER_".$gender,"checked=\"checked\"");
01197 }
01198
01199 $active = $data["fields"]["active"];
01200 if ($active)
01201 {
01202 $this->tpl->setVariable("ACTIVE", "checked=\"checked\"");
01203 }
01204 }
01205
01206
01207 include_once('./Services/Authentication/classes/class.ilAuthUtils.php');
01208 if(ilAuthUtils::_isExternalAccountEnabled())
01209 {
01210 $this->tpl->setCurrentBlock("ext_account");
01211 $this->tpl->setVariable("TXT_EXT_ACCOUNT",$this->lng->txt("user_ext_account"));
01212 $this->tpl->setVariable("TXT_EXT_ACCOUNT_DESC",$this->lng->txt("user_ext_account_desc"));
01213 if (isset($_SESSION["error_post_vars"]["Fobject"]["ext_account"]))
01214 {
01215 $this->tpl->setVariable("EXT_ACCOUNT_VAL",
01216 $_SESSION["error_post_vars"]["Fobject"]["ext_account"]);
01217 }
01218 else
01219 {
01220 $this->tpl->setVariable("EXT_ACCOUNT_VAL",
01221 $data["fields"]["ext_account"]);
01222 }
01223
01224
01225
01226
01227
01228
01229
01230
01231
01232 $this->tpl->parseCurrentBlock();
01233 }
01234 $auth_mode = $_SESSION['error_post_vars']['Fobject']['auth_mode'] ?
01235 ilAuthUtils::_getAuthMode($_SESSION['error_post_vars']['Fobject']['auth_mode']) :
01236 $this->object->getAuthMode(true);
01237 if(!ilAuthUtils::_allowPasswordModificationByAuthMode($auth_mode))
01238 {
01239 $this->tpl->setVariable("OPTION_DISABLED", "\"disabled=disabled\"");
01240 }
01241 $obj_str = ($this->call_by_reference) ? "" : "&obj_id=".$this->obj_id;
01242
01243 $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
01244 $this->tpl->setVariable("TXT_HEADER", $this->lng->txt($this->object->getType()."_edit"));
01245 $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
01246 $this->tpl->setVariable("TXT_SUBMIT", $this->lng->txt("save"));
01247 $this->tpl->setVariable("CMD_SUBMIT", "update");
01248 $this->tpl->setVariable("TARGET", $this->getTargetFrame("update"));
01249 $this->tpl->setVariable("TXT_REQUIRED_FLD", $this->lng->txt("required_field"));
01250
01251 $this->tpl->setVariable("TXT_LOGIN_DATA", $this->lng->txt("login_data"));
01252 $this->tpl->setVariable("TXT_SYSTEM_INFO", $this->lng->txt("system_information"));
01253 $this->tpl->setVariable("TXT_PERSONAL_DATA", $this->lng->txt("personal_data"));
01254 $this->tpl->setVariable("TXT_CONTACT_DATA", $this->lng->txt("contact_data"));
01255 $this->tpl->setVariable("TXT_SETTINGS", $this->lng->txt("settings"));
01256 $this->tpl->setVariable("TXT_LANGUAGE",$this->lng->txt("language"));
01257 $this->tpl->setVariable("TXT_SKIN_STYLE",$this->lng->txt("usr_skin_style"));
01258 $this->tpl->setVariable("TXT_HITS_PER_PAGE",$this->lng->txt("hits_per_page"));
01259 $this->tpl->setVariable("TXT_SHOW_USERS_ONLINE",$this->lng->txt("show_users_online"));
01260 $this->tpl->setVariable("TXT_GENDER_F",$this->lng->txt("gender_f"));
01261 $this->tpl->setVariable("TXT_GENDER_M",$this->lng->txt("gender_m"));
01262 $this->tpl->setVariable("TXT_INSTANT_MESSENGERS",$this->lng->txt("user_profile_instant_messengers"));
01263 $this->tpl->setVariable("TXT_OTHER",$this->lng->txt("user_profile_other"));
01264 if ($this->object->getId() == $ilUser->getId())
01265 {
01266 $this->tpl->setVariable("TXT_CURRENT_IP","(".$this->lng->txt("current_ip")." ".$_SERVER["REMOTE_ADDR"].")");
01267 }
01268 $this->tpl->setVariable("TXT_CURRENT_IP_ALERT",$this->lng->txt("current_ip_alert"));
01269
01270
01271 include_once('./Services/Authentication/classes/class.ilAuthUtils.php');
01272 $active_auth_modes = ilAuthUtils::_getActiveAuthModes();
01273
01274
01275 $selected_auth_mode = (isset($_SESSION["error_post_vars"]["Fobject"]["auth_mode"])) ? $_SESSION["error_post_vars"]["Fobject"]["auth_mode"] : $this->object->getAuthMode();
01276
01277 foreach ($active_auth_modes as $auth_name => $auth_key)
01278 {
01279 $this->tpl->setCurrentBlock("auth_mode_selection");
01280
01281 if ($auth_name == 'default')
01282 {
01283 $name = $this->lng->txt('auth_'.$auth_name)." (".$this->lng->txt('auth_'.ilAuthUtils::_getAuthModeName($auth_key)).")";
01284 }
01285 else
01286 {
01287 $name = $this->lng->txt('auth_'.$auth_name);
01288 }
01289
01290 $this->tpl->setVariable("AUTH_MODE_NAME", $name);
01291
01292 $this->tpl->setVariable("AUTH_MODE", $auth_name);
01293
01294 if ($selected_auth_mode == $auth_name)
01295 {
01296 $this->tpl->setVariable("SELECTED_AUTH_MODE", "selected=\"selected\"");
01297 }
01298
01299 $this->tpl->parseCurrentBlock();
01300 }
01301
01302
01303
01304 $languages = $this->lng->getInstalledLanguages();
01305
01306
01307 $selected_lang = (isset($_SESSION["error_post_vars"]["Fobject"]["language"])) ? $_SESSION["error_post_vars"]["Fobject"]["language"] : $this->object->getLanguage();
01308
01309 foreach ($languages as $lang_key)
01310 {
01311 $this->tpl->setCurrentBlock("language_selection");
01312 $this->tpl->setVariable("LANG", $this->lng->txt("lang_".$lang_key));
01313 $this->tpl->setVariable("LANGSHORT", $lang_key);
01314
01315 if ($selected_lang == $lang_key)
01316 {
01317 $this->tpl->setVariable("SELECTED_LANG", "selected=\"selected\"");
01318 }
01319
01320 $this->tpl->parseCurrentBlock();
01321 }
01322
01323
01324
01325 $templates = $styleDefinition->getAllTemplates();
01326
01327
01328 if (isset($_SESSION["error_post_vars"]["Fobject"]["skin_style"]))
01329 {
01330 $sknst = explode(":", $_SESSION["error_post_vars"]["Fobject"]["skin_style"]);
01331
01332 $selected_style = $sknst[1];
01333 $selected_skin = $sknst[0];
01334 }
01335 else
01336 {
01337 $selected_style = $this->object->prefs["style"];
01338 $selected_skin = $this->object->skin;
01339 }
01340
01341 include("classes/class.ilObjStyleSettings.php");
01342 if (count($templates) > 0 && is_array ($templates))
01343 {
01344 foreach ($templates as $template)
01345 {
01346
01347
01348 $styleDef =& new ilStyleDefinition($template["id"]);
01349 $styleDef->startParsing();
01350 $styles = $styleDef->getStyles();
01351 foreach ($styles as $style)
01352 {
01353 if (!ilObjStyleSettings::_lookupActivatedStyle($template["id"],$style["id"]))
01354 {
01355 continue;
01356 }
01357
01358 $this->tpl->setCurrentBlock("selectskin");
01359
01360 if ($selected_skin == $template["id"] &&
01361 $selected_style == $style["id"])
01362 {
01363 $this->tpl->setVariable("SKINSELECTED", "selected=\"selected\"");
01364 }
01365
01366 $this->tpl->setVariable("SKINVALUE", $template["id"].":".$style["id"]);
01367 $this->tpl->setVariable("SKINOPTION", $styleDef->getTemplateName()." / ".$style["name"]);
01368 $this->tpl->parseCurrentBlock();
01369 }
01370 }
01371 }
01372
01373 $hits_options = array(2,10,15,20,30,40,50,100,9999);
01374
01375 if (isset($_SESSION["error_post_vars"]["Fobject"]["hits_per_page"]))
01376 {
01377 $selected_option = $_SESSION["error_post_vars"]["Fobject"]["hits_per_page"];
01378 }
01379 else
01380 {
01381 $selected_option = $this->object->prefs["hits_per_page"];
01382 }
01383 foreach($hits_options as $hits_option)
01384 {
01385 $this->tpl->setCurrentBlock("selecthits");
01386
01387 if ($selected_option == $hits_option)
01388 {
01389 $this->tpl->setVariable("HITSSELECTED", "selected=\"selected\"");
01390 }
01391
01392 $this->tpl->setVariable("HITSVALUE", $hits_option);
01393
01394 if ($hits_option == 9999)
01395 {
01396 $hits_option = $this->lng->txt("no_limit");
01397 }
01398
01399 $this->tpl->setVariable("HITSOPTION", $hits_option);
01400 $this->tpl->parseCurrentBlock();
01401 }
01402
01403
01404
01405 $users_online_options = array("y","associated","n");
01406
01407 if (isset($_SESSION["error_post_vars"]["Fobject"]["show_users_online"]))
01408 {
01409 $selected_option = $_SESSION["error_post_vars"]["Fobject"]["show_users_online"];
01410 }
01411 else
01412 {
01413 $selected_option = $this->object->prefs["show_users_online"];
01414 }
01415 foreach($users_online_options as $an_option)
01416 {
01417 $this->tpl->setCurrentBlock("show_users_online");
01418
01419 if ($selected_option == $an_option)
01420 {
01421 $this->tpl->setVariable("USERS_ONLINE_SELECTED", "selected=\"selected\"");
01422 }
01423
01424 $this->tpl->setVariable("USERS_ONLINE_VALUE", $an_option);
01425
01426 $this->tpl->setVariable("USERS_ONLINE_OPTION", $this->lng->txt("users_online_show_".$an_option));
01427 $this->tpl->parseCurrentBlock();
01428 }
01429
01430
01431
01432 if (isset($_SESSION["error_post_vars"]["Fobject"]["hide_own_online_status"]))
01433 {
01434 $hide_own_online_status = $_SESSION["error_post_vars"]["Fobject"]["hide_own_online_status"];
01435 }
01436 else
01437 {
01438 $hide_own_online_status = ($this->object->prefs["hide_own_online_status"] != '') ? $this->object->prefs["hide_own_online_status"] : "n";
01439 }
01440 $this->tpl->setCurrentBlock("hide_own_online_status");
01441 $this->tpl->setVariable("TXT_HIDE_OWN_ONLINE_STATUS", $this->lng->txt("hide_own_online_status"));
01442 if ($hide_own_online_status == "y") {
01443 $this->tpl->setVariable("CHK_HIDE_OWN_ONLINE_STATUS", "checked=\"checked\"");
01444 }
01445 else {
01446 $this->tpl->setVariable("CHK_HIDE_OWN_ONLINE_STATUS", "");
01447 }
01448 $this->tpl->parseCurrentBlock();
01449
01450
01451
01452 $this->tpl->setCurrentBlock("inform_user");
01453
01454
01455 if (true)
01456 {
01457 $this->tpl->setVariable("SEND_MAIL", " checked=\"checked\"");
01458 }
01459
01460 $this->tpl->setVariable("TXT_INFORM_USER_MAIL", $this->lng->txt("inform_user_mail"));
01461 $this->tpl->parseCurrentBlock();
01462
01463 $this->lng->loadLanguageModule('crs');
01464
01465 $time_limit_unlimited = $_SESSION["error_post_vars"]["time_limit"]["unlimited"] ?
01466 $_SESSION["error_post_vars"]["time_limit"]["unlimited"] :
01467 $this->object->getTimeLimitUnlimited();
01468 $time_limit_from = $_SESSION["error_post_vars"]["time_limit"]["from"] ?
01469 $this->__toUnix($_SESSION["error_post_vars"]["time_limit"]["from"]) :
01470 $this->object->getTimeLimitFrom();
01471
01472 $time_limit_until = $_SESSION["error_post_vars"]["time_limit"]["until"] ?
01473 $this->__toUnix($_SESSION["error_post_vars"]["time_limit"]["until"]) :
01474 $this->object->getTimeLimitUntil();
01475
01476 $this->tpl->setCurrentBlock("time_limit");
01477 $this->tpl->setVariable("TXT_TIME_LIMIT", $this->lng->txt("time_limit"));
01478 $this->tpl->setVariable("TXT_TIME_LIMIT_UNLIMITED", $this->lng->txt("crs_unlimited"));
01479 $this->tpl->setVariable("TXT_TIME_LIMIT_FROM", $this->lng->txt("crs_from"));
01480 $this->tpl->setVariable("TXT_TIME_LIMIT_UNTIL", $this->lng->txt("crs_to"));
01481
01482 $this->tpl->setVariable("TIME_LIMIT_UNLIMITED",ilUtil::formCheckbox($time_limit_unlimited,"time_limit[unlimited]",1));
01483 $this->tpl->setVariable("SELECT_TIME_LIMIT_FROM_MINUTE",$this->__getDateSelect("minute","time_limit[from][minute]",
01484 date("i",$time_limit_from)));
01485 $this->tpl->setVariable("SELECT_TIME_LIMIT_FROM_HOUR",$this->__getDateSelect("hour","time_limit[from][hour]",
01486 date("G",$time_limit_from)));
01487 $this->tpl->setVariable("SELECT_TIME_LIMIT_FROM_DAY",$this->__getDateSelect("day","time_limit[from][day]",
01488 date("d",$time_limit_from)));
01489 $this->tpl->setVariable("SELECT_TIME_LIMIT_FROM_MONTH",$this->__getDateSelect("month","time_limit[from][month]",
01490 date("m",$time_limit_from)));
01491 $this->tpl->setVariable("SELECT_TIME_LIMIT_FROM_YEAR",$this->__getDateSelect("year","time_limit[from][year]",
01492 date("Y",$time_limit_from)));
01493 $this->tpl->setVariable("SELECT_TIME_LIMIT_UNTIL_MINUTE",$this->__getDateSelect("minute","time_limit[until][minute]",
01494 date("i",$time_limit_until)));
01495 $this->tpl->setVariable("SELECT_TIME_LIMIT_UNTIL_HOUR",$this->__getDateSelect("hour","time_limit[until][hour]",
01496 date("G",$time_limit_until)));
01497 $this->tpl->setVariable("SELECT_TIME_LIMIT_UNTIL_DAY",$this->__getDateSelect("day","time_limit[until][day]",
01498 date("d",$time_limit_until)));
01499 $this->tpl->setVariable("SELECT_TIME_LIMIT_UNTIL_MONTH",$this->__getDateSelect("month","time_limit[until][month]",
01500 date("m",$time_limit_until)));
01501 $this->tpl->setVariable("SELECT_TIME_LIMIT_UNTIL_YEAR",$this->__getDateSelect("year","time_limit[until][year]",
01502 date("Y",$time_limit_until)));
01503 $this->tpl->parseCurrentBlock();
01504
01505
01506
01507
01508
01509
01510
01511
01512
01513
01514
01515
01516
01517
01518
01519
01520
01521
01522
01523
01524
01525
01526
01527
01528
01529
01530
01531
01532
01533
01534
01535
01536
01537
01538
01539 $this->__showUserDefinedFields();
01540 }
01541
01546 function saveObject()
01547 {
01548 global $ilias, $rbacsystem, $rbacadmin, $ilSetting;
01549
01550 include_once('./Services/Authentication/classes/class.ilAuthUtils.php');
01551
01552
01553 $settings = $ilias->getAllSettings();
01554
01555
01556 if (!$rbacsystem->checkAccess('create_user', $this->usrf_ref_id) and
01557 !$rbacsystem->checkAccess('cat_administrate_users',$this->usrf_ref_id))
01558 {
01559 $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
01560 }
01561
01562
01563 foreach ($settings as $key => $val)
01564 {
01565 if (substr($key,0,8) == "require_")
01566 {
01567 $field = substr($key,8);
01568
01569 switch($field)
01570 {
01571 case 'passwd':
01572 case 'passwd2':
01573 if(ilAuthUtils::_allowPasswordModificationByAuthMode(ilAuthUtils::_getAuthMode($_POST['Fobject']['auth_mode'])))
01574 {
01575 $require_keys[] = $field;
01576 }
01577 break;
01578 default:
01579 $require_keys[] = $field;
01580 break;
01581 }
01582 }
01583 }
01584
01585 foreach ($require_keys as $key => $val)
01586 {
01587 if (isset($settings["require_" . $val]) && $settings["require_" . $val])
01588 {
01589 if (empty($_POST["Fobject"][$val]))
01590 {
01591 $this->ilias->raiseError($this->lng->txt("fill_out_all_required_fields") . ": " .
01592 $this->lng->txt($val),$this->ilias->error_obj->MESSAGE);
01593 }
01594 }
01595 }
01596
01597 if(!$this->__checkUserDefinedRequiredFields())
01598 {
01599 $this->ilias->raiseError($this->lng->txt("fill_out_all_required_fields"),$this->ilias->error_obj->MESSAGE);
01600 }
01601
01602
01603 if (!ilUtil::isLogin($_POST["Fobject"]["login"]))
01604 {
01605 $this->ilias->raiseError($this->lng->txt("login_invalid"),$this->ilias->error_obj->MESSAGE);
01606 }
01607
01608
01609 if (ilObjUser::_loginExists($_POST["Fobject"]["login"]))
01610 {
01611 $this->ilias->raiseError($this->lng->txt("login_exists"),$this->ilias->error_obj->MESSAGE);
01612 }
01613
01614
01615 include_once('./Services/Authentication/classes/class.ilAuthUtils.php');
01616 if(ilAuthUtils::_allowPasswordModificationByAuthMode(ilAuthUtils::_getAuthMode($_POST['Fobject']['auth_mode'])))
01617 {
01618
01619 if ($_POST["Fobject"]["passwd"] != $_POST["Fobject"]["passwd2"])
01620 {
01621 $this->ilias->raiseError($this->lng->txt("passwd_not_match"),$this->ilias->error_obj->MESSAGE);
01622 }
01623
01624
01625 if (!ilUtil::isPassword($_POST["Fobject"]["passwd"]))
01626 {
01627 $this->ilias->raiseError($this->lng->txt("passwd_invalid"),$this->ilias->error_obj->MESSAGE);
01628 }
01629 }
01630 if(ilAuthUtils::_needsExternalAccountByAuthMode(ilAuthUtils::_getAuthMode($_POST['Fobject']['auth_mode'])))
01631 {
01632 if(!strlen($_POST['Fobject']['ext_account']))
01633 {
01634 $this->ilias->raiseError($this->lng->txt('ext_acccount_required'),$this->ilias->error_obj->MESSAGE);
01635 }
01636 }
01637
01638 if($_POST['Fobject']['ext_account'] &&
01639 ($elogin = ilObjUser::_checkExternalAuthAccount($_POST['Fobject']['auth_mode'],$_POST['Fobject']['ext_account'])))
01640 {
01641 if($elogin != '')
01642 {
01643 $this->ilias->raiseError(
01644 sprintf($this->lng->txt("err_auth_ext_user_exists"),
01645 $_POST["Fobject"]["ext_account"],
01646 $_POST['Fobject']['auth_mode'],
01647 $elogin),
01648 $this->ilias->error_obj->MESSAGE);
01649 }
01650 }
01651
01652
01653
01654
01655 include_once ('./Services/User/classes/class.ilObjUser.php');
01656 $_POST["Fobject"]["passwd_type"] = IL_PASSWD_PLAIN;
01657
01658
01659 if (strlen($_POST['Fobject']['email']) and !ilUtil::is_email($_POST["Fobject"]["email"]))
01660 {
01661 $this->ilias->raiseError($this->lng->txt("email_not_valid"),$this->ilias->error_obj->MESSAGE);
01662 }
01663
01664
01665 if ($_POST["time_limit"]["unlimited"] != 1 and
01666 ($this->__toUnix($_POST["time_limit"]["until"]) < $this->__toUnix($_POST["time_limit"]["from"])))
01667 {
01668 $this->ilias->raiseError($this->lng->txt("time_limit_not_valid"),$this->ilias->error_obj->MESSAGE);
01669 }
01670 if(!$this->ilias->account->getTimeLimitUnlimited())
01671 {
01672 if($this->__toUnix($_POST["time_limit"]["from"]) < $this->ilias->account->getTimeLimitFrom() or
01673 $this->__toUnix($_POST["time_limit"]["until"])> $this->ilias->account->getTimeLimitUntil() or
01674 $_POST['time_limit']['unlimited'])
01675 {
01676 $this->ilias->raiseError($this->lng->txt("time_limit_not_within_owners"),$this->ilias->error_obj->MESSAGE);
01677 }
01678 }
01679
01680
01681
01682
01683
01684 $userObj = new ilObjUser();
01685 $userObj->assignData($_POST["Fobject"]);
01686 $userObj->setTitle($userObj->getFullname());
01687 $userObj->setDescription($userObj->getEmail());
01688
01689 $userObj->setTimeLimitOwner($this->object->getRefId());
01690 $userObj->setTimeLimitUnlimited($_POST["time_limit"]["unlimited"]);
01691 $userObj->setTimeLimitFrom($this->__toUnix($_POST["time_limit"]["from"]));
01692 $userObj->setTimeLimitUntil($this->__toUnix($_POST["time_limit"]["until"]));
01693
01694 $userObj->setUserDefinedData($_POST['udf']);
01695
01696 $userObj->create();
01697
01698 include_once('./Services/Authentication/classes/class.ilAuthUtils.php');
01699 if(ilAuthUtils::_isExternalAccountEnabled())
01700 {
01701 $userObj->setExternalAccount($_POST["Fobject"]["ext_account"]);
01702 }
01703
01704
01705
01706
01707 $userObj->saveAsNew();
01708
01709
01710 $userObj->setLanguage($_POST["Fobject"]["language"]);
01711
01712
01713 $sknst = explode(":", $_POST["Fobject"]["skin_style"]);
01714
01715 if ($userObj->getPref("style") != $sknst[1] ||
01716 $userObj->getPref("skin") != $sknst[0])
01717 {
01718 $userObj->setPref("skin", $sknst[0]);
01719 $userObj->setPref("style", $sknst[1]);
01720 }
01721
01722
01723 $userObj->setPref("hits_per_page", $_POST["Fobject"]["hits_per_page"]);
01724
01725 $userObj->setPref("show_users_online", $_POST["Fobject"]["show_users_online"]);
01726
01727 $userObj->setPref("hide_own_online_status", $_POST["Fobject"]["hide_own_online_status"]);
01728
01729 $userObj->writePrefs();
01730
01731
01732 $rbacadmin->assignUser($_POST["Fobject"]["default_role"],$userObj->getId(),true);
01733
01734 $msg = $this->lng->txt("user_added");
01735
01736
01737 if ($_POST["send_mail"] != "")
01738 {
01739 include_once("Services/Mail/classes/class.ilAccountMail.php");
01740 $acc_mail = new ilAccountMail();
01741 $acc_mail->setUserPassword($_POST["Fobject"]["passwd"]);
01742 $acc_mail->setUser($userObj);
01743
01744 if ($acc_mail->send())
01745 {
01746 $msg = $msg."<br />".$this->lng->txt("mail_sent");
01747 }
01748 else
01749 {
01750 $msg = $msg."<br />".$this->lng->txt("mail_not_sent");
01751 }
01752 }
01753
01754 ilUtil::sendInfo($msg, true);
01755
01756 if(strtolower($_GET["baseClass"]) == 'iladministrationgui')
01757 {
01758 $this->ctrl->redirectByClass("ilobjuserfoldergui", "view");
01759 }
01760 else
01761 {
01762 $this->ctrl->redirectByClass('ilobjcategorygui','listUsers');
01763 }
01764 }
01765
01770 function updateObject()
01771 {
01772 global $ilias, $rbacsystem, $rbacadmin,$ilUser;
01773
01774 include_once('./Services/Authentication/classes/class.ilAuthUtils.php');
01775
01776
01777 $settings = $ilias->getAllSettings();
01778
01779
01780 if($this->usrf_ref_id == USER_FOLDER_ID and !$rbacsystem->checkAccess('visible,read,write',$this->usrf_ref_id))
01781 {
01782 $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"),$this->ilias->error_obj->MESSAGE);
01783 }
01784
01785
01786 if($this->usrf_ref_id != USER_FOLDER_ID)
01787 {
01788
01789 if(!$rbacsystem->checkAccess('cat_administrate_users',$this->object->getTimeLimitOwner()))
01790 {
01791 $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"),$this->ilias->error_obj->MESSAGE);
01792 }
01793 }
01794
01795 foreach ($_POST["Fobject"] as $key => $val)
01796 {
01797 $_POST["Fobject"][$key] = ilUtil::stripSlashes($val);
01798 }
01799
01800
01801 foreach ($settings as $key => $val)
01802 {
01803 $field = substr($key,8);
01804 switch($field)
01805 {
01806 case 'passwd':
01807 case 'passwd2':
01808 if(ilAuthUtils::_allowPasswordModificationByAuthMode(ilAuthUtils::_getAuthMode($_POST['Fobject']['auth_mode'])))
01809 {
01810 $require_keys[] = $field;
01811 }
01812 break;
01813 default:
01814 $require_keys[] = $field;
01815 break;
01816
01817 }
01818 }
01819
01820 foreach ($require_keys as $key => $val)
01821 {
01822
01823 $system_fields = array("default_role");
01824 if (!in_array($val, $system_fields))
01825 {
01826 if (isset($settings["require_" . $val]) && $settings["require_" . $val])
01827 {
01828 if (empty($_POST["Fobject"][$val]))
01829 {
01830 $this->ilias->raiseError($this->lng->txt("fill_out_all_required_fields") . ": " .
01831 $this->lng->txt($val),$this->ilias->error_obj->MESSAGE);
01832 }
01833 }
01834 }
01835 }
01836
01837 if(!$this->__checkUserDefinedRequiredFields())
01838 {
01839 $this->ilias->raiseError($this->lng->txt("fill_out_all_required_fields"),$this->ilias->error_obj->MESSAGE);
01840 }
01841
01842 if ($this->object->getLogin() != $_POST["Fobject"]["login"] &&
01843 !ilUtil::isLogin($_POST["Fobject"]["login"]))
01844 {
01845 $this->ilias->raiseError($this->lng->txt("login_invalid"),$this->ilias->error_obj->MESSAGE);
01846 }
01847
01848
01849 if (ilObjUser::_loginExists($_POST["Fobject"]["login"],$this->id))
01850 {
01851 $this->ilias->raiseError($this->lng->txt("login_exists"),$this->ilias->error_obj->MESSAGE);
01852 }
01853
01854 if(ilAuthUtils::_allowPasswordModificationByAuthMode(ilAuthUtils::_getAuthMode($_POST['Fobject']['auth_mode'])))
01855 {
01856 if($_POST['Fobject']['passwd'] == "********" and
01857 !strlen($this->object->getPasswd()))
01858 {
01859 $this->ilias->raiseError($this->lng->txt("fill_out_all_required_fields") . ": " .
01860 $this->lng->txt('password'),$this->ilias->error_obj->MESSAGE);
01861 }
01862
01863 if ($_POST["Fobject"]["passwd"] != $_POST["Fobject"]["passwd2"])
01864 {
01865 $this->ilias->raiseError($this->lng->txt("passwd_not_match"),$this->ilias->error_obj->MESSAGE);
01866 }
01867
01868
01869 if (!ilUtil::isPassword($_POST["Fobject"]["passwd"]))
01870 {
01871 $this->ilias->raiseError($this->lng->txt("passwd_invalid"),$this->ilias->error_obj->MESSAGE);
01872 }
01873 }
01874 else
01875 {
01876
01877 $_POST['Fobject']['passwd'] = "********";
01878 }
01879 if(ilAuthUtils::_needsExternalAccountByAuthMode(ilAuthUtils::_getAuthMode($_POST['Fobject']['auth_mode'])))
01880 {
01881 if(!strlen($_POST['Fobject']['ext_account']))
01882 {
01883 $this->ilias->raiseError($this->lng->txt('ext_acccount_required'),$this->ilias->error_obj->MESSAGE);
01884 }
01885 }
01886 if($_POST['Fobject']['ext_account'] &&
01887 ($elogin = ilObjUser::_checkExternalAuthAccount($_POST['Fobject']['auth_mode'],$_POST['Fobject']['ext_account'])))
01888 {
01889 if($elogin != $this->object->getLogin())
01890 {
01891 $this->ilias->raiseError(
01892 sprintf($this->lng->txt("err_auth_ext_user_exists"),
01893 $_POST["Fobject"]["ext_account"],
01894 $_POST['Fobject']['auth_mode'],
01895 $elogin),
01896 $this->ilias->error_obj->MESSAGE);
01897 }
01898 }
01899
01900
01901
01902 include_once ('./Services/User/classes/class.ilObjUser.php');
01903 $_POST["Fobject"]["passwd_type"] = IL_PASSWD_PLAIN;
01904
01905
01906 if (strlen($_POST['Fobject']['email']) and !ilUtil::is_email($_POST["Fobject"]["email"]))
01907 {
01908 $this->ilias->raiseError($this->lng->txt("email_not_valid"),$this->ilias->error_obj->MESSAGE);
01909 }
01910
01911 $start = $this->__toUnix($_POST["time_limit"]["from"]);
01912 $end = $this->__toUnix($_POST["time_limit"]["until"]);
01913
01914
01915 if (!$_POST["time_limit"]["unlimited"] and
01916 ( $start > $end))
01917 {
01918 $this->ilias->raiseError($this->lng->txt("time_limit_not_valid"),$this->ilias->error_obj->MESSAGE);
01919 }
01920
01921 if(!$this->ilias->account->getTimeLimitUnlimited())
01922 {
01923 if($start < $this->ilias->account->getTimeLimitFrom() or
01924 $end > $this->ilias->account->getTimeLimitUntil() or
01925 $_POST['time_limit']['unlimited'])
01926 {
01927 $_SESSION['error_post_vars'] = $_POST;
01928
01929 ilUtil::sendInfo($this->lng->txt('time_limit_not_within_owners'));
01930 $this->editObject();
01931
01932 return false;
01933 }
01934 }
01935
01936
01937
01938
01939 $_POST['Fobject']['time_limit_owner'] = $this->object->getTimeLimitOwner();
01940
01941 $_POST['Fobject']['time_limit_unlimited'] = (int) $_POST['time_limit']['unlimited'];
01942 $_POST['Fobject']['time_limit_from'] = $this->__toUnix($_POST['time_limit']['from']);
01943 $_POST['Fobject']['time_limit_until'] = $this->__toUnix($_POST['time_limit']['until']);
01944
01945 if($_POST['Fobject']['time_limit_unlimited'] != $this->object->getTimeLimitUnlimited() or
01946 $_POST['Fobject']['time_limit_from'] != $this->object->getTimeLimitFrom() or
01947 $_POST['Fobject']['time_limit_until'] != $this->object->getTimeLimitUntil())
01948 {
01949 $_POST['Fobject']['time_limit_message'] = 0;
01950 }
01951 else
01952 {
01953 $_POST['Fobject']['time_limit_message'] = $this->object->getTimeLimitMessage();
01954 }
01955
01956 $this->object->assignData($_POST["Fobject"]);
01957 $this->object->setUserDefinedData($_POST['udf']);
01958
01959 $this->object->updateLogin($_POST["Fobject"]["login"]);
01960 $this->object->setTitle($this->object->getFullname());
01961 $this->object->setDescription($this->object->getEmail());
01962 $this->object->setLanguage($_POST["Fobject"]["language"]);
01963
01964
01965 $sknst = explode(":", $_POST["Fobject"]["skin_style"]);
01966
01967 if ($this->object->getPref("style") != $sknst[1] ||
01968 $this->object->getPref("skin") != $sknst[0])
01969 {
01970 $this->object->setPref("skin", $sknst[0]);
01971 $this->object->setPref("style", $sknst[1]);
01972 }
01973
01974
01975 $this->object->setPref("hits_per_page", $_POST["Fobject"]["hits_per_page"]);
01976
01977 $this->object->setPref("show_users_online", $_POST["Fobject"]["show_users_online"]);
01978
01979 if ($_POST["Fobject"]["hide_own_online_status"]) {
01980 $this->object->setPref("hide_own_online_status", $_POST["Fobject"]["hide_own_online_status"]);
01981 }
01982 else {
01983 $this->object->setPref("hide_own_online_status", "n");
01984 }
01985
01986 $this->update = $this->object->update();
01987
01988
01989 $mail_message = $this->__sendProfileMail();
01990 $msg = $this->lng->txt('saved_successfully').$mail_message;
01991
01992
01993 ilUtil::sendInfo($msg,true);
01994
01995 if (strtolower($_GET["baseClass"]) == 'iladministrationgui')
01996 {
01997 $this->ctrl->redirectByClass("ilobjuserfoldergui", "view");
01998 }
01999 else
02000 {
02001 $this->ctrl->redirectByClass('ilobjcategorygui','listUsers');
02002 }
02003 }
02004
02005
02006
02012 function assignSaveObject()
02013 {
02014 global $rbacsystem, $rbacadmin, $rbacreview;
02015
02016 if (!$rbacsystem->checkAccess("edit_roleassignment", $this->usrf_ref_id))
02017 {
02018 $this->ilias->raiseError($this->lng->txt("msg_no_perm_assign_role_to_user"),$this->ilias->error_obj->MESSAGE);
02019 }
02020
02021 $selected_roles = $_POST["role_id"] ? $_POST["role_id"] : array();
02022 $posted_roles = $_POST["role_id_ctrl"] ? $_POST["role_id_ctrl"] : array();
02023
02024
02025 if ($this->object->getId() == SYSTEM_USER_ID and in_array(SYSTEM_ROLE_ID, $posted_roles))
02026 {
02027 array_push($selected_roles,SYSTEM_ROLE_ID);
02028 }
02029
02030 $global_roles_all = $rbacreview->getGlobalRoles();
02031 $assigned_roles_all = $rbacreview->assignedRoles($this->object->getId());
02032 $assigned_roles = array_intersect($assigned_roles_all,$posted_roles);
02033 $assigned_global_roles_all = array_intersect($assigned_roles_all,$global_roles_all);
02034 $assigned_global_roles = array_intersect($assigned_global_roles_all,$posted_roles);
02035 $posted_global_roles = array_intersect($selected_roles,$global_roles_all);
02036
02037 if ((empty($selected_roles) and count($assigned_roles_all) == count($assigned_roles))
02038 or (empty($posted_global_roles) and count($assigned_global_roles_all) == count($assigned_global_roles)))
02039 {
02040
02041
02042 ilUtil::sendInfo($this->lng->txt("msg_min_one_role")."<br/>".$this->lng->txt("action_aborted"),true);
02043 $this->ctrl->redirect($this,'roleassignment');
02044 }
02045
02046 foreach (array_diff($assigned_roles,$selected_roles) as $role)
02047 {
02048 $rbacadmin->deassignUser($role,$this->object->getId());
02049 }
02050
02051 foreach (array_diff($selected_roles,$assigned_roles) as $role)
02052 {
02053 $rbacadmin->assignUser($role,$this->object->getId(),false);
02054 }
02055
02056 include_once "./classes/class.ilObjRole.php";
02057
02058
02059 $this->object->update();
02060
02061 ilUtil::sendInfo($this->lng->txt("msg_roleassignment_changed"),true);
02062
02063 if(strtolower($_GET["baseClass"]) == 'iladministrationgui')
02064 {
02065 $this->ctrl->redirect($this,'roleassignment');
02066 }
02067 else
02068 {
02069 $this->ctrl->redirectByClass('ilobjcategorygui','listUsers');
02070 }
02071
02072 }
02073
02079 function roleassignmentObject ()
02080 {
02081 global $rbacreview,$rbacsystem,$ilUser;
02082
02083 if (!$rbacsystem->checkAccess("edit_roleassignment", $this->usrf_ref_id))
02084 {
02085 $this->ilias->raiseError($this->lng->txt("msg_no_perm_assign_role_to_user"),$this->ilias->error_obj->MESSAGE);
02086 }
02087
02088 $_SESSION['filtered_roles'] = isset($_POST['filter']) ? $_POST['filter'] : $_SESSION['filtered_roles'];
02089
02090 if ($_SESSION['filtered_roles'] > 5)
02091 {
02092 $_SESSION['filtered_roles'] = 0;
02093 }
02094
02095 $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.usr_role_assignment.html');
02096
02097 if(true)
02098 {
02099 $this->tpl->setCurrentBlock("filter");
02100 $this->tpl->setVariable("FILTER_TXT_FILTER",$this->lng->txt('filter'));
02101 $this->tpl->setVariable("SELECT_FILTER",$this->__buildFilterSelect());
02102 $this->tpl->setVariable("FILTER_ACTION",$this->ctrl->getFormAction($this));
02103 $this->tpl->setVariable("FILTER_NAME",'roleassignment');
02104 $this->tpl->setVariable("FILTER_VALUE",$this->lng->txt('apply_filter'));
02105 $this->tpl->parseCurrentBlock();
02106 }
02107
02108
02109 $role_list = $rbacreview->getRolesByFilter($_SESSION["filtered_roles"],$this->object->getId());
02110 $assigned_roles = $rbacreview->assignedRoles($this->object->getId());
02111
02112 $counter = 0;
02113
02114 include_once ('./classes/class.ilObjRole.php');
02115
02116 foreach ($role_list as $role)
02117 {
02118
02119 $rolf = $rbacreview->getFoldersAssignedToRole($role["obj_id"],true);
02120
02121
02122 if ($rbacreview->isDeleted($rolf[0]))
02123 {
02124 continue;
02125 }
02126
02127
02128 $path = "";
02129
02130 if ($this->tree->isInTree($rolf[0]))
02131 {
02132 if ($rolf[0] == ROLE_FOLDER_ID)
02133 {
02134 $path = $this->lng->txt("global");
02135 }
02136 else
02137 {
02138 $tmpPath = $this->tree->getPathFull($rolf[0]);
02139
02140
02141
02142
02143
02144
02145
02146
02147
02148
02149
02150
02151 $path = $tmpPath[count($tmpPath)-2]["title"];
02152 }
02153 }
02154 else
02155 {
02156 $path = "<b>Rolefolder ".$rolf[0]." not found in tree! (Role ".$role["obj_id"].")</b>";
02157 }
02158
02159 $disabled = false;
02160
02161
02162 if (($this->object->getId() == SYSTEM_USER_ID and $role["obj_id"] == SYSTEM_ROLE_ID)
02163 or (!in_array(SYSTEM_ROLE_ID,$rbacreview->assignedRoles($ilUser->getId())) and $role["obj_id"] == SYSTEM_ROLE_ID))
02164 {
02165 $disabled = true;
02166 }
02167
02168 if (substr($role["title"],0,3) == "il_")
02169 {
02170 if (!$assignable)
02171 {
02172 $rolf_arr = $rbacreview->getFoldersAssignedToRole($role["obj_id"],true);
02173 $rolf2 = $rolf_arr[0];
02174 }
02175 else
02176 {
02177 $rolf2 = $rolf;
02178 }
02179
02180 $parent_node = $this->tree->getParentNodeData($rolf2);
02181
02182 $role["description"] = $this->lng->txt("obj_".$parent_node["type"])." (#".$parent_node["obj_id"].")";
02183 }
02184
02185 $role_ids[$counter] = $role["obj_id"];
02186
02187 $result_set[$counter][] = ilUtil::formCheckBox(in_array($role["obj_id"],$assigned_roles),"role_id[]",$role["obj_id"],$disabled)."<input type=\"hidden\" name=\"role_id_ctrl[]\" value=\"".$role["obj_id"]."\"/>";
02188 $this->ctrl->setParameterByClass("ilobjrolegui", "ref_id", $rolf[0]);
02189 $this->ctrl->setParameterByClass("ilobjrolegui", "obj_id", $role["obj_id"]);
02190 $result_set[$counter][] = "<a href=\"".$this->ctrl->getLinkTargetByClass("ilobjrolegui", "perm")."\">".ilObjRole::_getTranslation($role["title"])."</a>";
02191 $result_set[$counter][] = $role["description"];
02192 $result_set[$counter][] = $path;
02193
02194 ++$counter;
02195 }
02196
02197 return $this->__showRolesTable($result_set,$role_ids);
02198 }
02199
02210 function insertPublicProfile($a_template_var, $a_template_block_name, $a_additional = "")
02211 {
02212 if ($_GET["vcard"] == 1)
02213 {
02214 $this->deliverVCardObject();
02215 }
02216 else
02217 {
02218 $this->tpl->setVariable($a_template_var,
02219 $this->getPublicProfile($a_additional, true));
02220 }
02221 }
02222
02223
02224
02225 function getPublicProfileObject($a_additional = "", $no_ilctrl = false)
02226 {
02227 return $this->getPublicProfile($a_additional, $no_ilctrl);
02228 }
02229
02237 function getPublicProfile($a_additional = "", $no_ilctrl = false,
02238 $a_raw_rows = false)
02239 {
02240 global $ilSetting, $lng;
02241
02242 $tpl = new ilTemplate("tpl.usr_public_profile.html", true, true);
02243
02244 if (!$a_raw_rows)
02245 {
02246 $tpl->touchBlock("table_end");
02247 $tpl->setCurrentBlock("table_start");
02248 $tpl->setVariable("USR_PROFILE", $this->lng->txt("profile_of")." ".$this->object->getLogin());
02249 $tpl->parseCurrentBlock();
02250 }
02251
02252 $tpl->setVariable("ROWCOL1", "tblrow1");
02253 $tpl->setVariable("ROWCOL2", "tblrow2");
02254
02255
02256
02257 if ($this->object->getPref("public_profile") != "y")
02258 {
02259 return;
02260 }
02261
02262 $tpl->setVariable("TXT_MAIL", $lng->txt("send_mail"));
02263
02264
02265
02266
02267
02268
02269
02270
02271
02272
02273
02274
02275
02276 $tpl->setVariable('MAIL_USR_LOGIN',urlencode($this->object->getLogin()));
02277
02278 $tpl->setVariable("TXT_NAME", $this->lng->txt("name"));
02279 $tpl->setVariable("FIRSTNAME", $this->object->getFirstName());
02280 $tpl->setVariable("LASTNAME", $this->object->getLastName());
02281
02282 $tpl->setCurrentBlock("vcard");
02283 $tpl->setVariable("TXT_VCARD", $this->lng->txt("vcard"));
02284 $tpl->setVariable("TXT_DOWNLOAD_VCARD", $this->lng->txt("vcard_download"));
02285 if ($no_ilctrl)
02286 {
02287
02288 $tpl->setVariable("HREF_VCARD", basename($_SERVER["PHP_SELF"]) . "?ref_id=".
02289 $_GET["ref_id"]."&user=" . $_GET["user"] . "&vcard=1");
02290 }
02291 else
02292 {
02293 $this->ctrl->setParameter($this, "user", $this->object->getId());
02294 $tpl->setVariable("HREF_VCARD", $this->ctrl->getLinkTarget($this, "deliverVCard"));
02295 }
02296 $tpl->setVariable("IMG_VCARD", ilUtil::getImagePath("vcard.png"));
02297
02298 $webspace_dir = ilUtil::getWebspaceDir("user");
02299 $check_dir = ilUtil::getWebspaceDir();
02300 $imagefile = $webspace_dir."/usr_images/".$this->object->getPref("profile_image");
02301 $check_file = $check_dir."/usr_images/".$this->object->getPref("profile_image");
02302
02303 if ($this->object->getPref("public_upload")=="y" && @is_file($check_file))
02304 {
02305
02306
02307 $tpl->setCurrentBlock("image");
02308 $tpl->setVariable("TXT_IMAGE",$this->lng->txt("image"));
02309 $tpl->setVariable("IMAGE_PATH", $webspace_dir."/usr_images/".$this->object->getPref("profile_image")."?dummy=".rand(1,999999));
02310 $tpl->parseCurrentBlock();
02311 }
02312
02313 $val_arr = array("getInstitution" => "institution", "getDepartment" => "department",
02314 "getStreet" => "street",
02315 "getZipcode" => "zip", "getCity" => "city", "getCountry" => "country",
02316 "getPhoneOffice" => "phone_office", "getPhoneHome" => "phone_home",
02317 "getPhoneMobile" => "phone_mobile", "getFax" => "fax", "getEmail" => "email",
02318 "getHobby" => "hobby", "getMatriculation" => "matriculation", "getClientIP" => "client_ip");
02319
02320 foreach ($val_arr as $key => $value)
02321 {
02322
02323 if ($this->object->getPref("public_".$value) == "y")
02324 {
02325 $tpl->setCurrentBlock("profile_data");
02326 $tpl->setVariable("TXT_DATA", $this->lng->txt($value));
02327 $tpl->setVariable("DATA", $this->object->$key());
02328 $tpl->parseCurrentBlock();
02329 }
02330 }
02331
02332
02333 $d_set = new ilSetting("delicious");
02334 if ($d_set->get("user_profile") == "1" && $this->object->getPref("public_delicious") == "y")
02335 {
02336 $tpl->setCurrentBlock("delicious_row");
02337 $tpl->setVariable("TXT_DELICIOUS", $lng->txt("delicious"));
02338 $tpl->setVariable("TXT_DEL_ICON", $lng->txt("delicious"));
02339 $tpl->setVariable("SRC_DEL_ICON", ilUtil::getImagePath("icon_delicious.gif"));
02340 $tpl->setVariable("DEL_ACCOUNT", $this->object->getDelicious());
02341 $tpl->parseCurrentBlock();
02342 }
02343
02344
02345 include_once("./Services/GoogleMaps/classes/class.ilGoogleMapUtil.php");
02346 if (ilGoogleMapUtil::isActivated() && $this->object->getPref("public_location"))
02347 {
02348 $tpl->setVariable("TXT_LOCATION", $lng->txt("location"));
02349
02350 include_once("./Services/GoogleMaps/classes/class.ilGoogleMapGUI.php");
02351 $map_gui = new ilGoogleMapGUI();
02352
02353 $map_gui->setMapId("user_map");
02354 $map_gui->setWidth("350px");
02355 $map_gui->setHeight("230px");
02356 $map_gui->setLatitude($this->object->getLatitude());
02357 $map_gui->setLongitude($this->object->getLongitude());
02358 $map_gui->setZoom($this->object->getLocationZoom());
02359 $map_gui->setEnableNavigationControl(true);
02360 $map_gui->addUserMarker($this->object->getId());
02361
02362 $tpl->setVariable("MAP_CONTENT", $map_gui->getHTML());
02363 }
02364
02365
02366 if ($ilSetting->get("usr_settings_hide_instant_messengers") != 1)
02367 {
02368 $im_arr = array("icq","yahoo","msn","aim","skype");
02369
02370 foreach ($im_arr as $im_name)
02371 {
02372 if ($im_id = $this->object->getInstantMessengerId($im_name))
02373 {
02374 $tpl->setCurrentBlock("profile_data");
02375 $tpl->setVariable("TXT_DATA", $this->lng->txt('im_'.$im_name));
02376 $tpl->setVariable("IMG_ICON", ilUtil::getImagePath($im_name.'online.gif'));
02377 $tpl->setVariable("TXT_ICON", $this->lng->txt("im_".$im_name."_icon"));
02378 $tpl->setVariable("DATA", $im_id);
02379 $tpl->parseCurrentBlock();
02380 }
02381 }
02382 }
02383
02384 if (is_array($a_additional))
02385 {
02386 foreach($a_additional as $key => $val)
02387 {
02388 $tpl->setCurrentBlock("profile_data");
02389 $tpl->setVariable("TXT_DATA", $key);
02390 $tpl->setVariable("DATA", $val);
02391 $tpl->parseCurrentBlock();
02392 }
02393 }
02394 return $tpl->get();
02395 }
02396
02400 function deliverVCardObject()
02401 {
02402 require_once "./Services/User/classes/class.ilvCard.php";
02403 $vcard = new ilvCard();
02404
02405 if ($this->object->getPref("public_profile")!="y")
02406 {
02407 return;
02408 }
02409
02410 $vcard->setName($this->object->getLastName(), $this->object->getFirstName(), "", $this->object->getUTitle());
02411 $vcard->setNickname($this->object->getLogin());
02412
02413 $webspace_dir = ilUtil::getWebspaceDir("output");
02414 $imagefile = $webspace_dir."/usr_images/".$this->object->getPref("profile_image");
02415 if ($this->object->getPref("public_upload")=="y" && @is_file($imagefile))
02416 {
02417 $fh = fopen($imagefile, "r");
02418 if ($fh)
02419 {
02420 $image = fread($fh, filesize($imagefile));
02421 fclose($fh);
02422 require_once "./Services/MediaObjects/classes/class.ilObjMediaObject.php";
02423 $mimetype = ilObjMediaObject::getMimeType($imagefile);
02424 if (preg_match("/^image/", $mimetype))
02425 {
02426 $type = $mimetype;
02427 }
02428 $vcard->setPhoto($image, $type);
02429 }
02430 }
02431
02432 $val_arr = array("getInstitution" => "institution", "getDepartment" => "department",
02433 "getStreet" => "street",
02434 "getZipcode" => "zip", "getCity" => "city", "getCountry" => "country",
02435 "getPhoneOffice" => "phone_office", "getPhoneHome" => "phone_home",
02436 "getPhoneMobile" => "phone_mobile", "getFax" => "fax", "getEmail" => "email",
02437 "getHobby" => "hobby", "getMatriculation" => "matriculation", "getClientIP" => "client_ip");
02438
02439 $org = array();
02440 $adr = array();
02441 foreach ($val_arr as $key => $value)
02442 {
02443
02444 if ($this->object->getPref("public_".$value) == "y")
02445 {
02446 switch ($value)
02447 {
02448 case "institution":
02449 $org[0] = $this->object->$key();
02450 break;
02451 case "department":
02452 $org[1] = $this->object->$key();
02453 break;
02454 case "street":
02455 $adr[2] = $this->object->$key();
02456 break;
02457 case "zip":
02458 $adr[5] = $this->object->$key();
02459 break;
02460 case "city":
02461 $adr[3] = $this->object->$key();
02462 break;
02463 case "country":
02464 $adr[6] = $this->object->$key();
02465 break;
02466 case "phone_office":
02467 $vcard->setPhone($this->object->$key(), TEL_TYPE_WORK);
02468 break;
02469 case "phone_home":
02470 $vcard->setPhone($this->object->$key(), TEL_TYPE_HOME);
02471 break;
02472 case "phone_mobile":
02473 $vcard->setPhone($this->object->$key(), TEL_TYPE_CELL);
02474 break;
02475 case "fax":
02476 $vcard->setPhone($this->object->$key(), TEL_TYPE_FAX);
02477 break;
02478 case "email":
02479 $vcard->setEmail($this->object->$key());
02480 break;
02481 case "hobby":
02482 $vcard->setNote($this->object->$key());
02483 break;
02484 }
02485 }
02486 }
02487
02488 if (count($org))
02489 {
02490 $vcard->setOrganization(join(";", $org));
02491 }
02492 if (count($adr))
02493 {
02494 $vcard->setAddress($adr[0], $adr[1], $adr[2], $adr[3], $adr[4], $adr[5], $adr[6]);
02495 }
02496
02497 ilUtil::deliverData(utf8_decode($vcard->buildVCard()), $vcard->getFilename(), $vcard->getMimetype());
02498 }
02499
02500
02501 function __getDateSelect($a_type,$a_varname,$a_selected)
02502 {
02503 switch($a_type)
02504 {
02505 case "minute":
02506 for($i=0;$i<=60;$i++)
02507 {
02508 $days[$i] = $i < 10 ? "0".$i : $i;
02509 }
02510 return ilUtil::formSelect($a_selected,$a_varname,$days,false,true);
02511
02512 case "hour":
02513 for($i=0;$i<24;$i++)
02514 {
02515 $days[$i] = $i < 10 ? "0".$i : $i;
02516 }
02517 return ilUtil::formSelect($a_selected,$a_varname,$days,false,true);
02518
02519 case "day":
02520 for($i=1;$i<32;$i++)
02521 {
02522 $days[$i] = $i < 10 ? "0".$i : $i;
02523 }
02524 return ilUtil::formSelect($a_selected,$a_varname,$days,false,true);
02525
02526 case "month":
02527 for($i=1;$i<13;$i++)
02528 {
02529 $month[$i] = $i < 10 ? "0".$i : $i;
02530 }
02531 return ilUtil::formSelect($a_selected,$a_varname,$month,false,true);
02532
02533 case "year":
02534 if($a_selected < date('Y',time()))
02535 {
02536 $start = $a_selected;
02537 }
02538 else
02539 {
02540 $start = date('Y',time());
02541 }
02542
02543 for($i = $start;$i < date("Y",time()) + 11;++$i)
02544 {
02545 $year[$i] = $i;
02546 }
02547 return ilUtil::formSelect($a_selected,$a_varname,$year,false,true);
02548 }
02549 }
02550
02551 function __toUnix($a_time_arr)
02552 {
02553 return mktime($a_time_arr["hour"],
02554 $a_time_arr["minute"],
02555 $a_time_arr["second"],
02556 $a_time_arr["month"],
02557 $a_time_arr["day"],
02558 $a_time_arr["year"]);
02559 }
02560
02561 function __showRolesTable($a_result_set,$a_role_ids = NULL)
02562 {
02563 global $rbacsystem;
02564
02565 $actions = array("assignSave" => $this->lng->txt("change_assignment"));
02566
02567 $tbl =& $this->__initTableGUI();
02568 $tpl =& $tbl->getTemplateObject();
02569
02570 $tpl->setCurrentBlock("tbl_form_header");
02571 $tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
02572 $tpl->parseCurrentBlock();
02573
02574 $tpl->setCurrentBlock("tbl_action_row");
02575
02576 $tpl->setVariable("COLUMN_COUNTS",4);
02577 $tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.gif"));
02578
02579 foreach ($actions as $name => $value)
02580 {
02581 $tpl->setCurrentBlock("tbl_action_btn");
02582 $tpl->setVariable("BTN_NAME",$name);
02583 $tpl->setVariable("BTN_VALUE",$value);
02584 $tpl->parseCurrentBlock();
02585 }
02586
02587 if (!empty($a_role_ids))
02588 {
02589
02590 $tpl->setCurrentBlock("tbl_action_toggle_checkboxes");
02591 $tpl->setVariable("JS_VARNAME","role_id");
02592 $tpl->setVariable("JS_ONCLICK",ilUtil::array_php2js($a_role_ids));
02593 $tpl->setVariable("TXT_CHECKALL", $this->lng->txt("check_all"));
02594 $tpl->setVariable("TXT_UNCHECKALL", $this->lng->txt("uncheck_all"));
02595 $tpl->parseCurrentBlock();
02596 }
02597
02598 $tpl->setVariable("TPLPATH",$this->tpl->tplPath);
02599
02600
02601 $this->ctrl->setParameter($this,"cmd","roleassignment");
02602
02603
02604 $tbl->setTitle($this->lng->txt("edit_roleassignment"),"icon_role.gif",$this->lng->txt("roles"));
02605
02606
02607 $tbl->setHeaderNames(array("",$this->lng->txt("role"),$this->lng->txt("description"),$this->lng->txt("context")));
02608 $tbl->setHeaderVars(array("","title","description","context"),$this->ctrl->getParameterArray($this,"",false));
02609 $tbl->setColumnWidth(array("","30%","40%","30%"));
02610
02611 $this->__setTableGUIBasicData($tbl,$a_result_set,"roleassignment");
02612 $tbl->render();
02613 $this->tpl->setVariable("ROLES_TABLE",$tbl->tpl->get());
02614
02615 return true;
02616 }
02617
02618 function &__initTableGUI()
02619 {
02620 include_once "./Services/Table/classes/class.ilTableGUI.php";
02621
02622 return new ilTableGUI(0,false);
02623 }
02624
02625 function __setTableGUIBasicData(&$tbl,&$result_set,$from = "")
02626 {
02627 switch($from)
02628 {
02629 default:
02630 $order = $_GET["sort_by"] ? $_GET["sort_by"] : "title";
02631 break;
02632 }
02633
02634
02635 $tbl->setOrderColumn($order);
02636 $tbl->setOrderDirection($_GET["sort_order"]);
02637 $tbl->setOffset($_GET["offset"]);
02638 $tbl->setLimit($_GET["limit"]);
02639 $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
02640 $tbl->setData($result_set);
02641 }
02642
02643 function __unsetSessionVariables()
02644 {
02645 unset($_SESSION["filtered_roles"]);
02646 }
02647
02648 function __buildFilterSelect()
02649 {
02650 $action[0] = $this->lng->txt('assigned_roles');
02651 $action[1] = $this->lng->txt('all_roles');
02652 $action[2] = $this->lng->txt('all_global_roles');
02653 $action[3] = $this->lng->txt('all_local_roles');
02654 $action[4] = $this->lng->txt('internal_local_roles_only');
02655 $action[5] = $this->lng->txt('non_internal_local_roles_only');
02656
02657 return ilUtil::formSelect($_SESSION['filtered_roles'],"filter",$action,false,true);
02658 }
02659
02660 function hitsperpageObject()
02661 {
02662 parent::hitsperpageObject();
02663 $this->roleassignmentObject();
02664 }
02665
02670 function addAdminLocatorItems()
02671 {
02672 global $ilLocator;
02673
02674 $ilLocator->clearItems();
02675
02676 if ($_GET["admin_mode"] == "settings")
02677 {
02678 $ilLocator->addItem($this->lng->txt("administration"),
02679 $this->ctrl->getLinkTargetByClass("iladministrationgui", "frameset"),
02680 ilFrameTargetInfo::_getFrame("MainContent"));
02681
02682 if ($_GET['ref_id'] == USER_FOLDER_ID)
02683 {
02684 $ilLocator->addItem($this->lng->txt("obj_".ilObject::_lookupType(
02685 ilObject::_lookupObjId($_GET["ref_id"]))),
02686 $this->ctrl->getLinkTargetByClass("ilobjuserfoldergui", "view"));
02687 }
02688 elseif ($_GET['ref_id'] == ROLE_FOLDER_ID)
02689 {
02690 $ilLocator->addItem($this->lng->txt("obj_".ilObject::_lookupType(
02691 ilObject::_lookupObjId($_GET["ref_id"]))),
02692 $this->ctrl->getLinkTargetByClass("ilobjrolefoldergui", "view"));
02693 }
02694
02695 if ($_GET["obj_id"] > 0)
02696 {
02697 $ilLocator->addItem($this->object->getTitle(),
02698 $this->ctrl->getLinkTarget($this, "view"));
02699 }
02700 }
02701 else
02702 {
02703
02704 }
02705 }
02706
02707 function showUpperIcon()
02708 {
02709 global $tree, $tpl, $objDefinition;
02710
02711 if (strtolower($_GET["baseClass"]) == "iladministrationgui")
02712 {
02713 $tpl->setUpperIcon(
02714 $this->ctrl->getLinkTargetByClass("ilobjuserfoldergui", "view"));
02715 }
02716 else
02717 {
02718 if ($this->object->getRefId() != ROOT_FOLDER_ID &&
02719 $this->object->getRefId() != SYSTEM_FOLDER_ID)
02720 {
02721 $par_id = $tree->getParentId($this->usrf_ref_id);
02722 $tpl->setUpperIcon("repository.php?ref_id=".$par_id);
02723 }
02724 }
02725 }
02726
02727 function __sendProfileMail()
02728 {
02729 global $ilUser,$ilias;
02730
02731 if($_POST['send_mail'] != 'y')
02732 {
02733 return '';
02734 }
02735 if(!strlen($this->object->getEmail()))
02736 {
02737 return '';
02738 }
02739
02740
02741 $usr_lang = new ilLanguage($this->object->getLanguage());
02742 $usr_lang->loadLanguageModule('crs');
02743 $usr_lang->loadLanguageModule('registration');
02744
02745 include_once "Services/Mail/classes/class.ilMimeMail.php";
02746
02747 $mmail = new ilMimeMail();
02748 $mmail->autoCheck(false);
02749 $mmail->From($ilUser->getEmail());
02750 $mmail->To($this->object->getEmail());
02751
02752
02753 $subject = $usr_lang->txt("profile_changed");
02754
02755
02756
02757 $body = ($usr_lang->txt("reg_mail_body_salutation")." ".$this->object->getFullname().",\n\n");
02758
02759 $date = $this->object->getApproveDate();
02760
02761 if((time() - strtotime($date)) < 10)
02762 {
02763 $body .= ($usr_lang->txt('reg_mail_body_approve')."\n\n");
02764 }
02765 else
02766 {
02767 $body .= ($usr_lang->txt('reg_mail_body_profile_changed')."\n\n");
02768 }
02769
02770
02771 if($_POST['Fobject']['passwd'] != '********')
02772 {
02773 $body .= $usr_lang->txt("reg_mail_body_text2")."\n".
02774 ILIAS_HTTP_PATH."/login.php?client_id=".$ilias->client_id."\n".
02775 $usr_lang->txt("login").": ".$this->object->getLogin()."\n".
02776 $usr_lang->txt("passwd").": ".$_POST["Fobject"]["passwd"]."\n\n";
02777 }
02778 $body .= ($usr_lang->txt("reg_mail_body_text3")."\n");
02779 $body .= $this->object->getProfileAsString($usr_lang);
02780
02781 $mmail->Subject($subject);
02782 $mmail->Body($body);
02783 $mmail->Send();
02784
02785
02786 return "<br/>".$this->lng->txt("mail_sent");
02787 }
02788
02789 }
02790 ?>