24define (
"IL_EXTRACT_ROLES", 1);
 
   25define (
"IL_USER_IMPORT", 2);
 
   26define (
"IL_VERIFY", 3);
 
   28define (
"IL_FAIL_ON_CONFLICT", 1);
 
   29define (
"IL_UPDATE_ON_CONFLICT", 2);
 
   30define (
"IL_IGNORE_ON_CONFLICT", 3);
 
   32define (
"IL_IMPORT_SUCCESS", 1);
 
   33define (
"IL_IMPORT_WARNING", 2);
 
   34define (
"IL_IMPORT_FAILURE", 3);
 
   36define (
"IL_USER_MAPPING_LOGIN", 1);
 
   37define (
"IL_USER_MAPPING_ID", 2);
 
   39require_once(
"./Services/Xml/classes/class.ilSaxParser.php");
 
   40require_once (
'Services/User/classes/class.ilUserXMLWriter.php');
 
  286                $this->roles = array();
 
  287                $this->mode = $a_mode;
 
  288                $this->conflict_rule = $a_conflict_rule;
 
  290                $this->protocol = array();
 
  291                $this->logins = array();
 
  292                $this->userCount = 0;
 
  293                $this->localRoleCache = array();
 
  294                $this->parentRolesCache = array();
 
  295                $this->send_mail = 
false;
 
  299                $this->userStyles = array();
 
  300                include_once 
'./Services/Style/System/classes/class.ilStyleDefinition.php';
 
  301                $skins = ilStyleDefinition::getAllSkins();
 
  303                if (is_array($skins))
 
  306                        foreach($skins as 
$skin)
 
  310                                        include_once(
"./Services/Style/System/classes/class.ilSystemStyleSettings.php");
 
  315                                        $this->userStyles [] = 
$skin->getId().
":".
$style->getId();
 
  320                $settings = 
$ilias->getAllSettings();
 
  321                if ($settings[
"usr_settings_hide_skin_style"] == 1)
 
  323                        $this->hideSkin = TRUE;
 
  327                        $this->hideSkin = FALSE;
 
  329                if ($settings[
"usr_settings_disable_skin_style"] == 1)
 
  331                        $this->disableSkin = TRUE;
 
  335                        $this->disableSkin = FALSE;
 
  338                include_once(
"Services/Mail/classes/class.ilAccountMail.php");
 
  340                $this->acc_mail->useLangVariablesAsFallback(
true);
 
  342                parent::__construct($a_xml_file);
 
  352                $this->folder_id = $a_folder_id;
 
  367                xml_set_object($a_xml_parser,$this);
 
  368                xml_set_element_handler($a_xml_parser,
'handlerBeginTag',
'handlerEndTag');
 
  369                xml_set_character_data_handler($a_xml_parser,
'handlerCharacterData');
 
  377                parent::startParsing();
 
  387                $this->role_assign = $a_assign;
 
  408                        while (list($k,$v) = each($attr))
 
  409                                $tag.= 
" ".$k.
"=\"$v\"";
 
  447                                $this->current_role_id = $a_attribs[
"Id"]; 
 
  450                                         $this->current_role_id = $internal_id;
 
  452                                $this->current_role_type = $a_attribs[
"Type"];                                                  
 
  467                                $this->current_role_id = $a_attribs[
"Id"];
 
  470                                         $this->current_role_id = $internal_id;
 
  472                                $this->current_role_type = $a_attribs[
"Type"];
 
  473                                $this->current_role_action = (is_null($a_attribs[
"Action"])) ? 
"Assign" : $a_attribs[
"Action"];
 
  476                        case "PersonalPicture":
 
  477                                $this->personalPicture = array(
 
  478                                        "encoding" => $a_attribs[
"encoding"],
 
  479                                        "imagetype" => $a_attribs[
"imagetype"],
 
  485                                $this->skin = $a_attribs[
"Skin"];
 
  486                                $this->style = $a_attribs[
"Style"];
 
  490                                $this->acc_mail->reset();
 
  491                                $this->prefs = array();
 
  492                                $this->currentPrefKey = 
null;
 
  493                                $this->auth_mode_set = 
false;
 
  494                                $this->approve_date_set = 
false;
 
  495                                $this->time_limit_set = 
false;
 
  496                                $this->time_limit_owner_set = 
false;    
 
  497                                $this->updateLookAndSkin = 
false;
 
  500                                $this->personalPicture = 
null;
 
  505                                $this->udf_data = array();
 
  511                                    if (is_numeric($a_attribs[
"Id"]))
 
  513                                        $this->user_id = $a_attribs[
"Id"];
 
  517                                        $this->user_id = $id;
 
  521                                $this->userObj->setPref(
"skin",
 
  522                                        $ilias->ini->readVariable(
"layout",
"skin"));
 
  523                                $this->userObj->setPref(
"style",
 
  524                                        $ilias->ini->readVariable(
"layout",
"style"));
 
  526                                $this->userObj->setLanguage($a_attribs[
"Language"]);
 
  527                                $this->userObj->setImportId($a_attribs[
"Id"]);
 
  528                                $this->action = (is_null($a_attribs[
"Action"])) ? 
"Insert" : $a_attribs[
"Action"];
 
  529                                $this->currPassword     = 
null;
 
  530                                $this->currPasswordType = 
null;
 
  531                                $this->currActive = 
null;                               
 
  532                                $this->multi_values = array();
 
  536                                $this->currPasswordType = $a_attribs[
'Type'];
 
  539                                if (array_key_exists(
"type", $a_attribs))
 
  541                                        switch ($a_attribs[
"type"])
 
  547                                                        if(strcmp(
'ldap', $a_attribs[
'type']) === 0)
 
  550                                                                include_once 
'./Services/LDAP/classes/class.ilLDAPServer.php';
 
  552                                                                if(count($list) == 1)
 
  554                                                                        $this->auth_mode_set = 
true;
 
  555                                                                        $ldap_id = current($list);
 
  556                                                                        $this->userObj->setAuthMode(
'ldap_'.$ldap_id);
 
  569                                                        $this->auth_mode_set = 
true;
 
  570                                                        $this->userObj->setAuthMode($a_attribs[
"type"]);
 
  583                                                                          sprintf(
$lng->txt(
"usrimport_xml_element_inapplicable"),
"AuthMode",$a_attribs[
"type"]));
 
  587                        case 'UserDefinedField':
 
  588                                $this->tmp_udf_id = $a_attribs[
'Id'];
 
  589                                $this->tmp_udf_name = $a_attribs[
'Name'];
 
  593                                $this->current_messenger_type = strtolower($a_attribs[
"Type"]);
 
  596                                $this->userObj->setLatitude($a_attribs[
"latitude"]);
 
  597                                $this->userObj->setLongitude($a_attribs[
"longitude"]);
 
  598                                $this->userObj->setLocationZoom($a_attribs[
"zoom"]);
 
  601                                $this->currentPrefKey = $a_attribs[
"key"];
 
  615                                if (is_null($a_attribs[
'Id'])
 
  616                                || $a_attribs[
'Id'] == 
"")
 
  618                                        $this->
logFailure($this->userObj->getLogin(), 
sprintf(
$lng->txt(
"usrimport_xml_attribute_missing"),
"Role",
"Id"));
 
  620                                $this->current_role_id = $a_attribs[
"Id"];
 
  621                                $this->current_role_type = $a_attribs[
"Type"];
 
  622                                if ($this->current_role_type != 
'Global' 
  623                                && $this->current_role_type != 
'Local')
 
  625                                        $this->
logFailure($this->userObj->getLogin(), 
sprintf(
$lng->txt(
"usrimport_xml_attribute_missing"),
"Role",
"Type"));
 
  627                                $this->current_role_action = (is_null($a_attribs[
"Action"])) ? 
"Assign" : $a_attribs[
"Action"];
 
  628                                if ($this->current_role_action != 
"Assign" 
  629                                && $this->current_role_action != 
"AssignWithParents" 
  630                                && $this->current_role_action != 
"Detach")
 
  632                                        $this->
logFailure($this->userObj->getLogin(), 
sprintf(
$lng->txt(
"usrimport_xml_attribute_value_illegal"),
"Role",
"Action",$a_attribs[
"Action"]));
 
  634                                if ($this->action == 
"Insert" 
  635                                && $this->current_role_action == 
"Detach")
 
  637                                        $this->
logFailure($this->userObj->getLogin(), 
sprintf(
$lng->txt(
"usrimport_xml_attribute_value_inapplicable"),
"Role",
"Action",$this->current_role_action,$this->action));
 
  639                                if ($this->action == 
"Delete")
 
  641                                        $this->
logFailure($this->userObj->getLogin(), 
sprintf(
$lng->txt(
"usrimport_xml_element_inapplicable"),
"Role",
"Delete"));
 
  648                                $this->userObj->setLanguage($a_attribs[
"Language"]);
 
  649                                $this->userObj->setImportId($a_attribs[
"Id"]);
 
  650                                $this->currentPrefKey = 
null;
 
  656                                    if (is_numeric($a_attribs[
"Id"]))
 
  658                                        $this->user_id = $a_attribs[
"Id"];
 
  662                                        $this->user_id = $id;
 
  666                                $this->action = (is_null($a_attribs[
"Action"])) ? 
"Insert" : $a_attribs[
"Action"];
 
  667                                if ($this->action != 
"Insert" 
  668                                && $this->action != 
"Update" 
  669                                && $this->action != 
"Delete")
 
  671                                        $this->
logFailure($this->userObj->getImportId(), 
sprintf(
$lng->txt(
"usrimport_xml_attribute_value_illegal"),
"User",
"Action",$a_attribs[
"Action"]));
 
  673                                $this->currPassword     = 
null;
 
  674                                $this->currPasswordType = 
null;
 
  678                                $this->currPasswordType = $a_attribs[
'Type'];
 
  681                                if (array_key_exists(
"type", $a_attribs))
 
  683                                        switch($a_attribs[
"type"])
 
  689                                                        if(strcmp(
'ldap', $a_attribs[
'type']) === 0)
 
  692                                                                include_once 
'./Services/LDAP/classes/class.ilLDAPServer.php';
 
  694                                                                if(count($list) != 1)
 
  697                                                                                $this->userObj->getImportId(), 
 
  698                                                                                sprintf(
$lng->txt(
"usrimport_xml_attribute_value_illegal"),
"AuthMode",
"type",$a_attribs[
'type']));
 
  711                                                        $this->userObj->setAuthMode($a_attribs[
"type"]);
 
  723                                        $this->
logFailure($this->userObj->getImportId(), 
sprintf(
$lng->txt(
"usrimport_xml_attribute_value_illegal"),
"AuthMode",
"type",
""));
 
  727                                $this->currentPrefKey = $a_attribs[
"key"];
 
  760                                $this->roles[$this->current_role_id][
"name"] = $this->cdata;
 
  761                                $this->roles[$this->current_role_id][
"type"] =
 
  762                                        $this->current_role_type;
 
  772                if (array_key_exists($a_role_id, $this->localRoleCache))
 
  774                        return $this->localRoleCache[$a_role_id];
 
  778                        $role_obj = 
new ilObjRole($a_role_id, 
false);
 
  780                        $this->localRoleCache[$a_role_id] = $role_obj;
 
  790                global $rbacreview, $rbacadmin, $tree;
 
  792                if (array_key_exists($a_role_id.
'_courseMembersObject', $this->localRoleCache))
 
  794                        return $this->localRoleCache[$a_role_id.
'_courseMembersObject'];
 
  798                        require_once(
"Modules/Course/classes/class.ilObjCourse.php");
 
  799                        require_once(
"Modules/Course/classes/class.ilCourseParticipants.php");
 
  800                        $course_refs = $rbacreview->getFoldersAssignedToRole($a_role_id, 
true);
 
  801                        $course_ref = $course_refs[0];
 
  804                        $this->localRoleCache[$a_role_id.
'_courseMembersObject'] = $crsmembers_obj;
 
  805                        return $crsmembers_obj;
 
  815                require_once 
"./Services/AccessControl/classes/class.ilObjRole.php";
 
  816                include_once(
'./Services/Object/classes/class.ilObject.php');
 
  817                #require_once "Modules/Course/classes/class.ilObjCourse.php";
 
  818                #require_once "Modules/Course/classes/class.ilCourseParticipants.php";
 
  820                global $rbacreview, $rbacadmin, $tree;
 
  826                if ($rbacreview->isAssigned($a_user_obj->getId(), $a_role_id))
 
  834                $rbacadmin->assignUser($a_role_id, $a_user_obj->getId(), 
true);
 
  835                $obj_id = $rbacreview->getObjectOfRole($a_role_id);
 
  841                                $ref_id = current((array) $ref_ids);
 
  859                if (! array_key_exists($a_role_id, $this->parentRolesCache))
 
  861                        $parent_role_ids = array();
 
  864                        $short_role_title = substr($role_obj->getTitle(),0,12);
 
  865                        $folders = $rbacreview->getFoldersAssignedToRole($a_role_id, 
true);
 
  866                        if (count($folders) > 0)
 
  868                                $all_parent_role_ids = $rbacreview->getParentRoleIds($folders[0]);
 
  869                                foreach ($all_parent_role_ids as $parent_role_id => $parent_role_data)
 
  871                                        if ($parent_role_id != $a_role_id)
 
  873                                                switch (substr($parent_role_data[
'title'],0,12))
 
  875                                                        case 'il_crs_admin' :
 
  876                                                        case 'il_grp_admin' :
 
  877                                                                if ($short_role_title == 
'il_crs_admin' || $short_role_title == 
'il_grp_admin')
 
  879                                                                        $parent_role_ids[] = $parent_role_id;
 
  882                                                        case 'il_crs_tutor' :
 
  883                                                        case 'il_grp_tutor' :
 
  884                                                                if ($short_role_title == 
'il_crs_tutor' || $short_role_title == 
'il_grp_tutor')
 
  886                                                                        $parent_role_ids[] = $parent_role_id;
 
  889                                                        case 'il_crs_membe' :
 
  890                                                        case 'il_grp_membe' :
 
  891                                                                if ($short_role_title == 
'il_crs_membe' || $short_role_title == 
'il_grp_membe')
 
  893                                                                        $parent_role_ids[] = $parent_role_id;
 
  902                        $this->parentRolesCache[$a_role_id] = $parent_role_ids;
 
  904                return $this->parentRolesCache[$a_role_id];
 
  914                foreach ($parent_role_ids as $parent_role_id)
 
  924                global $rbacreview, $rbacadmin, $tree;
 
  926                $rbacadmin->deassignUser($a_role_id, $a_user_obj->getId());
 
  931                        $obj = $rbacreview->getObjectOfRole($a_role_id);
 
  948                                $this->roles[$this->current_role_id][
"name"] = $this->cdata;
 
  949                                $this->roles[$this->current_role_id][
"type"] = $this->current_role_type;
 
  950                                $this->roles[$this->current_role_id][
"action"] = $this->current_role_action;
 
  953                        case "PersonalPicture":
 
  954                                switch ($this->personalPicture[
"encoding"])
 
  957                                                $this->personalPicture[
"content"] = base64_decode($this->cdata);
 
  960                                        $this->personalPicture[
"content"] = convert_uudecode($this->cdata);
 
  966                                $this->userObj->setFullname();
 
  969                                if ($this->user_id == -1 || $this->action==
"Insert")
 
  977                                switch ($this->conflict_rule)
 
  983                                                switch ($this->action)
 
  988                                                                        $this->
logWarning($this->userObj->getLogin(),
sprintf(
$lng->txt(
"usrimport_action_replaced"),
"Insert",
"Update"));
 
  989                                                                        $this->action = 
"Update";
 
  995                                                                        $this->
logWarning($this->userObj->getLogin(),
sprintf(
$lng->txt(
"usrimport_action_replaced"),
"Update",
"Insert"));
 
  996                                                                        $this->action = 
"Insert";
 
 1002                                                                        $this->
logWarning($this->userObj->getLogin(),
sprintf(
$lng->txt(
"usrimport_action_ignored"),
"Delete"));
 
 1003                                                                        $this->action = 
"Ignore";
 
 1009                                                switch ($this->action)
 
 1014                                                                        $this->
logWarning($this->userObj->getLogin(),
sprintf(
$lng->txt(
"usrimport_action_ignored"),
"Insert"));
 
 1015                                                                        $this->action = 
"Ignore";
 
 1021                                                                        $this->
logWarning($this->userObj->getLogin(),
sprintf(
$lng->txt(
"usrimport_action_ignored"),
"Update"));
 
 1022                                                                        $this->action = 
"Ignore";
 
 1028                                                                        $this->
logWarning($this->userObj->getLogin(),
sprintf(
$lng->txt(
"usrimport_action_ignored"),
"Delete"));
 
 1029                                                                        $this->action = 
"Ignore";
 
 1040                                $am = ($this->userObj->getAuthMode() == 
"default" || $this->userObj->getAuthMode() == 
"")
 
 1042                                        : $this->userObj->getAuthMode();
 
 1043                                $loginForExternalAccount = ($this->userObj->getExternalAccount() == 
"")
 
 1046                                switch ($this->action)
 
 1049                                                if ($loginForExternalAccount != 
"")
 
 1051                                                        $this->
logWarning($this->userObj->getLogin(), 
$lng->txt(
"usrimport_no_insert_ext_account_exists").
" (".$this->userObj->getExternalAccount().
")");
 
 1052                                                        $this->action = 
"Ignore";
 
 1061                                                if ($loginForExternalAccount != 
"") 
 
 1066                                                        if ($externalAccountHasChanged && trim($loginForExternalAccount) != trim($this->userObj->getLogin()))
 
 1068                                                                $this->
logWarning($this->userObj->getLogin(), 
$lng->txt(
"usrimport_no_update_ext_account_exists").
" (".$this->userObj->getExternalAccount().
")");
 
 1069                                                                $this->action = 
"Ignore";
 
 1075                                if(
sizeof($this->multi_values))
 
 1077                                        if(isset($this->multi_values[
"GeneralInterest"]))
 
 1079                                                $this->userObj->setGeneralInterests($this->multi_values[
"GeneralInterest"]);
 
 1081                                        if(isset($this->multi_values[
"OfferingHelp"]))
 
 1083                                                $this->userObj->setOfferingHelp($this->multi_values[
"OfferingHelp"]);
 
 1085                                        if(isset($this->multi_values[
"LookingForHelp"]))
 
 1087                                                $this->userObj->setLookingForHelp($this->multi_values[
"LookingForHelp"]);
 
 1092                                switch ($this->action)
 
 1097                                                        $this->
logFailure($this->userObj->getLogin(),
$lng->txt(
"usrimport_cant_insert"));
 
 1102                                                        if(!strlen($this->currPassword) == 0)
 
 1104                                                                switch(strtoupper($this->currPasswordType))
 
 1108                                                                                $this->userObj->setPasswordEncodingType(
'bcryptphp');
 
 1109                                                                                $this->userObj->setPasswordSalt(
null);
 
 1114                                                                                $this->acc_mail->setUserPassword($this->currPassword);
 
 1118                                                                                $this->
logFailure($this->userObj->getLogin(), 
sprintf(
$lng->txt(
"usrimport_xml_attribute_value_illegal"),
"Type",
"Password",$this->currPasswordType));
 
 1133                                                        $this->userObj->setTitle($this->userObj->getFullname());
 
 1134                                                        $this->userObj->setDescription($this->userObj->getEmail());
 
 1136                                                        if(!$this->time_limit_owner_set)
 
 1138                                                                $this->userObj->setTimeLimitOwner($this->
getFolderId());
 
 1142                                                        if(!$this->time_limit_set)
 
 1144                                                                $this->userObj->setTimeLimitUnlimited(1);
 
 1145                                                                $this->userObj->setTimeLimitMessage(0);
 
 1147                                                                if (! $this->approve_date_set)
 
 1149                                                                        $this->userObj->setApproveDate(
date(
"Y-m-d H:i:s"));
 
 1154                                                        $this->userObj->setActive($this->currActive == 
'true' || is_null($this->currActive));
 
 1160                                                        if(count($this->udf_data))
 
 1162                                                                $this->userObj->setUserDefinedData($this->udf_data);                                                            
 
 1166                                                        $this->userObj->create();
 
 1169                                                        $this->userObj->saveAsNew(
false);
 
 1172                                                        $this->userObj->setPref(
'hits_per_page',
$ilSetting->get(
'hits_per_page',30));
 
 1175                                                        if (count ($this->prefs)) 
 
 1177                                                                foreach ($this->prefs as $key => $value)
 
 1179                                                                        if ($key != 
"mail_incoming_type" && 
 
 1180                                                                            $key != 
"mail_signature" &&
 
 1181                                                                            $key != 
"mail_linebreak" 
 1184                                                                           $this->userObj->setPref($key, $value);
 
 1189                                                        if(!is_array($this->prefs) || array_search(
'chat_osc_accept_msg', $this->prefs) === 
false)
 
 1191                                                                $this->userObj->setPref(
'chat_osc_accept_msg', 
$ilSetting->get(
'chat_osc_accept_msg', 
'n'));
 
 1193                                                        if(!is_array($this->prefs) || array_search(
'bs_allow_to_contact_me', $this->prefs) === 
false)
 
 1195                                                                $this->userObj->setPref(
'bs_allow_to_contact_me', 
$ilSetting->get(
'bs_allow_to_contact_me', 
'n'));
 
 1198                                                        $this->userObj->writePrefs();
 
 1203                                                        if (is_array($this->personalPicture))
 
 1205                                                                if (strlen($this->personalPicture[
"content"]))
 
 1208                                                                        if (preg_match(
"/.*(png|jpg|gif|jpeg)$/", $this->personalPicture[
"imagetype"], $matches))
 
 1210                                                                                $extension = $matches[1];
 
 1212                                                                        $tmp_name = $this->
saveTempImage($this->personalPicture[
"content"], 
".$extension");
 
 1213                                                                        if (strlen($tmp_name))
 
 1222                                                        foreach($this->roles as $role_id => $role)
 
 1224                                                                if ($this->role_assign[$role_id])
 
 1226                                                                        $this->
assignToRole($this->userObj, $this->role_assign[$role_id]);
 
 1230                                                        if(count($this->udf_data))
 
 1232                                                                include_once 
'./Services/User/classes/class.ilUserDefinedData.php';
 
 1234                                                                foreach($this->udf_data as $field => $value)
 
 1236                                                                        $udd->set(
"f_".$field,$value);
 
 1242                                                        $this->
logSuccess($this->userObj->getLogin(),$this->userObj->getId(), 
"Insert");
 
 1244                                                        $this->acc_mail->reset();
 
 1251                                                        $this->
logFailure($this->userObj->getLogin(),
$lng->txt(
"usrimport_cant_update"));
 
 1256                                                        $updateUser->read();
 
 1257                                                        $updateUser->readPrefs();
 
 1258                                                        if ($this->currPassword != 
null)
 
 1260                                                                switch(strtoupper($this->currPasswordType))
 
 1264                                                                                $updateUser->setPasswordEncodingType(
'bcryptphp');
 
 1265                                                                                $updateUser->setPasswordSalt(
null);
 
 1270                                                                                $this->acc_mail->setUserPassword($this->currPassword);
 
 1274                                                                                $this->
logFailure($this->userObj->getLogin(), 
sprintf(
$lng->txt(
"usrimport_xml_attribute_value_illegal"),
"Type",
"Password",$this->currPasswordType));
 
 1278                                                        if (! is_null($this->userObj->getFirstname())) $updateUser->setFirstname($this->userObj->getFirstname());
 
 1279                                                        if (! is_null($this->userObj->getLastname())) $updateUser->setLastname($this->userObj->getLastname());
 
 1280                                                        if (! is_null($this->userObj->getUTitle())) $updateUser->setUTitle($this->userObj->getUTitle());
 
 1281                                                        if (! is_null($this->userObj->getGender())) $updateUser->setGender($this->userObj->getGender());
 
 1282                                                        if (! is_null($this->userObj->getEmail())) $updateUser->setEmail($this->userObj->getEmail());
 
 1283                                                        if (! is_null($this->userObj->getBirthday())) $updateUser->setBirthday($this->userObj->getBirthday());
 
 1284                                                        if (! is_null($this->userObj->getInstitution())) $updateUser->setInstitution($this->userObj->getInstitution());
 
 1285                                                        if (! is_null($this->userObj->getStreet())) $updateUser->setStreet($this->userObj->getStreet());
 
 1286                                                        if (! is_null($this->userObj->getCity())) $updateUser->setCity($this->userObj->getCity());
 
 1287                                                        if (! is_null($this->userObj->getZipCode())) $updateUser->setZipCode($this->userObj->getZipCode());
 
 1288                                                        if (! is_null($this->userObj->getCountry())) $updateUser->setCountry($this->userObj->getCountry());
 
 1289                                                        if (! is_null($this->userObj->getSelectedCountry())) $updateUser->setSelectedCountry($this->userObj->getSelectedCountry());
 
 1290                                                        if (! is_null($this->userObj->getPhoneOffice())) $updateUser->setPhoneOffice($this->userObj->getPhoneOffice());
 
 1291                                                        if (! is_null($this->userObj->getPhoneHome())) $updateUser->setPhoneHome($this->userObj->getPhoneHome());
 
 1292                                                        if (! is_null($this->userObj->getPhoneMobile())) $updateUser->setPhoneMobile($this->userObj->getPhoneMobile());
 
 1293                                                        if (! is_null($this->userObj->getFax())) $updateUser->setFax($this->userObj->getFax());
 
 1294                                                        if (! is_null($this->userObj->getHobby())) $updateUser->setHobby($this->userObj->getHobby());
 
 1295                                                        if (! is_null($this->userObj->getGeneralInterests())) $updateUser->setGeneralInterests($this->userObj->getGeneralInterests());
 
 1296                                                        if (! is_null($this->userObj->getOfferingHelp())) $updateUser->setOfferingHelp($this->userObj->getOfferingHelp());
 
 1297                                                        if (! is_null($this->userObj->getLookingForHelp())) $updateUser->setLookingForHelp($this->userObj->getLookingForHelp());
 
 1298                                                        if (! is_null($this->userObj->getComment())) $updateUser->setComment($this->userObj->getComment());
 
 1299                                                        if (! is_null($this->userObj->getDepartment())) $updateUser->setDepartment($this->userObj->getDepartment());
 
 1300                                                        if (! is_null($this->userObj->getMatriculation())) $updateUser->setMatriculation($this->userObj->getMatriculation());
 
 1301                                                        if (! is_null($this->currActive)) $updateUser->setActive($this->currActive == 
"true", is_object(
$ilUser) ? 
$ilUser->getId() : 0);
 
 1302                                                        if (! is_null($this->userObj->getClientIP())) $updateUser->setClientIP($this->userObj->getClientIP());
 
 1303                                                        if (! is_null($this->userObj->getTimeLimitUnlimited())) $updateUser->setTimeLimitUnlimited($this->userObj->getTimeLimitUnlimited());
 
 1304                                                        if (! is_null($this->userObj->getTimeLimitFrom())) $updateUser->setTimeLimitFrom($this->userObj->getTimeLimitFrom());
 
 1305                                                        if (! is_null($this->userObj->getTimeLimitUntil())) $updateUser->setTimeLimitUntil($this->userObj->getTimeLimitUntil());
 
 1306                                                        if (! is_null($this->userObj->getTimeLimitMessage())) $updateUser->setTimeLimitMessage($this->userObj->getTimeLimitMessage());
 
 1307                                                        if (! is_null($this->userObj->getApproveDate())) $updateUser->setApproveDate($this->userObj->getApproveDate());
 
 1308                                                        if (! is_null($this->userObj->getAgreeDate())) $updateUser->setAgreeDate($this->userObj->getAgreeDate());
 
 1309                                                        if (! is_null($this->userObj->getLanguage())) $updateUser->setLanguage($this->userObj->getLanguage());
 
 1310                                                        if (! is_null($this->userObj->getExternalAccount())) $updateUser->setExternalAccount($this->userObj->getExternalAccount());
 
 1313                                                        #if (! is_null($this->userObj->getAuthMode())) $updateUser->setAuthMode($this->userObj->getAuthMode()); 
 1314                                                        if($this->auth_mode_set)
 
 1315                                                                $updateUser->setAuthMode($this->userObj->getAuthMode());
 
 1318                                                        if($this->time_limit_owner_set)
 
 1320                                                                $updateUser->setTimeLimitOwner($this->userObj->getTimeLimitOwner());
 
 1324                                                        if (count ($this->prefs)) 
 
 1326                                                                foreach ($this->prefs as $key => $value)
 
 1328                                                                        if ($key != 
"mail_incoming_type" && 
 
 1329                                                                            $key != 
"mail_signature" &&
 
 1330                                                                            $key != 
"mail_linebreak" 
 1332                                                                            $updateUser->setPref($key, $value);
 
 1338                                                        if ($this->updateLookAndSkin)
 
 1340                                                                $updateUser->setPref(
"skin", $this->userObj->getPref(
"skin"));
 
 1341                                                                $updateUser->setPref(
"style", $this->userObj->getPref(
"style"));
 
 1345                                                        $updateUser->writePrefs();
 
 1351                                                        if(count($this->udf_data))
 
 1353                                                                $updateUser->setUserDefinedData($this->udf_data);                                                               
 
 1357                                                        $updateUser->setFullname();
 
 1358                                                        $updateUser->setTitle($updateUser->getFullname());
 
 1359                                                        $updateUser->setDescription($updateUser->getEmail());
 
 1360                                                        $updateUser->update();
 
 1362                                                        if(count($this->udf_data))
 
 1364                                                                include_once 
'./Services/User/classes/class.ilUserDefinedData.php';
 
 1366                                                                foreach($this->udf_data as $field => $value)
 
 1368                                                                        $udd->set(
"f_".$field,$value);
 
 1374                                                        if (!is_null($this->userObj->getLogin()) && $this->user_id != -1)
 
 1378                                                                        $updateUser->updateLogin($this->userObj->getLogin());
 
 1388                                                        if (is_array($this->personalPicture))
 
 1390                                                                if (strlen($this->personalPicture[
"content"]))
 
 1393                                                                        if (preg_match(
"/.*(png|jpg|gif|jpeg)$/", $this->personalPicture[
"imagetype"], $matches))
 
 1395                                                                                $extension = $matches[1];
 
 1397                                                                        $tmp_name = $this->
saveTempImage($this->personalPicture[
"content"], 
".$extension");
 
 1398                                                                        if (strlen($tmp_name))
 
 1409                                                        foreach ($this->roles as $role_id => $role)
 
 1411                                                                if ($this->role_assign[$role_id])
 
 1413                                                                        switch ($role[
"action"])
 
 1416                                                                                        $this->
assignToRole($updateUser, $this->role_assign[$role_id]);
 
 1418                                                                                case "AssignWithParents" :
 
 1422                                                                                        $this->
detachFromRole($updateUser, $this->role_assign[$role_id]);
 
 1433                                                        $this->
logFailure($this->userObj->getLogin(),
$lng->txt(
"usrimport_cant_delete"));
 
 1438                                                        $deleteUser->delete();
 
 1446                                $this->roles = array();
 
 1450                                $this->userObj->setLogin($this->cdata);
 
 1454                                $this->currPassword = $this->cdata;
 
 1458                                $this->userObj->setFirstname($this->cdata);
 
 1462                                $this->userObj->setLastname($this->cdata);
 
 1466                                $this->userObj->setUTitle($this->cdata);
 
 1470                                $this->userObj->setGender($this->cdata);
 
 1474                                $this->userObj->setEmail($this->cdata);
 
 1481                                        $this->userObj->setBirthday($this->cdata);
 
 1485                                $this->userObj->setInstitution($this->cdata);
 
 1489                                $this->userObj->setStreet($this->cdata);
 
 1493                                $this->userObj->setCity($this->cdata);
 
 1497                                $this->userObj->setZipCode($this->cdata);
 
 1501                                $this->userObj->setCountry($this->cdata);
 
 1505                                $this->userObj->setSelectedCountry($this->cdata);
 
 1509                                $this->userObj->setPhoneOffice($this->cdata);
 
 1513                                $this->userObj->setPhoneHome($this->cdata);
 
 1517                                $this->userObj->setPhoneMobile($this->cdata);
 
 1521                                $this->userObj->setFax($this->cdata);
 
 1525                                $this->userObj->setHobby($this->cdata);
 
 1528                        case "GeneralInterest":
 
 1529                        case "OfferingHelp":
 
 1530                        case "LookingForHelp":
 
 1531                                $this->multi_values[$a_name][] = $this->cdata;                          
 
 1535                                $this->userObj->setComment($this->cdata);
 
 1539                                $this->userObj->setDepartment($this->cdata);
 
 1542                        case "Matriculation":
 
 1543                                $this->userObj->setMatriculation($this->cdata);
 
 1547                                $this->currActive = $this->cdata;
 
 1551                                $this->userObj->setClientIP($this->cdata);
 
 1554                        case "TimeLimitOwner":
 
 1555                                $this->time_limit_owner_set = 
true;
 
 1556                                $this->userObj->setTimeLimitOwner($this->cdata);
 
 1559                        case "TimeLimitUnlimited":
 
 1560                                $this->time_limit_set = 
true;
 
 1561                                $this->userObj->setTimeLimitUnlimited($this->cdata);
 
 1564                        case "TimeLimitFrom":
 
 1565                                if (is_numeric($this->cdata))
 
 1568                                        $this->userObj->setTimeLimitFrom($this->cdata);
 
 1574                                        if (
$timestamp !== 
false && trim($this->cdata) != 
"0000-00-00 00:00:00")
 
 1576                                                $this->userObj->setTimeLimitFrom(
$timestamp);
 
 1578                                        elseif ($this->cdata == 
"0000-00-00 00:00:00") 
 
 1580                                            $this->userObj->setTimeLimitFrom(
null);
 
 1586                        case "TimeLimitUntil":
 
 1587                                if (is_numeric($this->cdata))
 
 1590                                        $this->userObj->setTimeLimitUntil($this->cdata);
 
 1596                                        if (
$timestamp !== 
false && trim($this->cdata) != 
"0000-00-00 00:00:00")
 
 1598                                                $this->userObj->setTimeLimitUntil(
$timestamp);
 
 1600                                        elseif ($this->cdata == 
"0000-00-00 00:00:00") 
 
 1602                                            $this->userObj->setTimeLimitUntil(
null);
 
 1607                        case "TimeLimitMessage":
 
 1608                                $this->userObj->setTimeLimitMessage($this->cdata);
 
 1612                                $this->approve_date_set = 
true;
 
 1613                                if (is_numeric($this->cdata))
 
 1623                                        if (
$timestamp !== 
false && trim($this->cdata) != 
"0000-00-00 00:00:00")
 
 1628                                        elseif ($this->cdata == 
"0000-00-00 00:00:00") 
 
 1630                                            $this->userObj->setApproveDate(
null);
 
 1636                                if (is_numeric($this->cdata))
 
 1646                                        if (
$timestamp !== 
false && trim($this->cdata) != 
"0000-00-00 00:00:00")
 
 1651                                        elseif ($this->cdata == 
"0000-00-00 00:00:00") 
 
 1653                                            $this->userObj->setAgreeDate(
null);
 
 1658                        case "ExternalAccount":
 
 1659                                $this->userObj->setExternalAccount($this->cdata);
 
 1663                                $this->updateLookAndSkin = 
false;
 
 1664                                if (!$this->hideSkin)
 
 1667                                        if ((strlen($this->skin) > 0) && (strlen($this->style) > 0))
 
 1669                                                if (is_array($this->userStyles))
 
 1671                                                        if (in_array($this->skin . 
":" . $this->style, $this->userStyles))
 
 1673                                                                $this->userObj->setPref(
"skin", $this->skin);
 
 1674                                                                $this->userObj->setPref(
"style", $this->style);
 
 1675                                                                $this->updateLookAndSkin = 
true;
 
 1682                        case 'UserDefinedField':
 
 1683                                include_once 
'./Services/User/classes/class.ilUserDefinedFields.php';
 
 1685                                if($field_id = $udf->fetchFieldIdFromImportId($this->tmp_udf_id))
 
 1687                                        $this->udf_data[$field_id] = $this->cdata;
 
 1689                                elseif($field_id = $udf->fetchFieldIdFromName($this->tmp_udf_name))
 
 1691                                        $this->udf_data[$field_id] = $this->cdata;
 
 1695                                if($this->current_messenger_type ==
"external")
 
 1697                                        $this->userObj->setExternalAccount($this->cdata);
 
 1701                                if ($this->currentPrefKey != 
null && strlen(trim($this->cdata)) > 0 
 
 1703                                        $this->prefs[$this->currentPrefKey] = trim($this->cdata);
 
 1704                                $this->currentPrefKey = 
null;
 
 1716                $fh = fopen($tempname, 
"wb");
 
 1721                $imagefile = fwrite(
$fh, $image_data);
 
 1736                                $this->roles[$this->current_role_id][
"name"] = $this->cdata;
 
 1737                                $this->roles[$this->current_role_id][
"type"] = $this->current_role_type;
 
 1738                                $this->roles[$this->current_role_id][
"action"] = $this->current_role_action;
 
 1742                                $this->userObj->setFullname();
 
 1743                                if ($this->user_id != -1 && ($this->action == 
"Update" || $this->action == 
"Delete"))
 
 1748                                if (is_null($this->userObj->getLogin()))
 
 1750                                        $this->
logFailure(
"---",
sprintf($lng->txt(
"usrimport_xml_element_for_action_required"),
"Login", 
"Insert"));
 
 1753                                switch ($this->action)
 
 1758                                                        $this->
logWarning($this->userObj->getLogin(),
$lng->txt(
"usrimport_cant_insert"));
 
 1760                                                if (is_null($this->userObj->getGender()) && $this->isFieldRequired(
"gender"))
 
 1762                                                        $this->
logFailure($this->userObj->getLogin(),
sprintf(
$lng->txt(
"usrimport_xml_element_for_action_required"),
"Gender", 
"Insert"));
 
 1764                                                if (is_null($this->userObj->getFirstname()))
 
 1766                                                        $this->
logFailure($this->userObj->getLogin(),
sprintf(
$lng->txt(
"usrimport_xml_element_for_action_required"),
"Firstname", 
"Insert"));
 
 1768                                                if (is_null($this->userObj->getLastname()))
 
 1770                                                        $this->
logFailure($this->userObj->getLogin(),
sprintf(
$lng->txt(
"usrimport_xml_element_for_action_required"),
"Lastname", 
"Insert"));
 
 1772                                                if (count($this->roles) == 0)
 
 1774                                                        $this->
logFailure($this->userObj->getLogin(),
sprintf(
$lng->txt(
"usrimport_xml_element_for_action_required"),
"Role", 
"Insert"));
 
 1778                                                        $has_global_role = 
false;
 
 1779                                                        foreach ($this->roles as $role)
 
 1781                                                                if ($role[
'type'] == 
'Global')
 
 1783                                                                        $has_global_role = 
true;
 
 1787                                                        if (! $has_global_role)
 
 1789                                                                $this->
logFailure($this->userObj->getLogin(),
sprintf(
$lng->txt(
"usrimport_global_role_for_action_required"),
"Insert"));
 
 1796                                                        $this->
logWarning($this->userObj->getLogin(),
$lng->txt(
"usrimport_cant_update"));
 
 1798                                                elseif($this->user_id != -1 && !is_null($this->userObj->getLogin()))
 
 1803                            if (is_numeric($someonesId ) && $someonesId != $this->user_id) {
 
 1804                                          $this->
logFailure($this->userObj->getLogin(), 
$lng->txt(
"usrimport_login_is_not_unique"));
 
 1811                                                        $this->
logWarning($this->userObj->getLogin(),
$lng->txt(
"usrimport_cant_delete"));
 
 1817                                $this->roles = array();
 
 1821                                if (array_key_exists($this->cdata, $this->logins))
 
 1823                                        $this->
logWarning($this->cdata, 
$lng->txt(
"usrimport_login_is_not_unique"));
 
 1827                                        $this->logins[$this->cdata] = $this->cdata;
 
 1829                        $this->userObj->setLogin($this->cdata);
 
 1833                                switch ($this->currPasswordType)
 
 1837                                                $this->userObj->setPasswordEncodingType(
'bcryptphp');
 
 1838                                                $this->userObj->setPasswordSalt(
null);
 
 1843                                                $this->acc_mail->setUserPassword($this->currPassword);
 
 1847                                                $this->
logFailure($this->userObj->getLogin(), 
sprintf(
$lng->txt(
"usrimport_xml_attribute_value_illegal"),
"Type",
"Password",$this->currPasswordType));
 
 1853                                $this->userObj->setFirstname($this->cdata);
 
 1857                                $this->userObj->setLastname($this->cdata);
 
 1861                                $this->userObj->setUTitle($this->cdata);
 
 1865                                if ($this->cdata != 
"m" 
 1866                                && $this->cdata != 
"f")
 
 1869                                                $this->userObj->getLogin(), 
 
 1870                                                sprintf(
$lng->txt(
"usrimport_xml_element_content_illegal"),
"Gender",$this->cdata)
 
 1873                                $this->userObj->setGender($this->cdata);
 
 1877                                $this->userObj->setEmail($this->cdata);
 
 1881                                $this->userObj->setInstitution($this->cdata);
 
 1885                                $this->userObj->setStreet($this->cdata);
 
 1889                                $this->userObj->setCity($this->cdata);
 
 1893                                $this->userObj->setZipCode($this->cdata);
 
 1897                                $this->userObj->setCountry($this->cdata);
 
 1901                                $this->userObj->setSelectedCountry($this->cdata);
 
 1905                                $this->userObj->setPhoneOffice($this->cdata);
 
 1909                                $this->userObj->setPhoneHome($this->cdata);
 
 1913                                $this->userObj->setPhoneMobile($this->cdata);
 
 1917                                $this->userObj->setFax($this->cdata);
 
 1921                                $this->userObj->setHobby($this->cdata);
 
 1924                        case "GeneralInterest":
 
 1925                        case "OfferingHelp":
 
 1926                        case "LookingForHelp":
 
 1927                                $this->multi_values[$a_name][] = $this->cdata;                          
 
 1931                                $this->userObj->setComment($this->cdata);
 
 1935                                $this->userObj->setDepartment($this->cdata);
 
 1938                        case "Matriculation":
 
 1939                                $this->userObj->setMatriculation($this->cdata);
 
 1942                        case "ExternalAccount":
 
 1944                                $am = ($this->userObj->getAuthMode() == 
"default" || $this->userObj->getAuthMode() == 
"")
 
 1946                                        : $this->userObj->getAuthMode();
 
 1947                                $loginForExternalAccount = (trim($this->cdata) == 
"")
 
 1950                                switch ($this->action)
 
 1953                                                if ($loginForExternalAccount != 
"")
 
 1955                                                        $this->
logWarning($this->userObj->getLogin(), 
$lng->txt(
"usrimport_no_insert_ext_account_exists").
" (".$this->cdata.
")");
 
 1960                                                if ($loginForExternalAccount != 
"")
 
 1963                                                        if ($externalAccountHasChanged && trim($loginForExternalAccount) != trim($this->userObj->getLogin()))
 
 1965                                                                $this->
logWarning($this->userObj->getLogin(),
 
 1966                                                                        $lng->txt(
"usrimport_no_update_ext_account_exists").
" (".$this->cdata.
" for ".$loginForExternalAccount.
")");
 
 1972                                if ($externalAccountHasChanged)
 
 1973                                        $this->userObj->setExternalAccount(trim($this->cdata));
 
 1977                                if ($this->cdata != 
"true" 
 1978                                && $this->cdata != 
"false")
 
 1980                                        $this->
logFailure($this->userObj->getLogin(),
 
 1981                                                                          sprintf(
$lng->txt(
"usrimport_xml_element_content_illegal"),
"Active",$this->cdata));
 
 1983                                $this->currActive = $this->cdata;
 
 1985                        case "TimeLimitOwner":
 
 1986                                if (!preg_match(
"/\d+/", $this->cdata))
 
 1988                                        $this->
logFailure($this->userObj->getLogin(),
 
 1989                                                                          sprintf(
$lng->txt(
"usrimport_xml_element_content_illegal"),
"TimeLimitOwner",$this->cdata));
 
 1991                                elseif(!$ilAccess->checkAccess(
'cat_administrate_users',
'',$this->cdata))
 
 1993                                        $this->
logFailure($this->userObj->getLogin(),
 
 1994                                                                          sprintf(
$lng->txt(
"usrimport_xml_element_content_illegal"),
"TimeLimitOwner",$this->cdata));
 
 1996                                elseif($ilObjDataCache->lookupType($ilObjDataCache->lookupObjId($this->cdata)) != 
'cat' && !(
int) $this->cdata == 
USER_FOLDER_ID)
 
 1998                                        $this->
logFailure($this->userObj->getLogin(),
 
 1999                                                                          sprintf(
$lng->txt(
"usrimport_xml_element_content_illegal"),
"TimeLimitOwner",$this->cdata));
 
 2002                                $this->userObj->setTimeLimitOwner($this->cdata);
 
 2004                        case "TimeLimitUnlimited":
 
 2005                                switch (strtolower($this->cdata))
 
 2009                                                $this->userObj->setTimeLimitUnlimited(1);
 
 2013                                                $this->userObj->setTimeLimitUnlimited(0);
 
 2016                                                $this->
logFailure($this->userObj->getLogin(), 
sprintf(
$lng->txt(
"usrimport_xml_element_content_illegal"),
"TimeLimitUnlimited",$this->cdata));
 
 2020                        case "TimeLimitFrom":
 
 2022                                if (strtotime($this->cdata) === 
false && ! is_numeric($this->cdata))
 
 2024                                        $this->
logFailure($this->userObj->getLogin(), 
sprintf(
$lng->txt(
"usrimport_xml_element_content_illegal"),
"TimeLimitFrom",$this->cdata));
 
 2026                                $this->userObj->setTimeLimitFrom($this->cdata);
 
 2028                        case "TimeLimitUntil":
 
 2030                                if (strtotime($this->cdata) === 
false && ! is_numeric($this->cdata))
 
 2032                                        $this->
logFailure($this->userObj->getLogin(), 
sprintf(
$lng->txt(
"usrimport_xml_element_content_illegal"),
"TimeLimitUntil",$this->cdata));
 
 2034                                $this->userObj->setTimeLimitUntil($this->cdata);
 
 2036                        case "TimeLimitMessage":
 
 2037                                switch (strtolower($this->cdata))
 
 2040                                                $this->userObj->setTimeLimitMessage(1);
 
 2043                                                $this->userObj->setTimeLimitMessage(0);
 
 2046                                                $this->
logFailure($this->userObj->getLogin(), 
sprintf(
$lng->txt(
"usrimport_xml_element_content_illegal"),
"TimeLimitMessage",$this->cdata));
 
 2052                                if (strtotime($this->cdata) === 
false && ! is_numeric($this->cdata) && !$this->cdata == 
"0000-00-00 00:00:00")
 
 2054                                        $this->
logFailure($this->userObj->getLogin(), 
sprintf(
$lng->txt(
"usrimport_xml_element_content_illegal"),
"ApproveDate",$this->cdata));
 
 2059                                if (strtotime($this->cdata) === 
false && ! is_numeric($this->cdata) && !$this->cdata == 
"0000-00-00 00:00:00")
 
 2061                                        $this->
logFailure($this->userObj->getLogin(), 
sprintf(
$lng->txt(
"usrimport_xml_element_content_illegal"),
"AgreeDate",$this->cdata));
 
 2065                                if ($this->currentPrefKey != 
null)
 
 2066                                        $this->
verifyPref($this->currentPrefKey, $this->cdata);
 
 2067                                $this->currentPrefKey == 
null;
 
 2079                if($a_data != 
"\n") $a_data = preg_replace(
"/\t+/",
" ",$a_data);
 
 2081                if(strlen($a_data) > 0)
 
 2083                        $this->cdata .= $a_data;
 
 2110                if (! array_key_exists($aLogin, $this->protocol))
 
 2112                        $this->protocol[$aLogin] = array();
 
 2116                        $this->protocol[$aLogin][] = $aMessage;
 
 2131                if (! array_key_exists($aLogin, $this->protocol))
 
 2133                        $this->protocol[$aLogin] = array();
 
 2137                        $this->protocol[$aLogin][] = $aMessage;
 
 2151            $this->user_mapping[$userid] = array(
"login" => $aLogin, 
"action" => 
$action, 
"message" => 
"successful");
 
 2174                $block = 
new ilTemplate(
"tpl.usr_import_log_block.html", 
true, 
true, 
"Services/User");
 
 2175                $block->setVariable(
"TXT_LOG_TITLE", $a_log_title);
 
 2176                $block->setVariable(
"TXT_MESSAGE_ID", 
$lng->txt(
"login"));
 
 2177                $block->setVariable(
"TXT_MESSAGE_TEXT", 
$lng->txt(
"message"));
 
 2180                        $block->setCurrentBlock(
"log_row");
 
 2190                                        $reason = $reason.
"<br>".$message;
 
 2193                        $block->setVariable(
"MESSAGE_ID", $login);
 
 2194                        $block->setVariable(
"MESSAGE_TEXT", $reason);
 
 2195                        $block->parseCurrentBlock();
 
 2197                return $block->get();
 
 2231                if(
$_POST[
"send_mail"] != 
"" ||
 
 2232                        ($this->
isSendMail() && $this->userObj->getEmail() != 
""))
 
 2234                        $this->acc_mail->setUser($this->userObj);
 
 2237                        if($amail[
"att_file"])
 
 2239                                include_once 
"Services/User/classes/class.ilFSStorageUserFolder.php";
 
 2242                                $path = $fs->getAbsolutePath() . 
"/";
 
 2244                                $this->acc_mail->addAttachment(
$path . 
"/" . $amail[
"lang"], $amail[
"att_file"]);
 
 2246                        $this->acc_mail->send();
 
 2256                if(!isset(self::$account_mail_cache[$lang_key]))
 
 2258                        $default_lang_key = 
$GLOBALS[
"lng"]->getDefaultLanguage();
 
 2261                        include_once 
'./Services/User/classes/class.ilObjUserFolder.php';
 
 2265                        if (trim($amail[
"body"]) != 
"" && trim($amail[
"subject"]) != 
"")
 
 2267                                self::$account_mail_cache[$lang_key] = $amail;
 
 2271                                $lang_key = $default_lang_key;
 
 2274                        if(!isset(self::$account_mail_cache[$default_lang_key]))
 
 2277                                self::$account_mail_cache[$default_lang_key] = $amail;
 
 2280                return self::$account_mail_cache[$lang_key];
 
 2289            $this->send_mail = $value ? 
true: 
false;
 
 2309               $this->mapping_mode = $value;
 
 2310            else die (
"wrong argument using methode setUserMappingMethod in ".__FILE__);
 
 2333                if(is_array($this->required_fields))
 
 2335                        return $this->required_fields;
 
 2337                foreach(
$ilSetting->getAll() as $field => $value)
 
 2339                        if(substr($field,0,8) == 
'require_' and $value == 1)
 
 2341                                $value = substr($field,8);
 
 2342                                $this->required_fields[$value] = $value;
 
 2345                return $this->required_fields ? $this->required_fields : array();
 
 2358                include_once 
"Services/User/classes/class.ilUserProfile.php";
 
 2371                $fieldname = strtolower(trim($fieldname));
 
 2372                return array_key_exists($fieldname, $requiredFields);
 
 2377                    case 'mail_linebreak':
 
 2378                        case 'hits_per_page': 
 
 2379                                if (!is_numeric($value) || $value < 0)
 
 2380                                        $this->
logFailure(
"---", 
"Wrong value '$value': Positiv numeric value expected for preference $key.");
 
 2385                        case 'ilPageEditor_HTMLMode': 
 
 2386                        case 'ilPageEditor_JavaScript': 
 
 2387                        case 'ilPageEditor_MediaMode':
 
 2388                        case 'tst_javascript': 
 
 2389                        case 'tst_lastquestiontype': 
 
 2390                        case 'tst_multiline_answers':
 
 2391                        case 'tst_use_previous_answers':
 
 2392                        case 'graphicalAnswerSetting': 
 
 2393                        case 'priv_feed_pass': 
 
 2394                                $this->
logFailure(
"---", 
"Preference $key is not supported.");                          
 
 2397                        case 'public_country':
 
 2398                        case 'public_department':
 
 2399                        case 'public_email':
 
 2401                        case 'public_hobby':
 
 2402                        case 'public_institution':
 
 2403                        case 'public_matriculation':
 
 2404                        case 'public_phone':
 
 2405                        case 'public_phone_home':
 
 2406                        case 'public_phone_mobile':
 
 2407                        case 'public_phone_office':
 
 2408                        case 'public_street':
 
 2409                        case 'public_upload':
 
 2411                        case 'public_interests_general':
 
 2412                        case 'public_interests_help_offered':
 
 2413                        case 'public_interests_help_looking':
 
 2414                        case 'send_info_mails':
 
 2415                        case 'hide_own_online_status':
 
 2416                                if (!in_array($value, array(
'y', 
'n')))
 
 2417                                        $this->
logFailure(
"---", 
"Wrong value '$value': Value 'y' or 'n' expected for preference $key.");                               
 
 2419                        case 'bs_allow_to_contact_me':
 
 2420                                if(!in_array($value, array(
'y', 
'n')))
 
 2422                                        $this->
logFailure(
"---", 
"Wrong value '$value': Value 'y' or 'n' expected for preference $key.");
 
 2425                        case 'chat_osc_accept_msg':
 
 2426                                if(!in_array($value, array(
'y', 
'n')))
 
 2428                                        $this->
logFailure(
"---", 
"Wrong value '$value': Value 'y' or 'n' expected for preference $key.");
 
 2431                        case 'public_profile':
 
 2432                                if (!in_array($value, array(
'y', 
'n', 
'g')))
 
 2433                                        $this->
logFailure(
"---", 
"Wrong value '$value': Value 'y', 'g' or 'n' expected for preference $key.");                          
 
 2435                        case 'show_users_online':
 
 2436                                if (!in_array($value, array(
'y', 
'n', 
'associated')))
 
 2437                                        $this->
logFailure(
"---", 
"Wrong value '$value': Value 'y' or 'n' or 'associated' expected for preference $key.");
 
 2439                        case 'mail_incoming_type':
 
 2440                            if (!in_array((
int) $value, array(
"0",
"1",
"2")))
 
 2441                                $this->
logFailure(
"---", 
"Wrong value '$value': Value \"0\" (LOCAL),\"1\" (EMAIL) or \"2\" (BOTH) expected for preference $key.");
 
 2444                            if (!in_array($value, array (
"0",
"1")))
 
 2445                                $this->
logFailure(
"---", 
"Wrong value '$value': Value \"0\" (Sunday) or \"1\" (Monday) expected for preference $key.");
 
 2448                        case 'mail_signature':
 
 2451                                include_once(
'Services/Calendar/classes/class.ilTimeZone.php');
 
 2456                                        $this->
logFailure(
"---", 
"Wrong value '$value': Invalid timezone $value detected for preference $key.");                                        
 
 2461                                $this->
logFailure(
"---", 
"Preference $key is not supported.");                          
 
 2467            if (array_key_exists(
"mail_incoming_type", $this->prefs) || 
 
 2468                array_key_exists(
"mail_signature", $this->prefs) ||
 
 2469                array_key_exists(
"mail_linebreak", $this->prefs)
 
 2472                include_once(
"Services/Mail/classes/class.ilMailOptions.php"); 
 
 2474                $mailOptions->updateOptions(    
 
 2475                    array_key_exists(
"mail_signature", $this->prefs) ? $this->prefs[
"mail_signature"] : $mailOptions->getSignature(),
 
 2476                    array_key_exists(
"mail_linebreak", $this->prefs) ? $this->prefs[
"mail_linebreak"] : $mailOptions->getLinebreak(),
 
 2477                    array_key_exists(
"mail_incoming_type", $this->prefs) ? $this->prefs[
"mail_incoming_type"] : $mailOptions->getIncomingType(),
 
 2478                    $mailOptions->getCronjobNotification()
 
sprintf('%.4f', $callTime)
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
foreach($mandatory_scripts as $file) $timestamp
An exception for terminatinating execution or to throw for unit testing.
const USER_FOLDER_ID
Class ilObjUserFolder.
const IL_FAIL_ON_CONFLICT
const IL_UPDATE_ON_CONFLICT
const IL_USER_MAPPING_LOGIN
const IL_IGNORE_ON_CONFLICT
static _getAuthModeName($a_auth_key)
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
@classDescription Date and time handling
static _getActiveServerList()
Get active server list.
Class UserMail this class handles user mails.
static _lookupNewAccountMail($a_lang)
static _lookupLogin($a_user_id)
lookup login
static getUserIdByLogin($a_login)
static _dropDesktopItem($a_usr_id, $a_item_id, $a_type)
drop an item from user's personal desktop
static _uploadPersonalPicture($tmp_file, $obj_id)
Create a personal picture image file from a temporary image file.
static _lookupExternalAccount($a_user_id)
lookup external account for login and authmethod
static _lookupId($a_user_str)
Lookup id by login.
static _addDesktopItem($a_usr_id, $a_item_id, $a_type, $a_par="")
add an item to user's personal desktop
static _checkExternalAuthAccount($a_auth, $a_account)
check whether external account and authentication method matches with a user
static _lookupTitle($a_id)
lookup object title
static _getAllReferences($a_id)
get all reference ids of object
static _lookupType($a_id, $a_reference=false)
lookup object type
Base class for sax-based expat parsing extended classes need to overwrite the method setHandlers and ...
static _lookupActivatedStyle($a_skin, $a_style)
lookup if a style is activated
special template class to simplify handling of ITX/PEAR
Class for TimeZone exceptions.
static _getInstance($a_tz='')
get instance by timezone
static _getInstance()
Get instance.
Class for user related exception handling in ILIAS.
getUserCount()
get count of User elements
isFieldRequired($fieldname)
getCollectedRoles()
get collected roles
handlerBeginTag($a_xml_parser, $a_name, $a_attribs)
handler for begin of element
$userCount
The count of user elements in the XML file.
$personalPicture
Cached personal picture of the actual user This is used because the ilObjUser object has no field for...
logWarning($aLogin, $aMessage)
Writes a warning log message to the protocol.
$parentRolesCache
Cached parent roles.
extractRolesEndTag($a_xml_parser, $a_name)
handler for end of element when in extract roles mode.
logFailure($aLogin, $aMessage)
Writes a failure log message to the protocol.
$disableSkin
Indicates if the skins are enabled.
setUserMappingMode($value)
write access to user mapping mode
logSuccess($aLogin, $userid, $action)
Writes a success log message to the protocol.
setHandlers($a_xml_parser)
set event handler should be overwritten by inherited class @access private
startParsing()
start the parser
assignToRoleWithParents($a_user_obj, $a_role_id)
Assigns a user to a role and to all parent roles.
$conflict_rule
Conflict handling rule.
updateMailPreferences($usr_id)
saveTempImage($image_data, $filename)
Saves binary image data to a temporary image file and returns the name of the image file on success.
importEndTag($a_xml_parser, $a_name)
handler for end of element when in import user mode.
verifyBeginTag($a_xml_parser, $a_name, $a_attribs)
handler for begin of element
isSuccess()
Returns true, if the import was successful.
$currActive
The active state of the current user.
importBeginTag($a_xml_parser, $a_name, $a_attribs)
handler for begin of element in user import mode
$updateLookAndSkin
boolean to determine if look and skin should be updated
$localRoleCache
Cached local roles.
verifyEndTag($a_xml_parser, $a_name)
handler for end of element when in verify mode.
getParentRoleIds($a_role_id)
Get array of parent role ids from cache.
setRoleAssignment($a_assign)
set import to local role assignemt
getProtocolAsHTML($a_log_title)
Returns the protocol as a HTML table.
__construct($a_xml_file='', $a_mode=IL_USER_IMPORT, $a_conflict_rule=IL_FAIL_ON_CONFLICT)
Constructor.
readAccountMailFromCache($lang_key)
$currPassword
The password of the current user.
$currPasswordType
The password type of the current user.
static $account_mail_cache
assignToRole($a_user_obj, $a_role_id)
Assigns a user to a role.
getUserMappingMode()
read access to user mapping mode
sendAccountMail()
send account mail
isSendMail()
read access to property send mail
getErrorLevel()
Returns the error level.
checkProfileIncomplete($user_obj)
Check if profile is incomplete Will set the usr_data field profile_incomplete if any required field i...
handlerCharacterData($a_xml_parser, $a_data)
handler for character data
buildTag($type, $name, $attr="")
generate a tag with given name and attributes
handlerEndTag($a_xml_parser, $a_name)
handler for end of element
getRoleObject($a_role_id)
Returns the parent object of the role folder object which contains the specified role.
getProtocol()
Returns the protocol.
readRequiredFields()
read required fields
getUserMapping()
returns a map user_id <=> login
$logins
This variable is used to collect each login that we encounter in the import data.
getCourseMembersObjectForRole($a_role_id)
Returns the parent object of the role folder object which contains the specified role.
extractRolesBeginTag($a_xml_parser, $a_name, $a_attribs)
handler for begin of element in extract roles mode
detachFromRole($a_user_obj, $a_role_id)
Detachs a user from a role.
$hideSkin
Indicates if the skins are hidden.
setSendMail($value)
write access to property send mail
$userStyles
User assigned styles.
setFolderId($a_folder_id)
assign users to this folder (normally the usr_folder) But if called from local admin => the ref_id of...
static isProfileIncomplete($a_user, $a_include_udf=true, $a_personal_data_only=true)
Check if all required personal data fields are set.
static isPrefExportable($key)
returns wether a key from db is exportable or not
static ilTempnam($a_temp_path=null)
Create a temporary file in an ILIAS writable directory.
static __extractId($ilias_id, $inst_id)
extract ref id from role title, e.g.
$GLOBALS['loaded']
Global hash that tracks already loaded includes.