Пример #1
0
 /**
  * Init user form
  */
 function initForm($a_mode)
 {
     global $lng, $ilCtrl, $styleDefinition, $ilSetting, $ilClientIniFile, $ilUser;
     $settings = $ilSetting->getAll();
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->form_gui = new ilPropertyFormGUI();
     $this->form_gui->setFormAction($ilCtrl->getFormAction($this));
     if ($a_mode == "create") {
         $this->form_gui->setTitle($lng->txt("usr_new"));
     } else {
         $this->form_gui->setTitle($lng->txt("usr_edit"));
     }
     // login data
     $sec_l = new ilFormSectionHeaderGUI();
     $sec_l->setTitle($lng->txt("login_data"));
     $this->form_gui->addItem($sec_l);
     // authentication mode
     include_once './Services/Authentication/classes/class.ilAuthUtils.php';
     $active_auth_modes = ilAuthUtils::_getActiveAuthModes();
     $am = new ilSelectInputGUI($lng->txt("auth_mode"), "auth_mode");
     $option = array();
     foreach ($active_auth_modes as $auth_name => $auth_key) {
         if ($auth_name == 'default') {
             $name = $this->lng->txt('auth_' . $auth_name) . " (" . $this->lng->txt('auth_' . ilAuthUtils::_getAuthModeName($auth_key)) . ")";
         } else {
             $name = $this->lng->txt('auth_' . $auth_name);
         }
         $option[$auth_name] = $name;
     }
     $am->setOptions($option);
     $this->form_gui->addItem($am);
     if ($a_mode == "edit") {
         $id = new ilNonEditableValueGUI($lng->txt("usr_id"), "id");
         $id->setValue($this->object->getId());
         $this->form_gui->addItem($id);
     }
     // login
     $lo = new ilUserLoginInputGUI($lng->txt("login"), "login");
     $lo->setRequired(true);
     if ($a_mode == "edit") {
         $lo->setCurrentUserId($this->object->getId());
         try {
             include_once 'Services/Calendar/classes/class.ilDate.php';
             $last_history_entry = ilObjUser::_getLastHistoryDataByUserId($this->object->getId());
             $lo->setInfo(sprintf($this->lng->txt('usr_loginname_history_info'), ilDatePresentation::formatDate(new ilDateTime($last_history_entry[1], IL_CAL_UNIX)), $last_history_entry[0]));
         } catch (ilUserException $e) {
         }
     }
     $this->form_gui->addItem($lo);
     $pw = new ilPasswordInputGUI($lng->txt("passwd"), "passwd");
     $pw->setSize(32);
     $pw->setMaxLength(32);
     $pw->setValidateAuthPost("auth_mode");
     if ($a_mode == "create") {
         $pw->setRequiredOnAuth(true);
     }
     $pw->setInfo(ilUtil::getPasswordRequirementsInfo());
     $this->form_gui->addItem($pw);
     // @todo: invisible/hidden passwords
     // external account
     include_once './Services/Authentication/classes/class.ilAuthUtils.php';
     if (ilAuthUtils::_isExternalAccountEnabled()) {
         $ext = new ilTextInputGUI($lng->txt("user_ext_account"), "ext_account");
         $ext->setSize(40);
         $ext->setMaxLength(250);
         $ext->setInfo($lng->txt("user_ext_account_desc"));
         $this->form_gui->addItem($ext);
     }
     // login data
     $sec_si = new ilFormSectionHeaderGUI();
     $sec_si->setTitle($this->lng->txt("system_information"));
     $this->form_gui->addItem($sec_si);
     // create date, approve date, agreement date, last login
     if ($a_mode == "edit") {
         $sia = array("create_date", "approve_date", "agree_date", "last_login", "owner");
         foreach ($sia as $a) {
             $siai = new ilNonEditableValueGUI($lng->txt($a), $a);
             $this->form_gui->addItem($siai);
         }
     }
     // active
     $ac = new ilCheckboxInputGUI($lng->txt("active"), "active");
     $ac->setChecked(true);
     $this->form_gui->addItem($ac);
     // access	@todo: get fields right (names change)
     $lng->loadLanguageModule('crs');
     // access
     $radg = new ilRadioGroupInputGUI($lng->txt("time_limit"), "time_limit_unlimited");
     $radg->setValue(1);
     $op1 = new ilRadioOption($lng->txt("user_access_unlimited"), 1);
     $radg->addOption($op1);
     $op2 = new ilRadioOption($lng->txt("user_access_limited"), 0);
     $radg->addOption($op2);
     //		$ac = new ilCheckboxInputGUI($lng->txt("time_limit"), "time_limit_unlimited");
     //		$ac->setChecked(true);
     //		$ac->setOptionTitle($lng->txt("crs_unlimited"));
     // access.from
     $acfrom = new ilDateTimeInputGUI($this->lng->txt("crs_from"), "time_limit_from");
     $acfrom->setShowTime(true);
     //		$ac->addSubItem($acfrom);
     $op2->addSubItem($acfrom);
     // access.to
     $acto = new ilDateTimeInputGUI($this->lng->txt("crs_to"), "time_limit_until");
     $acto->setShowTime(true);
     //		$ac->addSubItem($acto);
     $op2->addSubItem($acto);
     //		$this->form_gui->addItem($ac);
     $this->form_gui->addItem($radg);
     require_once 'Services/WebDAV/classes/class.ilDiskQuotaActivationChecker.php';
     if (ilDiskQuotaActivationChecker::_isActive()) {
         $lng->loadLanguageModule("file");
         $quota_head = new ilFormSectionHeaderGUI();
         $quota_head->setTitle($lng->txt("repository_disk_quota"));
         $this->form_gui->addItem($quota_head);
         // disk quota
         $disk_quota = new ilTextInputGUI($lng->txt("disk_quota"), "disk_quota");
         $disk_quota->setSize(10);
         $disk_quota->setMaxLength(11);
         $disk_quota->setInfo($this->lng->txt("enter_in_mb_desc"));
         $this->form_gui->addItem($disk_quota);
         if ($a_mode == "edit") {
             // show which disk quota is in effect, and explain why
             require_once 'Services/WebDAV/classes/class.ilDiskQuotaChecker.php';
             $dq_info = ilDiskQuotaChecker::_lookupDiskQuota($this->object->getId());
             if ($dq_info['user_disk_quota'] > $dq_info['role_disk_quota']) {
                 $info_text = sprintf($lng->txt('disk_quota_is_1_instead_of_2_by_3'), ilFormat::formatSize($dq_info['user_disk_quota'], 'short'), ilFormat::formatSize($dq_info['role_disk_quota'], 'short'), $dq_info['role_title']);
             } else {
                 if (is_infinite($dq_info['role_disk_quota'])) {
                     $info_text = sprintf($lng->txt('disk_quota_is_unlimited_by_1'), $dq_info['role_title']);
                 } else {
                     $info_text = sprintf($lng->txt('disk_quota_is_1_by_2'), ilFormat::formatSize($dq_info['role_disk_quota'], 'short'), $dq_info['role_title']);
                 }
             }
             $disk_quota->setInfo($this->lng->txt("enter_in_mb_desc") . '<br>' . $info_text);
             // disk usage
             $du_info = ilDiskQuotaChecker::_lookupDiskUsage($this->object->getId());
             $disk_usage = new ilNonEditableValueGUI($lng->txt("disk_usage"), "disk_usage");
             if ($du_info['last_update'] === null) {
                 $disk_usage->setValue($lng->txt('unknown'));
             } else {
                 require_once './Services/Utilities/classes/class.ilFormat.php';
                 $disk_usage->setValue(ilFormat::formatSize($du_info['disk_usage'], 'short'));
                 $info = '<table class="il_user_quota_disk_usage_overview">';
                 // write the count and size of each object type
                 foreach ($du_info['details'] as $detail_data) {
                     $info .= '<tr>' . '<td class="std">' . $detail_data['count'] . '</td>' . '<td class="std">' . $lng->txt($detail_data['type']) . '</td>' . '<td class="std">' . ilFormat::formatSize($detail_data['size'], 'short') . '</td>' . '</tr>';
                 }
                 $info .= '</table>';
                 $info .= '<br>' . $this->lng->txt('last_update') . ': ' . ilDatePresentation::formatDate(new ilDateTime($du_info['last_update'], IL_CAL_DATETIME));
                 $disk_usage->setInfo($info);
             }
             $this->form_gui->addItem($disk_usage);
             // date when the last disk quota reminder was sent to the user
             if (true || $dq_info['last_reminder']) {
                 $reminder = new ilNonEditableValueGUI($lng->txt("disk_quota_last_reminder_sent"), "last_reminder");
                 $reminder->setValue(ilDatePresentation::formatDate(new ilDateTime($dq_info['last_reminder'], IL_CAL_DATETIME)));
                 $reminder->setInfo($this->lng->txt("disk_quota_last_reminder_sent_desc"));
                 $this->form_gui->addItem($reminder);
             }
         }
     }
     if (ilDiskQuotaActivationChecker::_isPersonalWorkspaceActive()) {
         $lng->loadLanguageModule("file");
         $quota_head = new ilFormSectionHeaderGUI();
         $quota_head->setTitle($lng->txt("personal_workspace_disk_quota"));
         $this->form_gui->addItem($quota_head);
         // personal workspace disk quota
         $wsp_disk_quota = new ilTextInputGUI($lng->txt("disk_quota"), "wsp_disk_quota");
         $wsp_disk_quota->setSize(10);
         $wsp_disk_quota->setMaxLength(11);
         $wsp_disk_quota->setInfo($this->lng->txt("enter_in_mb_desc"));
         $this->form_gui->addItem($wsp_disk_quota);
         if ($a_mode == "edit") {
             // show which disk quota is in effect, and explain why
             require_once 'Services/WebDAV/classes/class.ilDiskQuotaChecker.php';
             $dq_info = ilDiskQuotaChecker::_lookupPersonalWorkspaceDiskQuota($this->object->getId());
             if ($dq_info['user_wsp_disk_quota'] > $dq_info['role_wsp_disk_quota']) {
                 $info_text = sprintf($lng->txt('disk_quota_is_1_instead_of_2_by_3'), ilFormat::formatSize($dq_info['user_wsp_disk_quota'], 'short'), ilFormat::formatSize($dq_info['role_wsp_disk_quota'], 'short'), $dq_info['role_title']);
             } else {
                 if (is_infinite($dq_info['role_wsp_disk_quota'])) {
                     $info_text = sprintf($lng->txt('disk_quota_is_unlimited_by_1'), $dq_info['role_title']);
                 } else {
                     $info_text = sprintf($lng->txt('disk_quota_is_1_by_2'), ilFormat::formatSize($dq_info['role_wsp_disk_quota'], 'short'), $dq_info['role_title']);
                 }
             }
             $wsp_disk_quota->setInfo($this->lng->txt("enter_in_mb_desc") . '<br>' . $info_text);
         }
         // disk usage
         include_once "Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
         $du_info = ilDiskQuotaHandler::getFilesizeByTypeAndOwner($this->object->getId());
         $disk_usage = new ilNonEditableValueGUI($lng->txt("disk_usage"), "disk_usage");
         if (!sizeof($du_info)) {
             $disk_usage->setValue($lng->txt('unknown'));
         } else {
             require_once './Services/Utilities/classes/class.ilFormat.php';
             $disk_usage->setValue(ilFormat::formatSize(ilDiskQuotaHandler::getFilesizeByOwner($this->object->getId())));
             $info = '<table class="il_user_quota_disk_usage_overview">';
             // write the count and size of each object type
             foreach ($du_info as $detail_data) {
                 $info .= '<tr>' . '<td class="std">' . $detail_data['count'] . '</td>' . '<td class="std">' . $lng->txt("obj_" . $detail_data["src_type"]) . '</td>' . '<td class="std">' . ilFormat::formatSize($detail_data['filesize'], 'short') . '</td>' . '</tr>';
             }
             $info .= '</table>';
             $disk_usage->setInfo($info);
         }
         $this->form_gui->addItem($disk_usage);
     }
     // personal data
     if ($this->isSettingChangeable('gender') or $this->isSettingChangeable('firstname') or $this->isSettingChangeable('lastname') or $this->isSettingChangeable('title') or $this->isSettingChangeable('personal_image') or $this->isSettingChangeable('birhtday')) {
         $sec_pd = new ilFormSectionHeaderGUI();
         $sec_pd->setTitle($this->lng->txt("personal_data"));
         $this->form_gui->addItem($sec_pd);
     }
     // gender
     if ($this->isSettingChangeable('gender')) {
         $gndr = new ilRadioGroupInputGUI($lng->txt("gender"), "gender");
         $gndr->setRequired(isset($settings["require_gender"]) && $settings["require_gender"]);
         $female = new ilRadioOption($lng->txt("gender_f"), "f");
         $gndr->addOption($female);
         $male = new ilRadioOption($lng->txt("gender_m"), "m");
         $gndr->addOption($male);
         $this->form_gui->addItem($gndr);
     }
     // firstname, lastname, title
     $fields = array("firstname" => true, "lastname" => true, "title" => isset($settings["require_title"]) && $settings["require_title"]);
     foreach ($fields as $field => $req) {
         if ($this->isSettingChangeable($field)) {
             $inp = new ilTextInputGUI($lng->txt($field), $field);
             $inp->setSize(32);
             $inp->setMaxLength(32);
             $inp->setRequired($req);
             $this->form_gui->addItem($inp);
         }
     }
     // personal image
     if ($this->isSettingChangeable('upload')) {
         $pi = new ilImageFileInputGUI($lng->txt("personal_picture"), "userfile");
         if ($a_mode == "edit" || $a_mode == "upload") {
             $pi->setImage(ilObjUser::_getPersonalPicturePath($this->object->getId(), "small", true, true));
         }
         $this->form_gui->addItem($pi);
     }
     if ($this->isSettingChangeable('birthday')) {
         $birthday = new ilBirthdayInputGUI($lng->txt('birthday'), 'birthday');
         $birthday->setRequired(isset($settings["require_birthday"]) && $settings["require_birthday"]);
         $birthday->setShowEmpty(true);
         $birthday->setStartYear(1900);
         $this->form_gui->addItem($birthday);
     }
     // institution, department, street, city, zip code, country, phone office
     // phone home, phone mobile, fax, e-mail
     $fields = array(array("institution", 40, 80), array("department", 40, 80), array("street", 40, 40), array("city", 40, 40), array("zipcode", 10, 10), array("country", 40, 40), array("sel_country"), array("phone_office", 30, 30), array("phone_home", 30, 30), array("phone_mobile", 30, 30), array("fax", 30, 30));
     $counter = 0;
     foreach ($fields as $field) {
         if (!$counter++ and $this->isSettingChangeable($field[0])) {
             // contact data
             $sec_cd = new ilFormSectionHeaderGUI();
             $sec_cd->setTitle($this->lng->txt("contact_data"));
             $this->form_gui->addItem($sec_cd);
         }
         if ($this->isSettingChangeable($field[0])) {
             if ($field[0] != "sel_country") {
                 $inp = new ilTextInputGUI($lng->txt($field[0]), $field[0]);
                 $inp->setSize($field[1]);
                 $inp->setMaxLength($field[2]);
                 $inp->setRequired(isset($settings["require_" . $field[0]]) && $settings["require_" . $field[0]]);
                 $this->form_gui->addItem($inp);
             } else {
                 // country selection
                 include_once "./Services/Form/classes/class.ilCountrySelectInputGUI.php";
                 $cs = new ilCountrySelectInputGUI($lng->txt($field[0]), $field[0]);
                 $cs->setRequired(isset($settings["require_" . $field[0]]) && $settings["require_" . $field[0]]);
                 $this->form_gui->addItem($cs);
             }
         }
     }
     // email
     if ($this->isSettingChangeable('email')) {
         $em = new ilEMailInputGUI($lng->txt("email"), "email");
         $em->setRequired(isset($settings["require_email"]) && $settings["require_email"]);
         $this->form_gui->addItem($em);
     }
     // interests/hobbies
     if ($this->isSettingChangeable('hobby')) {
         $hob = new ilTextAreaInputGUI($lng->txt("hobby"), "hobby");
         $hob->setRows(3);
         $hob->setCols(40);
         $hob->setRequired(isset($settings["require_hobby"]) && $settings["require_hobby"]);
         $this->form_gui->addItem($hob);
     }
     // referral comment
     if ($this->isSettingChangeable('referral_comment')) {
         $rc = new ilTextAreaInputGUI($lng->txt("referral_comment"), "referral_comment");
         $rc->setRows(3);
         $rc->setCols(40);
         $rc->setRequired(isset($settings["require_referral_comment"]) && $settings["require_referral_comment"]);
         $this->form_gui->addItem($rc);
     }
     // interests
     $sh = new ilFormSectionHeaderGUI();
     $sh->setTitle($lng->txt("interests"));
     $this->form_gui->addItem($sh);
     $multi_fields = array("interests_general", "interests_help_offered", "interests_help_looking");
     foreach ($multi_fields as $multi_field) {
         if ($this->isSettingChangeable($multi_field)) {
             // see ilUserProfile
             $ti = new ilTextInputGUI($lng->txt($multi_field), $multi_field);
             $ti->setMulti(true);
             $ti->setMaxLength(40);
             $ti->setSize(40);
             $ti->setRequired(isset($settings["require_" . $multi_field]) && $settings["require_" . $multi_field]);
             $this->form_gui->addItem($ti);
         }
     }
     // instant messengers
     if ($this->isSettingChangeable('instant_messengers')) {
         $sec_im = new ilFormSectionHeaderGUI();
         $sec_im->setTitle($this->lng->txt("instant_messengers"));
         $this->form_gui->addItem($sec_im);
     }
     // icq, yahoo, msn, aim, skype
     $fields = array("icq", "yahoo", "msn", "aim", "skype", "jabber", "voip");
     foreach ($fields as $field) {
         if ($this->isSettingChangeable('instant_messengers')) {
             $im = new ilTextInputGUI($lng->txt("im_" . $field), "im_" . $field);
             $im->setSize(40);
             $im->setMaxLength(40);
             $this->form_gui->addItem($im);
         }
     }
     // other information
     if ($this->isSettingChangeable('user_profile_other')) {
         $sec_oi = new ilFormSectionHeaderGUI();
         $sec_oi->setTitle($this->lng->txt("user_profile_other"));
         $this->form_gui->addItem($sec_oi);
     }
     // matriculation number
     if ($this->isSettingChangeable('matriculation')) {
         $mr = new ilTextInputGUI($lng->txt("matriculation"), "matriculation");
         $mr->setSize(40);
         $mr->setMaxLength(40);
         $mr->setRequired(isset($settings["require_matriculation"]) && $settings["require_matriculation"]);
         $this->form_gui->addItem($mr);
     }
     // delicious
     if ($this->isSettingChangeable('delicious')) {
         $mr = new ilTextInputGUI($lng->txt("delicious"), "delicious");
         $mr->setSize(40);
         $mr->setMaxLength(40);
         $mr->setRequired(isset($settings["require_delicious"]) && $settings["require_delicious"]);
         $this->form_gui->addItem($mr);
     }
     // client IP
     $ip = new ilTextInputGUI($lng->txt("client_ip"), "client_ip");
     $ip->setSize(40);
     $ip->setMaxLength(255);
     $ip->setInfo($this->lng->txt("current_ip") . " " . $_SERVER["REMOTE_ADDR"] . " <br />" . '<span class="warning">' . $this->lng->txt("current_ip_alert") . "</span>");
     $this->form_gui->addItem($ip);
     // additional user defined fields
     include_once './Services/User/classes/class.ilUserDefinedFields.php';
     $user_defined_fields = ilUserDefinedFields::_getInstance();
     if ($this->usrf_ref_id == USER_FOLDER_ID) {
         $all_defs = $user_defined_fields->getDefinitions();
     } else {
         $all_defs = $user_defined_fields->getChangeableLocalUserAdministrationDefinitions();
     }
     foreach ($all_defs as $field_id => $definition) {
         if ($definition['field_type'] == UDF_TYPE_TEXT) {
             $udf = new ilTextInputGUI($definition['field_name'], "udf_" . $definition['field_id']);
             $udf->setSize(40);
             $udf->setMaxLength(255);
         } else {
             if ($definition['field_type'] == UDF_TYPE_WYSIWYG) {
                 $udf = new ilTextAreaInputGUI($definition['field_name'], "udf_" . $definition['field_id']);
                 $udf->setUseRte(true);
             } else {
                 $udf = new ilSelectInputGUI($definition['field_name'], "udf_" . $definition['field_id']);
                 $udf->setOptions($user_defined_fields->fieldValuesToSelectArray($definition['field_values']));
             }
         }
         $udf->setRequired($definition['required']);
         $this->form_gui->addItem($udf);
     }
     // settings
     if ($a_mode == 'create' or $this->isSettingChangeable('language') or $this->isSettingChangeable('skin_style') or $this->isSettingChangeable('hits_per_page') or $this->isSettingChangeable('hide_own_online_status')) {
         $sec_st = new ilFormSectionHeaderGUI();
         $sec_st->setTitle($this->lng->txt("settings"));
         $this->form_gui->addItem($sec_st);
     }
     // role
     if ($a_mode == "create") {
         $role = new ilSelectInputGUI($lng->txt("default_role"), 'default_role');
         $role->setRequired(true);
         $role->setValue($this->default_role);
         $role->setOptions($this->selectable_roles);
         $this->form_gui->addItem($role);
     }
     // language
     if ($this->isSettingChangeable('language')) {
         $lang = new ilSelectInputGUI($lng->txt("language"), 'language');
         $languages = $lng->getInstalledLanguages();
         $lng->loadLanguageModule("meta");
         $options = array();
         foreach ($languages as $l) {
             $options[$l] = $lng->txt("meta_l_" . $l);
         }
         $lang->setOptions($options);
         $lang->setValue($ilSetting->get("language"));
         $this->form_gui->addItem($lang);
     }
     // skin/style
     if ($this->isSettingChangeable('skin_style')) {
         $sk = new ilSelectInputGUI($lng->txt("skin_style"), 'skin_style');
         $templates = $styleDefinition->getAllTemplates();
         include_once "./Services/Style/classes/class.ilObjStyleSettings.php";
         $options = array();
         if (count($templates) > 0 && is_array($templates)) {
             foreach ($templates as $template) {
                 $styleDef =& new ilStyleDefinition($template["id"]);
                 $styleDef->startParsing();
                 $styles = $styleDef->getStyles();
                 foreach ($styles as $style) {
                     if (!ilObjStyleSettings::_lookupActivatedStyle($template["id"], $style["id"])) {
                         continue;
                     }
                     $options[$template["id"] . ":" . $style["id"]] = $styleDef->getTemplateName() . " / " . $style["name"];
                 }
             }
         }
         $sk->setOptions($options);
         $sk->setValue($ilClientIniFile->readVariable("layout", "skin") . ":" . $ilClientIniFile->readVariable("layout", "style"));
         $this->form_gui->addItem($sk);
     }
     // hits per page
     if ($this->isSettingChangeable('hits_per_page')) {
         $hpp = new ilSelectInputGUI($lng->txt("hits_per_page"), 'hits_per_page');
         $options = array(10 => 10, 15 => 15, 20 => 20, 30 => 30, 40 => 40, 50 => 50, 100 => 100, 9999 => $this->lng->txt("no_limit"));
         $hpp->setOptions($options);
         $hpp->setValue($ilSetting->get("hits_per_page"));
         $this->form_gui->addItem($hpp);
         // users online
         $uo = new ilSelectInputGUI($lng->txt("users_online"), 'show_users_online');
         $options = array("y" => $lng->txt("users_online_show_y"), "associated" => $lng->txt("users_online_show_associated"), "n" => $lng->txt("users_online_show_n"));
         $uo->setOptions($options);
         $uo->setValue($ilSetting->get("show_users_online"));
         $this->form_gui->addItem($uo);
     }
     // hide online status
     if ($this->isSettingChangeable('hide_own_online_status')) {
         $os = new ilCheckboxInputGUI($lng->txt("hide_own_online_status"), "hide_own_online_status");
         $this->form_gui->addItem($os);
     }
     if ((int) $ilSetting->get('session_reminder_enabled')) {
         $cb = new ilCheckboxInputGUI($this->lng->txt('session_reminder'), 'session_reminder_enabled');
         $cb->setValue(1);
         $this->form_gui->addItem($cb);
     }
     // Options
     if ($this->isSettingChangeable('send_mail')) {
         $sec_op = new ilFormSectionHeaderGUI();
         $sec_op->setTitle($this->lng->txt("options"));
         $this->form_gui->addItem($sec_op);
     }
     // send email
     $se = new ilCheckboxInputGUI($lng->txt('inform_user_mail'), 'send_mail');
     $se->setInfo($lng->txt('inform_user_mail_info'));
     $se->setValue('y');
     $se->setChecked($ilUser->getPref('send_info_mails') == 'y');
     $this->form_gui->addItem($se);
     // ignore required fields
     $irf = new ilCheckboxInputGUI($lng->txt('ignore_required_fields'), 'ignore_rf');
     $irf->setInfo($lng->txt('ignore_required_fields_info'));
     $irf->setValue(1);
     $this->form_gui->addItem($irf);
     // @todo: handle all required fields
     // command buttons
     if ($a_mode == "create" || $a_mode == "save") {
         $this->form_gui->addCommandButton("save", $lng->txt("save"));
     }
     if ($a_mode == "edit" || $a_mode == "update") {
         $this->form_gui->addCommandButton("update", $lng->txt("save"));
     }
     $this->form_gui->addCommandButton("cancel", $lng->txt("cancel"));
 }
Пример #2
0
 /**
  * display user edit form
  *
  * @access	public
  */
 function editOldObject()
 {
     global $ilias, $rbacsystem, $rbacreview, $rbacadmin, $styleDefinition, $ilUser, $ilSetting;
     include_once './Services/Authentication/classes/class.ilAuthUtils.php';
     //load ILIAS settings
     $settings = $ilias->getAllSettings();
     // User folder
     if ($this->usrf_ref_id == USER_FOLDER_ID and !$rbacsystem->checkAccess('visible,read', $this->usrf_ref_id)) {
         $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"), $this->ilias->error_obj->MESSAGE);
     }
     // if called from local administration $this->usrf_ref_id is category id
     // Todo: this has to be fixed. Do not mix user folder id and category id
     if ($this->usrf_ref_id != USER_FOLDER_ID) {
         // check if user is assigned to category
         if (!$rbacsystem->checkAccess('cat_administrate_users', $this->object->getTimeLimitOwner())) {
             $this->ilias->raiseError($this->lng->txt("msg_no_perm_modify_user"), $this->ilias->error_obj->MESSAGE);
         }
     }
     if ($this->usrf_ref_id != USER_FOLDER_ID) {
         $this->tabs_gui->clearTargets();
     }
     $data = array();
     $data["fields"] = array();
     $data["fields"]["login"] = $this->object->getLogin();
     $data["fields"]["passwd"] = "********";
     // will not be saved
     #$data["fields"]["passwd2"] = "********";	// will not be saved
     $data["fields"]["ext_account"] = $this->object->getExternalAccount();
     $data["fields"]["title"] = $this->object->getUTitle();
     $data["fields"]["gender"] = $this->object->getGender();
     $data["fields"]["firstname"] = $this->object->getFirstname();
     $data["fields"]["lastname"] = $this->object->getLastname();
     $data["fields"]["institution"] = $this->object->getInstitution();
     $data["fields"]["department"] = $this->object->getDepartment();
     $data["fields"]["street"] = $this->object->getStreet();
     $data["fields"]["city"] = $this->object->getCity();
     $data["fields"]["zipcode"] = $this->object->getZipcode();
     $data["fields"]["country"] = $this->object->getCountry();
     $data["fields"]["sel_country"] = $this->object->getSelectedCountry();
     $data["fields"]["phone_office"] = $this->object->getPhoneOffice();
     $data["fields"]["phone_home"] = $this->object->getPhoneHome();
     $data["fields"]["phone_mobile"] = $this->object->getPhoneMobile();
     $data["fields"]["fax"] = $this->object->getFax();
     $data["fields"]["email"] = $this->object->getEmail();
     $data["fields"]["hobby"] = $this->object->getHobby();
     $data["fields"]["im_icq"] = $this->object->getInstantMessengerId('icq');
     $data["fields"]["im_yahoo"] = $this->object->getInstantMessengerId('yahoo');
     $data["fields"]["im_msn"] = $this->object->getInstantMessengerId('msn');
     $data["fields"]["im_aim"] = $this->object->getInstantMessengerId('aim');
     $data["fields"]["im_skype"] = $this->object->getInstantMessengerId('skype');
     $data["fields"]["im_jabber"] = $this->object->getInstantMessengerId('jabber');
     $data["fields"]["im_voip"] = $this->object->getInstantMessengerId('voip');
     $data["fields"]["matriculation"] = $this->object->getMatriculation();
     $data["fields"]["client_ip"] = $this->object->getClientIP();
     $data["fields"]["referral_comment"] = $this->object->getComment();
     $data["fields"]["owner"] = ilObjUser::_lookupLogin($this->object->getOwner());
     $data["fields"]["create_date"] = $this->object->getCreateDate();
     $data["fields"]["approve_date"] = $this->object->getApproveDate();
     $data["fields"]["agree_date"] = $this->object->getAgreeDate();
     $data["fields"]["last_login"] = $this->object->getLastLogin();
     $data["fields"]["active"] = $this->object->getActive();
     $data["fields"]["auth_mode"] = $this->object->getAuthMode();
     $data["fields"]["ext_account"] = $this->object->getExternalAccount();
     // BEGIN DiskQuota Get Picture, Owner, Last login, Approve Date and AgreeDate
     $this->tpl->setVariable("TXT_UPLOAD", $this->lng->txt("personal_picture"));
     $webspace_dir = ilUtil::getWebspaceDir("output");
     $full_img = $this->object->getPref("profile_image");
     $last_dot = strrpos($full_img, ".");
     $small_img = substr($full_img, 0, $last_dot) . "_small" . substr($full_img, $last_dot, strlen($full_img) - $last_dot);
     $image_file = $webspace_dir . "/usr_images/" . $small_img;
     if (@is_file($image_file)) {
         $this->tpl->setVariable("IMG_PERSONAL", $image_file . "?dummy=" . rand(1, 99999));
         $this->tpl->setVariable("ALT_IMG_PERSONAL", $this->lng->txt("personal_picture"));
         $this->tpl->setVariable("TXT_REMOVE_PIC", $this->lng->txt("remove_personal_picture"));
     }
     $this->tpl->setVariable("UPLOAD", $this->lng->txt("upload"));
     $this->tpl->setVariable("TXT_FILE", $this->lng->txt("userfile"));
     $this->tpl->setVariable("USER_FILE", $this->lng->txt("user_file"));
     // END DiskQuota Get Picture, Owner, Last login, Approve Date and AgreeDate
     // BEGIN DiskQuota, Show disk space used
     // W. Randelshofer 2008-07-07: Deactivated display of disk space usage,
     // because determining the disk space usage may take several minutes.
     /*
     		require_once "Modules/File/classes/class.ilObjFileAccess.php";
     		require_once "Modules/HTMLLearningModule/classes/class.ilObjFileBasedLMAccess.php";
     		require_once "Modules/ScormAicc/classes/class.ilObjSAHSLearningModuleAccess.php";
     		require_once "Services/Mail/classes/class.ilObjMailAccess.php";
     		require_once "Modules/Forum/classes/class.ilObjForumAccess.php";
     		$this->tpl->setVariable('TXT_DISK_SPACE_USED',$this->lng->txt('disk_space_used'));
     		$this->tpl->setVariable('DISK_SPACE_USED',
     			ilObjFileAccess::_getDiskSpaceUsedBy($this->object->getId(), true).'<br>'.
     			ilObjFileBasedLMAccess::_getDiskSpaceUsedBy($this->object->getId(), true).'<br>'.
     			ilObjSAHSLearningModuleAccess::_getDiskSpaceUsedBy($this->object->getId(), true).'<br>'.
     			ilObjMailAccess::_getDiskSpaceUsedBy($this->object->getId(), true).'<br>'.
     			ilObjForumAccess::_getDiskSpaceUsedBy($this->object->getId(), true).'<br>'
     		);
     */
     // END DiskQuota, Show disk space used
     if (!count($user_online = ilUtil::getUsersOnline($this->object->getId())) == 1) {
         $user_is_online = false;
     } else {
         $user_is_online = true;
         // extract serialized role Ids from session data
         preg_match("/RoleId.*?;\\}/", $user_online[$this->object->getId()]["data"], $matches);
         $active_roles = unserialize(substr($matches[0], 7));
         // gather data for active roles
         $assigned_roles = $rbacreview->assignedRoles($this->object->getId());
         foreach ($assigned_roles as $key => $role) {
             $roleObj = $this->ilias->obj_factory->getInstanceByObjId($role);
             // fetch context path of role
             $rolf = $rbacreview->getFoldersAssignedToRole($role, true);
             // only list roles that are not set to status "deleted"
             if (count($rolf) > 0) {
                 if (!$rbacreview->isDeleted($rolf[0])) {
                     $path = "";
                     if ($this->tree->isInTree($rolf[0])) {
                         $tmpPath = $this->tree->getPathFull($rolf[0]);
                         // count -1, to exclude the role folder itself
                         for ($i = 0; $i < count($tmpPath) - 1; $i++) {
                             if ($path != "") {
                                 $path .= " > ";
                             }
                             $path .= $tmpPath[$i]["title"];
                         }
                     } else {
                         $path = "<b>Rolefolder " . $rolf[0] . " not found in tree! (Role " . $role . ")</b>";
                     }
                     $active_roles = $active_roles ? $active_roles : array();
                     if (in_array($role, $active_roles)) {
                         $data["active_role"][$role]["active"] = true;
                     }
                     $data["active_role"][$role]["title"] = $roleObj->getTitle();
                     $data["active_role"][$role]["context"] = $path;
                     unset($roleObj);
                 }
             } else {
                 $path = "<b>No role folder found for role " . $role . "!</b>";
             }
         }
     }
     $this->tpl->addBlockfile('ADM_CONTENT', 'adm_content', 'tpl.usr_edit.html', 'Services/User');
     // FILL SAVED VALUES IN CASE OF ERROR
     if (isset($_SESSION["error_post_vars"]["Fobject"])) {
         if (!isset($_SESSION["error_post_vars"]["Fobject"]["active"])) {
             $_SESSION["error_post_vars"]["Fobject"]["active"] = 0;
         }
         foreach ($_SESSION["error_post_vars"]["Fobject"] as $key => $val) {
             $str = $this->lng->txt($key);
             if ($key == "title") {
                 $str = $this->lng->txt("person_title");
             }
             if ($key == 'passwd2') {
                 continue;
             }
             if ($key == 'passwd') {
                 if (ilAuthUtils::_allowPasswordModificationByAuthMode(ilAuthUtils::_getAuthMode($_SESSION['error_post_vars']['Fobject']['auth_mode']))) {
                     $this->tpl->setCurrentBlock('passwords_visible');
                     $this->tpl->setVariable('VISIBLE_TXT_PASSWD', $this->lng->txt('passwd'));
                     $this->tpl->setVariable('VISIBLE_TXT_PASSWD2', $this->lng->txt('retype_password'));
                     $this->tpl->setVariable('VISIBLE_PASSWD', $_SESSION['error_post_vars']['Fobject']['passwd']);
                     $this->tpl->setVariable('VISIBLE_PASSWD2', $_SESSION['error_post_vars']['Fobject']['passwd2']);
                     $this->tpl->parseCurrentBlock();
                 } else {
                     $this->tpl->setCurrentBlock('passwords_invisible');
                     $this->tpl->setVariable('INVISIBLE_TXT_PASSWD', $this->lng->txt('passwd'));
                     $this->tpl->setVariable('INVISIBLE_TXT_PASSWD2', $this->lng->txt('retype_password'));
                     $this->tpl->setVariable('INVISIBLE_PASSWD', strlen($this->object->getPasswd()) ? "********" : "");
                     $this->tpl->setVariable('INVISIBLE_PASSWD2', strlen($this->object->getPasswd()) ? "********" : "");
                     $this->tpl->setVariable('INVISIBLE_PASSWD_HIDDEN', "********");
                     $this->tpl->parseCurrentBlock();
                 }
                 continue;
             }
             // check to see if dynamically required
             if (isset($settings["require_" . $key]) && $settings["require_" . $key]) {
                 $str = $str . '<span class="asterisk">*</span>';
             }
             $this->tpl->setVariable("TXT_" . strtoupper($key), $str);
             if ($key != "default_role" and $key != "language" and $key != "skin_style" and $key != "hits_per_page" and $key != "show_users_online") {
                 $this->tpl->setVariable(strtoupper($key), ilUtil::prepareFormOutput($val, true));
             }
         }
         // gender selection
         $gender = strtoupper($_SESSION["error_post_vars"]["Fobject"]["gender"]);
         if (!empty($gender)) {
             $this->tpl->setVariable("BTN_GENDER_" . $gender, "checked=\"checked\"");
         }
         $active = $_SESSION["error_post_vars"]["Fobject"]["active"];
         if ($active) {
             $this->tpl->setVariable("ACTIVE", "checked=\"checked\"");
         }
     } else {
         if (!isset($data["fields"]["active"])) {
             $data["fields"]["active"] = 0;
         }
         foreach ($data["fields"] as $key => $val) {
             $str = $this->lng->txt($key);
             if ($key == "title") {
                 $str = $this->lng->txt("person_title");
             }
             if ($key == "ext_account") {
                 continue;
             }
             if ($key == 'passwd') {
                 $auth_mode = $this->object->getAuthMode(true);
                 if (ilAuthUtils::_allowPasswordModificationByAuthMode($auth_mode)) {
                     $this->tpl->setCurrentBlock('passwords_visible');
                     $this->tpl->setVariable('VISIBLE_TXT_PASSWD', $this->lng->txt('passwd'));
                     $this->tpl->setVariable('VISIBLE_TXT_PASSWD2', $this->lng->txt('retype_password'));
                     $this->tpl->setVariable('VISIBLE_PASSWD', "********");
                     $this->tpl->setVariable('VISIBLE_PASSWD2', "********");
                     $this->tpl->parseCurrentBlock();
                 } else {
                     $this->tpl->setCurrentBlock('passwords_invisible');
                     $this->tpl->setVariable('INVISIBLE_TXT_PASSWD', $this->lng->txt('passwd'));
                     $this->tpl->setVariable('INVISIBLE_TXT_PASSWD2', $this->lng->txt('retype_password'));
                     $this->tpl->setVariable('INVISIBLE_PASSWD', strlen($this->object->getPasswd()) ? "********" : "");
                     $this->tpl->setVariable('INVISIBLE_PASSWD2', strlen($this->object->getPasswd()) ? "********" : "");
                     $this->tpl->setVariable('INVISIBLE_PASSWD_HIDDEN', "********");
                     $this->tpl->parseCurrentBlock();
                 }
                 continue;
             }
             // check to see if dynamically required
             if (isset($settings["require_" . $key]) && $settings["require_" . $key]) {
                 $str = $str . '<span class="asterisk">*</span>';
             }
             $this->tpl->setVariable("TXT_" . strtoupper($key), $str);
             $this->tpl->setVariable(strtoupper($key), ilUtil::prepareFormOutput($val));
             #$this->tpl->parseCurrentBlock();
         }
         // gender selection
         $gender = strtoupper($data["fields"]["gender"]);
         if (!empty($gender)) {
             $this->tpl->setVariable("BTN_GENDER_" . $gender, "checked=\"checked\"");
         }
         $active = $data["fields"]["active"];
         if ($active) {
             $this->tpl->setVariable("ACTIVE", "checked=\"checked\"");
         }
     }
     // external account
     include_once './Services/Authentication/classes/class.ilAuthUtils.php';
     if (ilAuthUtils::_isExternalAccountEnabled()) {
         $this->tpl->setCurrentBlock("ext_account");
         $this->tpl->setVariable("TXT_EXT_ACCOUNT", $this->lng->txt("user_ext_account"));
         $this->tpl->setVariable("TXT_EXT_ACCOUNT_DESC", $this->lng->txt("user_ext_account_desc"));
         if (isset($_SESSION["error_post_vars"]["Fobject"]["ext_account"])) {
             $this->tpl->setVariable("EXT_ACCOUNT_VAL", $_SESSION["error_post_vars"]["Fobject"]["ext_account"]);
         } else {
             $this->tpl->setVariable("EXT_ACCOUNT_VAL", $data["fields"]["ext_account"]);
         }
         /* Disabled: external account names should be changeable by admins
         			if ($this->object->getAuthMode(true) != AUTH_LOCAL &&
         				$this->object->getAuthMode(true) != AUTH_CAS &&
         				$this->object->getAuthMode(true) != AUTH_SHIBBOLETH &&
         				$this->object->getAuthMode(true) != AUTH_SOAP)
         			{
         				$this->tpl->setVariable("OPTION_DISABLED_EXT", "\"disabled=disabled\"");
         			}
         			*/
         $this->tpl->parseCurrentBlock();
     }
     $auth_mode = $_SESSION['error_post_vars']['Fobject']['auth_mode'] ? ilAuthUtils::_getAuthMode($_SESSION['error_post_vars']['Fobject']['auth_mode']) : $this->object->getAuthMode(true);
     if (!ilAuthUtils::_allowPasswordModificationByAuthMode($auth_mode)) {
         $this->tpl->setVariable("OPTION_DISABLED", "\"disabled=disabled\"");
     }
     $obj_str = $this->call_by_reference ? "" : "&obj_id=" . $this->obj_id;
     $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
     $this->tpl->setVariable("TXT_HEADER", $this->lng->txt($this->object->getType() . "_edit"));
     $this->tpl->setVariable("TXT_CANCEL", $this->lng->txt("cancel"));
     $this->tpl->setVariable("TXT_SUBMIT", $this->lng->txt("save"));
     $this->tpl->setVariable("CMD_SUBMIT", "update");
     $this->tpl->setVariable("TARGET", $this->getTargetFrame("update"));
     $this->tpl->setVariable("TXT_REQUIRED_FLD", $this->lng->txt("required_field"));
     $this->tpl->setVariable("TXT_LOGIN_DATA", $this->lng->txt("login_data"));
     $this->tpl->setVariable("TXT_SYSTEM_INFO", $this->lng->txt("system_information"));
     $this->tpl->setVariable("TXT_PERSONAL_DATA", $this->lng->txt("personal_data"));
     $this->tpl->setVariable("TXT_CONTACT_DATA", $this->lng->txt("contact_data"));
     $this->tpl->setVariable("TXT_SETTINGS", $this->lng->txt("settings"));
     $this->tpl->setVariable("TXT_LANGUAGE", $this->lng->txt("language"));
     $this->tpl->setVariable("TXT_SKIN_STYLE", $this->lng->txt("usr_skin_style"));
     $this->tpl->setVariable("TXT_HITS_PER_PAGE", $this->lng->txt("hits_per_page"));
     $this->tpl->setVariable("TXT_SHOW_USERS_ONLINE", $this->lng->txt("show_users_online"));
     $this->tpl->setVariable("TXT_GENDER_F", $this->lng->txt("gender_f"));
     $this->tpl->setVariable("TXT_GENDER_M", $this->lng->txt("gender_m"));
     $this->tpl->setVariable("TXT_INSTANT_MESSENGERS", $this->lng->txt("user_profile_instant_messengers"));
     $this->tpl->setVariable("TXT_OTHER", $this->lng->txt("user_profile_other"));
     if ($this->object->getId() == $ilUser->getId()) {
         $this->tpl->setVariable("TXT_CURRENT_IP", "(" . $this->lng->txt("current_ip") . " " . $_SERVER["REMOTE_ADDR"] . ")");
     }
     $this->tpl->setVariable("TXT_CURRENT_IP_ALERT", $this->lng->txt("current_ip_alert"));
     // auth mode selection
     include_once './Services/Authentication/classes/class.ilAuthUtils.php';
     $active_auth_modes = ilAuthUtils::_getActiveAuthModes();
     //var_dump($active_auth_modes);
     // preselect previous chosen auth mode otherwise default auth mode
     $selected_auth_mode = isset($_SESSION["error_post_vars"]["Fobject"]["auth_mode"]) ? $_SESSION["error_post_vars"]["Fobject"]["auth_mode"] : $this->object->getAuthMode();
     foreach ($active_auth_modes as $auth_name => $auth_key) {
         $this->tpl->setCurrentBlock("auth_mode_selection");
         if ($auth_name == 'default') {
             $name = $this->lng->txt('auth_' . $auth_name) . " (" . $this->lng->txt('auth_' . ilAuthUtils::_getAuthModeName($auth_key)) . ")";
         } else {
             $name = $this->lng->txt('auth_' . $auth_name);
         }
         $this->tpl->setVariable("AUTH_MODE_NAME", $name);
         $this->tpl->setVariable("AUTH_MODE", $auth_name);
         if ($selected_auth_mode == $auth_name) {
             $this->tpl->setVariable("SELECTED_AUTH_MODE", "selected=\"selected\"");
         }
         $this->tpl->parseCurrentBlock();
     }
     // END auth_mode selection
     // language selection
     $languages = $this->lng->getInstalledLanguages();
     // preselect previous chosen language otherwise default language
     $selected_lang = isset($_SESSION["error_post_vars"]["Fobject"]["language"]) ? $_SESSION["error_post_vars"]["Fobject"]["language"] : $this->object->getLanguage();
     foreach ($languages as $lang_key) {
         $this->tpl->setCurrentBlock("language_selection");
         $this->tpl->setVariable("LANG", $this->lng->txt("lang_" . $lang_key));
         $this->tpl->setVariable("LANGSHORT", $lang_key);
         if ($selected_lang == $lang_key) {
             $this->tpl->setVariable("SELECTED_LANG", "selected=\"selected\"");
         }
         $this->tpl->parseCurrentBlock();
     }
     // END language selection
     // BEGIN skin & style selection
     //$this->ilias->getSkins();
     $templates = $styleDefinition->getAllTemplates();
     // preselect previous chosen skin/style otherwise default skin/style
     if (isset($_SESSION["error_post_vars"]["Fobject"]["skin_style"])) {
         $sknst = explode(":", $_SESSION["error_post_vars"]["Fobject"]["skin_style"]);
         $selected_style = $sknst[1];
         $selected_skin = $sknst[0];
     } else {
         $selected_style = $this->object->prefs["style"];
         $selected_skin = $this->object->skin;
     }
     include "./Services/Style/classes/class.ilObjStyleSettings.php";
     if (count($templates) > 0 && is_array($templates)) {
         foreach ($templates as $template) {
             // get styles for skin
             //$this->ilias->getStyles($skin["name"]);
             $styleDef =& new ilStyleDefinition($template["id"]);
             $styleDef->startParsing();
             $styles = $styleDef->getStyles();
             foreach ($styles as $style) {
                 if (!ilObjStyleSettings::_lookupActivatedStyle($template["id"], $style["id"])) {
                     continue;
                 }
                 $this->tpl->setCurrentBlock("selectskin");
                 if ($selected_skin == $template["id"] && $selected_style == $style["id"]) {
                     $this->tpl->setVariable("SKINSELECTED", "selected=\"selected\"");
                 }
                 $this->tpl->setVariable("SKINVALUE", $template["id"] . ":" . $style["id"]);
                 $this->tpl->setVariable("SKINOPTION", $styleDef->getTemplateName() . " / " . $style["name"]);
                 $this->tpl->parseCurrentBlock();
             }
         }
         // END skin & style selection
     }
     // BEGIN hits per page
     $hits_options = array(2, 10, 15, 20, 30, 40, 50, 100, 9999);
     // preselect previous chosen option otherwise default option
     if (isset($_SESSION["error_post_vars"]["Fobject"]["hits_per_page"])) {
         $selected_option = $_SESSION["error_post_vars"]["Fobject"]["hits_per_page"];
     } else {
         $selected_option = $this->object->prefs["hits_per_page"];
     }
     foreach ($hits_options as $hits_option) {
         $this->tpl->setCurrentBlock("selecthits");
         if ($selected_option == $hits_option) {
             $this->tpl->setVariable("HITSSELECTED", "selected=\"selected\"");
         }
         $this->tpl->setVariable("HITSVALUE", $hits_option);
         if ($hits_option == 9999) {
             $hits_option = $this->lng->txt("no_limit");
         }
         $this->tpl->setVariable("HITSOPTION", $hits_option);
         $this->tpl->parseCurrentBlock();
     }
     // END hits per page
     // BEGIN show users online
     $users_online_options = array("y", "associated", "n");
     // preselect previous chosen option otherwise default option
     if (isset($_SESSION["error_post_vars"]["Fobject"]["show_users_online"])) {
         $selected_option = $_SESSION["error_post_vars"]["Fobject"]["show_users_online"];
     } else {
         $selected_option = $this->object->prefs["show_users_online"];
     }
     foreach ($users_online_options as $an_option) {
         $this->tpl->setCurrentBlock("show_users_online");
         if ($selected_option == $an_option) {
             $this->tpl->setVariable("USERS_ONLINE_SELECTED", "selected=\"selected\"");
         }
         $this->tpl->setVariable("USERS_ONLINE_VALUE", $an_option);
         $this->tpl->setVariable("USERS_ONLINE_OPTION", $this->lng->txt("users_online_show_" . $an_option));
         $this->tpl->parseCurrentBlock();
     }
     // END show users online
     // BEGIN hide_own_online_status
     if (isset($_SESSION["error_post_vars"]["Fobject"]["hide_own_online_status"])) {
         $hide_own_online_status = $_SESSION["error_post_vars"]["Fobject"]["hide_own_online_status"];
     } else {
         $hide_own_online_status = $this->object->prefs["hide_own_online_status"] != '' ? $this->object->prefs["hide_own_online_status"] : "n";
     }
     $this->tpl->setCurrentBlock("hide_own_online_status");
     $this->tpl->setVariable("TXT_HIDE_OWN_ONLINE_STATUS", $this->lng->txt("hide_own_online_status"));
     if ($hide_own_online_status == "y") {
         $this->tpl->setVariable("CHK_HIDE_OWN_ONLINE_STATUS", "checked=\"checked\"");
     } else {
         $this->tpl->setVariable("CHK_HIDE_OWN_ONLINE_STATUS", "");
     }
     $this->tpl->parseCurrentBlock();
     //END hide_own_online_status
     // inform user about changes option
     $this->tpl->setCurrentBlock("inform_user");
     // BEGIN DiskQuota Remember the state of the "send info mail" checkbox
     $sendInfoMail = $ilUser->getPref('send_info_mails') == 'y';
     if ($sendInfoMail) {
         $this->tpl->setVariable("SEND_MAIL", " checked=\"checked\"");
     }
     $this->tpl->setVariable("TXT_INFORM_USER_MAIL", $this->lng->txt("inform_user_mail"));
     $this->tpl->parseCurrentBlock();
     $this->lng->loadLanguageModule('crs');
     $time_limit_unlimited = $_SESSION["error_post_vars"]["time_limit"]["unlimited"] ? $_SESSION["error_post_vars"]["time_limit"]["unlimited"] : $this->object->getTimeLimitUnlimited();
     $time_limit_from = $_SESSION["error_post_vars"]["time_limit"]["from"] ? $this->__toUnix($_SESSION["error_post_vars"]["time_limit"]["from"]) : $this->object->getTimeLimitFrom();
     $time_limit_until = $_SESSION["error_post_vars"]["time_limit"]["until"] ? $this->__toUnix($_SESSION["error_post_vars"]["time_limit"]["until"]) : $this->object->getTimeLimitUntil();
     $this->tpl->setCurrentBlock("time_limit");
     $this->tpl->setVariable("TXT_TIME_LIMIT", $this->lng->txt("time_limit"));
     $this->tpl->setVariable("TXT_TIME_LIMIT_UNLIMITED", $this->lng->txt("crs_unlimited"));
     $this->tpl->setVariable("TXT_TIME_LIMIT_FROM", $this->lng->txt("crs_from"));
     $this->tpl->setVariable("TXT_TIME_LIMIT_UNTIL", $this->lng->txt("crs_to"));
     $this->tpl->setVariable("TIME_LIMIT_UNLIMITED", ilUtil::formCheckbox($time_limit_unlimited, "time_limit[unlimited]", 1));
     $this->tpl->setVariable("SELECT_TIME_LIMIT_FROM_MINUTE", $this->__getDateSelect("minute", "time_limit[from][minute]", date("i", $time_limit_from)));
     $this->tpl->setVariable("SELECT_TIME_LIMIT_FROM_HOUR", $this->__getDateSelect("hour", "time_limit[from][hour]", date("G", $time_limit_from)));
     $this->tpl->setVariable("SELECT_TIME_LIMIT_FROM_DAY", $this->__getDateSelect("day", "time_limit[from][day]", date("d", $time_limit_from)));
     $this->tpl->setVariable("SELECT_TIME_LIMIT_FROM_MONTH", $this->__getDateSelect("month", "time_limit[from][month]", date("m", $time_limit_from)));
     $this->tpl->setVariable("SELECT_TIME_LIMIT_FROM_YEAR", $this->__getDateSelect("year", "time_limit[from][year]", date("Y", $time_limit_from)));
     $this->tpl->setVariable("SELECT_TIME_LIMIT_UNTIL_MINUTE", $this->__getDateSelect("minute", "time_limit[until][minute]", date("i", $time_limit_until)));
     $this->tpl->setVariable("SELECT_TIME_LIMIT_UNTIL_HOUR", $this->__getDateSelect("hour", "time_limit[until][hour]", date("G", $time_limit_until)));
     $this->tpl->setVariable("SELECT_TIME_LIMIT_UNTIL_DAY", $this->__getDateSelect("day", "time_limit[until][day]", date("d", $time_limit_until)));
     $this->tpl->setVariable("SELECT_TIME_LIMIT_UNTIL_MONTH", $this->__getDateSelect("month", "time_limit[until][month]", date("m", $time_limit_until)));
     $this->tpl->setVariable("SELECT_TIME_LIMIT_UNTIL_YEAR", $this->__getDateSelect("year", "time_limit[until][year]", date("Y", $time_limit_until)));
     $this->tpl->parseCurrentBlock();
     $this->__showUserDefinedFields();
 }