ILIAS  release_5-1 Revision 5.0.0-5477-g43f3e3fab5f
ilUserImportParser Class Reference

User Import Parser. More...

+ Inheritance diagram for ilUserImportParser:
+ Collaboration diagram for ilUserImportParser:

Public Member Functions

 ilUserImportParser ($a_xml_file='', $a_mode=IL_USER_IMPORT, $a_conflict_rule=IL_FAIL_ON_CONFLICT)
 Constructor. More...
 
 setFolderId ($a_folder_id)
 assign users to this folder (normally the usr_folder) But if called from local admin => the ref_id of the category @access public More...
 
 getFolderId ()
 
 setHandlers ($a_xml_parser)
 set event handler should be overwritten by inherited class @access private More...
 
 startParsing ()
 start the parser More...
 
 setRoleAssignment ($a_assign)
 set import to local role assignemt More...
 
 buildTag ($type, $name, $attr="")
 generate a tag with given name and attributes More...
 
 handlerBeginTag ($a_xml_parser, $a_name, $a_attribs)
 handler for begin of element More...
 
 extractRolesBeginTag ($a_xml_parser, $a_name, $a_attribs)
 handler for begin of element in extract roles mode More...
 
 importBeginTag ($a_xml_parser, $a_name, $a_attribs)
 handler for begin of element in user import mode More...
 
 verifyBeginTag ($a_xml_parser, $a_name, $a_attribs)
 handler for begin of element More...
 
 handlerEndTag ($a_xml_parser, $a_name)
 handler for end of element More...
 
 extractRolesEndTag ($a_xml_parser, $a_name)
 handler for end of element when in extract roles mode. More...
 
 getRoleObject ($a_role_id)
 Returns the parent object of the role folder object which contains the specified role. More...
 
 getCourseMembersObjectForRole ($a_role_id)
 Returns the parent object of the role folder object which contains the specified role. More...
 
 assignToRole ($a_user_obj, $a_role_id)
 Assigns a user to a role. More...
 
 getParentRoleIds ($a_role_id)
 Get array of parent role ids from cache. More...
 
 assignToRoleWithParents ($a_user_obj, $a_role_id)
 Assigns a user to a role and to all parent roles. More...
 
 detachFromRole ($a_user_obj, $a_role_id)
 Detachs a user from a role. More...
 
 importEndTag ($a_xml_parser, $a_name)
 handler for end of element when in import user mode. More...
 
 saveTempImage ($image_data, $filename)
 Saves binary image data to a temporary image file and returns the name of the image file on success. More...
 
 verifyEndTag ($a_xml_parser, $a_name)
 handler for end of element when in verify mode. More...
 
 handlerCharacterData ($a_xml_parser, $a_data)
 handler for character data More...
 
 getCollectedRoles ()
 get collected roles More...
 
 getUserCount ()
 get count of User elements More...
 
 logWarning ($aLogin, $aMessage)
 Writes a warning log message to the protocol. More...
 
 logFailure ($aLogin, $aMessage)
 Writes a failure log message to the protocol. More...
 
 logSuccess ($aLogin, $userid, $action)
 Writes a success log message to the protocol. More...
 
 getProtocol ()
 Returns the protocol. More...
 
 getProtocolAsHTML ($a_log_title)
 Returns the protocol as a HTML table. More...
 
 isSuccess ()
 Returns true, if the import was successful. More...
 
 getErrorLevel ()
 Returns the error level. More...
 
 getUserMapping ()
 returns a map user_id <=> login More...
 
 sendAccountMail ()
 send account mail More...
 
 setSendMail ($value)
 write access to property send mail More...
 
 isSendMail ()
 read access to property send mail More...
 
 setUserMappingMode ($value)
 write access to user mapping mode More...
 
 getUserMappingMode ()
 read access to user mapping mode More...
 
- Public Member Functions inherited from ilSaxParser
 ilSaxParser ($a_xml_file='', $throwException=false)
 Constructor setup ILIAS global object @access public. More...
 
 setXMLContent ($a_xml_content)
 
 getXMLContent ()
 
 getInputType ()
 
 startParsing ()
 stores xml data in array More...
 
 createParser ()
 create parser More...
 
 setOptions ($a_xml_parser)
 set parser options More...
 
 setHandlers ($a_xml_parser)
 set event handler should be overwritten by inherited class @access private More...
 
 openXMLFile ()
 open xml file More...
 
 parse ($a_xml_parser, $a_fp=null)
 parse xml file More...
 
 freeParser ($a_xml_parser)
 free xml parser handle More...
 
 setThrowException ($throwException)
 set error handling More...
 
- Public Member Functions inherited from PEAR
 PEAR ($error_class=null)
 Constructor. More...
 
 _PEAR ()
 Destructor (the emulated type of...). More...
 
getStaticProperty ($class, $var)
 If you have a class that's mostly/entirely static, and you need static properties, you can use this method to simulate them. More...
 
 registerShutdownFunc ($func, $args=array())
 Use this function to register a shutdown method for static classes. More...
 
 isError ($data, $code=null)
 Tell whether a value is a PEAR error. More...
 
 setErrorHandling ($mode=null, $options=null)
 Sets how errors generated by this object should be handled. More...
 
 expectError ($code=' *')
 This method is used to tell which errors you expect to get. More...
 
 popExpect ()
 This method pops one element off the expected error codes stack. More...
 
 _checkDelExpect ($error_code)
 This method checks unsets an error code if available. More...
 
 delExpect ($error_code)
 This method deletes all occurences of the specified element from the expected error codes stack. More...
 
raiseError ($message=null, $code=null, $mode=null, $options=null, $userinfo=null, $error_class=null, $skipmsg=false)
 This method is a wrapper that returns an instance of the configured error class with this object's default error handling applied. More...
 
throwError ($message=null, $code=null, $userinfo=null)
 Simpler form of raiseError with fewer options. More...
 
 staticPushErrorHandling ($mode, $options=null)
 
 staticPopErrorHandling ()
 
 pushErrorHandling ($mode, $options=null)
 Push a new error handler on top of the error handler options stack. More...
 
 popErrorHandling ()
 Pop the last error handler used. More...
 
 loadExtension ($ext)
 OS independant PHP extension load. More...
 

Data Fields

 $approve_date_set = false
 
 $time_limit_set = false
 
 $time_limit_owner_set = false
 
 $updateLookAndSkin = false
 boolean to determine if look and skin should be updated More...
 
 $folder_id
 
 $roles
 
 $action
 
 $protocol
 
 $logins
 This variable is used to collect each login that we encounter in the import data. More...
 
 $conflict_rule
 Conflict handling rule. More...
 
 $send_mail
 
 $error_level
 
 $currPasswordType
 The password type of the current user. More...
 
 $currPassword
 The password of the current user. More...
 
 $currActive
 The active state of the current user. More...
 
 $userCount
 The count of user elements in the XML file. More...
 
 $user_mapping
 
 $mapping_mode
 
 $localRoleCache
 Cached local roles. More...
 
 $personalPicture
 Cached personal picture of the actual user This is used because the ilObjUser object has no field for the personal picture. More...
 
 $parentRolesCache
 Cached parent roles. More...
 
 $skin
 ILIAS skin. More...
 
 $style
 ILIAS style. More...
 
 $userStyles
 User assigned styles. More...
 
 $hideSkin
 Indicates if the skins are hidden. More...
 
 $disableSkin
 Indicates if the skins are enabled. More...
 
 $user_id
 
- Data Fields inherited from ilSaxParser
 $input_type = null
 
 $xml_content = ''
 
 $ilias
 
 $lng
 
 $xml_file
 
 $throwException = false
 
- Data Fields inherited from PEAR
 $_debug = false
 
 $_default_error_mode = null
 
 $_default_error_options = null
 
 $_default_error_handler = ''
 
 $_error_class = 'PEAR_Error'
 
 $_expected_errors = array()
 

Protected Member Functions

 isFieldRequired ($fieldname)
 
- Protected Member Functions inherited from ilSaxParser
 handleError ($message, $code)
 use given error handler to handle error message or internal ilias error message handle More...
 

Protected Attributes

 $currPasswordSalt
 

Private Member Functions

 readAccountMailFromCache ($lang_key)
 
 readRequiredFields ()
 read required fields More...
 
 checkProfileIncomplete ($user_obj)
 Check if profile is incomplete Will set the usr_data field profile_incomplete if any required field is missing. More...
 
 verifyPref ($key, $value)
 
 updateMailPreferences ($usr_id)
 

Private Attributes

 $userObj
 
 $current_messenger_type
 

Static Private Attributes

static $account_mail_cache = array()
 

Detailed Description

User Import Parser.

Author
Alex Killing alex..nosp@m.kill.nosp@m.ing@g.nosp@m.mx.d.nosp@m.e

Definition at line 49 of file class.ilUserImportParser.php.

Member Function Documentation

◆ assignToRole()

ilUserImportParser::assignToRole (   $a_user_obj,
  $a_role_id 
)

Assigns a user to a role.

Definition at line 826 of file class.ilUserImportParser.php.

827 {
828 require_once "./Services/AccessControl/classes/class.ilObjRole.php";
829 include_once('./Services/Object/classes/class.ilObject.php');
830 #require_once "Modules/Course/classes/class.ilObjCourse.php";
831 #require_once "Modules/Course/classes/class.ilCourseParticipants.php";
832
833 global $rbacreview, $rbacadmin, $tree;
834
835 // Do nothing, if the user is already assigned to the role.
836 // Specifically, we do not want to put a course object or
837 // group object on the personal desktop again, if a user
838 // has removed it from the personal desktop.
839 if ($rbacreview->isAssigned($a_user_obj->getId(), $a_role_id))
840 {
841 return;
842 }
843
844 // If it is a course role, use the ilCourseMember object to assign
845 // the user to the role
846
847 $rbacadmin->assignUser($a_role_id, $a_user_obj->getId(), true);
848 $obj_id = $rbacreview->getObjectOfRole($a_role_id);
849 switch($type = ilObject::_lookupType($obj_id))
850 {
851 case 'grp':
852 case 'crs':
853 $ref_ids = ilObject::_getAllReferences($obj_id);
854 $ref_id = current((array) $ref_ids);
855 if($ref_id)
856 {
857 ilObjUser::_addDesktopItem($a_user_obj->getId(),$ref_id,$type);
858 }
859 break;
860 default:
861 break;
862 }
863 }
static _addDesktopItem($a_usr_id, $a_item_id, $a_type, $a_par="")
add an item to user's personal desktop
static _getAllReferences($a_id)
get all reference ids of object
static _lookupType($a_id, $a_reference=false)
lookup object type
$ref_id
Definition: sahs_server.php:39

References $ref_id, ilObjUser\_addDesktopItem(), ilObject\_getAllReferences(), and ilObject\_lookupType().

Referenced by assignToRoleWithParents(), and importEndTag().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ assignToRoleWithParents()

ilUserImportParser::assignToRoleWithParents (   $a_user_obj,
  $a_role_id 
)

Assigns a user to a role and to all parent roles.

Definition at line 922 of file class.ilUserImportParser.php.

923 {
924 $this->assignToRole($a_user_obj, $a_role_id);
925
926 $parent_role_ids = $this->getParentRoleIds($a_role_id);
927 foreach ($parent_role_ids as $parent_role_id)
928 {
929 $this->assignToRole($a_user_obj, $parent_role_id);
930 }
931 }
getParentRoleIds($a_role_id)
Get array of parent role ids from cache.
assignToRole($a_user_obj, $a_role_id)
Assigns a user to a role.

References assignToRole(), and getParentRoleIds().

Referenced by importEndTag().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ buildTag()

ilUserImportParser::buildTag (   $type,
  $name,
  $attr = "" 
)

generate a tag with given name and attributes

Parameters
string"start" | "end" for starting or ending tag
stringelement/tag name
arrayarray of attributes

Definition at line 406 of file class.ilUserImportParser.php.

407 {
408 $tag = "<";
409
410 if ($type == "end")
411 $tag.= "/";
412
413 $tag.= $name;
414
415 if (is_array($attr))
416 {
417 while (list($k,$v) = each($attr))
418 $tag.= " ".$k."=\"$v\"";
419 }
420
421 $tag.= ">";
422
423 return $tag;
424 }

◆ checkProfileIncomplete()

ilUserImportParser::checkProfileIncomplete (   $user_obj)
private

Check if profile is incomplete Will set the usr_data field profile_incomplete if any required field is missing.

@access private

Definition at line 2380 of file class.ilUserImportParser.php.

2381 {
2382 include_once "Services/User/classes/class.ilUserProfile.php";
2383 return ilUserProfile::isProfileIncomplete($user_obj);
2384 }
static isProfileIncomplete($a_user, $a_include_udf=true, $a_personal_data_only=true)
Check if all required personal data fields are set.

References ilUserProfile\isProfileIncomplete().

Referenced by importEndTag().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ detachFromRole()

ilUserImportParser::detachFromRole (   $a_user_obj,
  $a_role_id 
)

Detachs a user from a role.

Definition at line 935 of file class.ilUserImportParser.php.

936 {
937 global $rbacreview, $rbacadmin, $tree;
938
939 $rbacadmin->deassignUser($a_role_id, $a_user_obj->getId());
940
941 if (substr(ilObject::_lookupTitle($a_role_id),0,6) == 'il_crs' or
942 substr(ilObject::_lookupTitle($a_role_id),0,6) == 'il_grp')
943 {
944 $obj = $rbacreview->getObjectOfRole($a_role_id);
945 $ref = ilObject::_getAllReferences($obj);
946 $ref_id = end($ref);
947 ilObjUser::_dropDesktopItem($a_user_obj->getId(), $ref_id, ilObject::_lookupType($obj));
948 }
949}
static _dropDesktopItem($a_usr_id, $a_item_id, $a_type)
drop an item from user's personal desktop
static _lookupTitle($a_id)
lookup object title

References $ref_id, ilObjUser\_dropDesktopItem(), ilObject\_getAllReferences(), ilObject\_lookupTitle(), and ilObject\_lookupType().

Referenced by importEndTag().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ extractRolesBeginTag()

ilUserImportParser::extractRolesBeginTag (   $a_xml_parser,
  $a_name,
  $a_attribs 
)

handler for begin of element in extract roles mode

Definition at line 450 of file class.ilUserImportParser.php.

451 {
452 switch($a_name)
453 {
454 case "Role":
455 // detect numeric, ilias id (then extract role id) or alphanumeric
456 $this->current_role_id = $a_attribs["Id"];
457 if ($internal_id = ilUtil::__extractId($this->current_role_id, IL_INST_ID))
458 {
459 $this->current_role_id = $internal_id;
460 }
461 $this->current_role_type = $a_attribs["Type"];
462
463 break;
464 }
465 }
static __extractId($ilias_id, $inst_id)
extract ref id from role title, e.g.

References ilUtil\__extractId().

Referenced by handlerBeginTag().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ extractRolesEndTag()

ilUserImportParser::extractRolesEndTag (   $a_xml_parser,
  $a_name 
)

handler for end of element when in extract roles mode.

Definition at line 768 of file class.ilUserImportParser.php.

769 {
770 switch($a_name)
771 {
772 case "Role":
773 $this->roles[$this->current_role_id]["name"] = $this->cdata;
774 $this->roles[$this->current_role_id]["type"] =
775 $this->current_role_type;
776 break;
777 }
778 }

Referenced by handlerEndTag().

+ Here is the caller graph for this function:

◆ getCollectedRoles()

ilUserImportParser::getCollectedRoles ( )

get collected roles

Definition at line 2114 of file class.ilUserImportParser.php.

2115 {
2116 return $this->roles;
2117 }

References $roles.

◆ getCourseMembersObjectForRole()

ilUserImportParser::getCourseMembersObjectForRole (   $a_role_id)

Returns the parent object of the role folder object which contains the specified role.

Definition at line 801 of file class.ilUserImportParser.php.

802 {
803 global $rbacreview, $rbacadmin, $tree;
804
805 if (array_key_exists($a_role_id.'_courseMembersObject', $this->localRoleCache))
806 {
807 return $this->localRoleCache[$a_role_id.'_courseMembersObject'];
808 }
809 else
810 {
811 require_once("Modules/Course/classes/class.ilObjCourse.php");
812 require_once("Modules/Course/classes/class.ilCourseParticipants.php");
813 $course_refs = $rbacreview->getFoldersAssignedToRole($a_role_id, true);
814 $course_ref = $course_refs[0];
815 $course_obj = new ilObjCourse($course_ref, true);
816 $crsmembers_obj = ilCourseParticipants::_getInstanceByObjId($course_obj->getId());
817 $this->localRoleCache[$a_role_id.'_courseMembersObject'] = $crsmembers_obj;
818 return $crsmembers_obj;
819 }
820
821 }
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
Class ilObjCourse.

References ilCourseParticipants\_getInstanceByObjId().

+ Here is the call graph for this function:

◆ getErrorLevel()

ilUserImportParser::getErrorLevel ( )

Returns the error level.

Returns
IL_IMPORT_SUCCESS | IL_IMPORT_WARNING | IL_IMPORT_FAILURE

Definition at line 2236 of file class.ilUserImportParser.php.

2237 {
2238 return $this->error_level;
2239 }

References $error_level.

◆ getFolderId()

ilUserImportParser::getFolderId ( )

Definition at line 364 of file class.ilUserImportParser.php.

References $folder_id.

Referenced by importEndTag().

+ Here is the caller graph for this function:

◆ getParentRoleIds()

ilUserImportParser::getParentRoleIds (   $a_role_id)

Get array of parent role ids from cache.

If necessary, create a new cache entry.

Definition at line 868 of file class.ilUserImportParser.php.

869 {
870 global $rbacreview;
871
872 if (! array_key_exists($a_role_id, $this->parentRolesCache))
873 {
874 $parent_role_ids = array();
875
876 $role_obj = $this->getRoleObject($a_role_id);
877 $short_role_title = substr($role_obj->getTitle(),0,12);
878 $folders = $rbacreview->getFoldersAssignedToRole($a_role_id, true);
879 if (count($folders) > 0)
880 {
881 $all_parent_role_ids = $rbacreview->getParentRoleIds($folders[0]);
882 foreach ($all_parent_role_ids as $parent_role_id => $parent_role_data)
883 {
884 if ($parent_role_id != $a_role_id)
885 {
886 switch (substr($parent_role_data['title'],0,12))
887 {
888 case 'il_crs_admin' :
889 case 'il_grp_admin' :
890 if ($short_role_title == 'il_crs_admin' || $short_role_title == 'il_grp_admin')
891 {
892 $parent_role_ids[] = $parent_role_id;
893 }
894 break;
895 case 'il_crs_tutor' :
896 case 'il_grp_tutor' :
897 if ($short_role_title == 'il_crs_tutor' || $short_role_title == 'il_grp_tutor')
898 {
899 $parent_role_ids[] = $parent_role_id;
900 }
901 break;
902 case 'il_crs_membe' :
903 case 'il_grp_membe' :
904 if ($short_role_title == 'il_crs_membe' || $short_role_title == 'il_grp_membe')
905 {
906 $parent_role_ids[] = $parent_role_id;
907 }
908 break;
909 default :
910 break;
911 }
912 }
913 }
914 }
915 $this->parentRolesCache[$a_role_id] = $parent_role_ids;
916 }
917 return $this->parentRolesCache[$a_role_id];
918 }
getRoleObject($a_role_id)
Returns the parent object of the role folder object which contains the specified role.

References getRoleObject().

Referenced by assignToRoleWithParents().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ getProtocol()

ilUserImportParser::getProtocol ( )

Returns the protocol.

The protocol is an associative array.
Keys are login names.
Values are non-associative arrays. Each array element contains an error
message.

Definition at line 2187 of file class.ilUserImportParser.php.

2188 {
2189 return $this->protocol;
2190 }

References $protocol.

Referenced by getProtocolAsHTML().

+ Here is the caller graph for this function:

◆ getProtocolAsHTML()

ilUserImportParser::getProtocolAsHTML (   $a_log_title)

Returns the protocol as a HTML table.

Definition at line 2194 of file class.ilUserImportParser.php.

2195 {
2196 global $lng;
2197
2198 $block = new ilTemplate("tpl.usr_import_log_block.html", true, true, "Services/User");
2199 $block->setVariable("TXT_LOG_TITLE", $a_log_title);
2200 $block->setVariable("TXT_MESSAGE_ID", $lng->txt("login"));
2201 $block->setVariable("TXT_MESSAGE_TEXT", $lng->txt("message"));
2202 foreach ($this->getProtocol() as $login => $messages)
2203 {
2204 $block->setCurrentBlock("log_row");
2205 $reason = "";
2206 foreach ($messages as $message)
2207 {
2208 if ($reason == "")
2209 {
2210 $reason = $message;
2211 }
2212 else
2213 {
2214 $reason = $reason."<br>".$message;
2215 }
2216 }
2217 $block->setVariable("MESSAGE_ID", $login);
2218 $block->setVariable("MESSAGE_TEXT", $reason);
2219 $block->parseCurrentBlock();
2220 }
2221 return $block->get();
2222 }
special template class to simplify handling of ITX/PEAR
getProtocol()
Returns the protocol.
$messages
Definition: en-x-test.php:7

References ilSaxParser\$lng, $messages, and getProtocol().

+ Here is the call graph for this function:

◆ getRoleObject()

ilUserImportParser::getRoleObject (   $a_role_id)

Returns the parent object of the role folder object which contains the specified role.

Definition at line 783 of file class.ilUserImportParser.php.

784 {
785 if (array_key_exists($a_role_id, $this->localRoleCache))
786 {
787 return $this->localRoleCache[$a_role_id];
788 }
789 else
790 {
791 $role_obj = new ilObjRole($a_role_id, false);
792 $role_obj->read();
793 $this->localRoleCache[$a_role_id] = $role_obj;
794 return $role_obj;
795 }
796
797 }
Class ilObjRole.

Referenced by getParentRoleIds().

+ Here is the caller graph for this function:

◆ getUserCount()

ilUserImportParser::getUserCount ( )

get count of User elements

Definition at line 2121 of file class.ilUserImportParser.php.

2122 {
2123 return $this->userCount;
2124 }
$userCount
The count of user elements in the XML file.

References $userCount.

◆ getUserMapping()

ilUserImportParser::getUserMapping ( )

returns a map user_id <=> login

Returns
assoc array, with user_id as key and login as value

Definition at line 2246 of file class.ilUserImportParser.php.

References $user_mapping.

◆ getUserMappingMode()

ilUserImportParser::getUserMappingMode ( )

read access to user mapping mode

Returns
int one of IL_USER_MAPPING_ID or IL_USER_MAPPING_LOGIN

Definition at line 2342 of file class.ilUserImportParser.php.

References $mapping_mode.

Referenced by importBeginTag(), and verifyBeginTag().

+ Here is the caller graph for this function:

◆ handlerBeginTag()

ilUserImportParser::handlerBeginTag (   $a_xml_parser,
  $a_name,
  $a_attribs 
)

handler for begin of element

Definition at line 429 of file class.ilUserImportParser.php.

430 {
431 switch ($this->mode)
432 {
433 case IL_EXTRACT_ROLES :
434 $this->extractRolesBeginTag($a_xml_parser, $a_name, $a_attribs);
435 break;
436 case IL_USER_IMPORT :
437 $this->importBeginTag($a_xml_parser, $a_name, $a_attribs);
438 break;
439 case IL_VERIFY :
440 $this->verifyBeginTag($a_xml_parser, $a_name, $a_attribs);
441 break;
442 }
443
444 $this->cdata = "";
445 }
const IL_EXTRACT_ROLES
const IL_USER_IMPORT
const IL_VERIFY
verifyBeginTag($a_xml_parser, $a_name, $a_attribs)
handler for begin of element
importBeginTag($a_xml_parser, $a_name, $a_attribs)
handler for begin of element in user import mode
extractRolesBeginTag($a_xml_parser, $a_name, $a_attribs)
handler for begin of element in extract roles mode

References extractRolesBeginTag(), IL_EXTRACT_ROLES, IL_USER_IMPORT, IL_VERIFY, importBeginTag(), and verifyBeginTag().

+ Here is the call graph for this function:

◆ handlerCharacterData()

ilUserImportParser::handlerCharacterData (   $a_xml_parser,
  $a_data 
)

handler for character data

Definition at line 2098 of file class.ilUserImportParser.php.

2099 {
2100 // DELETE WHITESPACES AND NEWLINES OF CHARACTER DATA
2101 // TODO: Mit Alex klären, ob das noch benötigt wird $a_data = preg_replace("/\n/","",$a_data);
2102 // TODO: Mit Alex klären, ob das noch benötigt wird $a_data = preg_replace("/\t+/","",$a_data);
2103 if($a_data != "\n") $a_data = preg_replace("/\t+/"," ",$a_data);
2104
2105 if(strlen($a_data) > 0)
2106 {
2107 $this->cdata .= $a_data;
2108 }
2109 }

◆ handlerEndTag()

ilUserImportParser::handlerEndTag (   $a_xml_parser,
  $a_name 
)

handler for end of element

Definition at line 749 of file class.ilUserImportParser.php.

750 {
751 switch ($this->mode)
752 {
753 case IL_EXTRACT_ROLES :
754 $this->extractRolesEndTag($a_xml_parser, $a_name);
755 break;
756 case IL_USER_IMPORT :
757 $this->importEndTag($a_xml_parser, $a_name);
758 break;
759 case IL_VERIFY :
760 $this->verifyEndTag($a_xml_parser, $a_name);
761 break;
762 }
763 }
extractRolesEndTag($a_xml_parser, $a_name)
handler for end of element when in extract roles mode.
importEndTag($a_xml_parser, $a_name)
handler for end of element when in import user mode.
verifyEndTag($a_xml_parser, $a_name)
handler for end of element when in verify mode.

References extractRolesEndTag(), IL_EXTRACT_ROLES, IL_USER_IMPORT, IL_VERIFY, importEndTag(), and verifyEndTag().

+ Here is the call graph for this function:

◆ ilUserImportParser()

ilUserImportParser::ilUserImportParser (   $a_xml_file = '',
  $a_mode = IL_USER_IMPORT,
  $a_conflict_rule = IL_FAIL_ON_CONFLICT 
)

Constructor.

Parameters
string$a_xml_filexml file
int$a_modeIL_EXTRACT_ROLES | IL_USER_IMPORT | IL_VERIFY
int$a_conflict_rueIL_FAIL_ON_CONFLICT | IL_UPDATE_ON_CONFLICT | IL_IGNORE_ON_CONFLICT

@access public

Definition at line 286 of file class.ilUserImportParser.php.

287 {
288 global $lng, $tree, $ilias, $ilUser, $styleDefinition;
289
290 $this->roles = array();
291 $this->mode = $a_mode;
292 $this->conflict_rule = $a_conflict_rule;
293 $this->error_level = IL_IMPORT_SUCCESS;
294 $this->protocol = array();
295 $this->logins = array();
296 $this->userCount = 0;
297 $this->localRoleCache = array();
298 $this->parentRolesCache = array();
299 $this->send_mail = false;
300 $this->mapping_mode = IL_USER_MAPPING_LOGIN;
301
302 // get all active style instead of only assigned ones -> cannot transfer all to another otherwise
303 $this->userStyles = array();
304 include_once("./Services/Style/classes/class.ilObjStyleSettings.php");
305 include_once './Services/Style/classes/class.ilStyleDefinition.php';
307
308 if (is_array($templates))
309 {
310
311 foreach($templates as $template)
312 {
313 // get styles information of template
314 $styleDef =& new ilStyleDefinition($template["id"]);
315 $styleDef->startParsing();
316 $styles = $styleDef->getStyles();
317
318 foreach($styles as $style)
319 {
320 if (!ilObjStyleSettings::_lookupActivatedStyle($template["id"],$style["id"]))
321 {
322 continue;
323 }
324 $this->userStyles [] = $template["id"].":".$style["id"];
325 }
326 }
327 }
328
329 $settings = $ilias->getAllSettings();
330 if ($settings["usr_settings_hide_skin_style"] == 1)
331 {
332 $this->hideSkin = TRUE;
333 }
334 else
335 {
336 $this->hideSkin = FALSE;
337 }
338 if ($settings["usr_settings_disable_skin_style"] == 1)
339 {
340 $this->disableSkin = TRUE;
341 }
342 else
343 {
344 $this->disableSkin = FALSE;
345 }
346
347 include_once("Services/Mail/classes/class.ilAccountMail.php");
348 $this->acc_mail = new ilAccountMail();
349 $this->acc_mail->useLangVariablesAsFallback(true);
350
351 parent::ilSaxParser($a_xml_file);
352 }
const IL_IMPORT_SUCCESS
const IL_USER_MAPPING_LOGIN
Class ilAccountMail.
_lookupActivatedStyle($a_skin, $a_style)
lookup if a style is activated
parses the template.xml that defines all styles of the current template
global $ilUser
Definition: imgupload.php:15

References ilSaxParser\$ilias, $ilUser, ilSaxParser\$lng, $style, ilStyleDefinition\_getAllTemplates(), ilObjStyleSettings\_lookupActivatedStyle(), IL_IMPORT_SUCCESS, and IL_USER_MAPPING_LOGIN.

+ Here is the call graph for this function:

◆ importBeginTag()

ilUserImportParser::importBeginTag (   $a_xml_parser,
  $a_name,
  $a_attribs 
)

handler for begin of element in user import mode

Definition at line 469 of file class.ilUserImportParser.php.

470 {
471 global $ilias,$lng;
472
473 switch($a_name)
474 {
475 case "Role":
476 $this->current_role_id = $a_attribs["Id"];
477 if ($internal_id = ilUtil::__extractId($this->current_role_id, IL_INST_ID))
478 {
479 $this->current_role_id = $internal_id;
480 }
481 $this->current_role_type = $a_attribs["Type"];
482 $this->current_role_action = (is_null($a_attribs["Action"])) ? "Assign" : $a_attribs["Action"];
483 break;
484
485 case "PersonalPicture":
486 $this->personalPicture = array(
487 "encoding" => $a_attribs["encoding"],
488 "imagetype" => $a_attribs["imagetype"],
489 "content" => ""
490 );
491 break;
492
493 case "Look":
494 $this->skin = $a_attribs["Skin"];
495 $this->style = $a_attribs["Style"];
496 break;
497
498 case "User":
499 $this->acc_mail->reset();
500 $this->prefs = array();
501 $this->currentPrefKey = null;
502 $this->auth_mode_set = false;
503 $this->approve_date_set = false;
504 $this->time_limit_set = false;
505 $this->time_limit_owner_set = false;
506 $this->updateLookAndSkin = false;
507 $this->skin = "";
508 $this->style = "";
509 $this->personalPicture = null;
510 $this->userCount++;
511 $this->userObj = new ilObjUser();
512
513 // user defined fields
514 $this->udf_data = array();
515
516 // if we have an object id, store it
517 $this->user_id = -1;
518 if (!is_null($a_attribs["Id"]) && $this->getUserMappingMode() == IL_USER_MAPPING_ID)
519 {
520 if (is_numeric($a_attribs["Id"]))
521 {
522 $this->user_id = $a_attribs["Id"];
523 }
524 elseif ($id = ilUtil::__extractId ($a_attribs["Id"], IL_INST_ID))
525 {
526 $this->user_id = $id;
527 }
528 }
529
530 $this->userObj->setPref("skin",
531 $ilias->ini->readVariable("layout","skin"));
532 $this->userObj->setPref("style",
533 $ilias->ini->readVariable("layout","style"));
534
535 $this->userObj->setLanguage($a_attribs["Language"]);
536 $this->userObj->setImportId($a_attribs["Id"]);
537 $this->action = (is_null($a_attribs["Action"])) ? "Insert" : $a_attribs["Action"];
538 $this->currPassword = null;
539 $this->currPasswordType = null;
540 $this->currPasswordSalt = null;
541 $this->currActive = null;
542 $this->multi_values = array();
543 break;
544
545 case 'Password':
546 $this->currPasswordType = $a_attribs['Type'];
547 $this->currPasswordSalt = $a_attribs['Salt'];
548 break;
549 case "AuthMode":
550 if (array_key_exists("type", $a_attribs))
551 {
552 switch ($a_attribs["type"])
553 {
554 case "default":
555 case "local":
556 case "ldap":
557
558 if(strcmp('ldap', $a_attribs['type']) === 0)
559 {
560 // no server id provided => use default server
561 include_once './Services/LDAP/classes/class.ilLDAPServer.php';
563 if(count($list) == 1)
564 {
565 $this->auth_mode_set = true;
566 $ldap_id = current($list);
567 $this->userObj->setAuthMode('ldap_'.$ldap_id);
568 }
569 }
570 break;
571
572 case "radius":
573 case "shibboleth":
574 case "script":
575 case "cas":
576 case "soap":
577 case "openid":
578 // begin-patch auth_plugin
579 default:
580 $this->auth_mode_set = true;
581 $this->userObj->setAuthMode($a_attribs["type"]);
582 break;
583 /*
584 $this->logFailure($this->userObj->getLogin(),
585 sprintf($lng->txt("usrimport_xml_element_inapplicable"),"AuthMode",$a_attribs["type"]));
586 break;
587 *
588 */
589 }
590 }
591 else
592 {
593 $this->logFailure($this->userObj->getLogin(),
594 sprintf($lng->txt("usrimport_xml_element_inapplicable"),"AuthMode",$a_attribs["type"]));
595 }
596 break;
597
598 case 'UserDefinedField':
599 $this->tmp_udf_id = $a_attribs['Id'];
600 $this->tmp_udf_name = $a_attribs['Name'];
601 break;
602
603 case 'AccountInfo':
604 $this->current_messenger_type = strtolower($a_attribs["Type"]);
605 break;
606 case 'GMapInfo':
607 $this->userObj->setLatitude($a_attribs["latitude"]);
608 $this->userObj->setLongitude($a_attribs["longitude"]);
609 $this->userObj->setLocationZoom($a_attribs["zoom"]);
610 break;
611 case 'Pref':
612 $this->currentPrefKey = $a_attribs["key"];
613 break;
614 }
615 }
const IL_USER_MAPPING_ID
static _getActiveServerList()
Get active server list.
logFailure($aLogin, $aMessage)
Writes a failure log message to the protocol.
getUserMappingMode()
read access to user mapping mode

References ilSaxParser\$ilias, ilSaxParser\$lng, ilUtil\__extractId(), ilLDAPServer\_getActiveServerList(), getUserMappingMode(), IL_USER_MAPPING_ID, and logFailure().

Referenced by handlerBeginTag().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ importEndTag()

ilUserImportParser::importEndTag (   $a_xml_parser,
  $a_name 
)

handler for end of element when in import user mode.

Definition at line 954 of file class.ilUserImportParser.php.

955 {
956 global $ilias, $rbacadmin, $rbacreview, $ilUser, $lng, $ilSetting;
957
958 switch($a_name)
959 {
960 case "Role":
961 $this->roles[$this->current_role_id]["name"] = $this->cdata;
962 $this->roles[$this->current_role_id]["type"] = $this->current_role_type;
963 $this->roles[$this->current_role_id]["action"] = $this->current_role_action;
964 break;
965
966 case "PersonalPicture":
967 switch ($this->personalPicture["encoding"])
968 {
969 case "Base64":
970 $this->personalPicture["content"] = base64_decode($this->cdata);
971 break;
972 case "UUEncode":
973 $this->personalPicture["content"] = convert_uudecode($this->cdata);
974 break;
975 }
976 break;
977
978 case "User":
979 $this->userObj->setFullname();
980 // Fetch the user_id from the database, if we didn't have it in xml file
981 // fetch as well, if we are trying to insert -> recognize duplicates!
982 if ($this->user_id == -1 || $this->action=="Insert")
983 $user_id = ilObjUser::getUserIdByLogin($this->userObj->getLogin());
984 else
986
987 //echo $user_id.":".$this->userObj->getLogin();
988
989 // Handle conflicts
990 switch ($this->conflict_rule)
991 {
993 // do not change action
994 break;
996 switch ($this->action)
997 {
998 case "Insert" :
999 if ($user_id)
1000 {
1001 $this->logWarning($this->userObj->getLogin(),sprintf($lng->txt("usrimport_action_replaced"),"Insert","Update"));
1002 $this->action = "Update";
1003 }
1004 break;
1005 case "Update" :
1006 if (! $user_id)
1007 {
1008 $this->logWarning($this->userObj->getLogin(),sprintf($lng->txt("usrimport_action_replaced"),"Update","Insert"));
1009 $this->action = "Insert";
1010 }
1011 break;
1012 case "Delete" :
1013 if (! $user_id)
1014 {
1015 $this->logWarning($this->userObj->getLogin(),sprintf($lng->txt("usrimport_action_ignored"),"Delete"));
1016 $this->action = "Ignore";
1017 }
1018 break;
1019 }
1020 break;
1022 switch ($this->action)
1023 {
1024 case "Insert" :
1025 if ($user_id)
1026 {
1027 $this->logWarning($this->userObj->getLogin(),sprintf($lng->txt("usrimport_action_ignored"),"Insert"));
1028 $this->action = "Ignore";
1029 }
1030 break;
1031 case "Update" :
1032 if (! $user_id)
1033 {
1034 $this->logWarning($this->userObj->getLogin(),sprintf($lng->txt("usrimport_action_ignored"),"Update"));
1035 $this->action = "Ignore";
1036 }
1037 break;
1038 case "Delete" :
1039 if (! $user_id)
1040 {
1041 $this->logWarning($this->userObj->getLogin(),sprintf($lng->txt("usrimport_action_ignored"),"Delete"));
1042 $this->action = "Ignore";
1043 }
1044 break;
1045 }
1046 break;
1047 }
1048
1049 // check external account conflict (if external account is already used)
1050 // note: we cannot apply conflict rules in the same manner as to logins here
1051 // so we ignore records with already existing external accounts.
1052 //echo $this->userObj->getAuthMode().'h';
1053 $am = ($this->userObj->getAuthMode() == "default" || $this->userObj->getAuthMode() == "")
1054 ? ilAuthUtils::_getAuthModeName($ilSetting->get('auth_mode'))
1055 : $this->userObj->getAuthMode();
1056 $loginForExternalAccount = ($this->userObj->getExternalAccount() == "")
1057 ? ""
1058 : ilObjUser::_checkExternalAuthAccount($am, $this->userObj->getExternalAccount());
1059 switch ($this->action)
1060 {
1061 case "Insert" :
1062 if ($loginForExternalAccount != "")
1063 {
1064 $this->logWarning($this->userObj->getLogin(), $lng->txt("usrimport_no_insert_ext_account_exists")." (".$this->userObj->getExternalAccount().")");
1065 $this->action = "Ignore";
1066 }
1067 break;
1068
1069 case "Update" :
1070 // this variable describes the ILIAS login which belongs to the given external account!!!
1071 // it is NOT nescessarily the ILIAS login of the current user record !!
1072 // so if we found an ILIAS login according to the authentication method
1073 // check if the ILIAS login belongs to the current user record, otherwise somebody else is using it!
1074 if ($loginForExternalAccount != "")
1075 {
1076 // check if we changed the value!
1077 $externalAccountHasChanged = $this->userObj->getExternalAccount() != ilObjUser::_lookupExternalAccount($this->user_id);
1078 // if it has changed and the external login
1079 if ($externalAccountHasChanged && trim($loginForExternalAccount) != trim($this->userObj->getLogin()))
1080 {
1081 $this->logWarning($this->userObj->getLogin(), $lng->txt("usrimport_no_update_ext_account_exists")." (".$this->userObj->getExternalAccount().")");
1082 $this->action = "Ignore";
1083 }
1084 }
1085 break;
1086 }
1087
1088 if(sizeof($this->multi_values))
1089 {
1090 if(isset($this->multi_values["GeneralInterest"]))
1091 {
1092 $this->userObj->setGeneralInterests($this->multi_values["GeneralInterest"]);
1093 }
1094 if(isset($this->multi_values["OfferingHelp"]))
1095 {
1096 $this->userObj->setOfferingHelp($this->multi_values["OfferingHelp"]);
1097 }
1098 if(isset($this->multi_values["LookingForHelp"]))
1099 {
1100 $this->userObj->setLookingForHelp($this->multi_values["LookingForHelp"]);
1101 }
1102 }
1103
1104 // Perform the action
1105 switch ($this->action)
1106 {
1107 case "Insert" :
1108 if ($user_id)
1109 {
1110 $this->logFailure($this->userObj->getLogin(),$lng->txt("usrimport_cant_insert"));
1111 }
1112 else
1113 {
1114
1115 if(!strlen($this->currPassword) == 0)
1116 {
1117 switch($this->currPasswordType)
1118 {
1119 case "BCRYPT":
1120 if(!strlen($this->currPasswordSalt))
1121 {
1122 $this->logFailure($this->userObj->getLogin(), $lng->txt("usrimport_xml_pw_bcrypt_missing_salt"));
1123 }
1124 $this->userObj->setPasswd($this->currPassword, IL_PASSWD_CRYPTED);
1125 $this->userObj->setPasswordEncodingType('bcrypt');
1126 $this->userObj->setPasswordSalt($this->currPasswordSalt);
1127 break;
1128
1129 case "PLAIN":
1130 $this->userObj->setPasswd($this->currPassword, IL_PASSWD_PLAIN);
1131 $this->acc_mail->setUserPassword($this->currPassword);
1132 break;
1133
1134 }
1135 }
1136 else
1137 {
1138 // this does the trick for empty passwords
1139 // since a MD5 string has always 32 characters,
1140 // no hashed password combination will ever equal to
1141 // an empty string
1142 $this->userObj->setPasswd("", IL_PASSWD_CRYPTED);
1143
1144 }
1145
1146 $this->userObj->setTitle($this->userObj->getFullname());
1147 $this->userObj->setDescription($this->userObj->getEmail());
1148
1149 if(!$this->time_limit_owner_set)
1150 {
1151 $this->userObj->setTimeLimitOwner($this->getFolderId());
1152 }
1153
1154 // default time limit settings
1155 if(!$this->time_limit_set)
1156 {
1157 $this->userObj->setTimeLimitUnlimited(1);
1158 $this->userObj->setTimeLimitMessage(0);
1159
1160 if (! $this->approve_date_set)
1161 {
1162 $this->userObj->setApproveDate(date("Y-m-d H:i:s"));
1163 }
1164 }
1165
1166
1167 $this->userObj->setActive($this->currActive == 'true' || is_null($this->currActive));
1168
1169 // Finally before saving new user.
1170 // Check if profile is incomplete
1171
1172 // #8759
1173 if(count($this->udf_data))
1174 {
1175 $this->userObj->setUserDefinedData($this->udf_data);
1176 }
1177
1178 $this->userObj->setProfileIncomplete($this->checkProfileIncomplete($this->userObj));
1179 $this->userObj->create();
1180
1181 //insert user data in table user_data
1182 $this->userObj->saveAsNew(false);
1183
1184 // Set default prefs
1185 $this->userObj->setPref('hits_per_page',$ilSetting->get('hits_per_page',30));
1186 //$this->userObj->setPref('show_users_online',$ilSetting->get('show_users_online','y'));
1187
1188 if (count ($this->prefs))
1189 {
1190 foreach ($this->prefs as $key => $value)
1191 {
1192 if ($key != "mail_incoming_type" &&
1193 $key != "mail_signature" &&
1194 $key != "mail_linebreak"
1195 )
1196 {
1197 $this->userObj->setPref($key, $value);
1198 }
1199 }
1200 }
1201
1202 $this->userObj->writePrefs();
1203
1204 // update mail preferences, to be extended
1205 $this->updateMailPreferences($this->userObj->getId());
1206
1207 if (is_array($this->personalPicture))
1208 {
1209 if (strlen($this->personalPicture["content"]))
1210 {
1211 $extension = "jpg";
1212 if (preg_match("/.*(png|jpg|gif|jpeg)$/", $this->personalPicture["imagetype"], $matches))
1213 {
1214 $extension = $matches[1];
1215 }
1216 $tmp_name = $this->saveTempImage($this->personalPicture["content"], ".$extension");
1217 if (strlen($tmp_name))
1218 {
1219 ilObjUser::_uploadPersonalPicture($tmp_name, $this->userObj->getId());
1220 unlink($tmp_name);
1221 }
1222 }
1223 }
1224
1225 //set role entries
1226 foreach($this->roles as $role_id => $role)
1227 {
1228 if ($this->role_assign[$role_id])
1229 {
1230 $this->assignToRole($this->userObj, $this->role_assign[$role_id]);
1231 }
1232 }
1233
1234 if(count($this->udf_data))
1235 {
1236 include_once './Services/User/classes/class.ilUserDefinedData.php';
1237 $udd = new ilUserDefinedData($this->userObj->getId());
1238 foreach($this->udf_data as $field => $value)
1239 {
1240 $udd->set("f_".$field,$value);
1241 }
1242 $udd->update();
1243 }
1244
1245 $this->sendAccountMail();
1246 $this->logSuccess($this->userObj->getLogin(),$this->userObj->getId(), "Insert");
1247 // reset account mail object
1248 $this->acc_mail->reset();
1249 }
1250 break;
1251
1252 case "Update" :
1253 if (! $user_id)
1254 {
1255 $this->logFailure($this->userObj->getLogin(),$lng->txt("usrimport_cant_update"));
1256 }
1257 else
1258 {
1259 $updateUser = new ilObjUser($user_id);
1260 $updateUser->read();
1261 $updateUser->readPrefs();
1262 if ($this->currPassword != null)
1263 {
1264 switch ($this->currPasswordType)
1265 {
1266 case "BCRYPT":
1267 if(!strlen($this->currPasswordSalt))
1268 {
1269 $this->logFailure($this->userObj->getLogin(), $lng->txt("usrimport_xml_pw_bcrypt_missing_salt"));
1270 }
1271 $updateUser->setPasswd($this->currPassword, IL_PASSWD_CRYPTED);
1272 $updateUser->setPasswordEncodingType('bcrypt');
1273 $updateUser->setPasswordSalt($this->currPasswordSalt);
1274 break;
1275
1276 case "PLAIN":
1277 $updateUser->setPasswd($this->currPassword, IL_PASSWD_PLAIN);
1278 $this->acc_mail->setUserPassword($this->currPassword);
1279 break;
1280 }
1281 }
1282 if (! is_null($this->userObj->getFirstname())) $updateUser->setFirstname($this->userObj->getFirstname());
1283 if (! is_null($this->userObj->getLastname())) $updateUser->setLastname($this->userObj->getLastname());
1284 if (! is_null($this->userObj->getUTitle())) $updateUser->setUTitle($this->userObj->getUTitle());
1285 if (! is_null($this->userObj->getGender())) $updateUser->setGender($this->userObj->getGender());
1286 if (! is_null($this->userObj->getEmail())) $updateUser->setEmail($this->userObj->getEmail());
1287 if (! is_null($this->userObj->getBirthday())) $updateUser->setBirthday($this->userObj->getBirthday());
1288 if (! is_null($this->userObj->getInstitution())) $updateUser->setInstitution($this->userObj->getInstitution());
1289 if (! is_null($this->userObj->getStreet())) $updateUser->setStreet($this->userObj->getStreet());
1290 if (! is_null($this->userObj->getCity())) $updateUser->setCity($this->userObj->getCity());
1291 if (! is_null($this->userObj->getZipCode())) $updateUser->setZipCode($this->userObj->getZipCode());
1292 if (! is_null($this->userObj->getCountry())) $updateUser->setCountry($this->userObj->getCountry());
1293 if (! is_null($this->userObj->getSelectedCountry())) $updateUser->setSelectedCountry($this->userObj->getSelectedCountry());
1294 if (! is_null($this->userObj->getPhoneOffice())) $updateUser->setPhoneOffice($this->userObj->getPhoneOffice());
1295 if (! is_null($this->userObj->getPhoneHome())) $updateUser->setPhoneHome($this->userObj->getPhoneHome());
1296 if (! is_null($this->userObj->getPhoneMobile())) $updateUser->setPhoneMobile($this->userObj->getPhoneMobile());
1297 if (! is_null($this->userObj->getFax())) $updateUser->setFax($this->userObj->getFax());
1298 if (! is_null($this->userObj->getHobby())) $updateUser->setHobby($this->userObj->getHobby());
1299 if (! is_null($this->userObj->getGeneralInterests())) $updateUser->setGeneralInterests($this->userObj->getGeneralInterests());
1300 if (! is_null($this->userObj->getOfferingHelp())) $updateUser->setOfferingHelp($this->userObj->getOfferingHelp());
1301 if (! is_null($this->userObj->getLookingForHelp())) $updateUser->setLookingForHelp($this->userObj->getLookingForHelp());
1302 if (! is_null($this->userObj->getComment())) $updateUser->setComment($this->userObj->getComment());
1303 if (! is_null($this->userObj->getDepartment())) $updateUser->setDepartment($this->userObj->getDepartment());
1304 if (! is_null($this->userObj->getMatriculation())) $updateUser->setMatriculation($this->userObj->getMatriculation());
1305 if (! is_null($this->currActive)) $updateUser->setActive($this->currActive == "true", is_object($ilUser) ? $ilUser->getId() : 0);
1306 if (! is_null($this->userObj->getClientIP())) $updateUser->setClientIP($this->userObj->getClientIP());
1307 if (! is_null($this->userObj->getTimeLimitUnlimited())) $updateUser->setTimeLimitUnlimited($this->userObj->getTimeLimitUnlimited());
1308 if (! is_null($this->userObj->getTimeLimitFrom())) $updateUser->setTimeLimitFrom($this->userObj->getTimeLimitFrom());
1309 if (! is_null($this->userObj->getTimeLimitUntil())) $updateUser->setTimeLimitUntil($this->userObj->getTimeLimitUntil());
1310 if (! is_null($this->userObj->getTimeLimitMessage())) $updateUser->setTimeLimitMessage($this->userObj->getTimeLimitMessage());
1311 if (! is_null($this->userObj->getApproveDate())) $updateUser->setApproveDate($this->userObj->getApproveDate());
1312 if (! is_null($this->userObj->getAgreeDate())) $updateUser->setAgreeDate($this->userObj->getAgreeDate());
1313 if (! is_null($this->userObj->getLanguage())) $updateUser->setLanguage($this->userObj->getLanguage());
1314 if (! is_null($this->userObj->getExternalAccount())) $updateUser->setExternalAccount($this->userObj->getExternalAccount());
1315
1316 // Fixed: if auth_mode is not set, it was always overwritten with auth_default
1317 #if (! is_null($this->userObj->getAuthMode())) $updateUser->setAuthMode($this->userObj->getAuthMode());
1318 if($this->auth_mode_set)
1319 $updateUser->setAuthMode($this->userObj->getAuthMode());
1320
1321 if (! is_null($this->userObj->getInstantMessengerId("aim"))) $updateUser->setInstantMessengerId("aim", $this->userObj->getInstantMessengerId("aim"));
1322 if (! is_null($this->userObj->getInstantMessengerId("msn"))) $updateUser->setInstantMessengerId("msn", $this->userObj->getInstantMessengerId("msn"));
1323 if (! is_null($this->userObj->getInstantMessengerId("icq"))) $updateUser->setInstantMessengerId("icq", $this->userObj->getInstantMessengerId("icq"));
1324 if (! is_null($this->userObj->getInstantMessengerId("yahoo"))) $updateUser->setInstantMessengerId("yahoo", $this->userObj->getInstantMessengerId("yahoo"));
1325 if (! is_null($this->userObj->getInstantMessengerId("skype"))) $updateUser->setInstantMessengerId("skype", $this->userObj->getInstantMessengerId("skype"));
1326 if (! is_null($this->userObj->getInstantMessengerId("jabber"))) $updateUser->setInstantMessengerId("jabber", $this->userObj->getInstantMessengerId("jabber"));
1327 if (! is_null($this->userObj->getInstantMessengerId("voip"))) $updateUser->setInstantMessengerId("voip", $this->userObj->getInstantMessengerId("voip"));
1328
1329 // Special handlin since it defaults to 7 (USER_FOLDER_ID)
1330 if($this->time_limit_owner_set)
1331 {
1332 $updateUser->setTimeLimitOwner($this->userObj->getTimeLimitOwner());
1333 }
1334
1335
1336 if (count ($this->prefs))
1337 {
1338 foreach ($this->prefs as $key => $value)
1339 {
1340 if ($key != "mail_incoming_type" &&
1341 $key != "mail_signature" &&
1342 $key != "mail_linebreak"
1343 ){
1344 $updateUser->setPref($key, $value);
1345 }
1346 }
1347 }
1348
1349 // save user preferences (skin and style)
1350 if ($this->updateLookAndSkin)
1351 {
1352 $updateUser->setPref("skin", $this->userObj->getPref("skin"));
1353 $updateUser->setPref("style", $this->userObj->getPref("style"));
1354 }
1355
1356
1357 $updateUser->writePrefs();
1358
1359 // update mail preferences, to be extended
1360 $this->updateMailPreferences($updateUser->getId());
1361
1362 // #8759
1363 if(count($this->udf_data))
1364 {
1365 $updateUser->setUserDefinedData($this->udf_data);
1366 }
1367
1368 $updateUser->setProfileIncomplete($this->checkProfileIncomplete($updateUser));
1369
1370 $updateUser->setTitle($updateUser->getFullname());
1371 $updateUser->setDescription($updateUser->getEmail());
1372 $updateUser->update();
1373
1374 if(count($this->udf_data))
1375 {
1376 include_once './Services/User/classes/class.ilUserDefinedData.php';
1377 $udd = new ilUserDefinedData($updateUser->getId());
1378 foreach($this->udf_data as $field => $value)
1379 {
1380 $udd->set("f_".$field,$value);
1381 }
1382 $udd->update();
1383 }
1384
1385 // update login
1386 if (!is_null($this->userObj->getLogin()) && $this->user_id != -1)
1387 {
1388 try
1389 {
1390 $updateUser->updateLogin($this->userObj->getLogin());
1391 }
1392 catch (ilUserException $e)
1393 {
1394 }
1395 }
1396
1397
1398 // if language has changed
1399
1400 if (is_array($this->personalPicture))
1401 {
1402 if (strlen($this->personalPicture["content"]))
1403 {
1404 $extension = "jpg";
1405 if (preg_match("/.*(png|jpg|gif|jpeg)$/", $this->personalPicture["imagetype"], $matches))
1406 {
1407 $extension = $matches[1];
1408 }
1409 $tmp_name = $this->saveTempImage($this->personalPicture["content"], ".$extension");
1410 if (strlen($tmp_name))
1411 {
1412 ilObjUser::_uploadPersonalPicture($tmp_name, $this->userObj->getId());
1413 unlink($tmp_name);
1414 }
1415 }
1416 }
1417
1418
1419 //update role entries
1420 //-------------------
1421 foreach ($this->roles as $role_id => $role)
1422 {
1423 if ($this->role_assign[$role_id])
1424 {
1425 switch ($role["action"])
1426 {
1427 case "Assign" :
1428 $this->assignToRole($updateUser, $this->role_assign[$role_id]);
1429 break;
1430 case "AssignWithParents" :
1431 $this->assignToRoleWithParents($updateUser, $this->role_assign[$role_id]);
1432 break;
1433 case "Detach" :
1434 $this->detachFromRole($updateUser, $this->role_assign[$role_id]);
1435 break;
1436 }
1437 }
1438 }
1439 $this->logSuccess($updateUser->getLogin(), $user_id, "Update");
1440 }
1441 break;
1442 case "Delete" :
1443 if (! $user_id)
1444 {
1445 $this->logFailure($this->userObj->getLogin(),$lng->txt("usrimport_cant_delete"));
1446 }
1447 else
1448 {
1449 $deleteUser = new ilObjUser($user_id);
1450 $deleteUser->delete();
1451
1452 $this->logSuccess($this->userObj->getLogin(),$user_id, "Delete");
1453 }
1454 break;
1455 }
1456
1457 // init role array for next user
1458 $this->roles = array();
1459 break;
1460
1461 case "Login":
1462 $this->userObj->setLogin($this->cdata);
1463 break;
1464
1465 case "Password":
1466 $this->currPassword = $this->cdata;
1467 break;
1468
1469 case "Firstname":
1470 $this->userObj->setFirstname($this->cdata);
1471 break;
1472
1473 case "Lastname":
1474 $this->userObj->setLastname($this->cdata);
1475 break;
1476
1477 case "Title":
1478 $this->userObj->setUTitle($this->cdata);
1479 break;
1480
1481 case "Gender":
1482 $this->userObj->setGender($this->cdata);
1483 break;
1484
1485 case "Email":
1486 $this->userObj->setEmail($this->cdata);
1487 break;
1488
1489 case "Birthday":
1490 $timestamp = strtotime($this->cdata);
1491 if ($timestamp !== false)
1492 {
1493 $this->userObj->setBirthday($this->cdata);
1494 }
1495 break;
1496 case "Institution":
1497 $this->userObj->setInstitution($this->cdata);
1498 break;
1499
1500 case "Street":
1501 $this->userObj->setStreet($this->cdata);
1502 break;
1503
1504 case "City":
1505 $this->userObj->setCity($this->cdata);
1506 break;
1507
1508 case "PostalCode":
1509 $this->userObj->setZipCode($this->cdata);
1510 break;
1511
1512 case "Country":
1513 $this->userObj->setCountry($this->cdata);
1514 break;
1515
1516 case "SelCountry":
1517 $this->userObj->setSelectedCountry($this->cdata);
1518 break;
1519
1520 case "PhoneOffice":
1521 $this->userObj->setPhoneOffice($this->cdata);
1522 break;
1523
1524 case "PhoneHome":
1525 $this->userObj->setPhoneHome($this->cdata);
1526 break;
1527
1528 case "PhoneMobile":
1529 $this->userObj->setPhoneMobile($this->cdata);
1530 break;
1531
1532 case "Fax":
1533 $this->userObj->setFax($this->cdata);
1534 break;
1535
1536 case "Hobby":
1537 $this->userObj->setHobby($this->cdata);
1538 break;
1539
1540 case "GeneralInterest":
1541 case "OfferingHelp":
1542 case "LookingForHelp":
1543 $this->multi_values[$a_name][] = $this->cdata;
1544 break;
1545
1546 case "Comment":
1547 $this->userObj->setComment($this->cdata);
1548 break;
1549
1550 case "Department":
1551 $this->userObj->setDepartment($this->cdata);
1552 break;
1553
1554 case "Matriculation":
1555 $this->userObj->setMatriculation($this->cdata);
1556 break;
1557
1558 case "Active":
1559 $this->currActive = $this->cdata;
1560 break;
1561
1562 case "ClientIP":
1563 $this->userObj->setClientIP($this->cdata);
1564 break;
1565
1566 case "TimeLimitOwner":
1567 $this->time_limit_owner_set = true;
1568 $this->userObj->setTimeLimitOwner($this->cdata);
1569 break;
1570
1571 case "TimeLimitUnlimited":
1572 $this->time_limit_set = true;
1573 $this->userObj->setTimeLimitUnlimited($this->cdata);
1574 break;
1575
1576 case "TimeLimitFrom":
1577 if (is_numeric($this->cdata))
1578 {
1579 // Treat cdata as a unix timestamp
1580 $this->userObj->setTimeLimitFrom($this->cdata);
1581 }
1582 else
1583 {
1584 // Try to convert cdata into unix timestamp, or ignore it
1585 $timestamp = strtotime($this->cdata);
1586 if ($timestamp !== false && trim($this->cdata) != "0000-00-00 00:00:00")
1587 {
1588 $this->userObj->setTimeLimitFrom($timestamp);
1589 }
1590 elseif ($this->cdata == "0000-00-00 00:00:00")
1591 {
1592 $this->userObj->setTimeLimitFrom(null);
1593 }
1594
1595 }
1596 break;
1597
1598 case "TimeLimitUntil":
1599 if (is_numeric($this->cdata))
1600 {
1601 // Treat cdata as a unix timestamp
1602 $this->userObj->setTimeLimitUntil($this->cdata);
1603 }
1604 else
1605 {
1606 // Try to convert cdata into unix timestamp, or ignore it
1607 $timestamp = strtotime($this->cdata);
1608 if ($timestamp !== false && trim($this->cdata) != "0000-00-00 00:00:00")
1609 {
1610 $this->userObj->setTimeLimitUntil($timestamp);
1611 }
1612 elseif ($this->cdata == "0000-00-00 00:00:00")
1613 {
1614 $this->userObj->setTimeLimitUntil(null);
1615 }
1616 }
1617 break;
1618
1619 case "TimeLimitMessage":
1620 $this->userObj->setTimeLimitMessage($this->cdata);
1621 break;
1622
1623 case "ApproveDate":
1624 $this->approve_date_set = true;
1625 if (is_numeric($this->cdata))
1626 {
1627 // Treat cdata as a unix timestamp
1628 $tmp_date = new ilDateTime($this->cdata,IL_CAL_UNIX);
1629 $this->userObj->setApproveDate($tmp_date->get(IL_CAL_DATETIME));
1630 }
1631 else
1632 {
1633 // Try to convert cdata into unix timestamp, or ignore it
1634 $timestamp = strtotime($this->cdata);
1635 if ($timestamp !== false && trim($this->cdata) != "0000-00-00 00:00:00")
1636 {
1637 $tmp_date = new ilDateTime($timestamp,IL_CAL_UNIX);
1638 $this->userObj->setApproveDate($tmp_date->get(IL_CAL_DATETIME));
1639 }
1640 elseif ($this->cdata == "0000-00-00 00:00:00")
1641 {
1642 $this->userObj->setApproveDate(null);
1643 }
1644 }
1645 break;
1646
1647 case "AgreeDate":
1648 if (is_numeric($this->cdata))
1649 {
1650 // Treat cdata as a unix timestamp
1651 $tmp_date = new ilDateTime($this->cdata,IL_CAL_UNIX);
1652 $this->userObj->setAgreeDate($tmp_date->get(IL_CAL_DATETIME));
1653 }
1654 else
1655 {
1656 // Try to convert cdata into unix timestamp, or ignore it
1657 $timestamp = strtotime($this->cdata);
1658 if ($timestamp !== false && trim($this->cdata) != "0000-00-00 00:00:00")
1659 {
1660 $tmp_date = new ilDateTime($timestamp,IL_CAL_UNIX);
1661 $this->userObj->setAgreeDate($tmp_date->get(IL_CAL_DATETIME));
1662 }
1663 elseif ($this->cdata == "0000-00-00 00:00:00")
1664 {
1665 $this->userObj->setAgreeDate(null);
1666 }
1667 }
1668 break;
1669
1670 case "ExternalAccount":
1671 $this->userObj->setExternalAccount($this->cdata);
1672 break;
1673
1674 case "Look":
1675 $this->updateLookAndSkin = false;
1676 if (!$this->hideSkin)
1677 {
1678 // TODO: what to do with disabled skins? is it possible to change the skin via import?
1679 if ((strlen($this->skin) > 0) && (strlen($this->style) > 0))
1680 {
1681 if (is_array($this->userStyles))
1682 {
1683 if (in_array($this->skin . ":" . $this->style, $this->userStyles))
1684 {
1685 $this->userObj->setPref("skin", $this->skin);
1686 $this->userObj->setPref("style", $this->style);
1687 $this->updateLookAndSkin = true;
1688 }
1689 }
1690 }
1691 }
1692 break;
1693
1694 case 'UserDefinedField':
1695 include_once './Services/User/classes/class.ilUserDefinedFields.php';
1697 if($field_id = $udf->fetchFieldIdFromImportId($this->tmp_udf_id))
1698 {
1699 $this->udf_data[$field_id] = $this->cdata;
1700 }
1701 elseif($field_id = $udf->fetchFieldIdFromName($this->tmp_udf_name))
1702 {
1703 $this->udf_data[$field_id] = $this->cdata;
1704 }
1705 break;
1706 case 'AccountInfo':
1707 if ($this->current_messenger_type =="delicious")
1708 {
1709 $this->userObj->setDelicious($this->cdata);
1710 }
1711 elseif ($this->current_messenger_type =="external")
1712 {
1713 $this->userObj->setExternalAccount($this->cdata);
1714 }
1715 else
1716 {
1717 $this->userObj->setInstantMessengerId($this->current_messenger_type, $this->cdata);
1718 }
1719 break;
1720 case 'Pref':
1721 if ($this->currentPrefKey != null && strlen(trim($this->cdata)) > 0
1722 && ilUserXMLWriter::isPrefExportable($this->currentPrefKey))
1723 $this->prefs[$this->currentPrefKey] = trim($this->cdata);
1724 $this->currentPrefKey = null;
1725 break;
1726 }
1727 }
foreach($mandatory_scripts as $file) $timestamp
Definition: buildRTE.php:81
const IL_CAL_UNIX
const IL_CAL_DATETIME
const IL_PASSWD_PLAIN
const IL_PASSWD_CRYPTED
const IL_FAIL_ON_CONFLICT
const IL_UPDATE_ON_CONFLICT
const IL_IGNORE_ON_CONFLICT
static _getAuthModeName($a_auth_key)
@classDescription Date and time handling
_uploadPersonalPicture($tmp_file, $obj_id)
Create a personal picture image file from a temporary image file.
_lookupExternalAccount($a_user_id)
lookup external account for login and authmethod
getUserIdByLogin($a_login)
static _checkExternalAuthAccount($a_auth, $a_account)
check whether external account and authentication method matches with a user
Class ilUserDefinedData.
static _getInstance()
Get instance.
Class for user related exception handling in ILIAS.
logWarning($aLogin, $aMessage)
Writes a warning log message to the protocol.
logSuccess($aLogin, $userid, $action)
Writes a success log message to the protocol.
assignToRoleWithParents($a_user_obj, $a_role_id)
Assigns a user to a role and to all parent roles.
saveTempImage($image_data, $filename)
Saves binary image data to a temporary image file and returns the name of the image file on success.
sendAccountMail()
send account mail
checkProfileIncomplete($user_obj)
Check if profile is incomplete Will set the usr_data field profile_incomplete if any required field i...
detachFromRole($a_user_obj, $a_role_id)
Detachs a user from a role.
static isPrefExportable($key)
returns wether a key from db is exportable or not
global $ilSetting
Definition: privfeed.php:40

References ilSaxParser\$ilias, $ilSetting, $ilUser, ilSaxParser\$lng, $timestamp, $user_id, ilObjUser\_checkExternalAuthAccount(), ilAuthUtils\_getAuthModeName(), ilUserDefinedFields\_getInstance(), ilObjUser\_lookupExternalAccount(), ilObjUser\_uploadPersonalPicture(), assignToRole(), assignToRoleWithParents(), checkProfileIncomplete(), detachFromRole(), getFolderId(), ilObjUser\getUserIdByLogin(), IL_CAL_DATETIME, IL_CAL_UNIX, IL_FAIL_ON_CONFLICT, IL_IGNORE_ON_CONFLICT, IL_PASSWD_CRYPTED, IL_PASSWD_PLAIN, IL_UPDATE_ON_CONFLICT, ilUserXMLWriter\isPrefExportable(), logFailure(), logSuccess(), logWarning(), saveTempImage(), sendAccountMail(), and updateMailPreferences().

Referenced by handlerEndTag().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isFieldRequired()

ilUserImportParser::isFieldRequired (   $fieldname)
protected
  determine if a field $fieldname is to a required field (global setting)
Parameters
$fieldnamestring value of fieldname, e.g. gender
Returns
true, if field of required fields contains fieldname as key, false otherwise.

Definition at line 2392 of file class.ilUserImportParser.php.

2393 {
2394 $requiredFields = $this->readRequiredFields();
2395 $fieldname = strtolower(trim($fieldname));
2396 return array_key_exists($fieldname, $requiredFields);
2397 }
readRequiredFields()
read required fields

References readRequiredFields().

+ Here is the call graph for this function:

◆ isSendMail()

ilUserImportParser::isSendMail ( )

read access to property send mail

Returns
boolean

Definition at line 2321 of file class.ilUserImportParser.php.

2321 {
2322 return $this->send_mail;
2323 }

References $send_mail.

Referenced by sendAccountMail().

+ Here is the caller graph for this function:

◆ isSuccess()

ilUserImportParser::isSuccess ( )

Returns true, if the import was successful.

Definition at line 2227 of file class.ilUserImportParser.php.

2228 {
2229 return $this->error_level == IL_IMPORT_SUCCESS;
2230 }

References IL_IMPORT_SUCCESS.

◆ logFailure()

ilUserImportParser::logFailure (   $aLogin,
  $aMessage 
)

Writes a failure log message to the protocol.

Parameters
stringlogin
stringmessage

Definition at line 2153 of file class.ilUserImportParser.php.

2154 {
2155 if (! array_key_exists($aLogin, $this->protocol))
2156 {
2157 $this->protocol[$aLogin] = array();
2158 }
2159 if ($aMessage)
2160 {
2161 $this->protocol[$aLogin][] = $aMessage;
2162 }
2163 $this->error_level = IL_IMPORT_FAILURE;
2164 }
const IL_IMPORT_FAILURE

References IL_IMPORT_FAILURE.

Referenced by importBeginTag(), importEndTag(), verifyBeginTag(), verifyEndTag(), and verifyPref().

+ Here is the caller graph for this function:

◆ logSuccess()

ilUserImportParser::logSuccess (   $aLogin,
  $userid,
  $action 
)

Writes a success log message to the protocol.

@param      string          login
@param      string          userid
@param   string      action

Definition at line 2173 of file class.ilUserImportParser.php.

2174 {
2175 $this->user_mapping[$userid] = array("login" => $aLogin, "action" => $action, "message" => "successful");
2176 }

References $action.

Referenced by importEndTag().

+ Here is the caller graph for this function:

◆ logWarning()

ilUserImportParser::logWarning (   $aLogin,
  $aMessage 
)

Writes a warning log message to the protocol.

Parameters
stringlogin
stringmessage

Definition at line 2132 of file class.ilUserImportParser.php.

2133 {
2134 if (! array_key_exists($aLogin, $this->protocol))
2135 {
2136 $this->protocol[$aLogin] = array();
2137 }
2138 if ($aMessage)
2139 {
2140 $this->protocol[$aLogin][] = $aMessage;
2141 }
2142 if ($this->error_level == IL_IMPORT_SUCCESS)
2143 {
2144 $this->error_level = IL_IMPORT_WARNING;
2145 }
2146 }
const IL_IMPORT_WARNING

References IL_IMPORT_SUCCESS, and IL_IMPORT_WARNING.

Referenced by importEndTag(), and verifyEndTag().

+ Here is the caller graph for this function:

◆ readAccountMailFromCache()

ilUserImportParser::readAccountMailFromCache (   $lang_key)
private
Parameters
$lang_key
Returns
mixed

Definition at line 2278 of file class.ilUserImportParser.php.

2279 {
2280 if(!isset(self::$account_mail_cache[$lang_key]))
2281 {
2282 $default_lang_key = $GLOBALS["lng"]->getDefaultLanguage();
2283
2284 // try individual account mail in user administration
2285 include_once './Services/User/classes/class.ilObjUserFolder.php';
2286
2287 $amail = ilObjUserFolder::_lookupNewAccountMail($lang_key);
2288
2289 if (trim($amail["body"]) != "" && trim($amail["subject"]) != "")
2290 {
2291 self::$account_mail_cache[$lang_key] = $amail;
2292 }
2293 else
2294 {
2295 $lang_key = $default_lang_key;
2296 }
2297
2298 if(!isset(self::$account_mail_cache[$default_lang_key]))
2299 {
2300 $amail = ilObjUserFolder::_lookupNewAccountMail($default_lang_key);
2301 self::$account_mail_cache[$default_lang_key] = $amail;
2302 }
2303 }
2304 return self::$account_mail_cache[$lang_key];
2305 }
$GLOBALS['PHPCAS_CLIENT']
This global variable is used by the interface class phpCAS.
Definition: CAS.php:276

References $GLOBALS, and ilObjUserFolder\_lookupNewAccountMail().

Referenced by sendAccountMail().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readRequiredFields()

ilUserImportParser::readRequiredFields ( )
private

read required fields

@access private

Definition at line 2353 of file class.ilUserImportParser.php.

2354 {
2355 global $ilSetting;
2356
2357 if(is_array($this->required_fields))
2358 {
2359 return $this->required_fields;
2360 }
2361 foreach($ilSetting->getAll() as $field => $value)
2362 {
2363 if(substr($field,0,8) == 'require_' and $value == 1)
2364 {
2365 $value = substr($field,8);
2366 $this->required_fields[$value] = $value;
2367 }
2368 }
2369 return $this->required_fields ? $this->required_fields : array();
2370 }

References $ilSetting.

Referenced by isFieldRequired().

+ Here is the caller graph for this function:

◆ saveTempImage()

ilUserImportParser::saveTempImage (   $image_data,
  $filename 
)

Saves binary image data to a temporary image file and returns the name of the image file on success.

Definition at line 1733 of file class.ilUserImportParser.php.

1734 {
1735 $tempname = ilUtil::ilTempnam() . $filename;
1736 $fh = fopen($tempname, "wb");
1737 if ($fh == false)
1738 {
1739 return "";
1740 }
1741 $imagefile = fwrite($fh, $image_data);
1742 fclose($fh);
1743 return $tempname;
1744 }
$filename
Definition: buildRTE.php:89
static ilTempnam($a_temp_path=null)
Create a temporary file in an ILIAS writable directory.

References $filename, and ilUtil\ilTempnam().

Referenced by importEndTag().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ sendAccountMail()

ilUserImportParser::sendAccountMail ( )

send account mail

Definition at line 2253 of file class.ilUserImportParser.php.

2254 {
2255 if($_POST["send_mail"] != "" ||
2256 ($this->isSendMail() && $this->userObj->getEmail() != ""))
2257 {
2258 $this->acc_mail->setUser($this->userObj);
2259
2260 $amail = $this->readAccountMailFromCache($this->userObj->getLanguage());
2261 if($amail["att_file"])
2262 {
2263 include_once "Services/User/classes/class.ilFSStorageUserFolder.php";
2265 $fs->create();
2266 $path = $fs->getAbsolutePath() . "/";
2267
2268 $this->acc_mail->addAttachment($path . "/" . $amail["lang"], $amail["att_file"]);
2269 }
2270 $this->acc_mail->send();
2271 }
2272 }
const USER_FOLDER_ID
Class ilObjUserFolder.
isSendMail()
read access to property send mail
$_POST['username']
Definition: cron.php:12
$path
Definition: index.php:22

References $_POST, $path, isSendMail(), readAccountMailFromCache(), and USER_FOLDER_ID.

Referenced by importEndTag().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ setFolderId()

ilUserImportParser::setFolderId (   $a_folder_id)

assign users to this folder (normally the usr_folder) But if called from local admin => the ref_id of the category @access public

Definition at line 359 of file class.ilUserImportParser.php.

360 {
361 $this->folder_id = $a_folder_id;
362 }

◆ setHandlers()

ilUserImportParser::setHandlers (   $a_xml_parser)

set event handler should be overwritten by inherited class @access private

Reimplemented from ilSaxParser.

Definition at line 374 of file class.ilUserImportParser.php.

375 {
376 xml_set_object($a_xml_parser,$this);
377 xml_set_element_handler($a_xml_parser,'handlerBeginTag','handlerEndTag');
378 xml_set_character_data_handler($a_xml_parser,'handlerCharacterData');
379 }

◆ setRoleAssignment()

ilUserImportParser::setRoleAssignment (   $a_assign)

set import to local role assignemt

Parameters
arrayrole assignment (key: import id; value: local role id)

Definition at line 394 of file class.ilUserImportParser.php.

395 {
396 $this->role_assign = $a_assign;
397 }

◆ setSendMail()

ilUserImportParser::setSendMail (   $value)

write access to property send mail

Parameters
mixed$value

Definition at line 2312 of file class.ilUserImportParser.php.

2312 {
2313 $this->send_mail = $value ? true: false;
2314 }

◆ setUserMappingMode()

ilUserImportParser::setUserMappingMode (   $value)

write access to user mapping mode

Parameters
int$valuemust be one of IL_USER_MAPPING_ID or IL_USER_MAPPING_LOGIN, die otherwise

Definition at line 2330 of file class.ilUserImportParser.php.

2331 {
2332 if ($value == IL_USER_MAPPING_ID || $value == IL_USER_MAPPING_LOGIN)
2333 $this->mapping_mode = $value;
2334 else die ("wrong argument using methode setUserMappingMethod in ".__FILE__);
2335 }

References IL_USER_MAPPING_ID, and IL_USER_MAPPING_LOGIN.

◆ startParsing()

ilUserImportParser::startParsing ( )

start the parser

Reimplemented from ilSaxParser.

Definition at line 384 of file class.ilUserImportParser.php.

385 {
386 parent::startParsing();
387 }

◆ updateMailPreferences()

ilUserImportParser::updateMailPreferences (   $usr_id)
private

Definition at line 2484 of file class.ilUserImportParser.php.

2484 {
2485 if (array_key_exists("mail_incoming_type", $this->prefs) ||
2486 array_key_exists("mail_signature", $this->prefs) ||
2487 array_key_exists("mail_linebreak", $this->prefs)
2488 )
2489 {
2490 include_once("Services/Mail/classes/class.ilMailOptions.php");
2491 $mailOptions = new ilMailOptions($usr_id);
2492 $mailOptions->updateOptions(
2493 array_key_exists("mail_signature", $this->prefs) ? $this->prefs["mail_signature"] : $mailOptions->getSignature(),
2494 array_key_exists("mail_linebreak", $this->prefs) ? $this->prefs["mail_linebreak"] : $mailOptions->getLinebreak(),
2495 array_key_exists("mail_incoming_type", $this->prefs) ? $this->prefs["mail_incoming_type"] : $mailOptions->getIncomingType(),
2496 $mailOptions->getCronjobNotification()
2497 );
2498 }
2499 }
Class UserMail this class handles user mails.

Referenced by importEndTag().

+ Here is the caller graph for this function:

◆ verifyBeginTag()

ilUserImportParser::verifyBeginTag (   $a_xml_parser,
  $a_name,
  $a_attribs 
)

handler for begin of element

Definition at line 619 of file class.ilUserImportParser.php.

620 {
621 global $lng;
622
623 switch($a_name)
624 {
625 case "Role":
626 if (is_null($a_attribs['Id'])
627 || $a_attribs['Id'] == "")
628 {
629 $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_attribute_missing"),"Role","Id"));
630 }
631 $this->current_role_id = $a_attribs["Id"];
632 $this->current_role_type = $a_attribs["Type"];
633 if ($this->current_role_type != 'Global'
634 && $this->current_role_type != 'Local')
635 {
636 $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_attribute_missing"),"Role","Type"));
637 }
638 $this->current_role_action = (is_null($a_attribs["Action"])) ? "Assign" : $a_attribs["Action"];
639 if ($this->current_role_action != "Assign"
640 && $this->current_role_action != "AssignWithParents"
641 && $this->current_role_action != "Detach")
642 {
643 $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_attribute_value_illegal"),"Role","Action",$a_attribs["Action"]));
644 }
645 if ($this->action == "Insert"
646 && $this->current_role_action == "Detach")
647 {
648 $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_attribute_value_inapplicable"),"Role","Action",$this->current_role_action,$this->action));
649 }
650 if ($this->action == "Delete")
651 {
652 $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_inapplicable"),"Role","Delete"));
653 }
654 break;
655
656 case "User":
657 $this->userCount++;
658 $this->userObj = new ilObjUser();
659 $this->userObj->setLanguage($a_attribs["Language"]);
660 $this->userObj->setImportId($a_attribs["Id"]);
661 $this->currentPrefKey = null;
662 // if we have an object id, store it
663 $this->user_id = -1;
664
665 if (!is_null($a_attribs["Id"]) && $this->getUserMappingMode() == IL_USER_MAPPING_ID)
666 {
667 if (is_numeric($a_attribs["Id"]))
668 {
669 $this->user_id = $a_attribs["Id"];
670 }
671 elseif ($id = ilUtil::__extractId ($a_attribs["Id"], IL_INST_ID))
672 {
673 $this->user_id = $id;
674 }
675 }
676
677 $this->action = (is_null($a_attribs["Action"])) ? "Insert" : $a_attribs["Action"];
678 if ($this->action != "Insert"
679 && $this->action != "Update"
680 && $this->action != "Delete")
681 {
682 $this->logFailure($this->userObj->getImportId(), sprintf($lng->txt("usrimport_xml_attribute_value_illegal"),"User","Action",$a_attribs["Action"]));
683 }
684 $this->currPassword = null;
685 $this->currPasswordType = null;
686 $this->currPasswordSalt = null;
687 break;
688
689 case 'Password':
690 $this->currPasswordType = $a_attribs['Type'];
691 $this->currPasswordSalt = $a_attribs['Salt'];
692 break;
693 case "AuthMode":
694 if (array_key_exists("type", $a_attribs))
695 {
696 switch($a_attribs["type"])
697 {
698 case "default":
699 case "local":
700 case "ldap":
701
702 if(strcmp('ldap', $a_attribs['type']) === 0)
703 {
704 // no server id provided
705 include_once './Services/LDAP/classes/class.ilLDAPServer.php';
707 if(count($list) != 1)
708 {
709 $this->logFailure(
710 $this->userObj->getImportId(),
711 sprintf($lng->txt("usrimport_xml_attribute_value_illegal"),"AuthMode","type",$a_attribs['type']));
712 }
713 }
714 break;
715
716 case "radius":
717 case "shibboleth":
718 case "script":
719 case "cas":
720 case "soap":
721 case "openid":
722 // begin-patch auth_plugin
723 default:
724 $this->userObj->setAuthMode($a_attribs["type"]);
725 break;
726 /*
727 default:
728 $this->logFailure($this->userObj->getImportId(), sprintf($lng->txt("usrimport_xml_attribute_value_illegal"),"AuthMode","type",$a_attribs["type"]));
729 break;
730 *
731 */
732 }
733 }
734 else
735 {
736 $this->logFailure($this->userObj->getImportId(), sprintf($lng->txt("usrimport_xml_attribute_value_illegal"),"AuthMode","type",""));
737 }
738 break;
739 case 'Pref':
740 $this->currentPrefKey = $a_attribs["key"];
741 break;
742
743 }
744 }

References ilSaxParser\$lng, ilUtil\__extractId(), ilLDAPServer\_getActiveServerList(), getUserMappingMode(), IL_USER_MAPPING_ID, and logFailure().

Referenced by handlerBeginTag().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ verifyEndTag()

ilUserImportParser::verifyEndTag (   $a_xml_parser,
  $a_name 
)

handler for end of element when in verify mode.

Definition at line 1749 of file class.ilUserImportParser.php.

1750 {
1751 global $lng,$ilAccess,$ilSetting,$ilObjDataCache;
1752
1753 switch($a_name)
1754 {
1755 case "Role":
1756 $this->roles[$this->current_role_id]["name"] = $this->cdata;
1757 $this->roles[$this->current_role_id]["type"] = $this->current_role_type;
1758 $this->roles[$this->current_role_id]["action"] = $this->current_role_action;
1759 break;
1760
1761 case "User":
1762 $this->userObj->setFullname();
1763 if ($this->user_id != -1 && ($this->action == "Update" || $this->action == "Delete"))
1764 $user_exists = !is_null(ilObjUser::_lookupLogin($this->user_id));
1765 else
1766 $user_exists = ilObjUser::getUserIdByLogin($this->userObj->getLogin()) != 0;
1767
1768 if (is_null($this->userObj->getLogin()))
1769 {
1770 $this->logFailure("---",sprintf($lng->txt("usrimport_xml_element_for_action_required"),"Login", "Insert"));
1771 }
1772
1773 switch ($this->action)
1774 {
1775 case "Insert" :
1776 if ($user_exists and $this->conflict_rule == IL_FAIL_ON_CONFLICT)
1777 {
1778 $this->logWarning($this->userObj->getLogin(),$lng->txt("usrimport_cant_insert"));
1779 }
1780 if (is_null($this->userObj->getGender()) && $this->isFieldRequired("gender"))
1781 {
1782 $this->logFailure($this->userObj->getLogin(),sprintf($lng->txt("usrimport_xml_element_for_action_required"),"Gender", "Insert"));
1783 }
1784 if (is_null($this->userObj->getFirstname()))
1785 {
1786 $this->logFailure($this->userObj->getLogin(),sprintf($lng->txt("usrimport_xml_element_for_action_required"),"Firstname", "Insert"));
1787 }
1788 if (is_null($this->userObj->getLastname()))
1789 {
1790 $this->logFailure($this->userObj->getLogin(),sprintf($lng->txt("usrimport_xml_element_for_action_required"),"Lastname", "Insert"));
1791 }
1792 if (count($this->roles) == 0)
1793 {
1794 $this->logFailure($this->userObj->getLogin(),sprintf($lng->txt("usrimport_xml_element_for_action_required"),"Role", "Insert"));
1795 }
1796 else
1797 {
1798 $has_global_role = false;
1799 foreach ($this->roles as $role)
1800 {
1801 if ($role['type'] == 'Global')
1802 {
1803 $has_global_role = true;
1804 break;
1805 }
1806 }
1807 if (! $has_global_role)
1808 {
1809 $this->logFailure($this->userObj->getLogin(),sprintf($lng->txt("usrimport_global_role_for_action_required"),"Insert"));
1810 }
1811 }
1812 break;
1813 case "Update" :
1814 if(!$user_exists)
1815 {
1816 $this->logWarning($this->userObj->getLogin(),$lng->txt("usrimport_cant_update"));
1817 }
1818 elseif($this->user_id != -1 && !is_null($this->userObj->getLogin()))
1819 // check if someone owns the new login name!
1820 {
1821 $someonesId = ilObjUser::_lookupId($this->userObj->getLogin());
1822
1823 if (is_numeric($someonesId ) && $someonesId != $this->user_id) {
1824 $this->logFailure($this->userObj->getLogin(), $lng->txt("usrimport_login_is_not_unique"));
1825 }
1826 }
1827 break;
1828 case "Delete" :
1829 if(!$user_exists)
1830 {
1831 $this->logWarning($this->userObj->getLogin(),$lng->txt("usrimport_cant_delete"));
1832 }
1833 break;
1834 }
1835
1836 // init role array for next user
1837 $this->roles = array();
1838 break;
1839
1840 case "Login":
1841 if (array_key_exists($this->cdata, $this->logins))
1842 {
1843 $this->logWarning($this->cdata, $lng->txt("usrimport_login_is_not_unique"));
1844 }
1845 else
1846 {
1847 $this->logins[$this->cdata] = $this->cdata;
1848 }
1849 $this->userObj->setLogin($this->cdata);
1850 break;
1851
1852 case "Password":
1853 switch ($this->currPasswordType)
1854 {
1855 case "BCRYPT":
1856 if(!strlen($this->currPasswordSalt))
1857 {
1858 $this->logFailure($this->userObj->getLogin(), $lng->txt("usrimport_xml_pw_bcrypt_missing_salt"));
1859 }
1860 $this->userObj->setPasswd($this->cdata, IL_PASSWD_CRYPTED);
1861 $this->userObj->setPasswordEncodingType('bcrypt');
1862 $this->userObj->setPasswordSalt($this->currPasswordSalt);
1863 break;
1864
1865 case "PLAIN":
1866 $this->userObj->setPasswd($this->cdata, IL_PASSWD_PLAIN);
1867 $this->acc_mail->setUserPassword($this->currPassword);
1868 break;
1869
1870 default :
1871 $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_attribute_value_illegal"),"Type","Password",$this->currPasswordType));
1872 break;
1873 }
1874 break;
1875
1876 case "Firstname":
1877 $this->userObj->setFirstname($this->cdata);
1878 break;
1879
1880 case "Lastname":
1881 $this->userObj->setLastname($this->cdata);
1882 break;
1883
1884 case "Title":
1885 $this->userObj->setUTitle($this->cdata);
1886 break;
1887
1888 case "Gender":
1889 if ($this->cdata != "m"
1890 && $this->cdata != "f")
1891 {
1892 $this->logFailure(
1893 $this->userObj->getLogin(),
1894 sprintf($lng->txt("usrimport_xml_element_content_illegal"),"Gender",$this->cdata)
1895 );
1896 }
1897 $this->userObj->setGender($this->cdata);
1898 break;
1899
1900 case "Email":
1901 $this->userObj->setEmail($this->cdata);
1902 break;
1903
1904 case "Institution":
1905 $this->userObj->setInstitution($this->cdata);
1906 break;
1907
1908 case "Street":
1909 $this->userObj->setStreet($this->cdata);
1910 break;
1911
1912 case "City":
1913 $this->userObj->setCity($this->cdata);
1914 break;
1915
1916 case "PostalCode":
1917 $this->userObj->setZipCode($this->cdata);
1918 break;
1919
1920 case "Country":
1921 $this->userObj->setCountry($this->cdata);
1922 break;
1923
1924 case "SelCountry":
1925 $this->userObj->setSelectedCountry($this->cdata);
1926 break;
1927
1928 case "PhoneOffice":
1929 $this->userObj->setPhoneOffice($this->cdata);
1930 break;
1931
1932 case "PhoneHome":
1933 $this->userObj->setPhoneHome($this->cdata);
1934 break;
1935
1936 case "PhoneMobile":
1937 $this->userObj->setPhoneMobile($this->cdata);
1938 break;
1939
1940 case "Fax":
1941 $this->userObj->setFax($this->cdata);
1942 break;
1943
1944 case "Hobby":
1945 $this->userObj->setHobby($this->cdata);
1946 break;
1947
1948 case "GeneralInterest":
1949 case "OfferingHelp":
1950 case "LookingForHelp":
1951 $this->multi_values[$a_name][] = $this->cdata;
1952 break;
1953
1954 case "Comment":
1955 $this->userObj->setComment($this->cdata);
1956 break;
1957
1958 case "Department":
1959 $this->userObj->setDepartment($this->cdata);
1960 break;
1961
1962 case "Matriculation":
1963 $this->userObj->setMatriculation($this->cdata);
1964 break;
1965
1966 case "ExternalAccount":
1967//echo "-".$this->userObj->getAuthMode()."-".$this->userObj->getLogin()."-";
1968 $am = ($this->userObj->getAuthMode() == "default" || $this->userObj->getAuthMode() == "")
1969 ? ilAuthUtils::_getAuthModeName($ilSetting->get('auth_mode'))
1970 : $this->userObj->getAuthMode();
1971 $loginForExternalAccount = (trim($this->cdata) == "")
1972 ? ""
1973 : ilObjUser::_checkExternalAuthAccount($am, trim($this->cdata));
1974 switch ($this->action)
1975 {
1976 case "Insert" :
1977 if ($loginForExternalAccount != "")
1978 {
1979 $this->logWarning($this->userObj->getLogin(), $lng->txt("usrimport_no_insert_ext_account_exists")." (".$this->cdata.")");
1980 }
1981 break;
1982
1983 case "Update" :
1984 if ($loginForExternalAccount != "")
1985 {
1986 $externalAccountHasChanged = trim($this->cdata) != ilObjUser::_lookupExternalAccount($this->user_id);
1987 if ($externalAccountHasChanged && trim($loginForExternalAccount) != trim($this->userObj->getLogin()))
1988 {
1989 $this->logWarning($this->userObj->getLogin(),
1990 $lng->txt("usrimport_no_update_ext_account_exists")." (".$this->cdata." for ".$loginForExternalAccount.")");
1991 }
1992 }
1993 break;
1994
1995 }
1996 if ($externalAccountHasChanged)
1997 $this->userObj->setExternalAccount(trim($this->cdata));
1998 break;
1999
2000 case "Active":
2001 if ($this->cdata != "true"
2002 && $this->cdata != "false")
2003 {
2004 $this->logFailure($this->userObj->getLogin(),
2005 sprintf($lng->txt("usrimport_xml_element_content_illegal"),"Active",$this->cdata));
2006 }
2007 $this->currActive = $this->cdata;
2008 break;
2009 case "TimeLimitOwner":
2010 if (!preg_match("/\d+/", $this->cdata))
2011 {
2012 $this->logFailure($this->userObj->getLogin(),
2013 sprintf($lng->txt("usrimport_xml_element_content_illegal"),"TimeLimitOwner",$this->cdata));
2014 }
2015 elseif(!$ilAccess->checkAccess('cat_administrate_users','',$this->cdata))
2016 {
2017 $this->logFailure($this->userObj->getLogin(),
2018 sprintf($lng->txt("usrimport_xml_element_content_illegal"),"TimeLimitOwner",$this->cdata));
2019 }
2020 elseif($ilObjDataCache->lookupType($ilObjDataCache->lookupObjId($this->cdata)) != 'cat' && !(int) $this->cdata == USER_FOLDER_ID)
2021 {
2022 $this->logFailure($this->userObj->getLogin(),
2023 sprintf($lng->txt("usrimport_xml_element_content_illegal"),"TimeLimitOwner",$this->cdata));
2024
2025 }
2026 $this->userObj->setTimeLimitOwner($this->cdata);
2027 break;
2028 case "TimeLimitUnlimited":
2029 switch (strtolower($this->cdata))
2030 {
2031 case "true":
2032 case "1":
2033 $this->userObj->setTimeLimitUnlimited(1);
2034 break;
2035 case "false":
2036 case "0":
2037 $this->userObj->setTimeLimitUnlimited(0);
2038 break;
2039 default:
2040 $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_content_illegal"),"TimeLimitUnlimited",$this->cdata));
2041 break;
2042 }
2043 break;
2044 case "TimeLimitFrom":
2045 // Accept datetime or Unix timestamp
2046 if (strtotime($this->cdata) === false && ! is_numeric($this->cdata))
2047 {
2048 $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_content_illegal"),"TimeLimitFrom",$this->cdata));
2049 }
2050 $this->userObj->setTimeLimitFrom($this->cdata);
2051 break;
2052 case "TimeLimitUntil":
2053 // Accept datetime or Unix timestamp
2054 if (strtotime($this->cdata) === false && ! is_numeric($this->cdata))
2055 {
2056 $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_content_illegal"),"TimeLimitUntil",$this->cdata));
2057 }
2058 $this->userObj->setTimeLimitUntil($this->cdata);
2059 break;
2060 case "TimeLimitMessage":
2061 switch (strtolower($this->cdata))
2062 {
2063 case "1":
2064 $this->userObj->setTimeLimitMessage(1);
2065 break;
2066 case "0":
2067 $this->userObj->setTimeLimitMessage(0);
2068 break;
2069 default:
2070 $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_content_illegal"),"TimeLimitMessage",$this->cdata));
2071 break;
2072 }
2073 break;
2074 case "ApproveDate":
2075 // Accept datetime or Unix timestamp
2076 if (strtotime($this->cdata) === false && ! is_numeric($this->cdata) && !$this->cdata == "0000-00-00 00:00:00")
2077 {
2078 $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_content_illegal"),"ApproveDate",$this->cdata));
2079 }
2080 break;
2081 case "AgreeDate":
2082 // Accept datetime or Unix timestamp
2083 if (strtotime($this->cdata) === false && ! is_numeric($this->cdata) && !$this->cdata == "0000-00-00 00:00:00")
2084 {
2085 $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_content_illegal"),"AgreeDate",$this->cdata));
2086 }
2087 break;
2088 case "Pref":
2089 if ($this->currentPrefKey != null)
2090 $this->verifyPref($this->currentPrefKey, $this->cdata);
2091 $this->currentPrefKey == null;
2092 }
2093 }
static _lookupLogin($a_user_id)
lookup login
static _lookupId($a_user_str)
Lookup id by login.

References $ilSetting, ilSaxParser\$lng, ilObjUser\_checkExternalAuthAccount(), ilAuthUtils\_getAuthModeName(), ilObjUser\_lookupExternalAccount(), ilObjUser\_lookupId(), ilObjUser\_lookupLogin(), ilObjUser\getUserIdByLogin(), IL_FAIL_ON_CONFLICT, IL_PASSWD_CRYPTED, IL_PASSWD_PLAIN, logFailure(), logWarning(), USER_FOLDER_ID, and verifyPref().

Referenced by handlerEndTag().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ verifyPref()

ilUserImportParser::verifyPref (   $key,
  $value 
)
private

Definition at line 2399 of file class.ilUserImportParser.php.

2399 {
2400 switch ($key) {
2401 case 'mail_linebreak':
2402 case 'hits_per_page':
2403 if (!is_numeric($value) || $value < 0)
2404 $this->logFailure("---", "Wrong value '$value': Positiv numeric value expected for preference $key.");
2405 break;
2406 case 'language':
2407 case 'skin':
2408 case 'style':
2409 case 'ilPageEditor_HTMLMode':
2410 case 'ilPageEditor_JavaScript':
2411 case 'ilPageEditor_MediaMode':
2412 case 'tst_javascript':
2413 case 'tst_lastquestiontype':
2414 case 'tst_multiline_answers':
2415 case 'tst_use_previous_answers':
2416 case 'graphicalAnswerSetting':
2417 case 'priv_feed_pass':
2418 $this->logFailure("---", "Preference $key is not supported.");
2419 break;
2420 case 'public_city':
2421 case 'public_country':
2422 case 'public_department':
2423 case 'public_email':
2424 case 'public_fax':
2425 case 'public_hobby':
2426 case 'public_institution':
2427 case 'public_matriculation':
2428 case 'public_phone':
2429 case 'public_phone_home':
2430 case 'public_phone_mobile':
2431 case 'public_phone_office':
2432 case 'public_street':
2433 case 'public_upload':
2434 case 'public_zip':
2435 case 'public_interests_general':
2436 case 'public_interests_help_offered':
2437 case 'public_interests_help_looking':
2438 case 'send_info_mails':
2439 case 'hide_own_online_status':
2440 if (!in_array($value, array('y', 'n')))
2441 $this->logFailure("---", "Wrong value '$value': Value 'y' or 'n' expected for preference $key.");
2442 break;
2443 case 'bs_allow_to_contact_me':
2444 if(!in_array($value, array('y', 'n')))
2445 {
2446 $this->logFailure("---", "Wrong value '$value': Value 'y' or 'n' expected for preference $key.");
2447 }
2448 break;
2449 case 'public_profile':
2450 if (!in_array($value, array('y', 'n', 'g')))
2451 $this->logFailure("---", "Wrong value '$value': Value 'y', 'g' or 'n' expected for preference $key.");
2452 break;
2453 case 'show_users_online':
2454 if (!in_array($value, array('y', 'n', 'associated')))
2455 $this->logFailure("---", "Wrong value '$value': Value 'y' or 'n' or 'associated' expected for preference $key.");
2456 break;
2457 case 'mail_incoming_type':
2458 if (!in_array((int) $value, array("0","1","2")))
2459 $this->logFailure("---", "Wrong value '$value': Value \"0\" (LOCAL),\"1\" (EMAIL) or \"2\" (BOTH) expected for preference $key.");
2460 break;
2461 case 'weekstart':
2462 if (!in_array($value, array ("0","1")))
2463 $this->logFailure("---", "Wrong value '$value': Value \"0\" (Sunday) or \"1\" (Monday) expected for preference $key.");
2464 break;
2465
2466 case 'mail_signature':
2467 break;
2468 case 'user_tz':
2469 include_once('Services/Calendar/classes/class.ilTimeZone.php');
2470 try {
2471 $tz = ilTimeZone::_getInstance($value);
2472 return true;
2473 } catch (ilTimeZoneException $tze) {
2474 $this->logFailure("---", "Wrong value '$value': Invalid timezone $value detected for preference $key.");
2475 }
2476 break;
2477 default:
2479 $this->logFailure("---", "Preference $key is not supported.");
2480 break;
2481 }
2482 }
Class for TimeZone exceptions.
static _getInstance($a_tz='')
get instance by timezone

References $tz, ilTimeZone\_getInstance(), ilUserXMLWriter\isPrefExportable(), and logFailure().

Referenced by verifyEndTag().

+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $account_mail_cache

ilUserImportParser::$account_mail_cache = array()
staticprivate

Definition at line 275 of file class.ilUserImportParser.php.

◆ $action

ilUserImportParser::$action
The Action attribute determines what to do for the current User element.

This variable supports the following values: "Insert","Update","Delete".

Definition at line 65 of file class.ilUserImportParser.php.

Referenced by logSuccess().

◆ $approve_date_set

ilUserImportParser::$approve_date_set = false

Definition at line 51 of file class.ilUserImportParser.php.

◆ $conflict_rule

ilUserImportParser::$conflict_rule

Conflict handling rule.

Values: IL_FAIL_ON_CONFLICT IL_UPDATE_ON_CONFLICT IL_IGNORE_ON_CONFLICT

Definition at line 93 of file class.ilUserImportParser.php.

◆ $currActive

ilUserImportParser::$currActive

The active state of the current user.

Definition at line 182 of file class.ilUserImportParser.php.

◆ $current_messenger_type

ilUserImportParser::$current_messenger_type
private

Definition at line 270 of file class.ilUserImportParser.php.

◆ $currPassword

ilUserImportParser::$currPassword

The password of the current user.

Definition at line 173 of file class.ilUserImportParser.php.

◆ $currPasswordSalt

ilUserImportParser::$currPasswordSalt
protected

Definition at line 178 of file class.ilUserImportParser.php.

◆ $currPasswordType

ilUserImportParser::$currPasswordType

The password type of the current user.

Definition at line 169 of file class.ilUserImportParser.php.

◆ $disableSkin

ilUserImportParser::$disableSkin

Indicates if the skins are enabled.

Definition at line 250 of file class.ilUserImportParser.php.

◆ $error_level

ilUserImportParser::$error_level
This variable is used to report the error level of the validation process
or the importing process.

Values:  IL_IMPORT_SUCCESS
         IL_IMPORT_WARNING
         IL_IMPORT_FAILURE

Meaning of the values when in validation mode: IL_IMPORT_WARNING Some of the entity actions can not be processed as specified in the XML file. One or more of the following conflicts have occurred:

  • An "Insert" action has been specified for a user who is already in the database.
  • An "Update" action has been specified for a user who is not in the database.
  • A "Delete" action has been specified for a user who is not in the database. IL_IMPORT_FAILURE Some of the XML elements are invalid.

Meaning of the values when in import mode: IL_IMPORT_WARNING Some of the entity actions have not beeen processed as specified in the XML file.

In IL_UPDATE_ON_CONFLICT mode, the following may have occured:

  • An "Insert" action has been replaced by a "Update" action for a user who is already in the database.
    • An "Update" action has been replaced by a "Insert" action for a user who is not in the database.
  • A "Delete" action has been replaced by a "Ignore" action for a user who is not in the database.

In IL_IGNORE_ON_CONFLICT mode, the following may have occured:

  • An "Insert" action has been replaced by a "Ignore" action for a user who is already in the database.
  • An "Update" action has been replaced by a "Ignore" action for a user who is not in the database.
    • A "Delete" action has been replaced by a "Ignore" action for a user who is not in the database.

IL_IMPORT_FAILURE The import could not be completed.

In IL_FAIL_ON_CONFLICT mode, the following may have occured:

  • An "Insert" action has failed for a user who is already in the database.
  • An "Update" action has failed for a user who is not in the database.
  • A "Delete" action has failed for a user who is not in the database.

Definition at line 164 of file class.ilUserImportParser.php.

Referenced by getErrorLevel().

◆ $folder_id

ilUserImportParser::$folder_id

Definition at line 59 of file class.ilUserImportParser.php.

Referenced by getFolderId().

◆ $hideSkin

ilUserImportParser::$hideSkin

Indicates if the skins are hidden.

Definition at line 245 of file class.ilUserImportParser.php.

◆ $localRoleCache

ilUserImportParser::$localRoleCache

Cached local roles.

This is used to speed up access to local roles. This is an associative array. The key is either a role_id or a role_id with the string "_courseMembersObject" appended. The value is a role object or the course members object for which the role is defined

Definition at line 210 of file class.ilUserImportParser.php.

◆ $logins

ilUserImportParser::$logins

This variable is used to collect each login that we encounter in the import data.

This variable is needed to detect duplicate logins in the import data. The variable is an associative array. (I would prefer using a set, but PHP does not appear to support sets.) Keys are logins. Values are logins.

Definition at line 84 of file class.ilUserImportParser.php.

◆ $mapping_mode

ilUserImportParser::$mapping_mode

Definition at line 201 of file class.ilUserImportParser.php.

Referenced by getUserMappingMode().

◆ $parentRolesCache

ilUserImportParser::$parentRolesCache

Cached parent roles.

This is used to speed up assignment to local roles with parents. This is an associative array. The key is a role_id . The value is an array of role_ids containing all parent roles.

Definition at line 225 of file class.ilUserImportParser.php.

◆ $personalPicture

ilUserImportParser::$personalPicture

Cached personal picture of the actual user This is used because the ilObjUser object has no field for the personal picture.

Definition at line 216 of file class.ilUserImportParser.php.

◆ $protocol

ilUserImportParser::$protocol
The variable holds the protocol of the import.

This variable is an associative array.

  • Keys are login names of users or "missing login", if the login name is missing.
  • Values are an array of error messages associated with the login. If the value array is empty, then the user was imported successfully.

Definition at line 74 of file class.ilUserImportParser.php.

Referenced by getProtocol().

◆ $roles

ilUserImportParser::$roles

Definition at line 60 of file class.ilUserImportParser.php.

Referenced by getCollectedRoles().

◆ $send_mail

ilUserImportParser::$send_mail

Definition at line 101 of file class.ilUserImportParser.php.

Referenced by isSendMail().

◆ $skin

ilUserImportParser::$skin

ILIAS skin.

Definition at line 230 of file class.ilUserImportParser.php.

◆ $style

ilUserImportParser::$style

ILIAS style.

Definition at line 235 of file class.ilUserImportParser.php.

Referenced by ilUserImportParser().

◆ $time_limit_owner_set

ilUserImportParser::$time_limit_owner_set = false

Definition at line 53 of file class.ilUserImportParser.php.

◆ $time_limit_set

ilUserImportParser::$time_limit_set = false

Definition at line 52 of file class.ilUserImportParser.php.

◆ $updateLookAndSkin

ilUserImportParser::$updateLookAndSkin = false

boolean to determine if look and skin should be updated

Definition at line 58 of file class.ilUserImportParser.php.

◆ $user_id

ilUserImportParser::$user_id

Definition at line 257 of file class.ilUserImportParser.php.

Referenced by importEndTag().

◆ $user_mapping

ilUserImportParser::$user_mapping

Definition at line 193 of file class.ilUserImportParser.php.

Referenced by getUserMapping().

◆ $userCount

ilUserImportParser::$userCount

The count of user elements in the XML file.

Definition at line 186 of file class.ilUserImportParser.php.

Referenced by getUserCount().

◆ $userObj

ilUserImportParser::$userObj
private

Definition at line 263 of file class.ilUserImportParser.php.

◆ $userStyles

ilUserImportParser::$userStyles

User assigned styles.

Definition at line 240 of file class.ilUserImportParser.php.


The documentation for this class was generated from the following file: