ILIAS  release_6 Revision v6.24-5-g0c8bfefb3b8
ilUserImportParser Class Reference

User Import Parser. More...

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

Public Member Functions

 __construct ($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
 __construct ($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
 __construct ($error_class=null)
 Constructor. More...
 
 _PEAR ()
 Destructor (the emulated type of...). 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...
 
 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
 The Action attribute determines what to do for the current User element. More...
 
 $protocol
 The variable holds the protocol of the import. More...
 
 $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
 This variable is used to report the error level of the validation process or the importing process. More...
 
 $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)
 determine if a field $fieldname is to a required field (global setting) More...
 
- 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

 $recommended_content_manager
 
 $user_settings_config
 

Private Member Functions

 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
 

Additional Inherited Members

- Static Public Member Functions inherited from PEAR
static & 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...
 
static setErrorHandling ($mode=null, $options=null)
 Sets how errors generated by this object should be handled. More...
 

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 50 of file class.ilUserImportParser.php.

Constructor & Destructor Documentation

◆ __construct()

ilUserImportParser::__construct (   $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 289 of file class.ilUserImportParser.php.

290 {
291 global $DIC;
292
293 $global_settings = $DIC->settings();
294
295 $this->roles = array();
296 $this->mode = $a_mode;
297 $this->conflict_rule = $a_conflict_rule;
298 $this->error_level = IL_IMPORT_SUCCESS;
299 $this->protocol = array();
300 $this->logins = array();
301 $this->userCount = 0;
302 $this->localRoleCache = array();
303 $this->parentRolesCache = array();
304 $this->send_mail = false;
305 $this->mapping_mode = IL_USER_MAPPING_LOGIN;
306
307 $this->user_settings_config = new ilUserSettingsConfig();
308
309 // get all active style instead of only assigned ones -> cannot transfer all to another otherwise
310 $this->userStyles = array();
311 include_once './Services/Style/System/classes/class.ilStyleDefinition.php';
312 $skins = ilStyleDefinition::getAllSkins();
313
314 if (is_array($skins)) {
315 foreach ($skins as $skin) {
316 foreach ($skin->getStyles() as $style) {
317 include_once("./Services/Style/System/classes/class.ilSystemStyleSettings.php");
319 continue;
320 }
321 $this->userStyles [] = $skin->getId() . ":" . $style->getId();
322 }
323 }
324 }
325
326 $this->hideSkin = (!$this->user_settings_config->isVisible("skin_style"));
327 $this->disableSkin = (!$this->user_settings_config->isChangeable("skin_style"));
328
329 include_once("Services/Mail/classes/class.ilAccountMail.php");
330 $this->acc_mail = new ilAccountMail();
331 $this->acc_mail->setAttachConfiguredFiles(true);
332 $this->acc_mail->useLangVariablesAsFallback(true);
333
334 $this->recommended_content_manager = new ilRecommendedContentManager();
335
336 parent::__construct($a_xml_file);
337 }
const IL_IMPORT_SUCCESS
const IL_USER_MAPPING_LOGIN
Class ilAccountMail.
Recommended content manager (business logic)
static _lookupActivatedStyle($a_skin, $a_style)
lookup if a style is activated
User settings configuration (what preferences can be visible/changed/...)
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
$DIC
Definition: xapitoken.php:46

References $DIC, $skin, $style, ILIAS\GlobalScreen\Provider\__construct(), ilSystemStyleSettings\_lookupActivatedStyle(), IL_IMPORT_SUCCESS, and IL_USER_MAPPING_LOGIN.

+ Here is the call graph for this function:

Member Function Documentation

◆ assignToRole()

ilUserImportParser::assignToRole (   $a_user_obj,
  $a_role_id 
)

Assigns a user to a role.

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

802 {
803 require_once "./Services/AccessControl/classes/class.ilObjRole.php";
804 include_once('./Services/Object/classes/class.ilObject.php');
805 #require_once "Modules/Course/classes/class.ilObjCourse.php";
806 #require_once "Modules/Course/classes/class.ilCourseParticipants.php";
807
808 global $DIC;
809
810 $rbacreview = $DIC['rbacreview'];
811 $rbacadmin = $DIC['rbacadmin'];
812 $tree = $DIC['tree'];
813
814 // Do nothing, if the user is already assigned to the role.
815 // Specifically, we do not want to put a course object or
816 // group object on the personal desktop again, if a user
817 // has removed it from the personal desktop.
818 if ($rbacreview->isAssigned($a_user_obj->getId(), $a_role_id)) {
819 return;
820 }
821
822 // If it is a course role, use the ilCourseMember object to assign
823 // the user to the role
824
825 $rbacadmin->assignUser($a_role_id, $a_user_obj->getId(), true);
826 $obj_id = $rbacreview->getObjectOfRole($a_role_id);
827 switch ($type = ilObject::_lookupType($obj_id)) {
828 case 'grp':
829 case 'crs':
830 $ref_ids = ilObject::_getAllReferences($obj_id);
831 $ref_id = current((array) $ref_ids);
832 if ($ref_id) {
833 // deactivated for now, see discussion at
834 // https://docu.ilias.de/goto_docu_wiki_wpage_5620_1357.html
835 //$this->recommended_content_manager->addObjectRecommendation($a_user_obj->getId(), $ref_id);
836 }
837 break;
838 default:
839 break;
840 }
841 }
static _getAllReferences($a_id)
get all reference ids of object
static _lookupType($a_id, $a_reference=false)
lookup object type
$type

References $DIC, $type, 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 894 of file class.ilUserImportParser.php.

895 {
896 $this->assignToRole($a_user_obj, $a_role_id);
897
898 $parent_role_ids = $this->getParentRoleIds($a_role_id);
899 foreach ($parent_role_ids as $parent_role_id) {
900 $this->assignToRole($a_user_obj, $parent_role_id);
901 }
902 }
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 391 of file class.ilUserImportParser.php.

392 {
393 $tag = "<";
394
395 if ($type == "end") {
396 $tag .= "/";
397 }
398
399 $tag .= $name;
400
401 if (is_array($attr)) {
402 foreach ($attr as $k => $v) {
403 $tag .= " " . $k . "=\"$v\"";
404 }
405 }
406
407 $tag .= ">";
408
409 return $tag;
410 }
if($format !==null) $name
Definition: metadata.php:230

References $name, and $type.

◆ 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 2253 of file class.ilUserImportParser.php.

2254 {
2255 include_once "Services/User/classes/class.ilUserProfile.php";
2256 return ilUserProfile::isProfileIncomplete($user_obj);
2257 }
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 906 of file class.ilUserImportParser.php.

907 {
908 global $DIC;
909
910 $rbacreview = $DIC['rbacreview'];
911 $rbacadmin = $DIC['rbacadmin'];
912 $tree = $DIC['tree'];
913
914 $rbacadmin->deassignUser($a_role_id, $a_user_obj->getId());
915
916 if (substr(ilObject::_lookupTitle($a_role_id), 0, 6) == 'il_crs' or
917 substr(ilObject::_lookupTitle($a_role_id), 0, 6) == 'il_grp') {
918 $obj = $rbacreview->getObjectOfRole($a_role_id);
919 $ref = ilObject::_getAllReferences($obj);
920 $ref_id = end($ref);
921 $this->recommended_content_manager->removeObjectRecommendation($a_user_obj->getId(), $ref_id);
922 }
923 }
static _lookupTitle($a_id)
lookup object title

References $DIC, ilObject\_getAllReferences(), and ilObject\_lookupTitle().

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 435 of file class.ilUserImportParser.php.

436 {
437 switch ($a_name) {
438 case "Role":
439 // detect numeric, ilias id (then extract role id) or alphanumeric
440 $this->current_role_id = $a_attribs["Id"];
441 if ($internal_id = ilUtil::__extractId($this->current_role_id, IL_INST_ID)) {
442 $this->current_role_id = $internal_id;
443 }
444 $this->current_role_type = $a_attribs["Type"];
445
446 break;
447 }
448 }
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 748 of file class.ilUserImportParser.php.

749 {
750 switch ($a_name) {
751 case "Role":
752 $this->roles[$this->current_role_id]["name"] = $this->cdata;
753 $this->roles[$this->current_role_id]["type"] =
754 $this->current_role_type;
755 break;
756 }
757 }

Referenced by handlerEndTag().

+ Here is the caller graph for this function:

◆ getCollectedRoles()

ilUserImportParser::getCollectedRoles ( )

get collected roles

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

2037 {
2038 return $this->roles;
2039 }

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 776 of file class.ilUserImportParser.php.

777 {
778 global $DIC;
779
780 $rbacreview = $DIC['rbacreview'];
781 $rbacadmin = $DIC['rbacadmin'];
782 $tree = $DIC['tree'];
783
784 if (array_key_exists($a_role_id . '_courseMembersObject', $this->localRoleCache)) {
785 return $this->localRoleCache[$a_role_id . '_courseMembersObject'];
786 } else {
787 require_once("Modules/Course/classes/class.ilObjCourse.php");
788 require_once("Modules/Course/classes/class.ilCourseParticipants.php");
789 $course_refs = $rbacreview->getFoldersAssignedToRole($a_role_id, true);
790 $course_ref = $course_refs[0];
791 $course_obj = new ilObjCourse($course_ref, true);
792 $crsmembers_obj = ilCourseParticipants::_getInstanceByObjId($course_obj->getId());
793 $this->localRoleCache[$a_role_id . '_courseMembersObject'] = $crsmembers_obj;
794 return $crsmembers_obj;
795 }
796 }
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
Class ilObjCourse.

References $DIC, and 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 2150 of file class.ilUserImportParser.php.

2151 {
2152 return $this->error_level;
2153 }
$error_level
This variable is used to report the error level of the validation process or the importing process.

References $error_level.

◆ getFolderId()

ilUserImportParser::getFolderId ( )

Definition at line 349 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 846 of file class.ilUserImportParser.php.

847 {
848 global $DIC;
849
850 $rbacreview = $DIC['rbacreview'];
851
852 if (!array_key_exists($a_role_id, $this->parentRolesCache)) {
853 $parent_role_ids = array();
854
855 $role_obj = $this->getRoleObject($a_role_id);
856 $short_role_title = substr($role_obj->getTitle(), 0, 12);
857 $folders = $rbacreview->getFoldersAssignedToRole($a_role_id, true);
858 if (count($folders) > 0) {
859 $all_parent_role_ids = $rbacreview->getParentRoleIds($folders[0]);
860 foreach ($all_parent_role_ids as $parent_role_id => $parent_role_data) {
861 if ($parent_role_id != $a_role_id) {
862 switch (substr($parent_role_data['title'], 0, 12)) {
863 case 'il_crs_admin':
864 case 'il_grp_admin':
865 if ($short_role_title == 'il_crs_admin' || $short_role_title == 'il_grp_admin') {
866 $parent_role_ids[] = $parent_role_id;
867 }
868 break;
869 case 'il_crs_tutor':
870 case 'il_grp_tutor':
871 if ($short_role_title == 'il_crs_tutor' || $short_role_title == 'il_grp_tutor') {
872 $parent_role_ids[] = $parent_role_id;
873 }
874 break;
875 case 'il_crs_membe':
876 case 'il_grp_membe':
877 if ($short_role_title == 'il_crs_membe' || $short_role_title == 'il_grp_membe') {
878 $parent_role_ids[] = $parent_role_id;
879 }
880 break;
881 default:
882 break;
883 }
884 }
885 }
886 }
887 $this->parentRolesCache[$a_role_id] = $parent_role_ids;
888 }
889 return $this->parentRolesCache[$a_role_id];
890 }
getRoleObject($a_role_id)
Returns the parent object of the role folder object which contains the specified role.

References $DIC, and 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 2104 of file class.ilUserImportParser.php.

2105 {
2106 return $this->protocol;
2107 }
$protocol
The variable holds the protocol of the import.

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 2111 of file class.ilUserImportParser.php.

2112 {
2113 global $DIC;
2114
2115 $lng = $DIC['lng'];
2116
2117 $block = new ilTemplate("tpl.usr_import_log_block.html", true, true, "Services/User");
2118 $block->setVariable("TXT_LOG_TITLE", $a_log_title);
2119 $block->setVariable("TXT_MESSAGE_ID", $lng->txt("login"));
2120 $block->setVariable("TXT_MESSAGE_TEXT", $lng->txt("message"));
2121 foreach ($this->getProtocol() as $login => $messages) {
2122 $block->setCurrentBlock("log_row");
2123 $reason = "";
2124 foreach ($messages as $message) {
2125 if ($reason == "") {
2126 $reason = $message;
2127 } else {
2128 $reason = $reason . "<br>" . $message;
2129 }
2130 }
2131 $block->setVariable("MESSAGE_ID", $login);
2132 $block->setVariable("MESSAGE_TEXT", $reason);
2133 $block->parseCurrentBlock();
2134 }
2135 return $block->get();
2136 }
special template class to simplify handling of ITX/PEAR
getProtocol()
Returns the protocol.
$login
Definition: cron.php:13
$messages
Definition: xapiexit.php:5
$message
Definition: xapiexit.php:14

References $DIC, ilSaxParser\$lng, $login, $message, $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 762 of file class.ilUserImportParser.php.

763 {
764 if (array_key_exists($a_role_id, $this->localRoleCache)) {
765 return $this->localRoleCache[$a_role_id];
766 } else {
767 $role_obj = new ilObjRole($a_role_id, false);
768 $role_obj->read();
769 $this->localRoleCache[$a_role_id] = $role_obj;
770 return $role_obj;
771 }
772 }
Class ilObjRole.

Referenced by getParentRoleIds().

+ Here is the caller graph for this function:

◆ getUserCount()

ilUserImportParser::getUserCount ( )

get count of User elements

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

2044 {
2045 return $this->userCount;
2046 }
$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 2160 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 2216 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 415 of file class.ilUserImportParser.php.

416 {
417 switch ($this->mode) {
418 case IL_EXTRACT_ROLES:
419 $this->extractRolesBeginTag($a_xml_parser, $a_name, $a_attribs);
420 break;
421 case IL_USER_IMPORT:
422 $this->importBeginTag($a_xml_parser, $a_name, $a_attribs);
423 break;
424 case IL_VERIFY:
425 $this->verifyBeginTag($a_xml_parser, $a_name, $a_attribs);
426 break;
427 }
428
429 $this->cdata = "";
430 }
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 2019 of file class.ilUserImportParser.php.

2020 {
2021 // DELETE WHITESPACES AND NEWLINES OF CHARACTER DATA
2022 // TODO: Mit Alex klären, ob das noch benötigt wird $a_data = preg_replace("/\n/","",$a_data);
2023 // TODO: Mit Alex klären, ob das noch benötigt wird $a_data = preg_replace("/\t+/","",$a_data);
2024 if ($a_data != "\n") {
2025 $a_data = preg_replace("/\t+/", " ", $a_data);
2026 }
2027
2028 if (strlen($a_data) > 0) {
2029 $this->cdata .= $a_data;
2030 }
2031 }

◆ handlerEndTag()

ilUserImportParser::handlerEndTag (   $a_xml_parser,
  $a_name 
)

handler for end of element

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

731 {
732 switch ($this->mode) {
733 case IL_EXTRACT_ROLES:
734 $this->extractRolesEndTag($a_xml_parser, $a_name);
735 break;
736 case IL_USER_IMPORT:
737 $this->importEndTag($a_xml_parser, $a_name);
738 break;
739 case IL_VERIFY:
740 $this->verifyEndTag($a_xml_parser, $a_name);
741 break;
742 }
743 }
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:

◆ importBeginTag()

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

handler for begin of element in user import mode

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

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

References $DIC, ilSaxParser\$ilias, ilSaxParser\$lng, ilUtil\__extractId(), ilLDAPServer\_getActiveServerList(), ilSamlIdp\getActiveIdpList(), 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 928 of file class.ilUserImportParser.php.

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

References $DIC, Vendor\Package\$e, 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 2265 of file class.ilUserImportParser.php.

2266 {
2267 $requiredFields = $this->readRequiredFields();
2268 $fieldname = strtolower(trim($fieldname));
2269 return array_key_exists($fieldname, $requiredFields);
2270 }
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 2192 of file class.ilUserImportParser.php.

2193 {
2194 return $this->send_mail;
2195 }

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 2141 of file class.ilUserImportParser.php.

2142 {
2143 return $this->error_level == IL_IMPORT_SUCCESS;
2144 }

References IL_IMPORT_SUCCESS.

◆ logFailure()

ilUserImportParser::logFailure (   $aLogin,
  $aMessage 
)

Writes a failure log message to the protocol.

Parameters
stringlogin
stringmessage

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

2073 {
2074 if (!array_key_exists($aLogin, $this->protocol)) {
2075 $this->protocol[$aLogin] = array();
2076 }
2077 if ($aMessage) {
2078 $this->protocol[$aLogin][] = $aMessage;
2079 }
2080 $this->error_level = IL_IMPORT_FAILURE;
2081 }
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.

Parameters
stringlogin
stringuserid
stringaction

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

2091 {
2092 $this->user_mapping[$userid] = array("login" => $aLogin, "action" => $action, "message" => "successful");
2093 }
$action
The Action attribute determines what to do for the current User element.

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 2054 of file class.ilUserImportParser.php.

2055 {
2056 if (!array_key_exists($aLogin, $this->protocol)) {
2057 $this->protocol[$aLogin] = array();
2058 }
2059 if ($aMessage) {
2060 $this->protocol[$aLogin][] = $aMessage;
2061 }
2062 if ($this->error_level == IL_IMPORT_SUCCESS) {
2063 $this->error_level = IL_IMPORT_WARNING;
2064 }
2065 }
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:

◆ readRequiredFields()

ilUserImportParser::readRequiredFields ( )
private

read required fields

@access private

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

2228 {
2229 global $DIC;
2230
2231 $ilSetting = $DIC['ilSetting'];
2232
2233 if (is_array($this->required_fields)) {
2234 return $this->required_fields;
2235 }
2236 foreach ($ilSetting->getAll() as $field => $value) {
2237 if (substr($field, 0, 8) == 'require_' and $value == 1) {
2238 $value = substr($field, 8);
2239 $this->required_fields[$value] = $value;
2240 }
2241 }
2242 return $this->required_fields ? $this->required_fields : array();
2243 }

References $DIC, and $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 1679 of file class.ilUserImportParser.php.

1680 {
1681 $tempname = ilUtil::ilTempnam() . $filename;
1682 $fh = fopen($tempname, "wb");
1683 if ($fh == false) {
1684 return "";
1685 }
1686 $imagefile = fwrite($fh, $image_data);
1687 fclose($fh);
1688 return $tempname;
1689 }
$filename
Definition: buildRTE.php:89
static ilTempnam($a_temp_path=null)
Returns a unique and non existing Path for e temporary file or 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 2168 of file class.ilUserImportParser.php.

2169 {
2170 if ($_POST["send_mail"] != "" ||
2171 ($this->isSendMail() && $this->userObj->getEmail() != "")) {
2172 $this->acc_mail->setUser($this->userObj);
2173 $this->acc_mail->send();
2174 }
2175 }
$_POST["username"]
isSendMail()
read access to property send mail

References $_POST, and isSendMail().

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 344 of file class.ilUserImportParser.php.

345 {
346 $this->folder_id = $a_folder_id;
347 }

◆ setHandlers()

ilUserImportParser::setHandlers (   $a_xml_parser)

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

Reimplemented from ilSaxParser.

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

360 {
361 xml_set_object($a_xml_parser, $this);
362 xml_set_element_handler($a_xml_parser, 'handlerBeginTag', 'handlerEndTag');
363 xml_set_character_data_handler($a_xml_parser, 'handlerCharacterData');
364 }

◆ setRoleAssignment()

ilUserImportParser::setRoleAssignment (   $a_assign)

set import to local role assignemt

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

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

380 {
381 $this->role_assign = $a_assign;
382 }

◆ setSendMail()

ilUserImportParser::setSendMail (   $value)

write access to property send mail

Parameters
mixed$value

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

2183 {
2184 $this->send_mail = $value ? true: false;
2185 }

◆ 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 2202 of file class.ilUserImportParser.php.

2203 {
2204 if ($value == IL_USER_MAPPING_ID || $value == IL_USER_MAPPING_LOGIN) {
2205 $this->mapping_mode = $value;
2206 } else {
2207 die("wrong argument using methode setUserMappingMethod in " . __FILE__);
2208 }
2209 }

References IL_USER_MAPPING_ID, and IL_USER_MAPPING_LOGIN.

◆ startParsing()

ilUserImportParser::startParsing ( )

start the parser

Reimplemented from ilSaxParser.

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

370 {
371 parent::startParsing();
372 }

◆ updateMailPreferences()

ilUserImportParser::updateMailPreferences (   $usr_id)
private

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

2371 {
2372 if (array_key_exists("mail_incoming_type", $this->prefs) ||
2373 array_key_exists("mail_signature", $this->prefs) ||
2374 array_key_exists("mail_linebreak", $this->prefs)
2375 ) {
2376 include_once("Services/Mail/classes/class.ilMailOptions.php");
2377 $mailOptions = new ilMailOptions($usr_id);
2378
2379 $mailOptions->setLinebreak(array_key_exists("mail_linebreak", $this->prefs) ? $this->prefs["mail_linebreak"] : $mailOptions->getLinebreak());
2380 $mailOptions->setSignature(array_key_exists("mail_signature", $this->prefs) ? $this->prefs["mail_signature"] : $mailOptions->getSignature());
2381 $mailOptions->setIncomingType(array_key_exists("mail_incoming_type", $this->prefs) ? $this->prefs["mail_incoming_type"] : $mailOptions->getIncomingType());
2382 $mailOptions->updateOptions();
2383 }
2384 }
Class ilMailOptions 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 606 of file class.ilUserImportParser.php.

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

References $DIC, ilSaxParser\$lng, ilUtil\__extractId(), ilLDAPServer\_getActiveServerList(), ilSamlIdp\getActiveIdpList(), 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 1694 of file class.ilUserImportParser.php.

1695 {
1696 global $DIC;
1697
1698 $lng = $DIC['lng'];
1699 $ilAccess = $DIC['ilAccess'];
1700 $ilSetting = $DIC['ilSetting'];
1701 $ilObjDataCache = $DIC['ilObjDataCache'];
1702
1703 switch ($a_name) {
1704 case "Role":
1705 $this->roles[$this->current_role_id]["name"] = $this->cdata;
1706 $this->roles[$this->current_role_id]["type"] = $this->current_role_type;
1707 $this->roles[$this->current_role_id]["action"] = $this->current_role_action;
1708 break;
1709
1710 case "User":
1711 $this->userObj->setFullname();
1712 if ($this->user_id != -1 && ($this->action == "Update" || $this->action == "Delete")) {
1713 $user_exists = !is_null(ilObjUser::_lookupLogin($this->user_id));
1714 } else {
1715 $user_exists = ilObjUser::getUserIdByLogin($this->userObj->getLogin()) != 0;
1716 }
1717
1718 if (is_null($this->userObj->getLogin())) {
1719 $this->logFailure("---", sprintf($lng->txt("usrimport_xml_element_for_action_required"), "Login", "Insert"));
1720 }
1721
1722 switch ($this->action) {
1723 case "Insert":
1724 if ($user_exists and $this->conflict_rule == IL_FAIL_ON_CONFLICT) {
1725 $this->logWarning($this->userObj->getLogin(), $lng->txt("usrimport_cant_insert"));
1726 }
1727 if (is_null($this->userObj->getGender()) && $this->isFieldRequired("gender")) {
1728 $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_for_action_required"), "Gender", "Insert"));
1729 }
1730 if (is_null($this->userObj->getFirstname())) {
1731 $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_for_action_required"), "Firstname", "Insert"));
1732 }
1733 if (is_null($this->userObj->getLastname())) {
1734 $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_for_action_required"), "Lastname", "Insert"));
1735 }
1736 if (count($this->roles) == 0) {
1737 $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_for_action_required"), "Role", "Insert"));
1738 } else {
1739 $has_global_role = false;
1740 foreach ($this->roles as $role) {
1741 if ($role['type'] == 'Global') {
1742 $has_global_role = true;
1743 break;
1744 }
1745 }
1746 if (!$has_global_role) {
1747 $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_global_role_for_action_required"), "Insert"));
1748 }
1749 }
1750 break;
1751 case "Update":
1752 if (!$user_exists) {
1753 $this->logWarning($this->userObj->getLogin(), $lng->txt("usrimport_cant_update"));
1754 } elseif ($this->user_id != -1 && !is_null($this->userObj->getLogin())) {
1755 // check if someone owns the new login name!
1756 $someonesId = ilObjUser::_lookupId($this->userObj->getLogin());
1757
1758 if (is_numeric($someonesId) && $someonesId != $this->user_id) {
1759 $this->logFailure($this->userObj->getLogin(), $lng->txt("usrimport_login_is_not_unique"));
1760 }
1761 }
1762 break;
1763 case "Delete":
1764 if (!$user_exists) {
1765 $this->logWarning($this->userObj->getLogin(), $lng->txt("usrimport_cant_delete"));
1766 }
1767 break;
1768 }
1769
1770 // init role array for next user
1771 $this->roles = array();
1772 break;
1773
1774 case "Login":
1775 if (array_key_exists($this->cdata, $this->logins)) {
1776 $this->logWarning($this->cdata, $lng->txt("usrimport_login_is_not_unique"));
1777 } else {
1778 $this->logins[$this->cdata] = $this->cdata;
1779 }
1780 $this->userObj->setLogin($this->cdata);
1781 break;
1782
1783 case "Password":
1784 switch ($this->currPasswordType) {
1785 case "BCRYPT":
1786 $this->userObj->setPasswd($this->cdata, IL_PASSWD_CRYPTED);
1787 $this->userObj->setPasswordEncodingType('bcryptphp');
1788 $this->userObj->setPasswordSalt(null);
1789 break;
1790
1791 case "PLAIN":
1792 $this->userObj->setPasswd($this->cdata, IL_PASSWD_PLAIN);
1793 $this->acc_mail->setUserPassword($this->currPassword);
1794 break;
1795
1796 default:
1797 $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_attribute_value_illegal"), "Type", "Password", $this->currPasswordType));
1798 break;
1799 }
1800 break;
1801
1802 case "Firstname":
1803 $this->userObj->setFirstname($this->cdata);
1804 break;
1805
1806 case "Lastname":
1807 $this->userObj->setLastname($this->cdata);
1808 break;
1809
1810 case "Title":
1811 $this->userObj->setUTitle($this->cdata);
1812 break;
1813
1814 case "Gender":
1815 if (!in_array(strtolower($this->cdata), ['n', 'm', 'f'])) {
1816 $this->logFailure(
1817 $this->userObj->getLogin(),
1818 sprintf($lng->txt("usrimport_xml_element_content_illegal"), "Gender", $this->cdata)
1819 );
1820 }
1821 $this->userObj->setGender($this->cdata);
1822 break;
1823
1824 case "Email":
1825 $this->userObj->setEmail($this->cdata);
1826 break;
1827 case "SecondEmail":
1828 $this->userObj->setSecondEmail($this->cdata);
1829 break;
1830 case "Institution":
1831 $this->userObj->setInstitution($this->cdata);
1832 break;
1833
1834 case "Street":
1835 $this->userObj->setStreet($this->cdata);
1836 break;
1837
1838 case "City":
1839 $this->userObj->setCity($this->cdata);
1840 break;
1841
1842 case "PostalCode":
1843 $this->userObj->setZipCode($this->cdata);
1844 break;
1845
1846 case "Country":
1847 $this->userObj->setCountry($this->cdata);
1848 break;
1849
1850 case "SelCountry":
1851 $this->userObj->setSelectedCountry($this->cdata);
1852 break;
1853
1854 case "PhoneOffice":
1855 $this->userObj->setPhoneOffice($this->cdata);
1856 break;
1857
1858 case "PhoneHome":
1859 $this->userObj->setPhoneHome($this->cdata);
1860 break;
1861
1862 case "PhoneMobile":
1863 $this->userObj->setPhoneMobile($this->cdata);
1864 break;
1865
1866 case "Fax":
1867 $this->userObj->setFax($this->cdata);
1868 break;
1869
1870 case "Hobby":
1871 $this->userObj->setHobby($this->cdata);
1872 break;
1873
1874 case "GeneralInterest":
1875 case "OfferingHelp":
1876 case "LookingForHelp":
1877 $this->multi_values[$a_name][] = $this->cdata;
1878 break;
1879
1880 case "Comment":
1881 $this->userObj->setComment($this->cdata);
1882 break;
1883
1884 case "Department":
1885 $this->userObj->setDepartment($this->cdata);
1886 break;
1887
1888 case "Matriculation":
1889 $this->userObj->setMatriculation($this->cdata);
1890 break;
1891
1892 case "ExternalAccount":
1893//echo "-".$this->userObj->getAuthMode()."-".$this->userObj->getLogin()."-";
1894 $am = ($this->userObj->getAuthMode() == "default" || $this->userObj->getAuthMode() == "")
1895 ? ilAuthUtils::_getAuthModeName($ilSetting->get('auth_mode'))
1896 : $this->userObj->getAuthMode();
1897 $loginForExternalAccount = (trim($this->cdata) == "")
1898 ? ""
1899 : ilObjUser::_checkExternalAuthAccount($am, trim($this->cdata));
1900 switch ($this->action) {
1901 case "Insert":
1902 if ($loginForExternalAccount != "") {
1903 $this->logWarning($this->userObj->getLogin(), $lng->txt("usrimport_no_insert_ext_account_exists") . " (" . $this->cdata . ")");
1904 }
1905 break;
1906
1907 case "Update":
1908 if ($loginForExternalAccount != "") {
1909 $externalAccountHasChanged = trim($this->cdata) != ilObjUser::_lookupExternalAccount($this->user_id);
1910 if ($externalAccountHasChanged && trim($loginForExternalAccount) != trim($this->userObj->getLogin())) {
1911 $this->logWarning(
1912 $this->userObj->getLogin(),
1913 $lng->txt("usrimport_no_update_ext_account_exists") . " (" . $this->cdata . " for " . $loginForExternalAccount . ")"
1914 );
1915 }
1916 }
1917 break;
1918
1919 }
1920 if ($externalAccountHasChanged) {
1921 $this->userObj->setExternalAccount(trim($this->cdata));
1922 }
1923 break;
1924
1925 case "Active":
1926 if ($this->cdata != "true"
1927 && $this->cdata != "false") {
1928 $this->logFailure(
1929 $this->userObj->getLogin(),
1930 sprintf($lng->txt("usrimport_xml_element_content_illegal"), "Active", $this->cdata)
1931 );
1932 }
1933 $this->currActive = $this->cdata;
1934 break;
1935 case "TimeLimitOwner":
1936 if (!preg_match("/\d+/", $this->cdata)) {
1937 $this->logFailure(
1938 $this->userObj->getLogin(),
1939 sprintf($lng->txt("usrimport_xml_element_content_illegal"), "TimeLimitOwner", $this->cdata)
1940 );
1941 } elseif (!$ilAccess->checkAccess('cat_administrate_users', '', $this->cdata)) {
1942 $this->logFailure(
1943 $this->userObj->getLogin(),
1944 sprintf($lng->txt("usrimport_xml_element_content_illegal"), "TimeLimitOwner", $this->cdata)
1945 );
1946 } elseif ($ilObjDataCache->lookupType($ilObjDataCache->lookupObjId($this->cdata)) != 'cat' && !(int) $this->cdata == USER_FOLDER_ID) {
1947 $this->logFailure(
1948 $this->userObj->getLogin(),
1949 sprintf($lng->txt("usrimport_xml_element_content_illegal"), "TimeLimitOwner", $this->cdata)
1950 );
1951 }
1952 $this->userObj->setTimeLimitOwner($this->cdata);
1953 break;
1954 case "TimeLimitUnlimited":
1955 switch (strtolower($this->cdata)) {
1956 case "true":
1957 case "1":
1958 $this->userObj->setTimeLimitUnlimited(1);
1959 break;
1960 case "false":
1961 case "0":
1962 $this->userObj->setTimeLimitUnlimited(0);
1963 break;
1964 default:
1965 $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_content_illegal"), "TimeLimitUnlimited", $this->cdata));
1966 break;
1967 }
1968 break;
1969 case "TimeLimitFrom":
1970 // Accept datetime or Unix timestamp
1971 if (strtotime($this->cdata) === false && !is_numeric($this->cdata)) {
1972 $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_content_illegal"), "TimeLimitFrom", $this->cdata));
1973 }
1974 $this->userObj->setTimeLimitFrom($this->cdata);
1975 break;
1976 case "TimeLimitUntil":
1977 // Accept datetime or Unix timestamp
1978 if (strtotime($this->cdata) === false && !is_numeric($this->cdata)) {
1979 $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_content_illegal"), "TimeLimitUntil", $this->cdata));
1980 }
1981 $this->userObj->setTimeLimitUntil($this->cdata);
1982 break;
1983 case "TimeLimitMessage":
1984 switch (strtolower($this->cdata)) {
1985 case "1":
1986 $this->userObj->setTimeLimitMessage(1);
1987 break;
1988 case "0":
1989 $this->userObj->setTimeLimitMessage(0);
1990 break;
1991 default:
1992 $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_content_illegal"), "TimeLimitMessage", $this->cdata));
1993 break;
1994 }
1995 break;
1996 case "ApproveDate":
1997 // Accept datetime or Unix timestamp
1998 if (strtotime($this->cdata) === false && !is_numeric($this->cdata) && !$this->cdata == "0000-00-00 00:00:00") {
1999 $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_content_illegal"), "ApproveDate", $this->cdata));
2000 }
2001 break;
2002 case "AgreeDate":
2003 // Accept datetime or Unix timestamp
2004 if (strtotime($this->cdata) === false && !is_numeric($this->cdata) && !$this->cdata == "0000-00-00 00:00:00") {
2005 $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_content_illegal"), "AgreeDate", $this->cdata));
2006 }
2007 break;
2008 case "Pref":
2009 if ($this->currentPrefKey != null) {
2010 $this->verifyPref($this->currentPrefKey, $this->cdata);
2011 }
2012 $this->currentPrefKey == null;
2013 }
2014 }
const USER_FOLDER_ID
Class ilObjUserFolder.
static _lookupLogin($a_user_id)
lookup login
static _lookupId($a_user_str)
Lookup id by login.

References $DIC, $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 2272 of file class.ilUserImportParser.php.

2273 {
2274 switch ($key) {
2275 case 'mail_linebreak':
2276 case 'hits_per_page':
2277 if (!is_numeric($value) || $value < 0) {
2278 $this->logFailure("---", "Wrong value '$value': Positiv numeric value expected for preference $key.");
2279 }
2280 break;
2281 case 'language':
2282 case 'skin':
2283 case 'style':
2284 case 'ilPageEditor_HTMLMode':
2285 case 'ilPageEditor_JavaScript':
2286 case 'ilPageEditor_MediaMode':
2287 case 'tst_javascript':
2288 case 'tst_lastquestiontype':
2289 case 'tst_multiline_answers':
2290 case 'tst_use_previous_answers':
2291 case 'graphicalAnswerSetting':
2292 case 'priv_feed_pass':
2293 $this->logFailure("---", "Preference $key is not supported.");
2294 break;
2295 case 'public_city':
2296 case 'public_country':
2297 case 'public_department':
2298 case 'public_email':
2299 case 'public_second_email':
2300 case 'public_fax':
2301 case 'public_hobby':
2302 case 'public_institution':
2303 case 'public_matriculation':
2304 case 'public_phone':
2305 case 'public_phone_home':
2306 case 'public_phone_mobile':
2307 case 'public_phone_office':
2308 case 'public_street':
2309 case 'public_upload':
2310 case 'public_zip':
2311 case 'public_interests_general':
2312 case 'public_interests_help_offered':
2313 case 'public_interests_help_looking':
2314 case 'send_info_mails':
2315 case 'hide_own_online_status':
2316 if (!in_array($value, array('y', 'n'))) {
2317 $this->logFailure("---", "Wrong value '$value': Value 'y' or 'n' expected for preference $key.");
2318 }
2319 break;
2320 case 'bs_allow_to_contact_me':
2321 if (!in_array($value, array('y', 'n'))) {
2322 $this->logFailure("---", "Wrong value '$value': Value 'y' or 'n' expected for preference $key.");
2323 }
2324 break;
2325 case 'chat_osc_accept_msg':
2326 if (!in_array($value, array('y', 'n'))) {
2327 $this->logFailure("---", "Wrong value '$value': Value 'y' or 'n' expected for preference $key.");
2328 }
2329 break;
2330 case 'public_profile':
2331 if (!in_array($value, array('y', 'n', 'g'))) {
2332 $this->logFailure("---", "Wrong value '$value': Value 'y', 'g' or 'n' expected for preference $key.");
2333 }
2334 break;
2335 case 'show_users_online':
2336 if (!in_array($value, array('y', 'n', 'associated'))) {
2337 $this->logFailure("---", "Wrong value '$value': Value 'y' or 'n' or 'associated' expected for preference $key.");
2338 }
2339 break;
2340 case 'mail_incoming_type':
2341 if (!in_array((int) $value, array("0","1","2"))) {
2342 $this->logFailure("---", "Wrong value '$value': Value \"0\" (LOCAL),\"1\" (EMAIL) or \"2\" (BOTH) expected for preference $key.");
2343 }
2344 break;
2345 case 'weekstart':
2346 if (!in_array($value, array("0","1"))) {
2347 $this->logFailure("---", "Wrong value '$value': Value \"0\" (Sunday) or \"1\" (Monday) expected for preference $key.");
2348 }
2349 break;
2350
2351 case 'mail_signature':
2352 break;
2353 case 'user_tz':
2354 include_once('Services/Calendar/classes/class.ilTimeZone.php');
2355 try {
2356 $tz = ilTimeZone::_getInstance($value);
2357 return true;
2358 } catch (ilTimeZoneException $tze) {
2359 $this->logFailure("---", "Wrong value '$value': Invalid timezone $value detected for preference $key.");
2360 }
2361 break;
2362 default:
2364 $this->logFailure("---", "Preference $key is not supported.");
2365 }
2366 break;
2367 }
2368 }
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

◆ $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 66 of file class.ilUserImportParser.php.

Referenced by logSuccess().

◆ $approve_date_set

ilUserImportParser::$approve_date_set = false

Definition at line 52 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 94 of file class.ilUserImportParser.php.

◆ $currActive

ilUserImportParser::$currActive

The active state of the current user.

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

◆ $current_messenger_type

ilUserImportParser::$current_messenger_type
private

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

◆ $currPassword

ilUserImportParser::$currPassword

The password of the current user.

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

◆ $currPasswordType

ilUserImportParser::$currPasswordType

The password type of the current user.

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

◆ $disableSkin

ilUserImportParser::$disableSkin

Indicates if the skins are enabled.

Definition at line 247 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 165 of file class.ilUserImportParser.php.

Referenced by getErrorLevel().

◆ $folder_id

ilUserImportParser::$folder_id

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

Referenced by getFolderId().

◆ $hideSkin

ilUserImportParser::$hideSkin

Indicates if the skins are hidden.

Definition at line 242 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 207 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 85 of file class.ilUserImportParser.php.

◆ $mapping_mode

ilUserImportParser::$mapping_mode

Definition at line 198 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 222 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 213 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 75 of file class.ilUserImportParser.php.

Referenced by getProtocol().

◆ $recommended_content_manager

ilUserImportParser::$recommended_content_manager
protected

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

◆ $roles

ilUserImportParser::$roles

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

Referenced by getCollectedRoles().

◆ $send_mail

ilUserImportParser::$send_mail

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

Referenced by isSendMail().

◆ $skin

ilUserImportParser::$skin

ILIAS skin.

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

Referenced by __construct().

◆ $style

ilUserImportParser::$style

ILIAS style.

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

Referenced by __construct().

◆ $time_limit_owner_set

ilUserImportParser::$time_limit_owner_set = false

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

◆ $time_limit_set

ilUserImportParser::$time_limit_set = false

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

◆ $updateLookAndSkin

ilUserImportParser::$updateLookAndSkin = false

boolean to determine if look and skin should be updated

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

◆ $user_id

ilUserImportParser::$user_id

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

Referenced by importEndTag().

◆ $user_mapping

ilUserImportParser::$user_mapping = []

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

Referenced by getUserMapping().

◆ $user_settings_config

ilUserImportParser::$user_settings_config
protected

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

◆ $userCount

ilUserImportParser::$userCount

The count of user elements in the XML file.

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

Referenced by getUserCount().

◆ $userObj

ilUserImportParser::$userObj
private

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

◆ $userStyles

ilUserImportParser::$userStyles

User assigned styles.

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


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