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
00038 require_once "class.ilObjectGUI.php";
00039
00040 class ilObjUserGUI extends ilObjectGUI
00041 {
00042 var $ilCtrl;
00043
00049 var $gender;
00050
00056 var $type;
00057
00063 var $user_ref_id;
00064
00069 function ilObjUserGUI($a_data,$a_id,$a_call_by_reference = false, $a_prepare_output = true)
00070 {
00071 global $ilCtrl;
00072
00073 define('USER_FOLDER_ID',7);
00074
00075 $this->type = "usr";
00076 $this->ilObjectGUI($a_data,$a_id,$a_call_by_reference, false);
00077 $this->usrf_ref_id =& $this->ref_id;
00078
00079 $this->ctrl =& $ilCtrl;
00080 $this->ctrl->saveParameter($this,'obj_id');
00081
00082
00083
00084 $this->gender = array(
00085 'm' => "salutation_m",
00086 'f' => "salutation_f"
00087 );
00088 }
00089
00090 function &executeCommand()
00091 {
00092 global $rbacsystem;
00093
00094 $next_class = $this->ctrl->getNextClass($this);
00095 $cmd = $this->ctrl->getCmd();
00096
00097 if($cmd != "deliverVCard" and $this->ctrl->getTargetScript() != 'repository.php')
00098 {
00099 $this->prepareOutput();
00100 }
00101 switch($next_class)
00102 {
00103
00104 case "illearningprogressgui":
00105 include_once './Services/Tracking/classes/class.ilLearningProgressGUI.php';
00106 $new_gui =& new ilLearningProgressGUI(LP_MODE_USER_FOLDER,USER_FOLDER_ID,$this->object->getId());
00107 $this->ctrl->forwardCommand($new_gui);
00108 break;
00109
00110
00111 default:
00112 if($cmd == "" || $cmd == "view")
00113 {
00114 $cmd = "edit";
00115 }
00116 $cmd .= "Object";
00117 $this->$cmd();
00118
00119 break;
00120 }
00121 return true;
00122 }
00123
00124
00125 function cancelObject()
00126 {
00127 session_unregister("saved_post");
00128
00129 sendInfo($this->lng->txt("msg_cancel"),true);
00130
00131 if(strtolower($_GET["baseClass"]) == 'iladministrationgui')
00132 {
00133 $this->ctrl->redirectByClass("ilobjuserfoldergui", "view");
00134
00135
00136 }
00137 else
00138 {
00139 $this->ctrl->redirectByClass('ilobjcategorygui','listUsers');
00140 }
00141 }
00142
00146 function getAdminTabs(&$tabs_gui)
00147 {
00148 $this->getTabs($tabs_gui);
00149 }
00150
00154 function getTabs(&$tabs_gui)
00155 {
00156 global $rbacsystem;
00157
00158 $tabs_gui->addTarget("properties",
00159 $this->ctrl->getLinkTarget($this, "edit"), array("edit","","view"), get_class($this));
00160
00161 $tabs_gui->addTarget("role_assignment",
00162 $this->ctrl->getLinkTarget($this, "roleassignment"), array("roleassignment"), get_class($this));
00163
00164
00165 include_once("Services/Tracking/classes/class.ilObjUserTracking.php");
00166 if($rbacsystem->checkAccess('read',$this->ref_id) and ilObjUserTracking::_enabledLearningProgress())
00167 {
00168
00169 $tabs_gui->addTarget('learning_progress',
00170 $this->ctrl->getLinkTargetByClass('illearningprogressgui',''),
00171 '',
00172 array('illplistofobjectsgui','illplistofsettingsgui','illearningprogressgui','illplistofprogressgui'));
00173 }
00174
00175 }
00176
00177
00178
00182 function createObject()
00183 {
00184 global $ilias, $rbacsystem, $rbacreview, $styleDefinition;
00185
00186 $settings = $ilias->getAllSettings();
00187
00188 if (!$rbacsystem->checkAccess('create_user', $this->usrf_ref_id) and
00189 !$rbacsystem->checkAccess('cat_administrate_users',$this->usrf_ref_id))
00190 {
00191 $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
00192 }
00193
00194
00195 $obj_list = $rbacreview->getRoleListByObject(ROLE_FOLDER_ID);
00196 $rol = array();
00197 foreach ($obj_list as $obj_data)
00198 {
00199
00200 if($this->object->getRefId() != USER_FOLDER_ID and !in_array(SYSTEM_ROLE_ID,$_SESSION["RoleId"]))
00201 {
00202 include_once './classes/class.ilObjRole.php';
00203
00204 if(!ilObjRole::_getAssignUsersStatus($obj_data['obj_id']))
00205 {
00206 continue;
00207 }
00208 }
00209
00210 if ($obj_data["obj_id"] != ANONYMOUS_ROLE_ID)
00211 {
00212
00213 if ($obj_data["obj_id"] != SYSTEM_ROLE_ID or in_array(SYSTEM_ROLE_ID,$_SESSION["RoleId"]))
00214 {
00215 $rol[$obj_data["obj_id"]] = $obj_data["title"];
00216 }
00217 }
00218 }
00219
00220
00221 if(!count($rol))
00222 {
00223 $this->ilias->raiseError($this->lng->txt("msg_no_roles_users_can_be_assigned_to"),$this->ilias->error_obj->MESSAGE);
00224 }
00225
00226 $keys = array_keys($rol);
00227
00228
00229 if (in_array(4,$keys))
00230 {
00231 $default_role = 4;
00232 }
00233 else
00234 {
00235 if (count($keys) > 1 and in_array(2,$keys))
00236 {
00237
00238 foreach ($keys as $key => $val)
00239 {
00240 if ($val == 2)
00241 {
00242 unset($keys[$key]);
00243 break;
00244 }
00245 }
00246 }
00247
00248 $default_role = array_shift($keys);
00249 }
00250
00251 $pre_selected_role = (isset($_SESSION["error_post_vars"]["Fobject"]["default_role"])) ? $_SESSION["error_post_vars"]["Fobject"]["default_role"] : $default_role;
00252
00253 $roles = ilUtil::formSelect($pre_selected_role,"Fobject[default_role]",$rol,false,true);
00254
00255 $data = array();
00256 $data["fields"] = array();
00257 $data["fields"]["login"] = "";
00258 $data["fields"]["passwd"] = "";
00259 $data["fields"]["passwd2"] = "";
00260 $data["fields"]["title"] = "";
00261 $data["fields"]["gender"] = "";
00262 $data["fields"]["firstname"] = "";
00263 $data["fields"]["lastname"] = "";
00264 $data["fields"]["institution"] = "";
00265 $data["fields"]["department"] = "";
00266 $data["fields"]["street"] = "";
00267 $data["fields"]["city"] = "";
00268 $data["fields"]["zipcode"] = "";
00269 $data["fields"]["country"] = "";
00270 $data["fields"]["phone_office"] = "";
00271 $data["fields"]["phone_home"] = "";
00272 $data["fields"]["phone_mobile"] = "";
00273 $data["fields"]["fax"] = "";
00274 $data["fields"]["email"] = "";
00275 $data["fields"]["hobby"] = "";
00276 $data["fields"]["matriculation"] = "";
00277 $data["fields"]["client_ip"] = "";
00278 $data["fields"]["referral_comment"] = "";
00279 $data["fields"]["create_date"] = "";
00280 $data["fields"]["approve_date"] = "";
00281 $data["fields"]["active"] = " checked=\"checked\"";
00282 $data["fields"]["default_role"] = $roles;
00283 $data["fields"]["auth_mode"] = "";
00284
00285 $this->getTemplateFile("edit","usr");
00286
00287
00288 foreach ($data["fields"] as $key => $val)
00289 {
00290 $str = $this->lng->txt($key);
00291 if ($key == "title")
00292 {
00293 $str = $this->lng->txt("person_title");
00294 }
00295
00296
00297 if (isset($settings["require_" . $key]) && $settings["require_" . $key])
00298 {
00299 $str = $str . '<span class="asterisk">*</span>';
00300 }
00301
00302 $this->tpl->setVariable("TXT_".strtoupper($key), $str);
00303
00304 if ($key == "default_role")
00305 {
00306 $this->tpl->setVariable(strtoupper($key), $val);
00307 }
00308 else
00309 {
00310 $this->tpl->setVariable(strtoupper($key), ilUtil::prepareFormOutput($val));
00311 }
00312
00313 if ($this->prepare_output)
00314 {
00315 $this->tpl->parseCurrentBlock();
00316 }
00317 }
00318
00319 $this->ctrl->setParameter($this,'new_type',$this->type);
00320 $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
00321 $this->tpl->setVariable("TXT_HEADER", $this->lng->txt($this->type."_new"));
00322 $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
00323 $this->tpl->setVariable("TXT_SUBMIT", $this->lng->txt($this->type."_add"));
00324 $this->tpl->setVariable("CMD_SUBMIT", "save");
00325 $this->tpl->setVariable("TARGET", $this->getTargetFrame("save"));
00326 $this->tpl->setVariable("TXT_REQUIRED_FLD", $this->lng->txt("required_field"));
00327
00328 $this->tpl->setVariable("TXT_LOGIN_DATA", $this->lng->txt("login_data"));
00329 $this->tpl->setVariable("TXT_SYSTEM_INFO", $this->lng->txt("system_information"));
00330 $this->tpl->setVariable("TXT_PERSONAL_DATA", $this->lng->txt("personal_data"));
00331 $this->tpl->setVariable("TXT_CONTACT_DATA", $this->lng->txt("contact_data"));
00332 $this->tpl->setVariable("TXT_SETTINGS", $this->lng->txt("settings"));
00333 $this->tpl->setVariable("TXT_PASSWD2", $this->lng->txt("retype_password"));
00334 $this->tpl->setVariable("TXT_LANGUAGE",$this->lng->txt("language"));
00335 $this->tpl->setVariable("TXT_SKIN_STYLE",$this->lng->txt("usr_skin_style"));
00336 $this->tpl->setVariable("TXT_HITS_PER_PAGE",$this->lng->txt("usr_hits_per_page"));
00337 $this->tpl->setVariable("TXT_SHOW_USERS_ONLINE",$this->lng->txt("show_users_online"));
00338 $this->tpl->setVariable("TXT_GENDER_F",$this->lng->txt("gender_f"));
00339 $this->tpl->setVariable("TXT_GENDER_M",$this->lng->txt("gender_m"));
00340 $this->tpl->setVariable("TXT_OTHER",$this->lng->txt("user_profile_other"));
00341
00342
00343
00344 $this->tpl->setVariable("TXT_CURRENT_IP_ALERT",$this->lng->txt("current_ip_alert"));
00345
00346
00347 if (isset($_SESSION["error_post_vars"]["Fobject"]))
00348 {
00349 if (!isset($_SESSION["error_post_vars"]["Fobject"]["active"]))
00350 {
00351 $_SESSION["error_post_vars"]["Fobject"]["active"] = 0;
00352 }
00353
00354 foreach ($_SESSION["error_post_vars"]["Fobject"] as $key => $val)
00355 {
00356 if ($key != "default_role" and $key != "language"
00357 and $key != "skin_style" and $key != "hits_per_page"
00358 and $key != "show_users_online")
00359 {
00360 $this->tpl->setVariable(strtoupper($key), ilUtil::prepareFormOutput($val));
00361 }
00362 }
00363
00364
00365 $gender = strtoupper($_SESSION["error_post_vars"]["Fobject"]["gender"]);
00366
00367 if (!empty($gender))
00368 {
00369 $this->tpl->setVariable("BTN_GENDER_".$gender,"checked=\"checked\"");
00370 }
00371
00372 $active = $_SESSION["error_post_vars"]["Fobject"]["active"];
00373 if ($active)
00374 {
00375 $this->tpl->setVariable("ACTIVE", "checked=\"checked\"");
00376 }
00377 }
00378
00379
00380 include_once('classes/class.ilAuthUtils.php');
00381 $active_auth_modes = ilAuthUtils::_getActiveAuthModes();
00382
00383
00384 $selected_auth_mode = (isset($_SESSION["error_post_vars"]["Fobject"]["auth_mode"])) ? $_SESSION["error_post_vars"]["Fobject"]["auth_mode"] : 'default';
00385
00386 foreach ($active_auth_modes as $auth_name => $auth_key)
00387 {
00388 $this->tpl->setCurrentBlock("auth_mode_selection");
00389
00390 if ($auth_name == 'default')
00391 {
00392 $name = $this->lng->txt('auth_'.$auth_name)." (".$this->lng->txt('auth_'.ilAuthUtils::_getAuthModeName($auth_key)).")";
00393 }
00394 else
00395 {
00396 $name = $this->lng->txt('auth_'.$auth_name);
00397 }
00398
00399 $this->tpl->setVariable("AUTH_MODE_NAME", $name);
00400
00401 $this->tpl->setVariable("AUTH_MODE", $auth_name);
00402
00403 if ($selected_auth_mode == $auth_name)
00404 {
00405 $this->tpl->setVariable("SELECTED_AUTH_MODE", "selected=\"selected\"");
00406 }
00407
00408 $this->tpl->parseCurrentBlock();
00409 }
00410
00411
00412 $languages = $this->lng->getInstalledLanguages();
00413
00414
00415 $selected_lang = (isset($_SESSION["error_post_vars"]["Fobject"]["language"])) ? $_SESSION["error_post_vars"]["Fobject"]["language"] : $this->ilias->getSetting("language");
00416
00417 foreach ($languages as $lang_key)
00418 {
00419 $this->tpl->setCurrentBlock("language_selection");
00420 $this->tpl->setVariable("LANG", $this->lng->txt("lang_".$lang_key));
00421 $this->tpl->setVariable("LANGSHORT", $lang_key);
00422
00423 if ($selected_lang == $lang_key)
00424 {
00425 $this->tpl->setVariable("SELECTED_LANG", "selected=\"selected\"");
00426 }
00427
00428 $this->tpl->parseCurrentBlock();
00429 }
00430
00431
00432 $templates = $styleDefinition->getAllTemplates();
00433
00434
00435
00436 if (isset($_SESSION["error_post_vars"]["Fobject"]["skin_style"]))
00437 {
00438 $sknst = explode(":", $_SESSION["error_post_vars"]["Fobject"]["skin_style"]);
00439
00440 $selected_style = $sknst[1];
00441 $selected_skin = $sknst[0];
00442 }
00443 else
00444 {
00445 $selected_style = $this->ilias->ini->readVariable("layout","style");;
00446 $selected_skin = $this->ilias->ini->readVariable("layout","skin");;
00447 }
00448 include_once("classes/class.ilObjStyleSettings.php");
00449 foreach ($templates as $template)
00450 {
00451
00452
00453 $styleDef =& new ilStyleDefinition($template["id"]);
00454 $styleDef->startParsing();
00455 $styles = $styleDef->getStyles();
00456
00457 foreach($styles as $style)
00458 {
00459 if (!ilObjStyleSettings::_lookupActivatedStyle($template["id"],$style["id"]))
00460 {
00461 continue;
00462 }
00463
00464 $this->tpl->setCurrentBlock("selectskin");
00465
00466 if ($selected_skin == $template["id"] &&
00467 $selected_style == $style["id"])
00468 {
00469 $this->tpl->setVariable("SKINSELECTED", "selected=\"selected\"");
00470 }
00471
00472 $this->tpl->setVariable("SKINVALUE", $template["id"].":".$style["id"]);
00473 $this->tpl->setVariable("SKINOPTION", $styleDef->getTemplateName()." / ".$style["name"]);
00474 $this->tpl->parseCurrentBlock();
00475 }
00476 }
00477
00478
00479 $hits_options = array(2,10,15,20,30,40,50,100,9999);
00480
00481 if (isset($_SESSION["error_post_vars"]["Fobject"]["hits_per_page"]))
00482 {
00483 $selected_option = $_SESSION["error_post_vars"]["Fobject"]["hits_per_page"];
00484 }
00485 else
00486 {
00487 $selected_option = $this->ilias->getSetting("hits_per_page");
00488 }
00489 foreach($hits_options as $hits_option)
00490 {
00491 $this->tpl->setCurrentBlock("selecthits");
00492
00493 if ($hits_option == $selected_option)
00494 {
00495 $this->tpl->setVariable("HITSSELECTED", "selected=\"selected\"");
00496 }
00497
00498 $this->tpl->setVariable("HITSVALUE", $hits_option);
00499
00500 if ($hits_option == 9999)
00501 {
00502 $hits_option = $this->lng->txt("no_limit");
00503 }
00504
00505 $this->tpl->setVariable("HITSOPTION", $hits_option);
00506 $this->tpl->parseCurrentBlock();
00507 }
00508
00509
00510
00511
00512 if (isset($_SESSION["error_post_vars"]["Fobject"]["show_users_online"]))
00513 {
00514 $selected_option = $_SESSION["error_post_vars"]["Fobject"]["show_users_online"];
00515 }
00516 else
00517 {
00518 $selected_option = $this->ilias->getSetting("show_users_online");
00519 }
00520 $users_online_options = array("y","associated","n");
00521 foreach($users_online_options as $an_option)
00522 {
00523 $this->tpl->setCurrentBlock("show_users_online");
00524
00525 if ($selected_option == $an_option)
00526 {
00527 $this->tpl->setVariable("USERS_ONLINE_SELECTED", "selected=\"selected\"");
00528 }
00529
00530 $this->tpl->setVariable("USERS_ONLINE_VALUE", $an_option);
00531
00532 $this->tpl->setVariable("USERS_ONLINE_OPTION", $this->lng->txt("users_online_show_".$an_option));
00533 $this->tpl->parseCurrentBlock();
00534 }
00535
00536
00537
00538 if (is_array($_SESSION["error_post_vars"]))
00539 {
00540 $time_limit_unlimited = $_SESSION["error_post_vars"]["time_limit"]["unlimited"];
00541 }
00542 else
00543 {
00544 $time_limit_unlimited = 1;
00545 }
00546
00547 $time_limit_from = $_SESSION["error_post_vars"]["time_limit"]["from"] ?
00548 $this->__toUnix($_SESSION["error_post_vars"]["time_limit"]["from"]) :
00549 time();
00550
00551 $time_limit_until = $_SESSION["error_post_vars"]["time_limit"]["until"] ?
00552 $this->__toUnix($_SESSION["error_post_vars"]["time_limit"]["until"]) :
00553 time();
00554
00555 $this->lng->loadLanguageModule('crs');
00556
00557 $this->tpl->setCurrentBlock("time_limit");
00558 $this->tpl->setVariable("TXT_TIME_LIMIT", $this->lng->txt("time_limit"));
00559 $this->tpl->setVariable("TXT_TIME_LIMIT_UNLIMITED", $this->lng->txt("crs_unlimited"));
00560 $this->tpl->setVariable("TXT_TIME_LIMIT_FROM", $this->lng->txt("crs_from"));
00561 $this->tpl->setVariable("TXT_TIME_LIMIT_UNTIL", $this->lng->txt("crs_to"));
00562 $this->tpl->setVariable("TXT_TIME_LIMIT_CLOCK", $this->lng->txt("clock"));
00563 $this->tpl->setVariable("TIME_LIMIT_UNLIMITED",ilUtil::formCheckbox($time_limit_unlimited,"time_limit[unlimited]",1));
00564 $this->tpl->setVariable("SELECT_TIME_LIMIT_FROM_MINUTE",$this->__getDateSelect("minute","time_limit[from][minute]",
00565 date("i",$time_limit_from)));
00566 $this->tpl->setVariable("SELECT_TIME_LIMIT_FROM_HOUR",$this->__getDateSelect("hour","time_limit[from][hour]",
00567 date("G",$time_limit_from)));
00568 $this->tpl->setVariable("SELECT_TIME_LIMIT_FROM_DAY",$this->__getDateSelect("day","time_limit[from][day]",
00569 date("d",$time_limit_from)));
00570 $this->tpl->setVariable("SELECT_TIME_LIMIT_FROM_MONTH",$this->__getDateSelect("month","time_limit[from][month]",
00571 date("m",$time_limit_from)));
00572 $this->tpl->setVariable("SELECT_TIME_LIMIT_FROM_YEAR",$this->__getDateSelect("year","time_limit[from][year]",
00573 date("Y",$time_limit_from)));
00574 $this->tpl->setVariable("SELECT_TIME_LIMIT_UNTIL_MINUTE",$this->__getDateSelect("minute","time_limit[until][minute]",
00575 date("i",$time_limit_until)));
00576 $this->tpl->setVariable("SELECT_TIME_LIMIT_UNTIL_HOUR",$this->__getDateSelect("hour","time_limit[until][hour]",
00577 date("G",$time_limit_until)));
00578 $this->tpl->setVariable("SELECT_TIME_LIMIT_UNTIL_DAY",$this->__getDateSelect("day","time_limit[until][day]",
00579 date("d",$time_limit_until)));
00580 $this->tpl->setVariable("SELECT_TIME_LIMIT_UNTIL_MONTH",$this->__getDateSelect("month","time_limit[until][month]",
00581 date("m",$time_limit_until)));
00582 $this->tpl->setVariable("SELECT_TIME_LIMIT_UNTIL_YEAR",$this->__getDateSelect("year","time_limit[until][year]",
00583 date("Y",$time_limit_until)));
00584 $this->tpl->parseCurrentBlock();
00585
00586
00587 }
00588
00713 function editObject()
00714 {
00715 global $ilias, $rbacsystem, $rbacreview, $rbacadmin, $styleDefinition, $ilUser;
00716
00717
00718 $settings = $ilias->getAllSettings();
00719
00720
00721 if($this->usrf_ref_id == USER_FOLDER_ID and !$rbacsystem->checkAccess('visible,read',$this->usrf_ref_id))
00722 {
00723 $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"),$this->ilias->error_obj->MESSAGE);
00724 }
00725
00726
00727 if($this->usrf_ref_id != USER_FOLDER_ID)
00728 {
00729
00730 if(!$rbacsystem->checkAccess('cat_administrate_users',$this->object->getTimeLimitOwner()))
00731 {
00732 $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"),$this->ilias->error_obj->MESSAGE);
00733 }
00734 }
00735
00736 $data = array();
00737 $data["fields"] = array();
00738 $data["fields"]["login"] = $this->object->getLogin();
00739 $data["fields"]["passwd"] = "********";
00740 $data["fields"]["passwd2"] = "********";
00741 $data["fields"]["title"] = $this->object->getUTitle();
00742 $data["fields"]["gender"] = $this->object->getGender();
00743 $data["fields"]["firstname"] = $this->object->getFirstname();
00744 $data["fields"]["lastname"] = $this->object->getLastname();
00745 $data["fields"]["institution"] = $this->object->getInstitution();
00746 $data["fields"]["department"] = $this->object->getDepartment();
00747 $data["fields"]["street"] = $this->object->getStreet();
00748 $data["fields"]["city"] = $this->object->getCity();
00749 $data["fields"]["zipcode"] = $this->object->getZipcode();
00750 $data["fields"]["country"] = $this->object->getCountry();
00751 $data["fields"]["phone_office"] = $this->object->getPhoneOffice();
00752 $data["fields"]["phone_home"] = $this->object->getPhoneHome();
00753 $data["fields"]["phone_mobile"] = $this->object->getPhoneMobile();
00754 $data["fields"]["fax"] = $this->object->getFax();
00755 $data["fields"]["email"] = $this->object->getEmail();
00756 $data["fields"]["hobby"] = $this->object->getHobby();
00757 $data["fields"]["matriculation"] = $this->object->getMatriculation();
00758 $data["fields"]["client_ip"] = $this->object->getClientIP();
00759 $data["fields"]["referral_comment"] = $this->object->getComment();
00760 $data["fields"]["create_date"] = $this->object->getCreateDate();
00761 $data["fields"]["approve_date"] = $this->object->getApproveDate();
00762 $data["fields"]["active"] = $this->object->getActive();
00763 $data["fields"]["auth_mode"] = $this->object->getAuthMode();
00764
00765 if (!count($user_online = ilUtil::getUsersOnline($this->object->getId())) == 1)
00766 {
00767 $user_is_online = false;
00768 }
00769 else
00770 {
00771 $user_is_online = true;
00772
00773
00774 preg_match("/RoleId.*?;\}/",$user_online[$this->object->getId()]["data"],$matches);
00775
00776 $active_roles = unserialize(substr($matches[0],7));
00777
00778
00779 $assigned_roles = $rbacreview->assignedRoles($this->object->getId());
00780
00781 foreach ($assigned_roles as $key => $role)
00782 {
00783 $roleObj = $this->ilias->obj_factory->getInstanceByObjId($role);
00784
00785
00786 $rolf = $rbacreview->getFoldersAssignedToRole($role,true);
00787
00788
00789 if (count($rolf) > 0)
00790 {
00791 if (!$rbacreview->isDeleted($rolf[0]))
00792 {
00793 $path = "";
00794
00795 if ($this->tree->isInTree($rolf[0]))
00796 {
00797 $tmpPath = $this->tree->getPathFull($rolf[0]);
00798
00799
00800 for ($i = 0; $i < (count($tmpPath)-1); $i++)
00801 {
00802 if ($path != "")
00803 {
00804 $path .= " > ";
00805 }
00806
00807 $path .= $tmpPath[$i]["title"];
00808 }
00809 }
00810 else
00811 {
00812 $path = "<b>Rolefolder ".$rolf[0]." not found in tree! (Role ".$role.")</b>";
00813 }
00814
00815 if (in_array($role,$active_roles))
00816 {
00817 $data["active_role"][$role]["active"] = true;
00818 }
00819
00820 $data["active_role"][$role]["title"] = $roleObj->getTitle();
00821 $data["active_role"][$role]["context"] = $path;
00822
00823 unset($roleObj);
00824 }
00825 }
00826 else
00827 {
00828 $path = "<b>No role folder found for role ".$role."!</b>";
00829 }
00830 }
00831 }
00832
00833 $this->getTemplateFile("edit","usr");
00834
00835
00836 if (isset($_SESSION["error_post_vars"]["Fobject"]))
00837 {
00838 if (!isset($_SESSION["error_post_vars"]["Fobject"]["active"]))
00839 {
00840 $_SESSION["error_post_vars"]["Fobject"]["active"] = 0;
00841 }
00842
00843 foreach ($_SESSION["error_post_vars"]["Fobject"] as $key => $val)
00844 {
00845 $str = $this->lng->txt($key);
00846 if ($key == "title")
00847 {
00848 $str = $this->lng->txt("person_title");
00849 }
00850
00851
00852 if (isset($settings["require_" . $key]) && $settings["require_" . $key])
00853 {
00854 $str = $str . '<span class="asterisk">*</span>';
00855 }
00856
00857 $this->tpl->setVariable("TXT_".strtoupper($key), $str);
00858
00859 if ($key != "default_role" and $key != "language"
00860 and $key != "skin_style" and $key != "hits_per_page"
00861 and $key != "show_users_online")
00862 {
00863 $this->tpl->setVariable(strtoupper($key), ilUtil::prepareFormOutput($val,true));
00864 }
00865 }
00866
00867
00868 $gender = strtoupper($_SESSION["error_post_vars"]["Fobject"]["gender"]);
00869
00870
00871 if (!empty($gender))
00872 {
00873 $this->tpl->setVariable("BTN_GENDER_".$gender,"checked=\"checked\"");
00874 }
00875
00876 $active = $_SESSION["error_post_vars"]["Fobject"]["active"];
00877 if ($active)
00878 {
00879 $this->tpl->setVariable("ACTIVE", "checked=\"checked\"");
00880 }
00881 }
00882 else
00883 {
00884 if (!isset($data["fields"]["active"]))
00885 {
00886 $data["fields"]["active"] = 0;
00887 }
00888
00889 foreach ($data["fields"] as $key => $val)
00890 {
00891 $str = $this->lng->txt($key);
00892 if ($key == "title")
00893 {
00894 $str = $this->lng->txt("person_title");
00895 }
00896
00897
00898 if (isset($settings["require_" . $key]) && $settings["require_" . $key])
00899 {
00900 $str = $str . '<span class="asterisk">*</span>';
00901 }
00902
00903 $this->tpl->setVariable("TXT_".strtoupper($key), $str);
00904
00905 $this->tpl->setVariable(strtoupper($key), ilUtil::prepareFormOutput($val));
00906 #$this->tpl->parseCurrentBlock();
00907 }
00908
00909
00910 $gender = strtoupper($data["fields"]["gender"]);
00911
00912 if (!empty($gender))
00913 {
00914 $this->tpl->setVariable("BTN_GENDER_".$gender,"checked=\"checked\"");
00915 }
00916
00917 $active = $data["fields"]["active"];
00918 if ($active)
00919 {
00920 $this->tpl->setVariable("ACTIVE", "checked=\"checked\"");
00921 }
00922 }
00923
00924 if ($this->object->getAuthMode(true) != AUTH_LOCAL)
00925 {
00926 $this->tpl->setVariable("OPTION_DISABLED", "\"disabled=disabled\"");
00927 }
00928
00929 $obj_str = ($this->call_by_reference) ? "" : "&obj_id=".$this->obj_id;
00930
00931 $this->tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
00932 $this->tpl->setVariable("TXT_HEADER", $this->lng->txt($this->object->getType()."_edit"));
00933 $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
00934 $this->tpl->setVariable("TXT_SUBMIT", $this->lng->txt("save"));
00935 $this->tpl->setVariable("CMD_SUBMIT", "update");
00936 $this->tpl->setVariable("TARGET", $this->getTargetFrame("update"));
00937 $this->tpl->setVariable("TXT_REQUIRED_FLD", $this->lng->txt("required_field"));
00938
00939 $this->tpl->setVariable("TXT_LOGIN_DATA", $this->lng->txt("login_data"));
00940 $this->tpl->setVariable("TXT_SYSTEM_INFO", $this->lng->txt("system_information"));
00941 $this->tpl->setVariable("TXT_PERSONAL_DATA", $this->lng->txt("personal_data"));
00942 $this->tpl->setVariable("TXT_CONTACT_DATA", $this->lng->txt("contact_data"));
00943 $this->tpl->setVariable("TXT_SETTINGS", $this->lng->txt("settings"));
00944 $this->tpl->setVariable("TXT_PASSWD2", $this->lng->txt("retype_password"));
00945 $this->tpl->setVariable("TXT_LANGUAGE",$this->lng->txt("language"));
00946 $this->tpl->setVariable("TXT_SKIN_STYLE",$this->lng->txt("usr_skin_style"));
00947 $this->tpl->setVariable("TXT_HITS_PER_PAGE",$this->lng->txt("hits_per_page"));
00948 $this->tpl->setVariable("TXT_SHOW_USERS_ONLINE",$this->lng->txt("show_users_online"));
00949 $this->tpl->setVariable("TXT_GENDER_F",$this->lng->txt("gender_f"));
00950 $this->tpl->setVariable("TXT_GENDER_M",$this->lng->txt("gender_m"));
00951 $this->tpl->setVariable("TXT_OTHER",$this->lng->txt("user_profile_other"));
00952 if ($this->object->getId() == $ilUser->getId())
00953 {
00954 $this->tpl->setVariable("TXT_CURRENT_IP","(".$this->lng->txt("current_ip")." ".$_SERVER["REMOTE_ADDR"].")");
00955 }
00956 $this->tpl->setVariable("TXT_CURRENT_IP_ALERT",$this->lng->txt("current_ip_alert"));
00957
00958
00959 include_once('classes/class.ilAuthUtils.php');
00960 $active_auth_modes = ilAuthUtils::_getActiveAuthModes();
00961
00962
00963 $selected_auth_mode = (isset($_SESSION["error_post_vars"]["Fobject"]["auth_mode"])) ? $_SESSION["error_post_vars"]["Fobject"]["auth_mode"] : $this->object->getAuthMode();
00964
00965 foreach ($active_auth_modes as $auth_name => $auth_key)
00966 {
00967 $this->tpl->setCurrentBlock("auth_mode_selection");
00968
00969 if ($auth_name == 'default')
00970 {
00971 $name = $this->lng->txt('auth_'.$auth_name)." (".$this->lng->txt('auth_'.ilAuthUtils::_getAuthModeName($auth_key)).")";
00972 }
00973 else
00974 {
00975 $name = $this->lng->txt('auth_'.$auth_name);
00976 }
00977
00978 $this->tpl->setVariable("AUTH_MODE_NAME", $name);
00979
00980 $this->tpl->setVariable("AUTH_MODE", $auth_name);
00981
00982 if ($selected_auth_mode == $auth_name)
00983 {
00984 $this->tpl->setVariable("SELECTED_AUTH_MODE", "selected=\"selected\"");
00985 }
00986
00987 $this->tpl->parseCurrentBlock();
00988 }
00989
00990
00991
00992 $languages = $this->lng->getInstalledLanguages();
00993
00994
00995 $selected_lang = (isset($_SESSION["error_post_vars"]["Fobject"]["language"])) ? $_SESSION["error_post_vars"]["Fobject"]["language"] : $this->object->getLanguage();
00996
00997 foreach ($languages as $lang_key)
00998 {
00999 $this->tpl->setCurrentBlock("language_selection");
01000 $this->tpl->setVariable("LANG", $this->lng->txt("lang_".$lang_key));
01001 $this->tpl->setVariable("LANGSHORT", $lang_key);
01002
01003 if ($selected_lang == $lang_key)
01004 {
01005 $this->tpl->setVariable("SELECTED_LANG", "selected=\"selected\"");
01006 }
01007
01008 $this->tpl->parseCurrentBlock();
01009 }
01010
01011
01012
01013 $templates = $styleDefinition->getAllTemplates();
01014
01015
01016 if (isset($_SESSION["error_post_vars"]["Fobject"]["skin_style"]))
01017 {
01018 $sknst = explode(":", $_SESSION["error_post_vars"]["Fobject"]["skin_style"]);
01019
01020 $selected_style = $sknst[1];
01021 $selected_skin = $sknst[0];
01022 }
01023 else
01024 {
01025 $selected_style = $this->object->prefs["style"];
01026 $selected_skin = $this->object->skin;
01027 }
01028
01029 include("classes/class.ilObjStyleSettings.php");
01030 foreach ($templates as $template)
01031 {
01032
01033
01034 $styleDef =& new ilStyleDefinition($template["id"]);
01035 $styleDef->startParsing();
01036 $styles = $styleDef->getStyles();
01037 foreach ($styles as $style)
01038 {
01039 if (!ilObjStyleSettings::_lookupActivatedStyle($template["id"],$style["id"]))
01040 {
01041 continue;
01042 }
01043
01044 $this->tpl->setCurrentBlock("selectskin");
01045
01046 if ($selected_skin == $template["id"] &&
01047 $selected_style == $style["id"])
01048 {
01049 $this->tpl->setVariable("SKINSELECTED", "selected=\"selected\"");
01050 }
01051
01052 $this->tpl->setVariable("SKINVALUE", $template["id"].":".$style["id"]);
01053 $this->tpl->setVariable("SKINOPTION", $styleDef->getTemplateName()." / ".$style["name"]);
01054 $this->tpl->parseCurrentBlock();
01055 }
01056 }
01057
01058
01059 $hits_options = array(2,10,15,20,30,40,50,100,9999);
01060
01061 if (isset($_SESSION["error_post_vars"]["Fobject"]["hits_per_page"]))
01062 {
01063 $selected_option = $_SESSION["error_post_vars"]["Fobject"]["hits_per_page"];
01064 }
01065 else
01066 {
01067 $selected_option = $this->object->prefs["hits_per_page"];
01068 }
01069 foreach($hits_options as $hits_option)
01070 {
01071 $this->tpl->setCurrentBlock("selecthits");
01072
01073 if ($selected_option == $hits_option)
01074 {
01075 $this->tpl->setVariable("HITSSELECTED", "selected=\"selected\"");
01076 }
01077
01078 $this->tpl->setVariable("HITSVALUE", $hits_option);
01079
01080 if ($hits_option == 9999)
01081 {
01082 $hits_option = $this->lng->txt("no_limit");
01083 }
01084
01085 $this->tpl->setVariable("HITSOPTION", $hits_option);
01086 $this->tpl->parseCurrentBlock();
01087 }
01088
01089
01090
01091 $users_online_options = array("y","associated","n");
01092
01093 if (isset($_SESSION["error_post_vars"]["Fobject"]["show_users_online"]))
01094 {
01095 $selected_option = $_SESSION["error_post_vars"]["Fobject"]["show_users_online"];
01096 }
01097 else
01098 {
01099 $selected_option = $this->object->prefs["show_users_online"];
01100 }
01101 foreach($users_online_options as $an_option)
01102 {
01103 $this->tpl->setCurrentBlock("show_users_online");
01104
01105 if ($selected_option == $an_option)
01106 {
01107 $this->tpl->setVariable("USERS_ONLINE_SELECTED", "selected=\"selected\"");
01108 }
01109
01110 $this->tpl->setVariable("USERS_ONLINE_VALUE", $an_option);
01111
01112 $this->tpl->setVariable("USERS_ONLINE_OPTION", $this->lng->txt("users_online_show_".$an_option));
01113 $this->tpl->parseCurrentBlock();
01114 }
01115
01116
01117
01118 $this->tpl->setCurrentBlock("inform_user");
01119
01120
01121 if (true)
01122 {
01123 $this->tpl->setVariable("SEND_MAIL", " checked=\"checked\"");
01124 }
01125
01126 $this->tpl->setVariable("TXT_INFORM_USER_MAIL", $this->lng->txt("inform_user_mail"));
01127 $this->tpl->parseCurrentBlock();
01128
01129 $this->lng->loadLanguageModule('crs');
01130
01131 $time_limit_unlimited = $_SESSION["error_post_vars"]["time_limit"]["unlimited"] ?
01132 $_SESSION["error_post_vars"]["time_limit"]["unlimited"] :
01133 $this->object->getTimeLimitUnlimited();
01134 $time_limit_from = $_SESSION["error_post_vars"]["time_limit"]["from"] ?
01135 $this->__toUnix($_SESSION["error_post_vars"]["time_limit"]["from"]) :
01136 $this->object->getTimeLimitFrom();
01137
01138 $time_limit_until = $_SESSION["error_post_vars"]["time_limit"]["until"] ?
01139 $this->__toUnix($_SESSION["error_post_vars"]["time_limit"]["until"]) :
01140 $this->object->getTimeLimitUntil();
01141
01142 $this->tpl->setCurrentBlock("time_limit");
01143 $this->tpl->setVariable("TXT_TIME_LIMIT", $this->lng->txt("time_limit"));
01144 $this->tpl->setVariable("TXT_TIME_LIMIT_UNLIMITED", $this->lng->txt("crs_unlimited"));
01145 $this->tpl->setVariable("TXT_TIME_LIMIT_FROM", $this->lng->txt("crs_from"));
01146 $this->tpl->setVariable("TXT_TIME_LIMIT_UNTIL", $this->lng->txt("crs_to"));
01147
01148 $this->tpl->setVariable("TIME_LIMIT_UNLIMITED",ilUtil::formCheckbox($time_limit_unlimited,"time_limit[unlimited]",1));
01149 $this->tpl->setVariable("SELECT_TIME_LIMIT_FROM_MINUTE",$this->__getDateSelect("minute","time_limit[from][minute]",
01150 date("i",$time_limit_from)));
01151 $this->tpl->setVariable("SELECT_TIME_LIMIT_FROM_HOUR",$this->__getDateSelect("hour","time_limit[from][hour]",
01152 date("G",$time_limit_from)));
01153 $this->tpl->setVariable("SELECT_TIME_LIMIT_FROM_DAY",$this->__getDateSelect("day","time_limit[from][day]",
01154 date("d",$time_limit_from)));
01155 $this->tpl->setVariable("SELECT_TIME_LIMIT_FROM_MONTH",$this->__getDateSelect("month","time_limit[from][month]",
01156 date("m",$time_limit_from)));
01157 $this->tpl->setVariable("SELECT_TIME_LIMIT_FROM_YEAR",$this->__getDateSelect("year","time_limit[from][year]",
01158 date("Y",$time_limit_from)));
01159 $this->tpl->setVariable("SELECT_TIME_LIMIT_UNTIL_MINUTE",$this->__getDateSelect("minute","time_limit[until][minute]",
01160 date("i",$time_limit_until)));
01161 $this->tpl->setVariable("SELECT_TIME_LIMIT_UNTIL_HOUR",$this->__getDateSelect("hour","time_limit[until][hour]",
01162 date("G",$time_limit_until)));
01163 $this->tpl->setVariable("SELECT_TIME_LIMIT_UNTIL_DAY",$this->__getDateSelect("day","time_limit[until][day]",
01164 date("d",$time_limit_until)));
01165 $this->tpl->setVariable("SELECT_TIME_LIMIT_UNTIL_MONTH",$this->__getDateSelect("month","time_limit[until][month]",
01166 date("m",$time_limit_until)));
01167 $this->tpl->setVariable("SELECT_TIME_LIMIT_UNTIL_YEAR",$this->__getDateSelect("year","time_limit[until][year]",
01168 date("Y",$time_limit_until)));
01169 $this->tpl->parseCurrentBlock();
01170
01171
01172 if ($user_is_online)
01173 {
01174
01175 $this->tpl->setCurrentBlock("TABLE_ROLES");
01176
01177 $counter = 0;
01178
01179 foreach ($data["active_role"] as $role_id => $role)
01180 {
01181 ++$counter;
01182 $css_row = ilUtil::switchColor($counter,"tblrow2","tblrow1");
01183 ($role["active"]) ? $checked = "checked=\"checked\"" : $checked = "";
01184
01185 $this->tpl->setVariable("ACTIVE_ROLE_CSS_ROW",$css_row);
01186 $this->tpl->setVariable("ROLECONTEXT",$role["context"]);
01187 $this->tpl->setVariable("ROLENAME",$role["title"]);
01188 $this->tpl->setVariable("CHECKBOX_ID", $role_id);
01189 $this->tpl->setVariable("CHECKED", $checked);
01190 $this->tpl->parseCurrentBlock();
01191 }
01192
01193
01194
01195 $this->tpl->setCurrentBlock("ACTIVE_ROLE");
01196 $this->tpl->setVariable("ACTIVE_ROLE_FORMACTION",
01197 $this->ctrl->getFormAction($this));
01198 $this->tpl->setVariable("TXT_ACTIVE_ROLES",$this->lng->txt("active_roles"));
01199 $this->tpl->setVariable("TXT_ASSIGN",$this->lng->txt("change_active_assignment"));
01200 $this->tpl->parseCurrentBlock();
01201
01202 }
01203 }
01204
01209 function saveObject()
01210 {
01211 global $ilias, $rbacsystem, $rbacadmin;
01212
01213
01214 $settings = $ilias->getAllSettings();
01215
01216
01217 if (!$rbacsystem->checkAccess('create_user', $this->usrf_ref_id) and
01218 !$rbacsystem->checkAccess('cat_administrate_users',$this->usrf_ref_id))
01219 {
01220 $this->ilias->raiseError($this->lng->txt("permission_denied"),$this->ilias->error_obj->MESSAGE);
01221 }
01222
01223
01224 foreach ($settings as $key => $val)
01225 {
01226 if (substr($key,0,8) == "require_")
01227 {
01228 $require_keys[] = substr($key,8);
01229 }
01230 }
01231
01232 foreach ($require_keys as $key => $val)
01233 {
01234 if (isset($settings["require_" . $val]) && $settings["require_" . $val])
01235 {
01236 if (empty($_POST["Fobject"][$val]))
01237 {
01238 $this->ilias->raiseError($this->lng->txt("fill_out_all_required_fields") . ": " .
01239 $this->lng->txt($val),$this->ilias->error_obj->MESSAGE);
01240 }
01241 }
01242 }
01243
01244
01245 if (!ilUtil::isLogin($_POST["Fobject"]["login"]))
01246 {
01247 $this->ilias->raiseError($this->lng->txt("login_invalid"),$this->ilias->error_obj->MESSAGE);
01248 }
01249
01250
01251 if (loginExists($_POST["Fobject"]["login"]))
01252 {
01253 $this->ilias->raiseError($this->lng->txt("login_exists"),$this->ilias->error_obj->MESSAGE);
01254 }
01255
01256
01257 if ($_POST["Fobject"]["passwd"] != $_POST["Fobject"]["passwd2"])
01258 {
01259 $this->ilias->raiseError($this->lng->txt("passwd_not_match"),$this->ilias->error_obj->MESSAGE);
01260 }
01261
01262
01263 if (!ilUtil::isPassword($_POST["Fobject"]["passwd"]))
01264 {
01265 $this->ilias->raiseError($this->lng->txt("passwd_invalid"),$this->ilias->error_obj->MESSAGE);
01266 }
01267
01268
01269 require_once "class.ilObjUser.php";
01270 $_POST["Fobject"]["passwd_type"] = IL_PASSWD_PLAIN;
01271
01272
01273 if (!ilUtil::is_email($_POST["Fobject"]["email"]))
01274 {
01275 $this->ilias->raiseError($this->lng->txt("email_not_valid"),$this->ilias->error_obj->MESSAGE);
01276 }
01277
01278
01279 if ($_POST["time_limit"]["unlimited"] != 1 and
01280 ($this->__toUnix($_POST["time_limit"]["until"]) < $this->__toUnix($_POST["time_limit"]["from"])))
01281 {
01282 $this->ilias->raiseError($this->lng->txt("time_limit_not_valid"),$this->ilias->error_obj->MESSAGE);
01283 }
01284 if(!$this->ilias->account->getTimeLimitUnlimited())
01285 {
01286 if($this->__toUnix($_POST["time_limit"]["from"]) < $this->ilias->account->getTimeLimitFrom() or
01287 $this->__toUnix($_POST["time_limit"]["until"])> $this->ilias->account->getTimeLimitUntil() or
01288 $_POST['time_limit']['unlimited'])
01289 {
01290 $this->ilias->raiseError($this->lng->txt("time_limit_not_within_owners"),$this->ilias->error_obj->MESSAGE);
01291 }
01292 }
01293
01294
01295
01296
01297
01298
01299
01300 $userObj = new ilObjUser();
01301 $userObj->assignData($_POST["Fobject"]);
01302 $userObj->setTitle($userObj->getFullname());
01303 $userObj->setDescription($userObj->getEmail());
01304
01305 $userObj->setTimeLimitOwner($this->object->getRefId());
01306 $userObj->setTimeLimitUnlimited($_POST["time_limit"]["unlimited"]);
01307 $userObj->setTimeLimitFrom($this->__toUnix($_POST["time_limit"]["from"]));
01308 $userObj->setTimeLimitUntil($this->__toUnix($_POST["time_limit"]["until"]));
01309
01310 $userObj->create();
01311
01312
01313
01314
01315 $userObj->saveAsNew();
01316
01317
01318 $userObj->setLanguage($_POST["Fobject"]["language"]);
01319
01320
01321 $sknst = explode(":", $_POST["Fobject"]["skin_style"]);
01322
01323 if ($userObj->getPref("style") != $sknst[1] ||
01324 $userObj->getPref("skin") != $sknst[0])
01325 {
01326 $userObj->setPref("skin", $sknst[0]);
01327 $userObj->setPref("style", $sknst[1]);
01328 }
01329
01330
01331 $userObj->setPref("hits_per_page", $_POST["Fobject"]["hits_per_page"]);
01332
01333 $userObj->setPref("show_users_online", $_POST["Fobject"]["show_users_online"]);
01334
01335 $userObj->writePrefs();
01336
01337
01338 $rbacadmin->assignUser($_POST["Fobject"]["default_role"],$userObj->getId(),true);
01339
01340
01341
01342
01343
01344
01345
01346
01347
01348
01349
01350
01351
01352
01353
01354
01355 sendInfo($this->lng->txt("user_added"),true);
01356
01357
01358 if(strtolower($_GET["baseClass"]) == 'iladministrationgui')
01359 {
01360 $this->ctrl->redirectByClass("ilobjuserfoldergui", "view");
01361 }
01362 else
01363 {
01364 $this->ctrl->redirectByClass('ilobjcategorygui','listUsers');
01365 }
01366 }
01367
01372 function updateObject()
01373 {
01374 global $ilias, $rbacsystem, $rbacadmin;
01375
01376
01377 $settings = $ilias->getAllSettings();
01378
01379
01380 if($this->usrf_ref_id == USER_FOLDER_ID and !$rbacsystem->checkAccess('visible,read,write',$this->usrf_ref_id))
01381 {
01382 $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"),$this->ilias->error_obj->MESSAGE);
01383 }
01384
01385
01386 if($this->usrf_ref_id != USER_FOLDER_ID)
01387 {
01388
01389 if(!$rbacsystem->checkAccess('cat_administrate_users',$this->object->getTimeLimitOwner()))
01390 {
01391 $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"),$this->ilias->error_obj->MESSAGE);
01392 }
01393 }
01394
01395 foreach ($_POST["Fobject"] as $key => $val)
01396 {
01397 $_POST["Fobject"][$key] = ilUtil::stripSlashes($val);
01398 }
01399
01400
01401 if ($this->object->getAuthMode(true) == AUTH_LOCAL)
01402 {
01403
01404 foreach ($settings as $key => $val)
01405 {
01406 if (substr($key,0,8) == "require_")
01407 {
01408 $require_keys[] = substr($key,8);
01409 }
01410 }
01411
01412 foreach ($require_keys as $key => $val)
01413 {
01414
01415 $system_fields = array("default_role");
01416 if (!in_array($val, $system_fields))
01417 {
01418 if (isset($settings["require_" . $val]) && $settings["require_" . $val])
01419 {
01420 if (empty($_POST["Fobject"][$val]))
01421 {
01422 $this->ilias->raiseError($this->lng->txt("fill_out_all_required_fields") . ": " . $this->lng->txt($val),$this->ilias->error_obj->MESSAGE);
01423 }
01424 }
01425 }
01426 }
01427
01428
01429 if (!ilUtil::isLogin($_POST["Fobject"]["login"]))
01430 {
01431 $this->ilias->raiseError($this->lng->txt("login_invalid"),$this->ilias->error_obj->MESSAGE);
01432 }
01433
01434
01435 if (loginExists($_POST["Fobject"]["login"],$this->id))
01436 {
01437 $this->ilias->raiseError($this->lng->txt("login_exists"),$this->ilias->error_obj->MESSAGE);
01438 }
01439
01440
01441 if ($_POST["Fobject"]["passwd"] != $_POST["Fobject"]["passwd2"])
01442 {
01443 $this->ilias->raiseError($this->lng->txt("passwd_not_match"),$this->ilias->error_obj->MESSAGE);
01444 }
01445
01446
01447 if (!ilUtil::isPassword($_POST["Fobject"]["passwd"]))
01448 {
01449 $this->ilias->raiseError($this->lng->txt("passwd_invalid"),$this->ilias->error_obj->MESSAGE);
01450 }
01451
01452 if ($_POST["Fobject"]["passwd"] != "********")
01453 {
01454 $this->object->resetPassword($_POST["Fobject"]["passwd"],$_POST["Fobject"]["passwd2"]);
01455 }
01456 }
01457
01458
01459 include_once ('classes/class.ilObjUser.php');
01460 $_POST["Fobject"]["passwd_type"] = IL_PASSWD_PLAIN;
01461
01462
01463 if (!ilUtil::is_email($_POST["Fobject"]["email"]))
01464 {
01465 $this->ilias->raiseError($this->lng->txt("email_not_valid"),$this->ilias->error_obj->MESSAGE);
01466 }
01467
01468 $start = $this->__toUnix($_POST["time_limit"]["from"]);
01469 $end = $this->__toUnix($_POST["time_limit"]["until"]);
01470
01471
01472 if (!$_POST["time_limit"]["unlimited"] and
01473 ( $start > $end))
01474 {
01475 $this->ilias->raiseError($this->lng->txt("time_limit_not_valid"),$this->ilias->error_obj->MESSAGE);
01476 }
01477
01478 if(!$this->ilias->account->getTimeLimitUnlimited())
01479 {
01480 if($start < $this->ilias->account->getTimeLimitFrom() or
01481 $end > $this->ilias->account->getTimeLimitUntil() or
01482 $_POST['time_limit']['unlimited'])
01483 {
01484 $_SESSION['error_post_vars'] = $_POST;
01485
01486 sendInfo($this->lng->txt('time_limit_not_within_owners'));
01487 $this->editObject();
01488
01489 return false;
01490 }
01491 }
01492
01493
01494
01495
01496 $_POST['Fobject']['time_limit_owner'] = $this->object->getTimeLimitOwner();
01497
01498 $_POST['Fobject']['time_limit_unlimited'] = (int) $_POST['time_limit']['unlimited'];
01499 $_POST['Fobject']['time_limit_from'] = $this->__toUnix($_POST['time_limit']['from']);
01500 $_POST['Fobject']['time_limit_until'] = $this->__toUnix($_POST['time_limit']['until']);
01501
01502 if($_POST['Fobject']['time_limit_unlimited'] != $this->object->getTimeLimitUnlimited() or
01503 $_POST['Fobject']['time_limit_from'] != $this->object->getTimeLimitFrom() or
01504 $_POST['Fobject']['time_limit_until'] != $this->object->getTimeLimitUntil())
01505 {
01506 $_POST['Fobject']['time_limit_message'] = 0;
01507 }
01508 else
01509 {
01510 $_POST['Fobject']['time_limit_message'] = $this->object->getTimeLimitMessage();
01511 }
01512
01513
01514 if ($this->object->getAuthMode(true) != AUTH_LOCAL)
01515 {
01516 $_POST['Fobject']['login'] = $this->object->getLogin();
01517 $_POST['Fobject']['passwd'] = "********";
01518 }
01519
01520 $this->object->assignData($_POST["Fobject"]);
01521
01522 if ($this->object->getAuthMode(true) == AUTH_LOCAL)
01523 {
01524 $this->object->updateLogin($_POST["Fobject"]["login"]);
01525 }
01526
01527 $this->object->setTitle($this->object->getFullname());
01528 $this->object->setDescription($this->object->getEmail());
01529 $this->object->setLanguage($_POST["Fobject"]["language"]);
01530
01531
01532 $sknst = explode(":", $_POST["Fobject"]["skin_style"]);
01533
01534 if ($this->object->getPref("style") != $sknst[1] ||
01535 $this->object->getPref("skin") != $sknst[0])
01536 {
01537 $this->object->setPref("skin", $sknst[0]);
01538 $this->object->setPref("style", $sknst[1]);
01539 }
01540
01541
01542 $this->object->setPref("hits_per_page", $_POST["Fobject"]["hits_per_page"]);
01543
01544 $this->object->setPref("show_users_online", $_POST["Fobject"]["show_users_online"]);
01545
01546 $this->update = $this->object->update();
01547
01548
01549
01550 if ($_POST["send_mail"] == "y")
01551 {
01552 $this->lng->loadLanguageModule('crs');
01553
01554 include_once "classes/class.ilFormatMail.php";
01555
01556 $umail = new ilFormatMail($_SESSION["AccountId"]);
01557
01558
01559 $body = $this->lng->txt("login").": ".$this->object->getLogin()."\n\r".
01560 $this->lng->txt("passwd").": ".$_POST["Fobject"]["passwd"]."\n\r".
01561 $this->lng->txt("title").": ".$this->object->getTitle()."\n\r".
01562 $this->lng->txt("gender").": ".$this->object->getGender()."\n\r".
01563 $this->lng->txt("firstname").": ".$this->object->getFirstname()."\n\r".
01564 $this->lng->txt("lastname").": ".$this->object->getLastname()."\n\r".
01565 $this->lng->txt("institution").": ".$this->object->getInstitution()."\n\r".
01566 $this->lng->txt("department").": ".$this->object->getDepartment()."\n\r".
01567 $this->lng->txt("street").": ".$this->object->getStreet()."\n\r".
01568 $this->lng->txt("city").": ".$this->object->getCity()."\n\r".
01569 $this->lng->txt("zipcode").": ".$this->object->getZipcode()."\n\r".
01570 $this->lng->txt("country").": ".$this->object->getCountry()."\n\r".
01571 $this->lng->txt("phone_office").": ".$this->object->getPhoneOffice()."\n\r".
01572 $this->lng->txt("phone_home").": ".$this->object->getPhoneHome()."\n\r".
01573 $this->lng->txt("phone_mobile").": ".$this->object->getPhoneMobile()."\n\r".
01574 $this->lng->txt("fax").": ".$this->object->getFax()."\n\r".
01575 $this->lng->txt("email").": ".$this->object->getEmail()."\n\r".
01576 $this->lng->txt("hobby").": ".$this->object->getHobby()."\n\r".
01577 $this->lng->txt("matriculation").": ".$this->object->getMatriculation()."\n\r".
01578 $this->lng->txt("client_ip").": ".$this->object->getClientIP()."\n\r".
01579 $this->lng->txt("referral_comment").": ".$this->object->getComment()."\n\r".
01580 $this->lng->txt("create_date").": ".$this->object->getCreateDate()."\n\r".
01581 $this->lng->txt("default_role").": ".$_POST["Fobject"]["default_role"]."\n\r";
01582
01583 if($this->object->getTimeLimitUnlimited())
01584 {
01585 $body .= $this->lng->txt('time_limit').": ".$this->lng->txt('crs_unlimited')."\n\r";
01586 }
01587 else
01588 {
01589 $body .= $this->lng->txt('time_limit').": ".$this->lng->txt('crs_from')." ".
01590 strftime('%Y-%m-%d %R',$this->object->getTimeLimitFrom())." ".
01591 $this->lng->txt('crs_to')." ".
01592 strftime('%Y-%m-%d %R',$this->object->getTimeLimitUntil())."\n\r";
01593 }
01594
01595 $body .= $this->lng->txt('email_footer') . "\n\r";
01596
01597 if ($error_message = $umail->sendMail($this->object->getLogin(),"","",
01598 $this->lng->txt("profile_changed"),$body,array(),array("normal")))
01599 {
01600 $msg = $this->lng->txt("saved_successfully")."<br/>".$error_message;
01601 }
01602 else
01603 {
01604 $msg = $this->lng->txt("saved_successfully")."<br/>".$this->lng->txt("mail_sent");
01605 }
01606 }
01607 else
01608 {
01609 $msg = $this->lng->txt("saved_successfully");
01610 }
01611
01612
01613 sendInfo($msg,true);
01614
01615 if (strtolower($_GET["baseClass"]) == 'iladministrationgui')
01616 {
01617 $this->ctrl->redirectByClass("ilobjuserfoldergui", "view");
01618 }
01619 else
01620 {
01621 $this->ctrl->redirectByClass('ilobjcategorygui','listUsers');
01622 }
01623 }
01624
01625
01632 function activeRoleSaveObject()
01633 {
01634 global $rbacreview;
01635
01636 $_POST["id"] = $_POST["id"] ? $_POST["id"] : array();
01637
01638
01639 $global_roles_all = $rbacreview->getGlobalRoles();
01640 $assigned_global_roles = array_intersect($_POST["id"],$global_roles_all);
01641
01642 if (!count($_POST["id"]) or count($assigned_global_roles) < 1)
01643 {
01644 $this->ilias->raiseError($this->lng->txt("msg_min_one_active_role"),$this->ilias->error_obj->MESSAGE);
01645 }
01646
01647 if ($this->object->getId() == $_SESSION["AccountId"])
01648 {
01649 $_SESSION["RoleId"] = $_POST["id"];
01650 }
01651 else
01652 {
01653 if (count($user_online = ilUtil::getUsersOnline($this->object->getId())) == 1)
01654 {
01655
01656
01657 $roles = "RoleId|".serialize($_POST["id"]);
01658 $modified_data = preg_replace("/RoleId.*?;\}/",$roles,$user_online[$this->object->getId()]["data"]);
01659
01660 $q = "UPDATE usr_session SET data='".$modified_data."' WHERE user_id = '".$this->object->getId()."'";
01661 $this->ilias->db->query($q);
01662 }
01663 else
01664 {
01665
01666 }
01667 }
01668
01669 sendInfo($this->lng->txt("msg_roleassignment_active_changed").".<br/>".$this->lng->txt("msg_roleassignment_active_changed_comment"),true);
01670 $this->ctrl->redirect($this, "edit");
01671 }
01672
01678 function assignSaveObject()
01679 {
01680 global $rbacsystem, $rbacadmin, $rbacreview;
01681
01682 if (!$rbacsystem->checkAccess("edit_roleassignment", $this->usrf_ref_id))
01683 {
01684 $this->ilias->raiseError($this->lng->txt("msg_no_perm_assign_role_to_user"),$this->ilias->error_obj->MESSAGE);
01685 }
01686
01687 $selected_roles = $_POST["role_id"] ? $_POST["role_id"] : array();
01688 $posted_roles = $_POST["role_id_ctrl"] ? $_POST["role_id_ctrl"] : array();
01689
01690
01691 if ($this->object->getId() == SYSTEM_USER_ID and in_array(SYSTEM_ROLE_ID, $posted_roles))
01692 {
01693 array_push($selected_roles,SYSTEM_ROLE_ID);
01694 }
01695
01696 $global_roles_all = $rbacreview->getGlobalRoles();
01697 $assigned_roles_all = $rbacreview->assignedRoles($this->object->getId());
01698 $assigned_roles = array_intersect($assigned_roles_all,$posted_roles);
01699 $assigned_global_roles_all = array_intersect($assigned_roles_all,$global_roles_all);
01700 $assigned_global_roles = array_intersect($assigned_global_roles_all,$posted_roles);
01701 $posted_global_roles = array_intersect($selected_roles,$global_roles_all);
01702
01703 if ((empty($selected_roles) and count($assigned_roles_all) == count($assigned_roles))
01704 or (empty($posted_global_roles) and count($assigned_global_roles_all) == count($assigned_global_roles)))
01705 {
01706
01707
01708 sendInfo($this->lng->txt("msg_min_one_role")."<br/>".$this->lng->txt("action_aborted"),true);
01709 $this->ctrl->redirect($this,'roleassignment');
01710 }
01711
01712 foreach (array_diff($assigned_roles,$selected_roles) as $role)
01713 {
01714 $rbacadmin->deassignUser($role,$this->object->getId());
01715 }
01716
01717 foreach (array_diff($selected_roles,$assigned_roles) as $role)
01718 {
01719 $rbacadmin->assignUser($role,$this->object->getId(),false);
01720 }
01721
01722 include_once "./classes/class.ilObjRole.php";
01723 ilObjRole::_updateSessionRoles(array($this->object->getId()));
01724
01725
01726 $this->object->update();
01727
01728 sendInfo($this->lng->txt("msg_roleassignment_changed"),true);
01729
01730 if(strtolower($_GET["baseClass"]) == 'iladministrationgui')
01731 {
01732 $this->ctrl->redirect($this,'roleassignment');
01733 }
01734 else
01735 {
01736 $this->ctrl->redirectByClass('ilobjcategorygui','listUsers');
01737 }
01738
01739 }
01740
01746 function roleassignmentObject ()
01747 {
01748 global $rbacreview,$rbacsystem;
01749
01750 if (!$rbacsystem->checkAccess("edit_roleassignment", $this->usrf_ref_id))
01751 {
01752 $this->ilias->raiseError($this->lng->txt("msg_no_perm_assign_role_to_user"),$this->ilias->error_obj->MESSAGE);
01753 }
01754
01755 $_SESSION['filtered_roles'] = isset($_POST['filter']) ? $_POST['filter'] : $_SESSION['filtered_roles'];
01756
01757 if ($_SESSION['filtered_roles'] > 5)
01758 {
01759 $_SESSION['filtered_roles'] = 0;
01760 }
01761
01762 $this->tpl->addBlockfile('ADM_CONTENT','adm_content','tpl.usr_role_assignment.html');
01763
01764 if(true)
01765 {
01766 $this->tpl->setCurrentBlock("filter");
01767 $this->tpl->setVariable("FILTER_TXT_FILTER",$this->lng->txt('filter'));
01768 $this->tpl->setVariable("SELECT_FILTER",$this->__buildFilterSelect());
01769 $this->tpl->setVariable("FILTER_ACTION",$this->ctrl->getFormAction($this));
01770 $this->tpl->setVariable("FILTER_NAME",'roleassignment');
01771 $this->tpl->setVariable("FILTER_VALUE",$this->lng->txt('apply_filter'));
01772 $this->tpl->parseCurrentBlock();
01773 }
01774
01775
01776 $role_list = $rbacreview->getRolesByFilter($_SESSION["filtered_roles"],$this->object->getId());
01777 $assigned_roles = $rbacreview->assignedRoles($this->object->getId());
01778
01779 $counter = 0;
01780
01781 include_once ('class.ilObjRole.php');
01782
01783 foreach ($role_list as $role)
01784 {
01785
01786 $rolf = $rbacreview->getFoldersAssignedToRole($role["obj_id"],true);
01787
01788
01789 if ($rbacreview->isDeleted($rolf[0]))
01790 {
01791 continue;
01792 }
01793
01794
01795 $path = "";
01796
01797 if ($this->tree->isInTree($rolf[0]))
01798 {
01799 if ($rolf[0] == ROLE_FOLDER_ID)
01800 {
01801 $path = $this->lng->txt("global");
01802 }
01803 else
01804 {
01805 $tmpPath = $this->tree->getPathFull($rolf[0]);
01806
01807
01808
01809
01810
01811
01812
01813
01814
01815
01816
01817
01818 $path = $tmpPath[count($tmpPath)-2]["title"];
01819 }
01820 }
01821 else
01822 {
01823 $path = "<b>Rolefolder ".$rolf[0]." not found in tree! (Role ".$role["obj_id"].")</b>";
01824 }
01825
01826 $disabled = false;
01827
01828
01829 if (($this->object->getId() == SYSTEM_USER_ID and $role["obj_id"] == SYSTEM_ROLE_ID)
01830 or (!in_array(SYSTEM_ROLE_ID,$_SESSION["RoleId"]) and $role["obj_id"] == SYSTEM_ROLE_ID))
01831 {
01832 $disabled = true;
01833 }
01834
01835 if (substr($role["title"],0,3) == "il_")
01836 {
01837 if (!$assignable)
01838 {
01839 $rolf_arr = $rbacreview->getFoldersAssignedToRole($role["obj_id"],true);
01840 $rolf2 = $rolf_arr[0];
01841 }
01842 else
01843 {
01844 $rolf2 = $rolf;
01845 }
01846
01847 $parent_node = $this->tree->getParentNodeData($rolf2);
01848
01849 $role["description"] = $this->lng->txt("obj_".$parent_node["type"])." (#".$parent_node["obj_id"].")";
01850 }
01851
01852 $role_ids[$counter] = $role["obj_id"];
01853
01854 $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"]."\"/>";
01855 $this->ctrl->setParameterByClass("ilobjrolegui", "ref_id", $rolf[0]);
01856 $this->ctrl->setParameterByClass("ilobjrolegui", "obj_id", $role["obj_id"]);
01857 $result_set[$counter][] = "<a href=\"".$this->ctrl->getLinkTargetByClass("ilobjrolegui", "perm")."\">".ilObjRole::_getTranslation($role["title"])."</a>";
01858 $result_set[$counter][] = $role["description"];
01859 $result_set[$counter][] = $path;
01860
01861 ++$counter;
01862 }
01863
01864 return $this->__showRolesTable($result_set,$role_ids);
01865 }
01866
01877 function insertPublicProfile($a_template_var, $a_template_block_name, $a_additional = "")
01878 {
01879 if ($_GET["vcard"] == 1)
01880 {
01881 $this->deliverVCardObject();
01882 }
01883 else
01884 {
01885 $this->tpl->setVariable($a_template_var,
01886 $this->getPublicProfile($a_additional, true));
01887 }
01888 }
01889
01897 function getPublicProfile($a_additional = "", $no_ilctrl = false)
01898 {
01899 $tpl = new ilTemplate("tpl.usr_public_profile.html", true, true);
01900
01901 $tpl->setVariable("USR_PROFILE", $this->lng->txt("profile_of")." ".$this->object->getLogin());
01902
01903 $tpl->setVariable("ROWCOL1", "tblrow1");
01904 $tpl->setVariable("ROWCOL2", "tblrow2");
01905
01906
01907
01908 if ($this->object->getPref("public_profile") != "y")
01909 {
01910 return;
01911 }
01912
01913 $tpl->setVariable("TXT_NAME", $this->lng->txt("name"));
01914 $tpl->setVariable("FIRSTNAME", $this->object->getFirstName());
01915 $tpl->setVariable("LASTNAME", $this->object->getLastName());
01916
01917 $tpl->setCurrentBlock("vcard");
01918 $tpl->setVariable("TXT_VCARD", $this->lng->txt("vcard"));
01919 $tpl->setVariable("TXT_DOWNLOAD_VCARD", $this->lng->txt("vcard_download"));
01920 if ($no_ilctrl)
01921 {
01922
01923 $tpl->setVariable("HREF_VCARD", basename($_SERVER["PHP_SELF"]) . "?ref_id=".
01924 $_GET["ref_id"]."&user=" . $_GET["user"] . "&vcard=1");
01925 }
01926 else
01927 {
01928 $this->ctrl->setParameter($this, "user", $this->object->getId());
01929 $tpl->setVariable("HREF_VCARD", $this->ctrl->getLinkTarget($this, "deliverVCard"));
01930 }
01931 $tpl->setVariable("IMG_VCARD", ilUtil::getImagePath("vcard.png"));
01932
01933 $webspace_dir = ilUtil::getWebspaceDir("user");
01934 $check_dir = ilUtil::getWebspaceDir();
01935 $imagefile = $webspace_dir."/usr_images/".$this->object->getPref("profile_image");
01936 $check_file = $check_dir."/usr_images/".$this->object->getPref("profile_image");
01937
01938 if ($this->object->getPref("public_upload")=="y" && @is_file($check_file))
01939 {
01940
01941
01942 $tpl->setCurrentBlock("image");
01943 $tpl->setVariable("TXT_IMAGE",$this->lng->txt("image"));
01944 $tpl->setVariable("IMAGE_PATH", $webspace_dir."/usr_images/".$this->object->getPref("profile_image")."?dummy=".rand(1,999999));
01945 $tpl->parseCurrentBlock();
01946 }
01947
01948 $val_arr = array("getInstitution" => "institution", "getDepartment" => "department",
01949 "getStreet" => "street",
01950 "getZipcode" => "zip", "getCity" => "city", "getCountry" => "country",
01951 "getPhoneOffice" => "phone_office", "getPhoneHome" => "phone_home",
01952 "getPhoneMobile" => "phone_mobile", "getFax" => "fax", "getEmail" => "email",
01953 "getHobby" => "hobby", "getMatriculation" => "matriculation", "getClientIP" => "client_ip");
01954
01955 foreach ($val_arr as $key => $value)
01956 {
01957
01958 if ($this->object->getPref("public_".$value) == "y")
01959 {
01960 $tpl->setCurrentBlock("profile_data");
01961 $tpl->setVariable("TXT_DATA", $this->lng->txt($value));
01962 $tpl->setVariable("DATA", $this->object->$key());
01963 $tpl->parseCurrentBlock();
01964 }
01965 }
01966
01967 if (is_array($a_additional))
01968 {
01969 foreach($a_additional as $key => $val)
01970 {
01971 $tpl->setCurrentBlock("profile_data");
01972 $tpl->setVariable("TXT_DATA", $key);
01973 $tpl->setVariable("DATA", $val);
01974 $tpl->parseCurrentBlock();
01975 }
01976 }
01977
01978 return $tpl->get();
01979 }
01980
01984 function deliverVCardObject()
01985 {
01986 require_once "./classes/class.ilvCard.php";
01987 $vcard = new ilvCard();
01988
01989 if ($this->object->getPref("public_profile")!="y")
01990 {
01991 return;
01992 }
01993
01994 $vcard->setName($this->object->getLastName(), $this->object->getFirstName(), "", $this->object->getUTitle());
01995 $vcard->setNickname($this->object->getLogin());
01996
01997 $webspace_dir = ilUtil::getWebspaceDir("output");
01998 $imagefile = $webspace_dir."/usr_images/".$this->object->getPref("profile_image");
01999 if ($this->object->getPref("public_upload")=="y" && @is_file($imagefile))
02000 {
02001 $fh = fopen($imagefile, "r");
02002 if ($fh)
02003 {
02004 $image = fread($fh, filesize($imagefile));
02005 fclose($fh);
02006 require_once "./content/classes/Media/class.ilObjMediaObject.php";
02007 $mimetype = ilObjMediaObject::getMimeType($imagefile);
02008 if (preg_match("/^image/", $mimetype))
02009 {
02010 $type = $mimetype;
02011 }
02012 $vcard->setPhoto($image, $type);
02013 }
02014 }
02015
02016 $val_arr = array("getInstitution" => "institution", "getDepartment" => "department",
02017 "getStreet" => "street",
02018 "getZipcode" => "zip", "getCity" => "city", "getCountry" => "country",
02019 "getPhoneOffice" => "phone_office", "getPhoneHome" => "phone_home",
02020 "getPhoneMobile" => "phone_mobile", "getFax" => "fax", "getEmail" => "email",
02021 "getHobby" => "hobby", "getMatriculation" => "matriculation", "getClientIP" => "client_ip");
02022
02023 $org = array();
02024 $adr = array();
02025 foreach ($val_arr as $key => $value)
02026 {
02027
02028 if ($this->object->getPref("public_".$value) == "y")
02029 {
02030 switch ($value)
02031 {
02032 case "institution":
02033 $org[0] = $this->object->$key();
02034 break;
02035 case "department":
02036 $org[1] = $this->object->$key();
02037 break;
02038 case "street":
02039 $adr[2] = $this->object->$key();
02040 break;
02041 case "zip":
02042 $adr[5] = $this->object->$key();
02043 break;
02044 case "city":
02045 $adr[3] = $this->object->$key();
02046 break;
02047 case "country":
02048 $adr[6] = $this->object->$key();
02049 break;
02050 case "phone_office":
02051 $vcard->setPhone($this->object->$key(), TEL_TYPE_WORK);
02052 break;
02053 case "phone_home":
02054 $vcard->setPhone($this->object->$key(), TEL_TYPE_HOME);
02055 break;
02056 case "phone_mobile":
02057 $vcard->setPhone($this->object->$key(), TEL_TYPE_CELL);
02058 break;
02059 case "fax":
02060 $vcard->setPhone($this->object->$key(), TEL_TYPE_FAX);
02061 break;
02062 case "email":
02063 $vcard->setEmail($this->object->$key());
02064 break;
02065 case "hobby":
02066 $vcard->setNote($this->object->$key());
02067 break;
02068 }
02069 }
02070 }
02071
02072 if (count($org))
02073 {
02074 $vcard->setOrganization(join(";", $org));
02075 }
02076 if (count($adr))
02077 {
02078 $vcard->setAddress($adr[0], $adr[1], $adr[2], $adr[3], $adr[4], $adr[5], $adr[6]);
02079 }
02080
02081 ilUtil::deliverData(utf8_decode($vcard->buildVCard()), $vcard->getFilename(), $vcard->getMimetype());
02082 }
02083
02084
02085 function __getDateSelect($a_type,$a_varname,$a_selected)
02086 {
02087 switch($a_type)
02088 {
02089 case "minute":
02090 for($i=0;$i<=60;$i++)
02091 {
02092 $days[$i] = $i < 10 ? "0".$i : $i;
02093 }
02094 return ilUtil::formSelect($a_selected,$a_varname,$days,false,true);
02095
02096 case "hour":
02097 for($i=0;$i<24;$i++)
02098 {
02099 $days[$i] = $i < 10 ? "0".$i : $i;
02100 }
02101 return ilUtil::formSelect($a_selected,$a_varname,$days,false,true);
02102
02103 case "day":
02104 for($i=1;$i<32;$i++)
02105 {
02106 $days[$i] = $i < 10 ? "0".$i : $i;
02107 }
02108 return ilUtil::formSelect($a_selected,$a_varname,$days,false,true);
02109
02110 case "month":
02111 for($i=1;$i<13;$i++)
02112 {
02113 $month[$i] = $i < 10 ? "0".$i : $i;
02114 }
02115 return ilUtil::formSelect($a_selected,$a_varname,$month,false,true);
02116
02117 case "year":
02118 for($i = date("Y",time());$i < date("Y",time()) + 11;++$i)
02119 {
02120 $year[$i] = $i;
02121 }
02122 return ilUtil::formSelect($a_selected,$a_varname,$year,false,true);
02123 }
02124 }
02125
02126 function __toUnix($a_time_arr)
02127 {
02128 return mktime($a_time_arr["hour"],
02129 $a_time_arr["minute"],
02130 $a_time_arr["second"],
02131 $a_time_arr["month"],
02132 $a_time_arr["day"],
02133 $a_time_arr["year"]);
02134 }
02135
02136 function __showRolesTable($a_result_set,$a_role_ids = NULL)
02137 {
02138 global $rbacsystem;
02139
02140 $actions = array("assignSave" => $this->lng->txt("change_assignment"));
02141
02142 $tbl =& $this->__initTableGUI();
02143 $tpl =& $tbl->getTemplateObject();
02144
02145 $tpl->setCurrentBlock("tbl_form_header");
02146 $tpl->setVariable("FORMACTION",$this->ctrl->getFormAction($this));
02147 $tpl->parseCurrentBlock();
02148
02149 $tpl->setCurrentBlock("tbl_action_row");
02150
02151 $tpl->setVariable("COLUMN_COUNTS",4);
02152 $tpl->setVariable("IMG_ARROW", ilUtil::getImagePath("arrow_downright.gif"));
02153
02154 foreach ($actions as $name => $value)
02155 {
02156 $tpl->setCurrentBlock("tbl_action_btn");
02157 $tpl->setVariable("BTN_NAME",$name);
02158 $tpl->setVariable("BTN_VALUE",$value);
02159 $tpl->parseCurrentBlock();
02160 }
02161
02162 if (!empty($a_role_ids))
02163 {
02164
02165 $tpl->setCurrentBlock("tbl_action_toggle_checkboxes");
02166 $tpl->setVariable("JS_VARNAME","role_id");
02167 $tpl->setVariable("JS_ONCLICK",ilUtil::array_php2js($a_role_ids));
02168 $tpl->setVariable("TXT_CHECKALL", $this->lng->txt("check_all"));
02169 $tpl->setVariable("TXT_UNCHECKALL", $this->lng->txt("uncheck_all"));
02170 $tpl->parseCurrentBlock();
02171 }
02172
02173 $tpl->setVariable("TPLPATH",$this->tpl->tplPath);
02174
02175
02176 $this->ctrl->setParameter($this,"cmd","roleassignment");
02177
02178
02179 $tbl->setTitle($this->lng->txt("edit_roleassignment"),"icon_role.gif",$this->lng->txt("roles"));
02180
02181
02182 $tbl->setHeaderNames(array("",$this->lng->txt("role"),$this->lng->txt("description"),$this->lng->txt("context")));
02183 $tbl->setHeaderVars(array("","title","description","context"),$this->ctrl->getParameterArray($this,"",false));
02184 $tbl->setColumnWidth(array("","30%","40%","30%"));
02185
02186 $this->__setTableGUIBasicData($tbl,$a_result_set,"roleassignment");
02187 $tbl->render();
02188 $this->tpl->setVariable("ROLES_TABLE",$tbl->tpl->get());
02189
02190 return true;
02191 }
02192
02193 function &__initTableGUI()
02194 {
02195 include_once "class.ilTableGUI.php";
02196
02197 return new ilTableGUI(0,false);
02198 }
02199
02200 function __setTableGUIBasicData(&$tbl,&$result_set,$from = "")
02201 {
02202 switch($from)
02203 {
02204 default:
02205 $order = $_GET["sort_by"] ? $_GET["sort_by"] : "title";
02206 break;
02207 }
02208
02209
02210 $tbl->setOrderColumn($order);
02211 $tbl->setOrderDirection($_GET["sort_order"]);
02212 $tbl->setOffset($_GET["offset"]);
02213 $tbl->setLimit($_GET["limit"]);
02214 $tbl->setFooter("tblfooter",$this->lng->txt("previous"),$this->lng->txt("next"));
02215 $tbl->setData($result_set);
02216 }
02217
02218 function __unsetSessionVariables()
02219 {
02220 unset($_SESSION["filtered_roles"]);
02221 }
02222
02223 function __buildFilterSelect()
02224 {
02225 $action[0] = $this->lng->txt('assigned_roles');
02226 $action[1] = $this->lng->txt('all_roles');
02227 $action[2] = $this->lng->txt('all_global_roles');
02228 $action[3] = $this->lng->txt('all_local_roles');
02229 $action[4] = $this->lng->txt('internal_local_roles_only');
02230 $action[5] = $this->lng->txt('non_internal_local_roles_only');
02231
02232 return ilUtil::formSelect($_SESSION['filtered_roles'],"filter",$action,false,true);
02233 }
02234
02235 function hitsperpageObject()
02236 {
02237 parent::hitsperpageObject();
02238 $this->roleassignmentObject();
02239 }
02240
02245 function addAdminLocatorItems()
02246 {
02247 global $ilLocator;
02248
02249 if ($_GET["admin_mode"] == "settings")
02250 {
02251 $ilLocator->addItem($this->lng->txt("administration"),
02252 $this->ctrl->getLinkTargetByClass("iladministrationgui", "frameset"),
02253 ilFrameTargetInfo::_getFrame("MainContent"));
02254
02255 $ilLocator->addItem($this->lng->txt("obj_".ilObject::_lookupType(
02256 ilObject::_lookupObjId($_GET["ref_id"]))),
02257 $this->ctrl->getLinkTargetByClass("ilobjuserfoldergui", "view"));
02258
02259 if ($_GET["obj_id"] > 0)
02260 {
02261 $ilLocator->addItem($this->object->getTitle(),
02262 $this->ctrl->getLinkTarget($this, "view"));
02263 }
02264 }
02265 }
02266
02267 function showUpperIcon()
02268 {
02269 global $tree, $tpl, $objDefinition;
02270
02271 if (strtolower($_GET["baseClass"]) == "iladministrationgui")
02272 {
02273 $tpl->setUpperIcon(
02274 $this->ctrl->getLinkTargetByClass("ilobjuserfoldergui", "view"));
02275 }
02276 else
02277 {
02278 if ($this->object->getRefId() != ROOT_FOLDER_ID &&
02279 $this->object->getRefId() != SYSTEM_FOLDER_ID)
02280 {
02281 $par_id = $tree->getParentId($this->object->getRefId());
02282 $tpl->setUpperIcon("repository.php?ref_id=".$par_id);
02283 }
02284 }
02285 }
02286
02287 }
02288 ?>