ILIAS  release_4-4 Revision
All Data Structures Namespaces Files Functions Variables Modules Pages
ilUserImportParser Class Reference

User Import Parser. More...

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

Public Member Functions

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

Data Fields

 $approve_date_set = false
 
 $time_limit_set = false
 
 $time_limit_owner_set = false
 
 $updateLookAndSkin = false
 boolean to determine if look and skin should be updated More...
 
 $folder_id
 
 $roles
 
 $action
 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...
 
 $ilincdata
 Cached iLinc data. 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()
 

Detailed Description

User Import Parser.

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

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

Member Function Documentation

◆ assignToRole()

ilUserImportParser::assignToRole (   $a_user_obj,
  $a_role_id 
)

Assigns a user to a role.

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

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

Referenced by assignToRoleWithParents(), and importEndTag().

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

References assignToRole(), and getParentRoleIds().

Referenced by importEndTag().

890  {
891  $this->assignToRole($a_user_obj, $a_role_id);
892 
893  $parent_role_ids = $this->getParentRoleIds($a_role_id);
894  foreach ($parent_role_ids as $parent_role_id)
895  {
896  $this->assignToRole($a_user_obj, $parent_role_id);
897  }
898  }
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.
+ 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 407 of file class.ilUserImportParser.php.

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

◆ 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.

private

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

References ilUserProfile\isProfileIncomplete().

Referenced by importEndTag().

2349  {
2350  include_once "Services/User/classes/class.ilUserProfile.php";
2351  return ilUserProfile::isProfileIncomplete($user_obj);
2352  }
static isProfileIncomplete($a_user, $a_include_udf=true, $a_personal_data_only=true)
Check if all required personal data fields are set.
+ 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 902 of file class.ilUserImportParser.php.

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

Referenced by importEndTag().

903  {
904  global $rbacreview, $rbacadmin, $tree;
905 
906  $rbacadmin->deassignUser($a_role_id, $a_user_obj->getId());
907 
908  if (substr(ilObject::_lookupTitle($a_role_id),0,6) == 'il_crs' or
909  substr(ilObject::_lookupTitle($a_role_id),0,6) == 'il_grp')
910  {
911  $obj = $rbacreview->getObjectOfRole($a_role_id);
912  $ref = ilObject::_getAllReferences($obj);
913  $ref_id = end($ref);
914  ilObjUser::_dropDesktopItem($a_user_obj->getId(), $ref_id, ilObject::_lookupType($obj));
915  }
916 }
static _lookupTitle($a_id)
lookup object title
static _getAllReferences($a_id)
get all reference ids of object
static _dropDesktopItem($a_usr_id, $a_item_id, $a_type)
drop an item from user&#39;s personal desktop
static _lookupType($a_id, $a_reference=false)
lookup object type
$ref_id
Definition: sahs_server.php:39
+ 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 451 of file class.ilUserImportParser.php.

References ilUtil\__extractId().

Referenced by handlerBeginTag().

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

Referenced by handlerEndTag().

736  {
737  switch($a_name)
738  {
739  case "Role":
740  $this->roles[$this->current_role_id]["name"] = $this->cdata;
741  $this->roles[$this->current_role_id]["type"] =
742  $this->current_role_type;
743  break;
744  }
745  }
+ Here is the caller graph for this function:

◆ getCollectedRoles()

ilUserImportParser::getCollectedRoles ( )

get collected roles

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

References $roles.

2087  {
2088  return $this->roles;
2089  }

◆ 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.

References ilCourseParticipants\_getInstanceByObjId().

769  {
770  global $rbacreview, $rbacadmin, $tree;
771 
772  if (array_key_exists($a_role_id.'_courseMembersObject', $this->localRoleCache))
773  {
774  return $this->localRoleCache[$a_role_id.'_courseMembersObject'];
775  }
776  else
777  {
778  require_once("Modules/Course/classes/class.ilObjCourse.php");
779  require_once("Modules/Course/classes/class.ilCourseParticipants.php");
780  $rolf_refs = $rbacreview->getFoldersAssignedToRole($a_role_id, true);
781  $course_ref = $tree->getParentId($rolf_refs[0]);
782  $course_obj = new ilObjCourse($course_ref, true);
783  $crsmembers_obj = ilCourseParticipants::_getInstanceByObjId($course_obj->getId());
784  $this->localRoleCache[$a_role_id.'_courseMembersObject'] = $crsmembers_obj;
785  return $crsmembers_obj;
786  }
787 
788  }
static _getInstanceByObjId($a_obj_id)
Get singleton instance.
Class ilObjCourse.
+ 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 2208 of file class.ilUserImportParser.php.

References $error_level.

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

◆ getFolderId()

ilUserImportParser::getFolderId ( )

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

References $folder_id.

Referenced by importEndTag().

366  {
367  return $this->folder_id;
368  }
+ 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 835 of file class.ilUserImportParser.php.

References getRoleObject().

Referenced by assignToRoleWithParents().

836  {
837  global $rbacreview;
838 
839  if (! array_key_exists($a_role_id, $this->parentRolesCache))
840  {
841  $parent_role_ids = array();
842 
843  $role_obj = $this->getRoleObject($a_role_id);
844  $short_role_title = substr($role_obj->getTitle(),0,12);
845  $folders = $rbacreview->getFoldersAssignedToRole($a_role_id, true);
846  if (count($folders) > 0)
847  {
848  $all_parent_role_ids = $rbacreview->getParentRoleIds($folders[0]);
849  foreach ($all_parent_role_ids as $parent_role_id => $parent_role_data)
850  {
851  if ($parent_role_id != $a_role_id)
852  {
853  switch (substr($parent_role_data['title'],0,12))
854  {
855  case 'il_crs_admin' :
856  case 'il_grp_admin' :
857  if ($short_role_title == 'il_crs_admin' || $short_role_title == 'il_grp_admin')
858  {
859  $parent_role_ids[] = $parent_role_id;
860  }
861  break;
862  case 'il_crs_tutor' :
863  case 'il_grp_tutor' :
864  if ($short_role_title == 'il_crs_tutor' || $short_role_title == 'il_grp_tutor')
865  {
866  $parent_role_ids[] = $parent_role_id;
867  }
868  break;
869  case 'il_crs_membe' :
870  case 'il_grp_membe' :
871  if ($short_role_title == 'il_crs_membe' || $short_role_title == 'il_grp_membe')
872  {
873  $parent_role_ids[] = $parent_role_id;
874  }
875  break;
876  default :
877  break;
878  }
879  }
880  }
881  }
882  $this->parentRolesCache[$a_role_id] = $parent_role_ids;
883  }
884  return $this->parentRolesCache[$a_role_id];
885  }
getRoleObject($a_role_id)
Returns the parent object of the role folder object which contains the specified role.
+ 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 2159 of file class.ilUserImportParser.php.

References $protocol.

Referenced by getProtocolAsHTML().

2160  {
2161  return $this->protocol;
2162  }
$protocol
The variable holds the protocol of the import.
+ Here is the caller graph for this function:

◆ getProtocolAsHTML()

ilUserImportParser::getProtocolAsHTML (   $a_log_title)

Returns the protocol as a HTML table.

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

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

2167  {
2168  global $lng;
2169 
2170  $block = new ilTemplate("tpl.usr_import_log_block.html", true, true, "Services/User");
2171  $block->setVariable("TXT_LOG_TITLE", $a_log_title);
2172  $block->setVariable("TXT_MESSAGE_ID", $lng->txt("login"));
2173  $block->setVariable("TXT_MESSAGE_TEXT", $lng->txt("message"));
2174  foreach ($this->getProtocol() as $login => $messages)
2175  {
2176  $block->setCurrentBlock("log_row");
2177  $reason = "";
2178  foreach ($messages as $message)
2179  {
2180  if ($reason == "")
2181  {
2182  $reason = $message;
2183  }
2184  else
2185  {
2186  $reason = $reason."<br>".$message;
2187  }
2188  }
2189  $block->setVariable("MESSAGE_ID", $login);
2190  $block->setVariable("MESSAGE_TEXT", $reason);
2191  $block->parseCurrentBlock();
2192  }
2193  return $block->get();
2194  }
getProtocol()
Returns the protocol.
special template class to simplify handling of ITX/PEAR
$messages
Definition: en-x-test.php:7
+ 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 750 of file class.ilUserImportParser.php.

Referenced by getParentRoleIds().

751  {
752  if (array_key_exists($a_role_id, $this->localRoleCache))
753  {
754  return $this->localRoleCache[$a_role_id];
755  }
756  else
757  {
758  $role_obj = new ilObjRole($a_role_id, false);
759  $role_obj->read();
760  $this->localRoleCache[$a_role_id] = $role_obj;
761  return $role_obj;
762  }
763 
764  }
Class ilObjRole.
+ Here is the caller graph for this function:

◆ getUserCount()

ilUserImportParser::getUserCount ( )

get count of User elements

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

References $userCount.

2094  {
2095  return $this->userCount;
2096  }
$userCount
The count of user elements in the XML file.

◆ getUserMapping()

ilUserImportParser::getUserMapping ( )

returns a map user_id <=> login

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

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

References $user_mapping.

2218  {
2219  return $this->user_mapping;
2220  }

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

References $mapping_mode.

Referenced by importBeginTag(), and verifyBeginTag().

2311  {
2312  return $this->mapping_mode;
2313  }
+ 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 430 of file class.ilUserImportParser.php.

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

431  {
432  switch ($this->mode)
433  {
434  case IL_EXTRACT_ROLES :
435  $this->extractRolesBeginTag($a_xml_parser, $a_name, $a_attribs);
436  break;
437  case IL_USER_IMPORT :
438  $this->importBeginTag($a_xml_parser, $a_name, $a_attribs);
439  break;
440  case IL_VERIFY :
441  $this->verifyBeginTag($a_xml_parser, $a_name, $a_attribs);
442  break;
443  }
444 
445  $this->cdata = "";
446  }
verifyBeginTag($a_xml_parser, $a_name, $a_attribs)
handler for begin of element
const IL_USER_IMPORT
const IL_EXTRACT_ROLES
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
const IL_VERIFY
+ Here is the call graph for this function:

◆ handlerCharacterData()

ilUserImportParser::handlerCharacterData (   $a_xml_parser,
  $a_data 
)

handler for character data

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

2071  {
2072  // DELETE WHITESPACES AND NEWLINES OF CHARACTER DATA
2073  // TODO: Mit Alex klären, ob das noch benötigt wird $a_data = preg_replace("/\n/","",$a_data);
2074  // TODO: Mit Alex klären, ob das noch benötigt wird $a_data = preg_replace("/\t+/","",$a_data);
2075  if($a_data != "\n") $a_data = preg_replace("/\t+/"," ",$a_data);
2076 
2077  if(strlen($a_data) > 0)
2078  {
2079  $this->cdata .= $a_data;
2080  }
2081  }

◆ handlerEndTag()

ilUserImportParser::handlerEndTag (   $a_xml_parser,
  $a_name 
)

handler for end of element

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

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

717  {
718  switch ($this->mode)
719  {
720  case IL_EXTRACT_ROLES :
721  $this->extractRolesEndTag($a_xml_parser, $a_name);
722  break;
723  case IL_USER_IMPORT :
724  $this->importEndTag($a_xml_parser, $a_name);
725  break;
726  case IL_VERIFY :
727  $this->verifyEndTag($a_xml_parser, $a_name);
728  break;
729  }
730  }
const IL_USER_IMPORT
extractRolesEndTag($a_xml_parser, $a_name)
handler for end of element when in extract roles mode.
verifyEndTag($a_xml_parser, $a_name)
handler for end of element when in verify mode.
const IL_EXTRACT_ROLES
const IL_VERIFY
importEndTag($a_xml_parser, $a_name)
handler for end of element when in import user mode.
+ Here is the call graph for this function:

◆ ilUserImportParser()

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

Constructor.

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

public

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

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

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

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

Referenced by handlerBeginTag().

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

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

Referenced by handlerEndTag().

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

References readRequiredFields().

Referenced by verifyEndTag().

2361  {
2362  $requiredFields = $this->readRequiredFields();
2363  $fieldname = strtolower(trim($fieldname));
2364  return array_key_exists($fieldname, $requiredFields);
2365  }
readRequiredFields()
read required fields
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ isSendMail()

ilUserImportParser::isSendMail ( )

read access to property send mail

Returns
boolean

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

References $send_mail.

Referenced by sendAccountMail().

2289  {
2290  return $this->send_mail;
2291  }
+ Here is the caller graph for this function:

◆ isSuccess()

ilUserImportParser::isSuccess ( )

Returns true, if the import was successful.

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

References IL_IMPORT_SUCCESS.

2200  {
2201  return $this->error_level == IL_IMPORT_SUCCESS;
2202  }
const IL_IMPORT_SUCCESS

◆ logFailure()

ilUserImportParser::logFailure (   $aLogin,
  $aMessage 
)

Writes a failure log message to the protocol.

Parameters
stringlogin
stringmessage

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

References IL_IMPORT_FAILURE.

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

2126  {
2127  if (! array_key_exists($aLogin, $this->protocol))
2128  {
2129  $this->protocol[$aLogin] = array();
2130  }
2131  if ($aMessage)
2132  {
2133  $this->protocol[$aLogin][] = $aMessage;
2134  }
2135  $this->error_level = IL_IMPORT_FAILURE;
2136  }
const IL_IMPORT_FAILURE
+ 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 2145 of file class.ilUserImportParser.php.

Referenced by importEndTag().

2146  {
2147  $this->user_mapping[$userid] = array("login" => $aLogin, "action" => $action, "message" => "successful");
2148  }
$action
The Action attribute determines what to do for the current User element.
+ 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 2104 of file class.ilUserImportParser.php.

References IL_IMPORT_SUCCESS, and IL_IMPORT_WARNING.

Referenced by importEndTag(), and verifyEndTag().

2105  {
2106  if (! array_key_exists($aLogin, $this->protocol))
2107  {
2108  $this->protocol[$aLogin] = array();
2109  }
2110  if ($aMessage)
2111  {
2112  $this->protocol[$aLogin][] = $aMessage;
2113  }
2114  if ($this->error_level == IL_IMPORT_SUCCESS)
2115  {
2116  $this->error_level = IL_IMPORT_WARNING;
2117  }
2118  }
const IL_IMPORT_WARNING
const IL_IMPORT_SUCCESS
+ Here is the caller graph for this function:

◆ readAccountMailFromCache()

ilUserImportParser::readAccountMailFromCache (   $lang_key)
private

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

References $GLOBALS, and ilObjUserFolder\_lookupNewAccountMail().

Referenced by sendAccountMail().

2247  {
2248  if(!isset(self::$account_mail_cache[$lang_key]))
2249  {
2250  $default_lang_key = $GLOBALS["lng"]->getDefaultLanguage();
2251 
2252  // try individual account mail in user administration
2253  include_once './Services/User/classes/class.ilObjUserFolder.php';
2254 
2255  $amail = ilObjUserFolder::_lookupNewAccountMail($lang_key);
2256 
2257  if (trim($amail["body"]) != "" && trim($amail["subject"]) != "")
2258  {
2259  self::$account_mail_cache[$lang_key] = $amail;
2260  }
2261  else
2262  {
2263  $lang_key = $default_lang_key;
2264  }
2265 
2266  if(!isset(self::$account_mail_cache[$default_lang_key]))
2267  {
2268  $amail = ilObjUserFolder::_lookupNewAccountMail($default_lang_key);
2269  self::$account_mail_cache[$default_lang_key] = $amail;
2270  }
2271  }
2272  return self::$account_mail_cache[$lang_key];
2273  }
$GLOBALS['ct_recipient']
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

◆ readRequiredFields()

ilUserImportParser::readRequiredFields ( )
private

read required fields

private

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

References $ilSetting.

Referenced by isFieldRequired().

2322  {
2323  global $ilSetting;
2324 
2325  if(is_array($this->required_fields))
2326  {
2327  return $this->required_fields;
2328  }
2329  foreach($ilSetting->getAll() as $field => $value)
2330  {
2331  if(substr($field,0,8) == 'require_' and $value == 1)
2332  {
2333  $value = substr($field,8);
2334  $this->required_fields[$value] = $value;
2335  }
2336  }
2337  return $this->required_fields ? $this->required_fields : array();
2338  }
global $ilSetting
Definition: privfeed.php:40
+ 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 1699 of file class.ilUserImportParser.php.

References $filename, and ilUtil\ilTempnam().

Referenced by importEndTag().

1700  {
1701  $tempname = ilUtil::ilTempnam() . $filename;
1702  $fh = fopen($tempname, "wb");
1703  if ($fh == false)
1704  {
1705  return "";
1706  }
1707  $imagefile = fwrite($fh, $image_data);
1708  fclose($fh);
1709  return $tempname;
1710  }
$filename
Definition: buildRTE.php:89
static ilTempnam()
Create a temporary file in an ILIAS writable directory.
+ 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 2225 of file class.ilUserImportParser.php.

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

Referenced by importEndTag().

2226  {
2227  if($_POST["send_mail"] != "" ||
2228  ($this->isSendMail() && $this->userObj->getEmail() != ""))
2229  {
2230  $this->acc_mail->setUser($this->userObj);
2231 
2232  $amail = $this->readAccountMailFromCache($this->userObj->getLanguage());
2233  if($amail["att_file"])
2234  {
2235  include_once "Services/User/classes/class.ilFSStorageUserFolder.php";
2237  $fs->create();
2238  $path = $fs->getAbsolutePath() . "/";
2239 
2240  $this->acc_mail->addAttachment($path . "/" . $amail["lang"], $amail["att_file"]);
2241  }
2242  $this->acc_mail->send();
2243  }
2244  }
$_POST['username']
Definition: cron.php:12
isSendMail()
read access to property send mail
$path
Definition: index.php:22
const USER_FOLDER_ID
Class ilObjUserFolder.
+ 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 public

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

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

◆ setHandlers()

ilUserImportParser::setHandlers (   $a_xml_parser)

set event handler should be overwritten by inherited class private

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

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

◆ setRoleAssignment()

ilUserImportParser::setRoleAssignment (   $a_assign)

set import to local role assignemt

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

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

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

◆ setSendMail()

ilUserImportParser::setSendMail (   $value)

write access to property send mail

Parameters
mixed$value

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

2280  {
2281  $this->send_mail = $value ? true: false;
2282  }

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

References IL_USER_MAPPING_ID, and IL_USER_MAPPING_LOGIN.

2299  {
2300  if ($value == IL_USER_MAPPING_ID || $value == IL_USER_MAPPING_LOGIN)
2301  $this->mapping_mode = $value;
2302  else die ("wrong argument using methode setUserMappingMethod in ".__FILE__);
2303  }
const IL_USER_MAPPING_LOGIN
const IL_USER_MAPPING_ID

◆ startParsing()

ilUserImportParser::startParsing ( )

start the parser

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

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

◆ updateMailPreferences()

ilUserImportParser::updateMailPreferences (   $usr_id)
private

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

References $usr_id.

Referenced by importEndTag().

2443  {
2444  if (array_key_exists("mail_incoming_type", $this->prefs) ||
2445  array_key_exists("mail_signature", $this->prefs) ||
2446  array_key_exists("mail_linebreak", $this->prefs)
2447  )
2448  {
2449  include_once("Services/Mail/classes/class.ilMailOptions.php");
2450  $mailOptions = new ilMailOptions($usr_id);
2451  $mailOptions->updateOptions(
2452  array_key_exists("mail_signature", $this->prefs) ? $this->prefs["mail_signature"] : $mailOptions->getSignature(),
2453  array_key_exists("mail_linebreak", $this->prefs) ? $this->prefs["mail_linebreak"] : $mailOptions->getLinebreak(),
2454  array_key_exists("mail_incoming_type", $this->prefs) ? $this->prefs["mail_incoming_type"] : $mailOptions->getIncomingType(),
2455  $mailOptions->getCronjobNotification()
2456  );
2457  }
2458  }
Class UserMail this class handles user mails.
+ 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 603 of file class.ilUserImportParser.php.

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

Referenced by handlerBeginTag().

604  {
605  global $lng;
606 
607  switch($a_name)
608  {
609  case "Role":
610  if (is_null($a_attribs['Id'])
611  || $a_attribs['Id'] == "")
612  {
613  $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_attribute_missing"),"Role","Id"));
614  }
615  $this->current_role_id = $a_attribs["Id"];
616  $this->current_role_type = $a_attribs["Type"];
617  if ($this->current_role_type != 'Global'
618  && $this->current_role_type != 'Local')
619  {
620  $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_attribute_missing"),"Role","Type"));
621  }
622  $this->current_role_action = (is_null($a_attribs["Action"])) ? "Assign" : $a_attribs["Action"];
623  if ($this->current_role_action != "Assign"
624  && $this->current_role_action != "AssignWithParents"
625  && $this->current_role_action != "Detach")
626  {
627  $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_attribute_value_illegal"),"Role","Action",$a_attribs["Action"]));
628  }
629  if ($this->action == "Insert"
630  && $this->current_role_action == "Detach")
631  {
632  $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_attribute_value_inapplicable"),"Role","Action",$this->current_role_action,$this->action));
633  }
634  if ($this->action == "Delete")
635  {
636  $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_inapplicable"),"Role","Delete"));
637  }
638  break;
639 
640  case "User":
641  $this->userCount++;
642  $this->userObj = new ilObjUser();
643  $this->userObj->setLanguage($a_attribs["Language"]);
644  $this->userObj->setImportId($a_attribs["Id"]);
645  $this->currentPrefKey = null;
646  // if we have an object id, store it
647  $this->user_id = -1;
648 
649  if (!is_null($a_attribs["Id"]) && $this->getUserMappingMode() == IL_USER_MAPPING_ID)
650  {
651  if (is_numeric($a_attribs["Id"]))
652  {
653  $this->user_id = $a_attribs["Id"];
654  }
655  elseif ($id = ilUtil::__extractId ($a_attribs["Id"], IL_INST_ID))
656  {
657  $this->user_id = $id;
658  }
659  }
660 
661  $this->action = (is_null($a_attribs["Action"])) ? "Insert" : $a_attribs["Action"];
662  if ($this->action != "Insert"
663  && $this->action != "Update"
664  && $this->action != "Delete")
665  {
666  $this->logFailure($this->userObj->getImportId(), sprintf($lng->txt("usrimport_xml_attribute_value_illegal"),"User","Action",$a_attribs["Action"]));
667  }
668  $this->currPassword = null;
669  $this->currPasswordType = null;
670  break;
671 
672  case "Password":
673  $this->currPasswordType = $a_attribs["Type"];
674  break;
675  case "AuthMode":
676  if (array_key_exists("type", $a_attribs))
677  {
678  switch ($a_attribs["type"])
679  {
680  case "default":
681  case "local":
682  case "ldap":
683  case "radius":
684  case "shibboleth":
685  case "script":
686  case "cas":
687  case "soap":
688  case "openid":
689  // begin-patch auth_plugin
690  default:
691  $this->userObj->setAuthMode($a_attribs["type"]);
692  break;
693  /*
694  default:
695  $this->logFailure($this->userObj->getImportId(), sprintf($lng->txt("usrimport_xml_attribute_value_illegal"),"AuthMode","type",$a_attribs["type"]));
696  break;
697  *
698  */
699  }
700  }
701  else
702  {
703  $this->logFailure($this->userObj->getImportId(), sprintf($lng->txt("usrimport_xml_attribute_value_illegal"),"AuthMode","type",""));
704  }
705  break;
706  case 'Pref':
707  $this->currentPrefKey = $a_attribs["key"];
708  break;
709 
710  }
711  }
getUserMappingMode()
read access to user mapping mode
$action
The Action attribute determines what to do for the current User element.
const IL_USER_MAPPING_ID
logFailure($aLogin, $aMessage)
Writes a failure log message to the protocol.
static __extractId($ilias_id, $inst_id)
extract ref id from role title, e.g.
+ 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 1715 of file class.ilUserImportParser.php.

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

Referenced by handlerEndTag().

1716  {
1717  global $lng,$ilAccess,$ilSetting,$ilObjDataCache;
1718 
1719  switch($a_name)
1720  {
1721  case "Role":
1722  $this->roles[$this->current_role_id]["name"] = $this->cdata;
1723  $this->roles[$this->current_role_id]["type"] = $this->current_role_type;
1724  $this->roles[$this->current_role_id]["action"] = $this->current_role_action;
1725  break;
1726 
1727  case "User":
1728  $this->userObj->setFullname();
1729  if ($this->user_id != -1 && ($this->action == "Update" || $this->action == "Delete"))
1730  $user_exists = !is_null(ilObjUser::_lookupLogin($this->user_id));
1731  else
1732  $user_exists = ilObjUser::getUserIdByLogin($this->userObj->getLogin()) != 0;
1733 
1734  if (is_null($this->userObj->getLogin()))
1735  {
1736  $this->logFailure("---",sprintf($lng->txt("usrimport_xml_element_for_action_required"),"Login", "Insert"));
1737  }
1738 
1739  switch ($this->action)
1740  {
1741  case "Insert" :
1742  if ($user_exists and $this->conflict_rule == IL_FAIL_ON_CONFLICT)
1743  {
1744  $this->logWarning($this->userObj->getLogin(),$lng->txt("usrimport_cant_insert"));
1745  }
1746  if (is_null($this->userObj->getGender()) && $this->isFieldRequired("gender"))
1747  {
1748  $this->logFailure($this->userObj->getLogin(),sprintf($lng->txt("usrimport_xml_element_for_action_required"),"Gender", "Insert"));
1749  }
1750  if (is_null($this->userObj->getFirstname()))
1751  {
1752  $this->logFailure($this->userObj->getLogin(),sprintf($lng->txt("usrimport_xml_element_for_action_required"),"Firstname", "Insert"));
1753  }
1754  if (is_null($this->userObj->getLastname()))
1755  {
1756  $this->logFailure($this->userObj->getLogin(),sprintf($lng->txt("usrimport_xml_element_for_action_required"),"Lastname", "Insert"));
1757  }
1758  if (count($this->roles) == 0)
1759  {
1760  $this->logFailure($this->userObj->getLogin(),sprintf($lng->txt("usrimport_xml_element_for_action_required"),"Role", "Insert"));
1761  }
1762  else
1763  {
1764  $has_global_role = false;
1765  foreach ($this->roles as $role)
1766  {
1767  if ($role['type'] == 'Global')
1768  {
1769  $has_global_role = true;
1770  break;
1771  }
1772  }
1773  if (! $has_global_role)
1774  {
1775  $this->logFailure($this->userObj->getLogin(),sprintf($lng->txt("usrimport_global_role_for_action_required"),"Insert"));
1776  }
1777  }
1778  break;
1779  case "Update" :
1780  if(!$user_exists)
1781  {
1782  $this->logWarning($this->userObj->getLogin(),$lng->txt("usrimport_cant_update"));
1783  }
1784  elseif($this->user_id != -1 && !is_null($this->userObj->getLogin()))
1785  // check if someone owns the new login name!
1786  {
1787  $someonesId = ilObjUser::_lookupId($this->userObj->getLogin());
1788 
1789  if (is_numeric($someonesId ) && $someonesId != $this->user_id) {
1790  $this->logFailure($this->userObj->getLogin(), $lng->txt("usrimport_login_is_not_unique"));
1791  }
1792  }
1793  break;
1794  case "Delete" :
1795  if(!$user_exists)
1796  {
1797  $this->logWarning($this->userObj->getLogin(),$lng->txt("usrimport_cant_delete"));
1798  }
1799  break;
1800  }
1801 
1802  // init role array for next user
1803  $this->roles = array();
1804  break;
1805 
1806  case "Login":
1807  if (array_key_exists($this->cdata, $this->logins))
1808  {
1809  $this->logWarning($this->cdata, $lng->txt("usrimport_login_is_not_unique"));
1810  }
1811  else
1812  {
1813  $this->logins[$this->cdata] = $this->cdata;
1814  }
1815  $this->userObj->setLogin($this->cdata);
1816  break;
1817 
1818  case "Password":
1819  switch ($this->currPasswordType)
1820  {
1821  case "ILIAS2":
1822  $this->userObj->setPasswd($this->cdata, IL_PASSWD_CRYPT);
1823  break;
1824 
1825  case "ILIAS3":
1826  $this->userObj->setPasswd($this->cdata, IL_PASSWD_MD5);
1827  break;
1828 
1829  case "PLAIN":
1830  $this->userObj->setPasswd($this->cdata, IL_PASSWD_PLAIN);
1831  $this->acc_mail->setUserPassword($this->cdata);
1832  break;
1833 
1834  default :
1835  $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_attribute_value_illegal"),"Type","Password",$this->currPasswordType));
1836  break;
1837  }
1838  break;
1839 
1840  case "Firstname":
1841  $this->userObj->setFirstname($this->cdata);
1842  break;
1843 
1844  case "Lastname":
1845  $this->userObj->setLastname($this->cdata);
1846  break;
1847 
1848  case "Title":
1849  $this->userObj->setUTitle($this->cdata);
1850  break;
1851 
1852  case "Gender":
1853  if ($this->cdata != "m"
1854  && $this->cdata != "f")
1855  {
1856  $this->logFailure(
1857  $this->userObj->getLogin(),
1858  sprintf($lng->txt("usrimport_xml_element_content_illegal"),"Gender",$this->cdata)
1859  );
1860  }
1861  $this->userObj->setGender($this->cdata);
1862  break;
1863 
1864  case "Email":
1865  $this->userObj->setEmail($this->cdata);
1866  break;
1867 
1868  case "Institution":
1869  $this->userObj->setInstitution($this->cdata);
1870  break;
1871 
1872  case "Street":
1873  $this->userObj->setStreet($this->cdata);
1874  break;
1875 
1876  case "City":
1877  $this->userObj->setCity($this->cdata);
1878  break;
1879 
1880  case "PostalCode":
1881  $this->userObj->setZipCode($this->cdata);
1882  break;
1883 
1884  case "Country":
1885  $this->userObj->setCountry($this->cdata);
1886  break;
1887 
1888  case "PhoneOffice":
1889  $this->userObj->setPhoneOffice($this->cdata);
1890  break;
1891 
1892  case "PhoneHome":
1893  $this->userObj->setPhoneHome($this->cdata);
1894  break;
1895 
1896  case "PhoneMobile":
1897  $this->userObj->setPhoneMobile($this->cdata);
1898  break;
1899 
1900  case "Fax":
1901  $this->userObj->setFax($this->cdata);
1902  break;
1903 
1904  case "Hobby":
1905  $this->userObj->setHobby($this->cdata);
1906  break;
1907 
1908  case "Comment":
1909  $this->userObj->setComment($this->cdata);
1910  break;
1911 
1912  case "Department":
1913  $this->userObj->setDepartment($this->cdata);
1914  break;
1915 
1916  case "Matriculation":
1917  $this->userObj->setMatriculation($this->cdata);
1918  break;
1919 
1920  case "ExternalAccount":
1921 //echo "-".$this->userObj->getAuthMode()."-".$this->userObj->getLogin()."-";
1922  $am = ($this->userObj->getAuthMode() == "default" || $this->userObj->getAuthMode() == "")
1923  ? ilAuthUtils::_getAuthModeName($ilSetting->get('auth_mode'))
1924  : $this->userObj->getAuthMode();
1925  $loginForExternalAccount = (trim($this->cdata) == "")
1926  ? ""
1927  : ilObjUser::_checkExternalAuthAccount($am, trim($this->cdata));
1928  switch ($this->action)
1929  {
1930  case "Insert" :
1931  if ($loginForExternalAccount != "")
1932  {
1933  $this->logWarning($this->userObj->getLogin(), $lng->txt("usrimport_no_insert_ext_account_exists")." (".$this->cdata.")");
1934  }
1935  break;
1936 
1937  case "Update" :
1938  if ($loginForExternalAccount != "")
1939  {
1940  $externalAccountHasChanged = trim($this->cdata) != ilObjUser::_lookupExternalAccount($this->user_id);
1941  if ($externalAccountHasChanged && trim($loginForExternalAccount) != trim($this->userObj->getLogin()))
1942  {
1943  $this->logWarning($this->userObj->getLogin(),
1944  $lng->txt("usrimport_no_update_ext_account_exists")." (".$this->cdata." for ".$loginForExternalAccount.")");
1945  }
1946  }
1947  break;
1948 
1949  }
1950  if ($externalAccountHasChanged)
1951  $this->userObj->setExternalAccount(trim($this->cdata));
1952  break;
1953 
1954  case "Active":
1955  if ($this->cdata != "true"
1956  && $this->cdata != "false")
1957  {
1958  $this->logFailure($this->userObj->getLogin(),
1959  sprintf($lng->txt("usrimport_xml_element_content_illegal"),"Active",$this->cdata));
1960  }
1961  $this->currActive = $this->cdata;
1962  break;
1963  case "TimeLimitOwner":
1964  if (!preg_match("/\d+/", $this->cdata))
1965  {
1966  $this->logFailure($this->userObj->getLogin(),
1967  sprintf($lng->txt("usrimport_xml_element_content_illegal"),"TimeLimitOwner",$this->cdata));
1968  }
1969  elseif(!$ilAccess->checkAccess('cat_administrate_users','',$this->cdata))
1970  {
1971  $this->logFailure($this->userObj->getLogin(),
1972  sprintf($lng->txt("usrimport_xml_element_content_illegal"),"TimeLimitOwner",$this->cdata));
1973  }
1974  elseif($ilObjDataCache->lookupType($ilObjDataCache->lookupObjId($this->cdata)) != 'cat' && !(int) $this->cdata == USER_FOLDER_ID)
1975  {
1976  $this->logFailure($this->userObj->getLogin(),
1977  sprintf($lng->txt("usrimport_xml_element_content_illegal"),"TimeLimitOwner",$this->cdata));
1978 
1979  }
1980  $this->userObj->setTimeLimitOwner($this->cdata);
1981  break;
1982  case "TimeLimitUnlimited":
1983  switch (strtolower($this->cdata))
1984  {
1985  case "true":
1986  case "1":
1987  $this->userObj->setTimeLimitUnlimited(1);
1988  break;
1989  case "false":
1990  case "0":
1991  $this->userObj->setTimeLimitUnlimited(0);
1992  break;
1993  default:
1994  $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_content_illegal"),"TimeLimitUnlimited",$this->cdata));
1995  break;
1996  }
1997  break;
1998  case "TimeLimitFrom":
1999  // Accept datetime or Unix timestamp
2000  if (strtotime($this->cdata) === false && ! is_numeric($this->cdata))
2001  {
2002  $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_content_illegal"),"TimeLimitFrom",$this->cdata));
2003  }
2004  $this->userObj->setTimeLimitFrom($this->cdata);
2005  break;
2006  case "TimeLimitUntil":
2007  // Accept datetime or Unix timestamp
2008  if (strtotime($this->cdata) === false && ! is_numeric($this->cdata))
2009  {
2010  $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_content_illegal"),"TimeLimitUntil",$this->cdata));
2011  }
2012  $this->userObj->setTimeLimitUntil($this->cdata);
2013  break;
2014  case "TimeLimitMessage":
2015  switch (strtolower($this->cdata))
2016  {
2017  case "1":
2018  $this->userObj->setTimeLimitMessage(1);
2019  break;
2020  case "0":
2021  $this->userObj->setTimeLimitMessage(0);
2022  break;
2023  default:
2024  $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_content_illegal"),"TimeLimitMessage",$this->cdata));
2025  break;
2026  }
2027  break;
2028  case "ApproveDate":
2029  // Accept datetime or Unix timestamp
2030  if (strtotime($this->cdata) === false && ! is_numeric($this->cdata) && !$this->cdata == "0000-00-00 00:00:00")
2031  {
2032  $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_content_illegal"),"ApproveDate",$this->cdata));
2033  }
2034  break;
2035  case "AgreeDate":
2036  // Accept datetime or Unix timestamp
2037  if (strtotime($this->cdata) === false && ! is_numeric($this->cdata) && !$this->cdata == "0000-00-00 00:00:00")
2038  {
2039  $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_content_illegal"),"AgreeDate",$this->cdata));
2040  }
2041  break;
2042  case "iLincID":
2043  if (!preg_match("/\d+/", $this->cdata))
2044  {
2045  $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_content_illegal"),"iLincID",$this->cdata));
2046  }
2047  break;
2048  case "iLincUser":
2049  if (!preg_match("/\w+/", $this->cdata))
2050  {
2051  $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_content_illegal"),"iLincUser",$this->cdata));
2052  }
2053  break;
2054  case "iLincPasswd":
2055  if (!preg_match("/\w+/", $this->cdata))
2056  {
2057  $this->logFailure($this->userObj->getLogin(), sprintf($lng->txt("usrimport_xml_element_content_illegal"),"iLincPasswd",$this->cdata));
2058  }
2059  break;
2060  case "Pref":
2061  if ($this->currentPrefKey != null)
2062  $this->verifyPref($this->currentPrefKey, $this->cdata);
2063  $this->currentPrefKey == null;
2064  }
2065  }
const IL_PASSWD_PLAIN
_lookupExternalAccount($a_user_id)
lookup external account for login and authmethod
static _lookupId($a_user_str)
lookup id by login
isFieldRequired($fieldname)
determine if a field $fieldname is to a required field (global setting)
const IL_FAIL_ON_CONFLICT
const IL_PASSWD_CRYPT
$currPasswordType
The password type of the current user.
static _getAuthModeName($a_auth_key)
logWarning($aLogin, $aMessage)
Writes a warning log message to the protocol.
getUserIdByLogin($a_login)
_lookupLogin($a_user_id)
lookup login
logFailure($aLogin, $aMessage)
Writes a failure log message to the protocol.
const IL_PASSWD_MD5
global $ilSetting
Definition: privfeed.php:40
static _checkExternalAuthAccount($a_auth, $a_account)
check whether external account and authentication method matches with a user
const USER_FOLDER_ID
Class ilObjUserFolder.
+ 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 2367 of file class.ilUserImportParser.php.

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

Referenced by verifyEndTag().

2367  {
2368  switch ($key) {
2369  case 'mail_linebreak':
2370  case 'hits_per_page':
2371  if (!is_numeric($value) || $value < 0)
2372  $this->logFailure("---", "Wrong value '$value': Positiv numeric value expected for preference $key.");
2373  break;
2374  case 'language':
2375  case 'skin':
2376  case 'style':
2377  case 'ilPageEditor_HTMLMode':
2378  case 'ilPageEditor_JavaScript':
2379  case 'ilPageEditor_MediaMode':
2380  case 'tst_javascript':
2381  case 'tst_lastquestiontype':
2382  case 'tst_multiline_answers':
2383  case 'tst_use_previous_answers':
2384  case 'graphicalAnswerSetting':
2385  case 'priv_feed_pass':
2386  $this->logFailure("---", "Preference $key is not supported.");
2387  break;
2388  case 'public_city':
2389  case 'public_country':
2390  case 'public_department':
2391  case 'public_email':
2392  case 'public_fax':
2393  case 'public_hobby':
2394  case 'public_institution':
2395  case 'public_matriculation':
2396  case 'public_phone':
2397  case 'public_phone_home':
2398  case 'public_phone_mobile':
2399  case 'public_phone_office':
2400  case 'public_street':
2401  case 'public_upload':
2402  case 'public_zip':
2403  case 'send_info_mails':
2404  case 'hide_own_online_status':
2405  if (!in_array($value, array('y', 'n')))
2406  $this->logFailure("---", "Wrong value '$value': Value 'y' or 'n' expected for preference $key.");
2407  break;
2408  case 'public_profile':
2409  if (!in_array($value, array('y', 'n', 'g')))
2410  $this->logFailure("---", "Wrong value '$value': Value 'y', 'g' or 'n' expected for preference $key.");
2411  break;
2412  case 'show_users_online':
2413  if (!in_array($value, array('y', 'n', 'associated')))
2414  $this->logFailure("---", "Wrong value '$value': Value 'y' or 'n' or 'associated' expected for preference $key.");
2415  break;
2416  case 'mail_incoming_type':
2417  if (!in_array((int) $value, array("0","1","2")))
2418  $this->logFailure("---", "Wrong value '$value': Value \"0\" (LOCAL),\"1\" (EMAIL) or \"2\" (BOTH) expected for preference $key.");
2419  break;
2420  case 'weekstart':
2421  if (!in_array($value, array ("0","1")))
2422  $this->logFailure("---", "Wrong value '$value': Value \"0\" (Sunday) or \"1\" (Monday) expected for preference $key.");
2423  break;
2424 
2425  case 'mail_signature':
2426  break;
2427  case 'user_tz':
2428  include_once('Services/Calendar/classes/class.ilTimeZone.php');
2429  try {
2430  $tz = ilTimeZone::_getInstance($value);
2431  return true;
2432  } catch (ilTimeZoneException $tze) {
2433  $this->logFailure("---", "Wrong value '$value': Invalid timezone $value detected for preference $key.");
2434  }
2435  break;
2436  default:
2438  $this->logFailure("---", "Preference $key is not supported.");
2439  break;
2440  }
2441  }
static isPrefExportable($key)
returns wether a key from db is exportable or not
Class for TimeZone exceptions.
logFailure($aLogin, $aMessage)
Writes a failure log message to the protocol.
static _getInstance($a_tz='')
get instance by timezone
+ Here is the call graph for this function:
+ Here is the caller graph for this function:

Field Documentation

◆ $account_mail_cache

ilUserImportParser::$account_mail_cache = array()
staticprivate

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

◆ $action

ilUserImportParser::$action

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

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

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

Referenced by verifyBeginTag().

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

◆ $current_messenger_type

ilUserImportParser::$current_messenger_type
private

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

◆ $currPassword

ilUserImportParser::$currPassword

The password of the current user.

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

◆ $currPasswordType

ilUserImportParser::$currPasswordType

The password type of the current user.

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

Referenced by verifyEndTag().

◆ $disableSkin

ilUserImportParser::$disableSkin

Indicates if the skins are enabled.

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

◆ $error_level

ilUserImportParser::$error_level

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

Values: IL_IMPORT_SUCCESS IL_IMPORT_WARNING IL_IMPORT_FAILURE

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

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

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

In IL_UPDATE_ON_CONFLICT mode, the following may have occured:

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

In IL_IGNORE_ON_CONFLICT mode, the following may have occured:

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

IL_IMPORT_FAILURE The import could not be completed.

In IL_FAIL_ON_CONFLICT mode, the following may have occured:

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

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

Referenced by getErrorLevel().

◆ $folder_id

ilUserImportParser::$folder_id

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

Referenced by getFolderId().

◆ $hideSkin

ilUserImportParser::$hideSkin

Indicates if the skins are hidden.

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

◆ $ilincdata

ilUserImportParser::$ilincdata

Cached iLinc data.

Definition at line 216 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 205 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 196 of file class.ilUserImportParser.php.

Referenced by getUserMappingMode().

◆ $parentRolesCache

ilUserImportParser::$parentRolesCache

Cached parent roles.

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

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

◆ $personalPicture

ilUserImportParser::$personalPicture

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

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

◆ $protocol

ilUserImportParser::$protocol

The variable holds the protocol of the import.

This variable is an associative array.

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

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

Referenced by getProtocol().

◆ $roles

ilUserImportParser::$roles

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

Referenced by getCollectedRoles().

◆ $send_mail

ilUserImportParser::$send_mail

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

Referenced by isSendMail().

◆ $skin

ilUserImportParser::$skin

ILIAS skin.

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

◆ $style

ilUserImportParser::$style

ILIAS style.

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

◆ $time_limit_owner_set

ilUserImportParser::$time_limit_owner_set = false

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

◆ $time_limit_set

ilUserImportParser::$time_limit_set = false

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

◆ $updateLookAndSkin

ilUserImportParser::$updateLookAndSkin = false

boolean to determine if look and skin should be updated

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

◆ $user_id

ilUserImportParser::$user_id

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

Referenced by importEndTag(), and verifyEndTag().

◆ $user_mapping

ilUserImportParser::$user_mapping

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

Referenced by getUserMapping().

◆ $userCount

ilUserImportParser::$userCount

The count of user elements in the XML file.

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

Referenced by getUserCount().

◆ $userObj

ilUserImportParser::$userObj
private

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

◆ $userStyles

ilUserImportParser::$userStyles

User assigned styles.

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


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