19declare(strict_types=1);
56 $this->
ilias = $DIC[
'ilias'];
57 $this->db =
$DIC[
'ilDB'];
58 $this->
lng = $DIC[
'lng'];
59 $this->user_id =
$DIC[
'ilUser']->getId();
61 $this->attach_roles =
false;
68 $this->attach_roles = $value;
79 if (!is_array($this->users)) {
87 foreach ($this->users as $user) {
104 $this->
xmlSetDtdDef(
'<!DOCTYPE Users PUBLIC "-//ILIAS//DTD UserImport//EN" "' . ILIAS_HTTP_PATH .
'/components/ILIAS/Export/xml/ilias_user_5_1.dtd">');
124 if ($row[
'language'] ===
null
125 || $row[
'language'] ===
'') {
126 $row[
'language'] = $this->
lng->getDefaultLanguage();
130 'Id' =>
'il_' .
IL_INST_ID .
'_usr_' . $row[
'usr_id'],
131 'Language' => $row[
'language'],
137 $this->
xmlElement(
'Login',
null, $row[
'login']);
139 if ($this->attach_roles ==
true) {
141 'SELECT object_data.title, object_data.description, rbac_fa.* ' .
142 'FROM object_data, rbac_ua, rbac_fa WHERE rbac_ua.usr_id = %s ' .
143 'AND rbac_ua.rol_id = rbac_fa.rol_id AND object_data.obj_id = rbac_fa.rol_id',
144 $this->db->quote($row[
'usr_id'],
'integer')
146 $rbacresult = $this->db->query($query);
149 if ($rbacrow[
'assign'] !=
'y') {
163 [
'Id' =>
'il_' .
IL_INST_ID .
'_role_' . $rbacrow[
'rol_id'],
'Type' => $type],
174 if ($this->
canExport(
'PersonalPicture',
'upload')) {
177 $value = array_shift($imageData);
178 $this->
__addElement(
'PersonalPicture', $value, $imageData,
'upload');
185 $this->
__addElement(
'SecondEmail', $row[
'second_email'],
null,
'second_email');
187 $this->
__addElement(
'Institution', $row[
'institution']);
190 $this->
__addElement(
'PostalCode', $row[
'zipcode'],
null,
'zipcode');
192 $this->
__addElement(
'SelCountry', $row[
'sel_country'],
null,
'sel_country');
193 $this->
__addElement(
'PhoneOffice', $row[
'phone_office'],
null,
'phone_office');
194 $this->
__addElement(
'PhoneHome', $row[
'phone_home'],
null,
'phone_home');
195 $this->
__addElement(
'PhoneMobile', $row[
'phone_mobile'],
null,
'phone_mobile');
199 $this->
__addElementMulti(
'GeneralInterest', $row[
'interests_general'] ?? [],
null,
'interests_general');
200 $this->
__addElementMulti(
'OfferingHelp', $row[
'interests_help_offered'] ?? [],
null,
'interests_help_offered');
201 $this->
__addElementMulti(
'LookingForHelp', $row[
'interests_help_looking'] ?? [],
null,
'interests_help_looking');
204 $this->
__addElement(
'Comment', $row[
'referral_comment'],
null,
'referral_comment');
205 $this->
__addElement(
'Matriculation', $row[
'matriculation']);
206 $this->
__addElement(
'Active', $row[
'active'] ?
'true' :
'false');
207 $this->
__addElement(
'ClientIP', $row[
'client_ip'],
null,
'client_ip');
208 $this->
__addElement(
'TimeLimitOwner', $row[
'time_limit_owner'],
null,
'time_limit_owner');
209 $this->
__addElement(
'TimeLimitUnlimited', $row[
'time_limit_unlimited'],
null,
'time_limit_unlimited');
210 $this->
__addElement(
'TimeLimitFrom', $row[
'time_limit_from'],
null,
'time_limit_from');
211 $this->
__addElement(
'TimeLimitUntil', $row[
'time_limit_until'],
null,
'time_limit_until');
212 $this->
__addElement(
'TimeLimitMessage', $row[
'time_limit_message'],
null,
'time_limit_message');
213 $this->
__addElement(
'ApproveDate', $row[
'approve_date'],
null,
'approve_date');
214 $this->
__addElement(
'AgreeDate', $row[
'agree_date'],
null,
'agree_date');
216 if ($row[
'auth_mode'] !==
null
217 && $row[
'auth_mode'] !==
'') {
218 $this->
__addElement(
'AuthMode',
null, [
'type' => $row[
'auth_mode']],
'auth_mode',
true);
221 if ($row[
'ext_account'] !==
null
222 && $row[
'ext_account'] !==
'') {
223 $this->
__addElement(
'ExternalAccount', $row[
'ext_account'],
null,
'ext_account',
true);
226 if (isset($prefs[
'skin'])
227 && isset($prefs[
'style'])
228 && $this->
canExport(
'Look',
'skin_style')) {
233 'Skin' => $prefs[
'skin'],
'Style' => $prefs[
'style']
241 $this->
__addElement(
'LastUpdate', $row[
'last_update'],
null,
'last_update');
242 $this->
__addElement(
'LastLogin', $row[
'last_login'],
null,
'last_login');
246 $this->
__addElement(
'AccountInfo', $row[
'ext_account'], [
'Type' =>
'external']);
249 'longitude' => $row[
'longitude'],
250 'latitude' => $row[
'latitude'],
251 'zoom' => $row[
'loc_zoom']]);
255 if ($this->attach_preferences || $this->
canExport(
'prefs',
'preferences')) {
267 $prefs[
'mail_incoming_type'] = $mailOptions->getIncomingType();
268 $prefs[
'mail_address_option'] = $mailOptions->getEmailAddressMode();
269 $prefs[
'mail_signature'] = $mailOptions->getSignature();
272 foreach ($prefs as $key => $value) {
273 if (self::isPrefExportable($key)) {
274 $this->
xmlElement(
'Pref', [
'key' => $key], $value);
284 ?array $attrs =
null,
285 ?
string $settingsname =
null,
286 bool $requiredTag =
false
288 foreach ($value as $item) {
289 $this->
__addElement($tagname, $item, $attrs, $settingsname, $requiredTag);
296 ?array $attrs =
null,
297 ?
string $settingsname =
null,
298 bool $requiredTag =
false
300 if ($this->canExport($tagname, $settingsname)
303 || is_array($attrs) && count($attrs) > 0)) {
304 $this->xmlElement($tagname, $attrs, (
string) $value);
310 ?
string $settingsname =
null
313 || in_array(strtolower($tagname), $this->
settings) !== false
314 || in_array($settingsname, $this->
settings) !== false;
327 $this->attach_preferences = $attach_preferences;
337 $avatar_resolver->setForcePicture(
true);
338 if (!$avatar_resolver->hasProfilePicture()) {
342 [$image_data, $image_type] = $avatar_resolver->getUserPictureForVCard();
344 if ($image_data ===
null || $image_type ===
null) {
349 'value' => base64_encode($image_data),
350 'encoding' =>
'Base64',
351 'imagetype' => $image_type
360 foreach ($this->user_profile->getVisibleFields(Context::Export) as $field) {
364 'Id' => $field->getIdentifier(),
365 'Name' => $field->getName($this->lng)
367 (
string) ($this->user_data[
'f_' . $field->getIdentifier()] ??
'')
382 'public_second_email',
385 'public_institution',
386 'public_matriculation',
389 'public_phone_mobile',
390 'public_phone_office',
397 'hide_own_online_status',
398 'bs_allow_to_contact_me',
399 'chat_osc_accept_msg',
400 'chat_broadcast_typing',
403 'mail_incoming_type',
406 'public_interests_general',
407 'public_interests_help_offered',
408 'public_interests_help_looking'
417 return in_array($key, self::getExportablePreferences());
static getExportSettings()
static _getPreferences(int $user_id)
Class ilUserAvatarResolver.
XML writer class Class to simplify manual writing of xml documents.
setAttachPreferences(bool $attach_preferences)
if set to true, all preferences of a user will be set
getPictureValue(int $usr_id)
return array with base-encoded picture data as key value, encoding type as encoding,...
static isPrefExportable(string $key)
returns wether a key from db is exportable or not
canExport(string $tagname, ?string $settingsname=null)
array $settings
fields to be exported
addUDFsToXML()
add user defined field data to xml (using usr dtd)
__handlePreferences(array $prefs, array $row)
static getExportablePreferences()
return exportable preference keys as found in db
setSettings(array $settings)
__addElementMulti(string $tagname, array $value, ?array $attrs=null, ?string $settingsname=null, bool $requiredTag=false)
setAttachRoles(bool $value)
__addElement(string $tagname, ?string $value, ?array $attrs=null, ?string $settingsname=null, bool $requiredTag=false)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
xmlSetGenCmt(string $genCmt)
Sets generated comment.
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
__construct(string $version="1.0", string $outEnc="utf-8", string $inEnc="utf-8")
xmlHeader()
Writes xml header.
xmlEndTag(string $tag)
Writes an endtag.
xmlSetDtdDef(string $dtdDef)
Sets dtd definition.
xmlDumpMem(bool $format=true)
Returns xml document from memory.
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
return['delivery_method'=> 'php',]
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
Interface Observer \BackgroundTasks Contains several chained tasks and infos about them.
Class ilObjForumAdministration.
if(!file_exists('../ilias.ini.php'))