/**
  * create client tag
  *
  * @param ilSetting $setting
  */
 private function __buildClient($setting)
 {
     $auth_modes = ilAuthUtils::_getActiveAuthModes();
     $auth_mode_default = strtoupper(ilAuthUtils::_getAuthModeName(array_shift($auth_modes)));
     $auth_mode_names = array();
     foreach ($auth_modes as $mode) {
         $auth_mode_names[] = strtoupper(ilAuthUtils::_getAuthModeName($mode));
     }
     // determine skins/styles
     $skin_styles = array();
     include_once "./Services/Style/classes/class.ilStyleDefinition.php";
     $styleDefinition = new ilStyleDefinition();
     include_once "./Services/Style/classes/class.ilObjStyleSettings.php";
     $templates = $styleDefinition->getAllTemplates();
     if (is_array($templates)) {
         foreach ($templates as $template) {
             // get styles information of template
             $styleDef =& new ilStyleDefinition($template["id"]);
             $styleDef->startParsing();
             $styles = $styleDef->getStyles();
             foreach ($styles as $style) {
                 if (!ilObjStyleSettings::_lookupActivatedStyle($template["id"], $style["id"])) {
                     continue;
                 }
                 $skin_styles[] = $template["id"] . ":" . $style["id"];
             }
         }
     }
     // timezones
     include_once 'Services/Calendar/classes/class.ilTimeZone.php';
     $this->xmlStartTag("Client", array("inst_id" => $setting->get("inst_id"), "id" => $setting->clientid, "enabled" => $setting->access == 1 ? "TRUE" : "FALSE", "default_lang" => $setting->language));
     $this->xmlEndTag("Client");
     return;
     // END here due to security reasons.
     $this->xmlElement("Name", null, $setting->get("inst_name"));
     $this->xmlElement("Description", null, $setting->description);
     $this->xmlElement("Institution", null, $setting->get("inst_institution"));
     $this->xmlStartTag("Responsible");
     $this->xmlElement("Firstname", null, $setting->get("admin_firstname"));
     $this->xmlElement("Lastname", null, $setting->get("admin_lastname"));
     $this->xmlElement("Title", null, $setting->get("admin_title"));
     $this->xmlElement("Institution", null, $setting->get("admin_institution"));
     $this->xmlElement("Position", null, $setting->get("admin_position"));
     $this->xmlElement("Email", null, $setting->get("admin_email"));
     $this->xmlElement("Street ", null, $setting->get("admin_street"));
     $this->xmlElement("ZipCode ", null, $setting->get("admin_zipcode"));
     $this->xmlElement("City", null, $setting->get("admin_city"));
     $this->xmlElement("Country", null, $setting->get("admin_country"));
     $this->xmlElement("Phone", null, $setting->get("admin_phone"));
     $this->xmlEndTag("Responsible");
     $this->xmlStartTag("Settings");
     $this->xmlElement("Setting", array("key" => "error_recipient"), $setting->get("error_recipient"));
     $this->xmlElement("Setting", array("key" => "feedback_recipient"), $setting->get("feedback_recipient"));
     $this->xmlElement("Setting", array("key" => "session_expiration"), $setting->session);
     $this->xmlElement("Setting", array("key" => "soap_enabled"), $setting->get("soap_user_administration"));
     $this->xmlElement("Setting", array("key" => "authentication_methods"), join(",", $auth_mode_names));
     $this->xmlElement("Setting", array("key" => "authentication_default_method"), $auth_mode_default);
     $this->xmlElement("Setting", array("key" => "skins"), join(",", $skin_styles));
     $this->xmlElement("Setting", array("key" => "default_skin"), $setting->default_skin_style);
     $this->xmlElement("Setting", array("key" => "default_timezone"), ilTimeZone::_getDefaultTimeZone());
     $this->xmlElement("Setting", array("key" => "default_hits_per_page"), $setting->default_hits_per_page);
     $this->xmlElement("Setting", array("key" => "default_show_users_online"), $setting->default_show_users_online);
     $this->xmlEndTag("Settings");
     if ($this->exportAdvMDDefs) {
         // create advanced meta data record xml
         include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php';
         include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordXMLWriter.php';
         $record_ids = array();
         $record_types = ilAdvancedMDRecord::_getAssignableObjectTypes();
         foreach ($record_types as $type) {
             $records = ilAdvancedMDRecord::_getActivatedRecordsByObjectType($type);
             foreach ($records as $record) {
                 $record_ids[] = $record->getRecordId();
             }
         }
         $record_ids = array_unique($record_ids);
         $this->xmlStartTag('AdvancedMetaDataRecords');
         if (count($record_ids) > 0) {
             foreach ($record_ids as $record_id) {
                 $record_obj = ilAdvancedMDRecord::_getInstanceByrecordId($record_id);
                 $record_obj->toXML($this);
             }
         }
         $this->xmlEndTag('AdvancedMetaDataRecords');
     }
     if ($this->exportUDFDefs) {
         // create user defined fields record xml
         include_once "./Services/User/classes/class.ilUserDefinedFields.php";
         $udf_data =& ilUserDefinedFields::_newInstance();
         $udf_data->addToXML($this);
     }
     $this->xmlEndTag("Client");
 }
Exemplo n.º 2
0
 /**
  * Parse authentication mode
  * @return string auth mode
  */
 private function parseAuthMode()
 {
     if ($this->settings->isAuthenticationEnabled() or !$this->settings->getAuthenticationMapping()) {
         return 'ldap';
     }
     return ilAuthUtils::_getAuthModeName($this->settings->getAuthenticationMapping());
 }
 /**
  * display settings menu
  * 
  * @access	public
  */
 function authSettingsObject()
 {
     global $rbacsystem, $ilSetting;
     if (!$rbacsystem->checkAccess("visible,read", $this->object->getRefId())) {
         $this->ilias->raiseError($this->lng->txt("permission_denied"), $this->ilias->error_obj->MESSAGE);
     }
     $this->tabs_gui->setTabActive('authentication_settings');
     $this->setSubTabs('authSettings');
     $this->tabs_gui->setSubTabActive("auth_settings");
     $this->tpl->addBlockFile("ADM_CONTENT", "adm_content", "tpl.auth_general.html", "Services/Authentication");
     $this->tpl->setVariable("FORMACTION", $this->ctrl->getFormAction($this));
     $this->tpl->setVariable("TXT_AUTH_TITLE", $this->lng->txt("auth_select"));
     $this->tpl->setVariable("TXT_AUTH_MODE", $this->lng->txt("auth_mode"));
     $this->tpl->setVariable("TXT_AUTH_DEFAULT", $this->lng->txt("default"));
     $this->tpl->setVariable("TXT_AUTH_ACTIVE", $this->lng->txt("active"));
     $this->tpl->setVariable("TXT_AUTH_NUM_USERS", $this->lng->txt("num_users"));
     $this->tpl->setVariable("TXT_LOCAL", $this->lng->txt("auth_local"));
     $this->tpl->setVariable("TXT_LDAP", $this->lng->txt("auth_ldap"));
     $this->tpl->setVariable("TXT_SHIB", $this->lng->txt("auth_shib"));
     $this->tpl->setVariable("TXT_CAS", $this->lng->txt("auth_cas"));
     $this->tpl->setVariable("TXT_RADIUS", $this->lng->txt("auth_radius"));
     $this->tpl->setVariable("TXT_SCRIPT", $this->lng->txt("auth_script"));
     $this->tpl->setVariable("TXT_APACHE", $this->lng->txt("auth_apache"));
     $auth_cnt = ilObjUser::_getNumberOfUsersPerAuthMode();
     $auth_modes = ilAuthUtils::_getAllAuthModes();
     foreach ($auth_modes as $mode => $mode_name) {
         //echo "-".$ilSetting->get('auth_mode')."-".$mode."-";
         if ($ilSetting->get('auth_mode') == $mode) {
             $this->tpl->setVariable("NUM_" . strtoupper($mode_name), (int) $auth_cnt[$mode_name] + $auth_cnt["default"] . " (" . $this->lng->txt("auth_per_default") . ": " . $auth_cnt["default"] . ")");
         } else {
             $this->tpl->setVariable("NUM_" . strtoupper($mode_name), (int) $auth_cnt[$mode_name]);
         }
     }
     $this->tpl->setVariable("TXT_CONFIGURE", $this->lng->txt("auth_configure"));
     $this->tpl->setVariable("TXT_AUTH_REMARK", $this->lng->txt("auth_remark_non_local_auth"));
     $this->tpl->setVariable("TXT_SUBMIT", $this->lng->txt("save"));
     $this->tpl->setVariable("CMD_SUBMIT", "setAuthMode");
     // local vars
     $checked = "checked=\"checked\"";
     $disabled = "disabled=\"disabled\"";
     $style_disabled = "_disabled";
     // icon handlers
     $icon_ok = "<img src=\"" . ilUtil::getImagePath("icon_ok.svg") . "\" alt=\"" . $this->lng->txt("enabled") . "\" title=\"" . $this->lng->txt("enabled") . "\" border=\"0\" vspace=\"0\"/>";
     $icon_not_ok = "<img src=\"" . ilUtil::getImagePath("icon_not_ok.svg") . "\" alt=\"" . $this->lng->txt("disabled") . "\" title=\"" . $this->lng->txt("disabled") . "\" border=\"0\" vspace=\"0\"/>";
     $this->tpl->setVariable("AUTH_LOCAL_ACTIVE", $icon_ok);
     include_once 'Services/LDAP/classes/class.ilLDAPServer.php';
     $this->tpl->setVariable('AUTH_LDAP_ACTIVE', count(ilLDAPServer::_getActiveServerList()) ? $icon_ok : $icon_not_ok);
     #$this->tpl->setVariable("AUTH_LDAP_ACTIVE", $this->ilias->getSetting('ldap_active') ? $icon_ok : $icon_not_ok);
     $this->tpl->setVariable("AUTH_RADIUS_ACTIVE", $this->ilias->getSetting('radius_active') ? $icon_ok : $icon_not_ok);
     $this->tpl->setVariable("AUTH_SHIB_ACTIVE", $this->ilias->getSetting('shib_active') ? $icon_ok : $icon_not_ok);
     $this->tpl->setVariable("AUTH_SCRIPT_ACTIVE", $this->ilias->getSetting('script_active') ? $icon_ok : $icon_not_ok);
     $this->tpl->setVariable("AUTH_CAS_ACTIVE", $this->ilias->getSetting('cas_active') ? $icon_ok : $icon_not_ok);
     $this->tpl->setVariable("AUTH_APACHE_ACTIVE", $this->ilias->getSetting('apache_active') ? $icon_ok : $icon_not_ok);
     // alter style and disable buttons depending on current selection
     switch ($this->ilias->getSetting('auth_mode')) {
         case AUTH_LOCAL:
             // default
             $this->tpl->setVariable("CHK_LOCAL", $checked);
             break;
         case AUTH_LDAP:
             // LDAP
             $this->tpl->setVariable("CHK_LDAP", $checked);
             break;
         case AUTH_SHIBBOLETH:
             // SHIB
             $this->tpl->setVariable("CHK_SHIB", $checked);
             break;
         case AUTH_RADIUS:
             // RADIUS
             $this->tpl->setVariable("CHK_RADIUS", $checked);
             break;
         case AUTH_CAS:
             // CAS
             $this->tpl->setVariable("CHK_CAS", $checked);
             break;
         case AUTH_SCRIPT:
             // script
             $this->tpl->setVariable("CHK_SCRIPT", $checked);
             break;
         case AUTH_APACHE:
             // apache
             $this->tpl->setVariable("CHK_APACHE", $checked);
             break;
     }
     // auth mode determinitation
     if ($this->initAuthModeDetermination()) {
         $this->tpl->setVariable('TABLE_AUTH_DETERMINATION', $this->form->getHTML());
     }
     // roles table
     $this->tpl->setVariable("FORMACTION_ROLES", $this->ctrl->getFormAction($this));
     $this->tpl->setVariable("TXT_AUTH_ROLES", $this->lng->txt("auth_active_roles"));
     $this->tpl->setVariable("TXT_ROLE", $this->lng->txt("obj_role"));
     $this->tpl->setVariable("TXT_ROLE_AUTH_MODE", $this->lng->txt("auth_role_auth_mode"));
     $this->tpl->setVariable("CMD_SUBMIT_ROLES", "updateAuthRoles");
     include_once "./Services/AccessControl/classes/class.ilObjRole.php";
     $reg_roles = ilObjRole::_lookupRegisterAllowed();
     // auth mode selection
     include_once './Services/Authentication/classes/class.ilAuthUtils.php';
     $active_auth_modes = ilAuthUtils::_getActiveAuthModes();
     foreach ($reg_roles as $role) {
         foreach ($active_auth_modes as $auth_name => $auth_key) {
             // do not list auth modes with external login screen
             // even not default, because it can easily be set to
             // a non-working auth mode
             if ($auth_name == "default" || $auth_name == "cas" || $auth_name == "shibboleth" || $auth_name == 'ldap' || $auth_name == 'apache' || $auth_name == "ecs" || $auth_name == "openid") {
                 continue;
             }
             $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 ($role['auth_mode'] == $auth_name) {
                 $this->tpl->setVariable("SELECTED_AUTH_MODE", "selected=\"selected\"");
             }
             $this->tpl->parseCurrentBlock();
         }
         // END auth_mode selection
         $this->tpl->setCurrentBlock("roles");
         $this->tpl->setVariable("ROLE", $role['title']);
         $this->tpl->setVariable("ROLE_ID", $role['id']);
         $this->tpl->parseCurrentBlock();
     }
 }
Exemplo n.º 4
0
 /**
  * Get authentication mapping key
  * Default is ldap
  * @return string
  */
 public function getAuthenticationMappingKey()
 {
     if ($this->isAuthenticationEnabled() or !$this->getAuthenticationMapping()) {
         return 'ldap';
     }
     return ilAuthUtils::_getAuthModeName($this->getAuthenticationMapping());
 }
 /**
  * handler for end of element when in verify mode.
  */
 function verifyEndTag($a_xml_parser, $a_name)
 {
     global $lng, $ilAccess, $ilSetting, $ilObjDataCache;
     switch ($a_name) {
         case "Role":
             $this->roles[$this->current_role_id]["name"] = $this->cdata;
             $this->roles[$this->current_role_id]["type"] = $this->current_role_type;
             $this->roles[$this->current_role_id]["action"] = $this->current_role_action;
             break;
         case "User":
             $this->userObj->setFullname();
             if ($this->user_id != -1 && $this->action == "Update") {
                 $user_exists = !is_null(ilObjUser::_lookupLogin($this->user_id));
             } else {
                 $user_exists = ilObjUser::getUserIdByLogin($this->userObj->getLogin()) != 0;
             }
             if (is_null($this->userObj->getLogin())) {
                 $this->logFailure("---", sprintf($lng->txt("usrimport_xml_element_for_action_required"), "Login", "Insert"));
             }
             switch ($this->action) {
                 case "Insert":
                     if ($user_exists and $this->conflict_rule == IL_FAIL_ON_CONFLICT) {
                         $this->logWarning($this->userObj->getLogin(), $lng->txt("usrimport_cant_insert"));
                     }
                     if (is_null($this->userObj->getGender()) && $this->isFieldRequired("gender")) {
                         $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_for_action_required"), "Gender", "Insert"));
                     }
                     if (is_null($this->userObj->getFirstname())) {
                         $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_for_action_required"), "Firstname", "Insert"));
                     }
                     if (is_null($this->userObj->getLastname())) {
                         $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_for_action_required"), "Lastname", "Insert"));
                     }
                     if (count($this->roles) == 0) {
                         $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_for_action_required"), "Role", "Insert"));
                     } else {
                         $has_global_role = false;
                         foreach ($this->roles as $role) {
                             if ($role['type'] == 'Global') {
                                 $has_global_role = true;
                                 break;
                             }
                         }
                         if (!$has_global_role) {
                             $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_global_role_for_action_required"), "Insert"));
                         }
                     }
                     break;
                 case "Update":
                     if (!$user_exists) {
                         $this->logWarning($this->userObj->getLogin(), $lng->txt("usrimport_cant_update"));
                     } elseif ($this->user_id != -1 && !is_null($this->userObj->getLogin())) {
                         $someonesId = ilObjUser::_lookupId($this->userObj->getLogin());
                         if (is_numeric($someonesId) && $someonesId != $this->user_id) {
                             $this->logFailure($this->userObj->getLogin(), $lng->txt("usrimport_login_is_not_unique"));
                         }
                     }
                     break;
                 case "Delete":
                     if (!$user_exists) {
                         $this->logWarning($this->userObj->getLogin(), $lng->txt("usrimport_cant_delete"));
                     }
                     break;
             }
             // init role array for next user
             $this->roles = array();
             break;
         case "Login":
             if (array_key_exists($this->cdata, $this->logins)) {
                 $this->logWarning($this->cdata, $lng->txt("usrimport_login_is_not_unique"));
             } else {
                 $this->logins[$this->cdata] = $this->cdata;
             }
             $this->userObj->setLogin($this->cdata);
             break;
         case "Password":
             switch ($this->currPasswordType) {
                 case "ILIAS2":
                     $this->userObj->setPasswd($this->cdata, IL_PASSWD_CRYPT);
                     break;
                 case "ILIAS3":
                     $this->userObj->setPasswd($this->cdata, IL_PASSWD_MD5);
                     break;
                 case "PLAIN":
                     $this->userObj->setPasswd($this->cdata, IL_PASSWD_PLAIN);
                     $this->acc_mail->setUserPassword($this->currPassword);
                     break;
                 default:
                     $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_attribute_value_illegal"), "Type", "Password", $this->currPasswordType));
                     break;
             }
             break;
         case "Firstname":
             $this->userObj->setFirstname($this->cdata);
             break;
         case "Lastname":
             $this->userObj->setLastname($this->cdata);
             break;
         case "Title":
             $this->userObj->setUTitle($this->cdata);
             break;
         case "Gender":
             if ($this->cdata != "m" && $this->cdata != "f") {
                 $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_content_illegal"), "Gender", $this->cdata));
             }
             $this->userObj->setGender($this->cdata);
             break;
         case "Email":
             $this->userObj->setEmail($this->cdata);
             break;
         case "Institution":
             $this->userObj->setInstitution($this->cdata);
             break;
         case "Street":
             $this->userObj->setStreet($this->cdata);
             break;
         case "City":
             $this->userObj->setCity($this->cdata);
             break;
         case "PostalCode":
             $this->userObj->setZipCode($this->cdata);
             break;
         case "Country":
             $this->userObj->setCountry($this->cdata);
             break;
         case "PhoneOffice":
             $this->userObj->setPhoneOffice($this->cdata);
             break;
         case "PhoneHome":
             $this->userObj->setPhoneHome($this->cdata);
             break;
         case "PhoneMobile":
             $this->userObj->setPhoneMobile($this->cdata);
             break;
         case "Fax":
             $this->userObj->setFax($this->cdata);
             break;
         case "Hobby":
             $this->userObj->setHobby($this->cdata);
             break;
         case "Comment":
             $this->userObj->setComment($this->cdata);
             break;
         case "Department":
             $this->userObj->setDepartment($this->cdata);
             break;
         case "Matriculation":
             $this->userObj->setMatriculation($this->cdata);
             break;
         case "ExternalAccount":
             //echo "-".$this->userObj->getAuthMode()."-".$this->userObj->getLogin()."-";
             $am = $this->userObj->getAuthMode() == "default" || $this->userObj->getAuthMode() == "" ? ilAuthUtils::_getAuthModeName($ilSetting->get('auth_mode')) : $this->userObj->getAuthMode();
             $loginForExternalAccount = trim($this->cdata) == "" ? "" : ilObjUser::_checkExternalAuthAccount($am, trim($this->cdata));
             switch ($this->action) {
                 case "Insert":
                     if ($loginForExternalAccount != "") {
                         $this->logWarning($this->userObj->getLogin(), $lng->txt("usrimport_no_insert_ext_account_exists") . " (" . $this->cdata . ")");
                     }
                     break;
                 case "Update":
                     if ($loginForExternalAccount != "") {
                         $externalAccountHasChanged = trim($this->cdata) != ilObjUser::_lookupExternalAccount($this->user_id);
                         if ($externalAccountHasChanged && trim($loginForExternalAccount) != trim($this->userObj->getLogin())) {
                             $this->logWarning($this->userObj->getLogin(), $lng->txt("usrimport_no_update_ext_account_exists") . " (" . $this->cdata . " for " . $loginForExternalAccount . ")");
                         }
                     }
                     break;
             }
             if ($externalAccountHasChanged) {
                 $this->userObj->setExternalAccount(trim($this->cdata));
             }
             break;
         case "Active":
             if ($this->cdata != "true" && $this->cdata != "false") {
                 $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_content_illegal"), "Active", $this->cdata));
             }
             $this->currActive = $this->cdata;
             break;
         case "TimeLimitOwner":
             if (!preg_match("/\\d+/", $this->cdata)) {
                 $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_content_illegal"), "TimeLimitOwner", $this->cdata));
             } elseif (!$ilAccess->checkAccess('cat_administrate_users', '', $this->cdata)) {
                 $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_content_illegal"), "TimeLimitOwner", $this->cdata));
             } elseif ($ilObjDataCache->lookupType($ilObjDataCache->lookupObjId($this->cdata)) != 'cat' && !(int) $this->cdata == USER_FOLDER_ID) {
                 $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_content_illegal"), "TimeLimitOwner", $this->cdata));
             }
             $this->userObj->setTimeLimitOwner($this->cdata);
             break;
         case "TimeLimitUnlimited":
             switch (strtolower($this->cdata)) {
                 case "true":
                 case "1":
                     $this->userObj->setTimeLimitUnlimited(1);
                     break;
                 case "false":
                 case "0":
                     $this->userObj->setTimeLimitUnlimited(0);
                     break;
                 default:
                     $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_content_illegal"), "TimeLimitUnlimited", $this->cdata));
                     break;
             }
             break;
         case "TimeLimitFrom":
             // Accept datetime or Unix timestamp
             if (strtotime($this->cdata) === false && !is_numeric($this->cdata)) {
                 $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_content_illegal"), "TimeLimitFrom", $this->cdata));
             }
             $this->userObj->setTimeLimitFrom($this->cdata);
             break;
         case "TimeLimitUntil":
             // Accept datetime or Unix timestamp
             if (strtotime($this->cdata) === false && !is_numeric($this->cdata)) {
                 $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_content_illegal"), "TimeLimitUntil", $this->cdata));
             }
             $this->userObj->setTimeLimitUntil($this->cdata);
             break;
         case "TimeLimitMessage":
             switch (strtolower($this->cdata)) {
                 case "1":
                     $this->userObj->setTimeLimitMessage(1);
                     break;
                 case "0":
                     $this->userObj->setTimeLimitMessage(0);
                     break;
                 default:
                     $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_content_illegal"), "TimeLimitMessage", $this->cdata));
                     break;
             }
             break;
         case "ApproveDate":
             // Accept datetime or Unix timestamp
             if (strtotime($this->cdata) === false && !is_numeric($this->cdata) && !$this->cdata == "0000-00-00 00:00:00") {
                 $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_content_illegal"), "ApproveDate", $this->cdata));
             }
             break;
         case "AgreeDate":
             // Accept datetime or Unix timestamp
             if (strtotime($this->cdata) === false && !is_numeric($this->cdata) && !$this->cdata == "0000-00-00 00:00:00") {
                 $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_content_illegal"), "AgreeDate", $this->cdata));
             }
             break;
         case "iLincID":
             if (!preg_match("/\\d+/", $this->cdata)) {
                 $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_content_illegal"), "iLincID", $this->cdata));
             }
             break;
         case "iLincUser":
             if (!preg_match("/\\w+/", $this->cdata)) {
                 $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_content_illegal"), "iLincUser", $this->cdata));
             }
             break;
         case "iLincPasswd":
             if (!preg_match("/\\w+/", $this->cdata)) {
                 $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_content_illegal"), "iLincPasswd", $this->cdata));
             }
             break;
         case "Pref":
             if ($this->currentPrefKey != null) {
                 $this->verifyPref($this->currentPrefKey, $this->cdata);
             }
             $this->currentPrefKey == null;
     }
 }
Exemplo n.º 6
0
 /**
  * check whether external account and authentication method
  * matches with a user
  *
  * @static
  */
 public static function _checkExternalAuthAccount($a_auth, $a_account)
 {
     global $ilDB, $ilSetting;
     // Check directly with auth_mode
     $r = $ilDB->queryF("SELECT * FROM usr_data WHERE " . " ext_account = %s AND auth_mode = %s", array("text", "text"), array($a_account, $a_auth));
     if ($usr = $ilDB->fetchAssoc($r)) {
         return $usr["login"];
     }
     // For compatibility, check for login (no ext_account entry given)
     $res = $ilDB->queryF("SELECT login FROM usr_data " . "WHERE login = %s AND auth_mode = %s", array("text", "text"), array($a_account, $a_auth));
     if ($usr = $ilDB->fetchAssoc($res)) {
         return $usr['login'];
     }
     // If auth_default == $a_auth => check for login
     if (ilAuthUtils::_getAuthModeName($ilSetting->get('auth_mode')) == $a_auth) {
         $res = $ilDB->queryF("SELECT login FROM usr_data WHERE " . " ext_account = %s AND auth_mode = %s", array("text", "text"), array($a_account, "default"));
         if ($usr = $ilDB->fetchAssoc($res)) {
             return $usr["login"];
         }
         // Search for login (no ext_account given)
         $res = $ilDB->queryF("SELECT login FROM usr_data " . "WHERE login = %s AND (ext_account IS NULL OR ext_account = '') AND auth_mode = %s", array("text", "text"), array($a_account, "default"));
         if ($usr = $ilDB->fetchAssoc($res)) {
             return $usr["login"];
         }
     }
     return false;
 }
 /**
  * get client information from current as xml result set
  *
  * @param string $sid  current session id
  *
  * @return XMLResultSet containing columns installation_id, installation_version, installation_url, installation_description, installation_default_language
  */
 function getNIC($sid)
 {
     $this->initAuth($sid);
     $this->initIlias();
     if (!$this->__checkSession($sid)) {
         return $this->__raiseError($this->__getMessage(), $this->__getMessageCode());
     }
     global $rbacsystem, $rbacreview, $ilLog, $rbacadmin, $ilSetting, $ilClientIniFile;
     if (!is_object($ilClientIniFile)) {
         return $this->__raiseError("Client ini is not initialized", "Server");
     }
     $auth_modes = ilAuthUtils::_getActiveAuthModes();
     $auth_mode_default = strtoupper(ilAuthUtils::_getAuthModeName(array_shift($auth_modes)));
     $auth_mode_names = array();
     foreach ($auth_modes as $mode) {
         $auth_mode_names[] = strtoupper(ilAuthUtils::_getAuthModeName($mode));
     }
     include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecord.php';
     include_once 'Services/AdvancedMetaData/classes/class.ilAdvancedMDRecordXMLWriter.php';
     // create advanced meta data record xml
     $record_ids = array();
     $record_types = ilAdvancedMDRecord::_getAssignableObjectTypes();
     foreach ($record_types as $type) {
         $records = ilAdvancedMDRecord::_getActivatedRecordsByObjectType($type);
         foreach ($records as $record) {
             $record_ids[] = $record->getRecordId();
         }
     }
     $record_ids = array_unique($record_ids);
     $advmwriter = new ilAdvancedMDRecordXMLWriter($record_ids);
     $advmwriter->write();
     // create user defined fields record xml, simulate empty user records
     include_once "./Services/User/classes/class.ilUserXMLWriter.php";
     $udfWriter = new ilUserXMLWriter();
     $users = array();
     $udfWriter->setObjects($users);
     $udfWriter->start();
     // todo: get information from client id, read from ini file specificied
     $client_details[] = array("installation_id" => IL_INST_ID, "installation_version" => ILIAS_VERSION, "installation_url" => ILIAS_HTTP_PATH, "installation_description" => $ilClientIniFile->readVariable("client", "description"), "installation_language_default" => $ilClientIniFile->readVariable("language", "default"), "installation_session_expire" => $ilClientIniFile->readVariable("session", "expire"), "installation_php_postmaxsize" => $this->return_bytes(ini_get("post_max_size")), "authentication_methods" => join(",", $auth_mode_names), "authentication_default_method" => $auth_mode_default, "installation_udf_xml" => $udfWriter->getXML(), "installation_advmd_xml" => $advmwriter->xmlDumpMem(false));
     // store into xml result set
     include_once './webservice/soap/classes/class.ilXMLResultSet.php';
     $xmlResult = new ilXMLResultSet();
     $xmlResult->addArray($client_details, true);
     // create writer and return xml
     include_once './webservice/soap/classes/class.ilXMLResultSetWriter.php';
     $xmlResultWriter = new ilXMLResultSetWriter($xmlResult);
     $xmlResultWriter->start();
     return $xmlResultWriter->getXML();
 }
Exemplo n.º 8
0
 function _getAllAuthModes()
 {
     return array(AUTH_LOCAL => ilAuthUtils::_getAuthModeName(AUTH_LOCAL), AUTH_LDAP => ilAuthUtils::_getAuthModeName(AUTH_LDAP), AUTH_SHIBBOLETH => ilAuthUtils::_getAuthModeName(AUTH_SHIBBOLETH), AUTH_CAS => ilAuthUtils::_getAuthModeName(AUTH_CAS), AUTH_SOAP => ilAuthUtils::_getAuthModeName(AUTH_SOAP), AUTH_RADIUS => ilAuthUtils::_getAuthModeName(AUTH_RADIUS), AUTH_ECS => ilAuthUtils::_getAuthModeName(AUTH_ECS), AUTH_OPENID => ilAuthUtils::_getAuthModeName(AUTH_OPENID), AUTH_APACHE => ilAuthUtils::_getAuthModeName(AUTH_APACHE));
 }
Exemplo n.º 9
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"));
 }
Exemplo n.º 10
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();
 }