ILIAS  release_5-3 Revision v5.3.23-19-g915713cf615
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...
 

Private Member Functions

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

Private Attributes

 $userObj
 
 $current_messenger_type
 

Static Private Attributes

static $account_mail_cache = array()
 

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

283 {
284 global $lng, $tree, $ilias, $ilUser, $styleDefinition;
285
286 $this->roles = array();
287 $this->mode = $a_mode;
288 $this->conflict_rule = $a_conflict_rule;
289 $this->error_level = IL_IMPORT_SUCCESS;
290 $this->protocol = array();
291 $this->logins = array();
292 $this->userCount = 0;
293 $this->localRoleCache = array();
294 $this->parentRolesCache = array();
295 $this->send_mail = false;
296 $this->mapping_mode = IL_USER_MAPPING_LOGIN;
297
298 // get all active style instead of only assigned ones -> cannot transfer all to another otherwise
299 $this->userStyles = array();
300 include_once './Services/Style/System/classes/class.ilStyleDefinition.php';
301 $skins = ilStyleDefinition::getAllSkins();
302
303 if (is_array($skins)) {
304 foreach ($skins as $skin) {
305 foreach ($skin->getStyles() as $style) {
306 include_once("./Services/Style/System/classes/class.ilSystemStyleSettings.php");
308 continue;
309 }
310 $this->userStyles [] = $skin->getId() . ":" . $style->getId();
311 }
312 }
313 }
314
315 $settings = $ilias->getAllSettings();
316 if ($settings["usr_settings_hide_skin_style"] == 1) {
317 $this->hideSkin = true;
318 } else {
319 $this->hideSkin = false;
320 }
321 if ($settings["usr_settings_disable_skin_style"] == 1) {
322 $this->disableSkin = true;
323 } else {
324 $this->disableSkin = false;
325 }
326
327 include_once("Services/Mail/classes/class.ilAccountMail.php");
328 $this->acc_mail = new ilAccountMail();
329 $this->acc_mail->useLangVariablesAsFallback(true);
330
331 parent::__construct($a_xml_file);
332 }
const IL_IMPORT_SUCCESS
const IL_USER_MAPPING_LOGIN
Class ilAccountMail.
static _lookupActivatedStyle($a_skin, $a_style)
lookup if a style is activated
$ilUser
Definition: imgupload.php:18

References ilSaxParser\$ilias, $ilUser, ilSaxParser\$lng, $skin, $style, 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 789 of file class.ilUserImportParser.php.

790 {
791 require_once "./Services/AccessControl/classes/class.ilObjRole.php";
792 include_once('./Services/Object/classes/class.ilObject.php');
793 #require_once "Modules/Course/classes/class.ilObjCourse.php";
794 #require_once "Modules/Course/classes/class.ilCourseParticipants.php";
795
796 global $rbacreview, $rbacadmin, $tree;
797
798 // Do nothing, if the user is already assigned to the role.
799 // Specifically, we do not want to put a course object or
800 // group object on the personal desktop again, if a user
801 // has removed it from the personal desktop.
802 if ($rbacreview->isAssigned($a_user_obj->getId(), $a_role_id)) {
803 return;
804 }
805
806 // If it is a course role, use the ilCourseMember object to assign
807 // the user to the role
808
809 $rbacadmin->assignUser($a_role_id, $a_user_obj->getId(), true);
810 $obj_id = $rbacreview->getObjectOfRole($a_role_id);
811 switch ($type = ilObject::_lookupType($obj_id)) {
812 case 'grp':
813 case 'crs':
814 $ref_ids = ilObject::_getAllReferences($obj_id);
815 $ref_id = current((array) $ref_ids);
816 if ($ref_id) {
817 ilObjUser::_addDesktopItem($a_user_obj->getId(), $ref_id, $type);
818 }
819 break;
820 default:
821 break;
822 }
823 }
static _addDesktopItem($a_usr_id, $a_item_id, $a_type, $a_par="")
add an item to user's personal desktop
static _getAllReferences($a_id)
get all reference ids of object
static _lookupType($a_id, $a_reference=false)
lookup object type
$type

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

Referenced by assignToRoleWithParents(), and importEndTag().

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

◆ assignToRoleWithParents()

ilUserImportParser::assignToRoleWithParents (   $a_user_obj,
  $a_role_id 
)

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

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

875 {
876 $this->assignToRole($a_user_obj, $a_role_id);
877
878 $parent_role_ids = $this->getParentRoleIds($a_role_id);
879 foreach ($parent_role_ids as $parent_role_id) {
880 $this->assignToRole($a_user_obj, $parent_role_id);
881 }
882 }
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 386 of file class.ilUserImportParser.php.

387 {
388 $tag = "<";
389
390 if ($type == "end") {
391 $tag.= "/";
392 }
393
394 $tag.= $name;
395
396 if (is_array($attr)) {
397 foreach ($attr as $k => $v) {
398 $tag .= " " . $k . "=\"$v\"";
399 }
400 }
401
402 $tag.= ">";
403
404 return $tag;
405 }
if(function_exists( 'posix_getuid') &&posix_getuid()===0) if(!array_key_exists('t', $options)) $tag
Definition: cron.php:35
if($format !==null) $name
Definition: metadata.php:146

References $name, $tag, 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 2247 of file class.ilUserImportParser.php.

2248 {
2249 include_once "Services/User/classes/class.ilUserProfile.php";
2250 return ilUserProfile::isProfileIncomplete($user_obj);
2251 }
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 886 of file class.ilUserImportParser.php.

887 {
888 global $rbacreview, $rbacadmin, $tree;
889
890 $rbacadmin->deassignUser($a_role_id, $a_user_obj->getId());
891
892 if (substr(ilObject::_lookupTitle($a_role_id), 0, 6) == 'il_crs' or
893 substr(ilObject::_lookupTitle($a_role_id), 0, 6) == 'il_grp') {
894 $obj = $rbacreview->getObjectOfRole($a_role_id);
895 $ref = ilObject::_getAllReferences($obj);
896 $ref_id = end($ref);
897 ilObjUser::_dropDesktopItem($a_user_obj->getId(), $ref_id, ilObject::_lookupType($obj));
898 }
899 }
static _dropDesktopItem($a_usr_id, $a_item_id, $a_type)
drop an item from user's personal desktop
static _lookupTitle($a_id)
lookup object title

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

Referenced by importEndTag().

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

◆ extractRolesBeginTag()

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

handler for begin of element in extract roles mode

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

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

741 {
742 switch ($a_name) {
743 case "Role":
744 $this->roles[$this->current_role_id]["name"] = $this->cdata;
745 $this->roles[$this->current_role_id]["type"] =
746 $this->current_role_type;
747 break;
748 }
749 }

Referenced by handlerEndTag().

+ Here is the caller graph for this function:

◆ getCollectedRoles()

ilUserImportParser::getCollectedRoles ( )

get collected roles

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

1997 {
1998 return $this->roles;
1999 }

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

769 {
770 global $rbacreview, $rbacadmin, $tree;
771
772 if (array_key_exists($a_role_id . '_courseMembersObject', $this->localRoleCache)) {
773 return $this->localRoleCache[$a_role_id . '_courseMembersObject'];
774 } else {
775 require_once("Modules/Course/classes/class.ilObjCourse.php");
776 require_once("Modules/Course/classes/class.ilCourseParticipants.php");
777 $course_refs = $rbacreview->getFoldersAssignedToRole($a_role_id, true);
778 $course_ref = $course_refs[0];
779 $course_obj = new ilObjCourse($course_ref, true);
780 $crsmembers_obj = ilCourseParticipants::_getInstanceByObjId($course_obj->getId());
781 $this->localRoleCache[$a_role_id . '_courseMembersObject'] = $crsmembers_obj;
782 return $crsmembers_obj;
783 }
784 }
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
Class ilObjCourse.

References ilCourseParticipants\_getInstanceByObjId().

+ Here is the call graph for this function:

◆ getErrorLevel()

ilUserImportParser::getErrorLevel ( )

Returns the error level.

Returns
IL_IMPORT_SUCCESS | IL_IMPORT_WARNING | IL_IMPORT_FAILURE

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

2109 {
2110 return $this->error_level;
2111 }
$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 344 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 828 of file class.ilUserImportParser.php.

829 {
830 global $rbacreview;
831
832 if (!array_key_exists($a_role_id, $this->parentRolesCache)) {
833 $parent_role_ids = array();
834
835 $role_obj = $this->getRoleObject($a_role_id);
836 $short_role_title = substr($role_obj->getTitle(), 0, 12);
837 $folders = $rbacreview->getFoldersAssignedToRole($a_role_id, true);
838 if (count($folders) > 0) {
839 $all_parent_role_ids = $rbacreview->getParentRoleIds($folders[0]);
840 foreach ($all_parent_role_ids as $parent_role_id => $parent_role_data) {
841 if ($parent_role_id != $a_role_id) {
842 switch (substr($parent_role_data['title'], 0, 12)) {
843 case 'il_crs_admin':
844 case 'il_grp_admin':
845 if ($short_role_title == 'il_crs_admin' || $short_role_title == 'il_grp_admin') {
846 $parent_role_ids[] = $parent_role_id;
847 }
848 break;
849 case 'il_crs_tutor':
850 case 'il_grp_tutor':
851 if ($short_role_title == 'il_crs_tutor' || $short_role_title == 'il_grp_tutor') {
852 $parent_role_ids[] = $parent_role_id;
853 }
854 break;
855 case 'il_crs_membe':
856 case 'il_grp_membe':
857 if ($short_role_title == 'il_crs_membe' || $short_role_title == 'il_grp_membe') {
858 $parent_role_ids[] = $parent_role_id;
859 }
860 break;
861 default:
862 break;
863 }
864 }
865 }
866 }
867 $this->parentRolesCache[$a_role_id] = $parent_role_ids;
868 }
869 return $this->parentRolesCache[$a_role_id];
870 }
getRoleObject($a_role_id)
Returns the parent object of the role folder object which contains the specified role.

References getRoleObject().

Referenced by assignToRoleWithParents().

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

◆ getProtocol()

ilUserImportParser::getProtocol ( )

Returns the protocol.

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

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

2065 {
2066 return $this->protocol;
2067 }
$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 2071 of file class.ilUserImportParser.php.

2072 {
2073 global $lng;
2074
2075 $block = new ilTemplate("tpl.usr_import_log_block.html", true, true, "Services/User");
2076 $block->setVariable("TXT_LOG_TITLE", $a_log_title);
2077 $block->setVariable("TXT_MESSAGE_ID", $lng->txt("login"));
2078 $block->setVariable("TXT_MESSAGE_TEXT", $lng->txt("message"));
2079 foreach ($this->getProtocol() as $login => $messages) {
2080 $block->setCurrentBlock("log_row");
2081 $reason = "";
2082 foreach ($messages as $message) {
2083 if ($reason == "") {
2084 $reason = $message;
2085 } else {
2086 $reason = $reason . "<br>" . $message;
2087 }
2088 }
2089 $block->setVariable("MESSAGE_ID", $login);
2090 $block->setVariable("MESSAGE_TEXT", $reason);
2091 $block->parseCurrentBlock();
2092 }
2093 return $block->get();
2094 }
special template class to simplify handling of ITX/PEAR
getProtocol()
Returns the protocol.
catch(Exception $e) $message
$messages
Definition: en-x-test.php:7

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

755 {
756 if (array_key_exists($a_role_id, $this->localRoleCache)) {
757 return $this->localRoleCache[$a_role_id];
758 } else {
759 $role_obj = new ilObjRole($a_role_id, false);
760 $role_obj->read();
761 $this->localRoleCache[$a_role_id] = $role_obj;
762 return $role_obj;
763 }
764 }
Class ilObjRole.

Referenced by getParentRoleIds().

+ Here is the caller graph for this function:

◆ getUserCount()

ilUserImportParser::getUserCount ( )

get count of User elements

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

2004 {
2005 return $this->userCount;
2006 }
$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 2118 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 2212 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 410 of file class.ilUserImportParser.php.

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

1980 {
1981 // DELETE WHITESPACES AND NEWLINES OF CHARACTER DATA
1982 // TODO: Mit Alex klären, ob das noch benötigt wird $a_data = preg_replace("/\n/","",$a_data);
1983 // TODO: Mit Alex klären, ob das noch benötigt wird $a_data = preg_replace("/\t+/","",$a_data);
1984 if ($a_data != "\n") {
1985 $a_data = preg_replace("/\t+/", " ", $a_data);
1986 }
1987
1988 if (strlen($a_data) > 0) {
1989 $this->cdata .= $a_data;
1990 }
1991 }

◆ handlerEndTag()

ilUserImportParser::handlerEndTag (   $a_xml_parser,
  $a_name 
)

handler for end of element

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

723 {
724 switch ($this->mode) {
725 case IL_EXTRACT_ROLES:
726 $this->extractRolesEndTag($a_xml_parser, $a_name);
727 break;
728 case IL_USER_IMPORT:
729 $this->importEndTag($a_xml_parser, $a_name);
730 break;
731 case IL_VERIFY:
732 $this->verifyEndTag($a_xml_parser, $a_name);
733 break;
734 }
735 }
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 447 of file class.ilUserImportParser.php.

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

References $id, ilSaxParser\$ilias, $list, ilSaxParser\$lng, ilUtil\__extractId(), ilLDAPServer\_getActiveServerList(), ilSamlIdp\getActiveIdpList(), getUserMappingMode(), IL_USER_MAPPING_ID, logFailure(), and sprintf.

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

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

References ilSaxParser\$ilias, $ilSetting, $ilUser, $key, ilSaxParser\$lng, $timestamp, $user_id, ilObjUser\_checkExternalAuthAccount(), ilAuthUtils\_getAuthModeName(), ilUserDefinedFields\_getInstance(), ilObjUser\_lookupExternalAccount(), ilObjUser\_uploadPersonalPicture(), assignToRole(), assignToRoleWithParents(), checkProfileIncomplete(), date, 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(), sprintf, 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 2259 of file class.ilUserImportParser.php.

2260 {
2261 $requiredFields = $this->readRequiredFields();
2262 $fieldname = strtolower(trim($fieldname));
2263 return array_key_exists($fieldname, $requiredFields);
2264 }
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 2188 of file class.ilUserImportParser.php.

2189 {
2190 return $this->send_mail;
2191 }

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

2100 {
2101 return $this->error_level == IL_IMPORT_SUCCESS;
2102 }

References IL_IMPORT_SUCCESS.

◆ logFailure()

ilUserImportParser::logFailure (   $aLogin,
  $aMessage 
)

Writes a failure log message to the protocol.

Parameters
stringlogin
stringmessage

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

2033 {
2034 if (!array_key_exists($aLogin, $this->protocol)) {
2035 $this->protocol[$aLogin] = array();
2036 }
2037 if ($aMessage) {
2038 $this->protocol[$aLogin][] = $aMessage;
2039 }
2040 $this->error_level = IL_IMPORT_FAILURE;
2041 }
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 2050 of file class.ilUserImportParser.php.

2051 {
2052 $this->user_mapping[$userid] = array("login" => $aLogin, "action" => $action, "message" => "successful");
2053 }
$action
The Action attribute determines what to do for the current User element.
if(empty($userids)) $userid

References $action, and $userid.

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

2015 {
2016 if (!array_key_exists($aLogin, $this->protocol)) {
2017 $this->protocol[$aLogin] = array();
2018 }
2019 if ($aMessage) {
2020 $this->protocol[$aLogin][] = $aMessage;
2021 }
2022 if ($this->error_level == IL_IMPORT_SUCCESS) {
2023 $this->error_level = IL_IMPORT_WARNING;
2024 }
2025 }
const IL_IMPORT_WARNING

References IL_IMPORT_SUCCESS, and IL_IMPORT_WARNING.

Referenced by importEndTag(), and verifyEndTag().

+ Here is the caller graph for this function:

◆ readAccountMailFromCache()

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

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

2150 {
2151 if (!isset(self::$account_mail_cache[$lang_key])) {
2152 $default_lang_key = $GLOBALS["lng"]->getDefaultLanguage();
2153
2154 // try individual account mail in user administration
2155 include_once './Services/User/classes/class.ilObjUserFolder.php';
2156
2157 $amail = ilObjUserFolder::_lookupNewAccountMail($lang_key);
2158
2159 if (trim($amail["body"]) != "" && trim($amail["subject"]) != "") {
2160 self::$account_mail_cache[$lang_key] = $amail;
2161 } else {
2162 $lang_key = $default_lang_key;
2163 }
2164
2165 if (!isset(self::$account_mail_cache[$default_lang_key])) {
2166 $amail = ilObjUserFolder::_lookupNewAccountMail($default_lang_key);
2167 self::$account_mail_cache[$default_lang_key] = $amail;
2168 }
2169 }
2170 return self::$account_mail_cache[$lang_key];
2171 }
static _lookupNewAccountMail($a_lang)
$GLOBALS['loaded']
Global hash that tracks already loaded includes.

References $GLOBALS, and ilObjUserFolder\_lookupNewAccountMail().

Referenced by sendAccountMail().

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

◆ readRequiredFields()

ilUserImportParser::readRequiredFields ( )
private

read required fields

@access private

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

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

References $ilSetting.

Referenced by isFieldRequired().

+ Here is the caller graph for this function:

◆ saveTempImage()

ilUserImportParser::saveTempImage (   $image_data,
  $filename 
)

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

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

1645 {
1646 $tempname = ilUtil::ilTempnam() . $filename;
1647 $fh = fopen($tempname, "wb");
1648 if ($fh == false) {
1649 return "";
1650 }
1651 $imagefile = fwrite($fh, $image_data);
1652 fclose($fh);
1653 return $tempname;
1654 }
static ilTempnam($a_temp_path=null)
Create a temporary file in an ILIAS writable directory.

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

2127 {
2128 if ($_POST["send_mail"] != "" ||
2129 ($this->isSendMail() && $this->userObj->getEmail() != "")) {
2130 $this->acc_mail->setUser($this->userObj);
2131
2132 $amail = $this->readAccountMailFromCache($this->userObj->getLanguage());
2133 if ($amail["att_file"]) {
2134 include_once "Services/User/classes/class.ilFSStorageUserFolder.php";
2136 $fs->create();
2137 $path = $fs->getAbsolutePath() . "/";
2138
2139 $this->acc_mail->addAttachment($path . "/" . $amail["lang"], $amail["att_file"]);
2140 }
2141 $this->acc_mail->send();
2142 }
2143 }
$_POST["username"]
const USER_FOLDER_ID
Class ilObjUserFolder.
isSendMail()
read access to property send mail

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

Referenced by importEndTag().

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

◆ setFolderId()

ilUserImportParser::setFolderId (   $a_folder_id)

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

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

340 {
341 $this->folder_id = $a_folder_id;
342 }

◆ setHandlers()

ilUserImportParser::setHandlers (   $a_xml_parser)

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

Reimplemented from ilSaxParser.

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

355 {
356 xml_set_object($a_xml_parser, $this);
357 xml_set_element_handler($a_xml_parser, 'handlerBeginTag', 'handlerEndTag');
358 xml_set_character_data_handler($a_xml_parser, 'handlerCharacterData');
359 }

◆ setRoleAssignment()

ilUserImportParser::setRoleAssignment (   $a_assign)

set import to local role assignemt

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

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

375 {
376 $this->role_assign = $a_assign;
377 }

◆ setSendMail()

ilUserImportParser::setSendMail (   $value)

write access to property send mail

Parameters
mixed$value

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

2179 {
2180 $this->send_mail = $value ? true: false;
2181 }

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

2199 {
2200 if ($value == IL_USER_MAPPING_ID || $value == IL_USER_MAPPING_LOGIN) {
2201 $this->mapping_mode = $value;
2202 } else {
2203 die("wrong argument using methode setUserMappingMethod in " . __FILE__);
2204 }
2205 }

References IL_USER_MAPPING_ID, and IL_USER_MAPPING_LOGIN.

◆ startParsing()

ilUserImportParser::startParsing ( )

start the parser

Reimplemented from ilSaxParser.

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

365 {
366 parent::startParsing();
367 }

◆ updateMailPreferences()

ilUserImportParser::updateMailPreferences (   $usr_id)
private

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

2365 {
2366 if (array_key_exists("mail_incoming_type", $this->prefs) ||
2367 array_key_exists("mail_signature", $this->prefs) ||
2368 array_key_exists("mail_linebreak", $this->prefs)
2369 ) {
2370 include_once("Services/Mail/classes/class.ilMailOptions.php");
2371 $mailOptions = new ilMailOptions($usr_id);
2372
2373 $mailOptions->setLinebreak(array_key_exists("mail_linebreak", $this->prefs) ? $this->prefs["mail_linebreak"] : $mailOptions->getLinebreak());
2374 $mailOptions->setSignature(array_key_exists("mail_signature", $this->prefs) ? $this->prefs["mail_signature"] : $mailOptions->getSignature());
2375 $mailOptions->setIncomingType(array_key_exists("mail_incoming_type", $this->prefs) ? $this->prefs["mail_incoming_type"] : $mailOptions->getIncomingType());
2376 $mailOptions->updateOptions();
2377 }
2378 }
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 599 of file class.ilUserImportParser.php.

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

References $id, $list, ilSaxParser\$lng, ilUtil\__extractId(), ilLDAPServer\_getActiveServerList(), ilSamlIdp\getActiveIdpList(), getUserMappingMode(), IL_USER_MAPPING_ID, logFailure(), and sprintf.

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

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

References $ilSetting, ilSaxParser\$lng, ilObjUser\_checkExternalAuthAccount(), ilAuthUtils\_getAuthModeName(), ilObjUser\_lookupExternalAccount(), ilObjUser\_lookupId(), ilObjUser\_lookupLogin(), ilObjUser\getUserIdByLogin(), IL_FAIL_ON_CONFLICT, IL_PASSWD_CRYPTED, IL_PASSWD_PLAIN, logFailure(), logWarning(), sprintf, 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 2266 of file class.ilUserImportParser.php.

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

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

Referenced by verifyEndTag().

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

Field Documentation

◆ $account_mail_cache

ilUserImportParser::$account_mail_cache = array()
staticprivate

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

◆ $action

ilUserImportParser::$action

The Action attribute determines what to do for the current User element.

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

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

Referenced by logSuccess().

◆ $approve_date_set

ilUserImportParser::$approve_date_set = false

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

◆ $conflict_rule

ilUserImportParser::$conflict_rule

Conflict handling rule.

Values: IL_FAIL_ON_CONFLICT IL_UPDATE_ON_CONFLICT IL_IGNORE_ON_CONFLICT

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

◆ $currActive

ilUserImportParser::$currActive

The active state of the current user.

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

◆ $current_messenger_type

ilUserImportParser::$current_messenger_type
private

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

◆ $currPassword

ilUserImportParser::$currPassword

The password of the current user.

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

◆ $currPasswordType

ilUserImportParser::$currPasswordType

The password type of the current user.

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

◆ $disableSkin

ilUserImportParser::$disableSkin

Indicates if the skins are enabled.

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

◆ $error_level

ilUserImportParser::$error_level

This variable is used to report the error level of the validation process or the importing process.

Values: IL_IMPORT_SUCCESS IL_IMPORT_WARNING IL_IMPORT_FAILURE

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

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

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

In IL_UPDATE_ON_CONFLICT mode, the following may have occured:

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

In IL_IGNORE_ON_CONFLICT mode, the following may have occured:

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

IL_IMPORT_FAILURE The import could not be completed.

In IL_FAIL_ON_CONFLICT mode, the following may have occured:

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

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

Referenced by getErrorLevel().

◆ $folder_id

ilUserImportParser::$folder_id

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

Referenced by getFolderId().

◆ $hideSkin

ilUserImportParser::$hideSkin

Indicates if the skins are hidden.

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

◆ $logins

ilUserImportParser::$logins

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

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

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

◆ $mapping_mode

ilUserImportParser::$mapping_mode

Definition at line 197 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 221 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 212 of file class.ilUserImportParser.php.

◆ $protocol

ilUserImportParser::$protocol

The variable holds the protocol of the import.

This variable is an associative array.

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

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

Referenced by getProtocol().

◆ $roles

ilUserImportParser::$roles

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

Referenced by getCollectedRoles().

◆ $send_mail

ilUserImportParser::$send_mail

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

Referenced by isSendMail().

◆ $skin

ilUserImportParser::$skin

ILIAS skin.

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

Referenced by __construct().

◆ $style

ilUserImportParser::$style

ILIAS style.

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

Referenced by __construct().

◆ $time_limit_owner_set

ilUserImportParser::$time_limit_owner_set = false

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

◆ $time_limit_set

ilUserImportParser::$time_limit_set = false

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

◆ $updateLookAndSkin

ilUserImportParser::$updateLookAndSkin = false

boolean to determine if look and skin should be updated

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

◆ $user_id

ilUserImportParser::$user_id

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

Referenced by importEndTag().

◆ $user_mapping

ilUserImportParser::$user_mapping

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

Referenced by getUserMapping().

◆ $userCount

ilUserImportParser::$userCount

The count of user elements in the XML file.

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

Referenced by getUserCount().

◆ $userObj

ilUserImportParser::$userObj
private

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

◆ $userStyles

ilUserImportParser::$userStyles

User assigned styles.

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


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