46 $ilias = $DIC[
'ilias'];
52 $this->user_id =
$ilUser->getId();
53 $this->attachRoles =
false;
58 $this->attachRoles = $value;
69 if (!is_array($this->users)) {
76 $udf_data->addToXML($this);
78 foreach ($this->users as $user) {
95 $this->
xmlSetDtdDef(
"<!DOCTYPE Users PUBLIC \"-//ILIAS//DTD UserImport//EN\" \"" . ILIAS_HTTP_PATH .
"/xml/ilias_user_5_1.dtd\">");
111 $ilDB = $DIC[
'ilDB'];
119 if (strlen($row[
"language"]) == 0) {
120 $row[
"language"] =
$lng->getDefaultLanguage();
124 'Id' =>
"il_" .
IL_INST_ID .
"_usr_" . $row[
"usr_id"],
125 'Language' => $row[
"language"],
131 $this->
xmlElement(
"Login", null, $row[
"login"]);
133 if ($this->attachRoles ==
true) {
135 "SELECT object_data.title, object_data.description, rbac_fa.* " .
136 "FROM object_data, rbac_ua, rbac_fa WHERE rbac_ua.usr_id = %s " .
137 "AND rbac_ua.rol_id = rbac_fa.rol_id AND object_data.obj_id = rbac_fa.rol_id",
138 $ilDB->quote($row[
"usr_id"],
'integer')
143 if ($rbacrow[
"assign"] !=
"y") {
169 if ($this->
canExport(
"PersonalPicture",
"upload")) {
172 $value = array_shift($imageData);
173 $this->
__addElement(
"PersonalPicture", $value, $imageData,
"upload");
180 $this->
__addElement(
"SecondEmail", $row[
"second_email"], null,
"second_email");
182 $this->
__addElement(
"Institution", $row[
"institution"]);
185 $this->
__addElement(
"PostalCode", $row[
"zipcode"], null,
"zipcode");
187 $this->
__addElement(
"SelCountry", $row[
"sel_country"], null,
"sel_country");
188 $this->
__addElement(
"PhoneOffice", $row[
"phone_office"], null,
"phone_office");
189 $this->
__addElement(
"PhoneHome", $row[
"phone_home"], null,
"phone_home");
190 $this->
__addElement(
"PhoneMobile", $row[
"phone_mobile"], null,
"phone_mobile");
194 $this->
__addElementMulti(
"GeneralInterest", $row[
"interests_general"] ?? [], null,
"interests_general");
195 $this->
__addElementMulti(
"OfferingHelp", $row[
"interests_help_offered"] ?? [], null,
"interests_help_offered");
196 $this->
__addElementMulti(
"LookingForHelp", $row[
"interests_help_looking"] ?? [], null,
"interests_help_looking");
199 $this->
__addElement(
"Comment", $row[
"referral_comment"], null,
"referral_comment");
200 $this->
__addElement(
"Matriculation", $row[
"matriculation"]);
201 $this->
__addElement(
"Active", $row[
"active"] ?
"true" :
"false");
202 $this->
__addElement(
"ClientIP", $row[
"client_ip"], null,
"client_ip");
203 $this->
__addElement(
"TimeLimitOwner", $row[
"time_limit_owner"], null,
"time_limit_owner");
204 $this->
__addElement(
"TimeLimitUnlimited", $row[
"time_limit_unlimited"], null,
"time_limit_unlimited");
205 $this->
__addElement(
"TimeLimitFrom", $row[
"time_limit_from"], null,
"time_limit_from");
206 $this->
__addElement(
"TimeLimitUntil", $row[
"time_limit_until"], null,
"time_limit_until");
207 $this->
__addElement(
"TimeLimitMessage", $row[
"time_limit_message"], null,
"time_limit_message");
208 $this->
__addElement(
"ApproveDate", $row[
"approve_date"], null,
"approve_date");
209 $this->
__addElement(
"AgreeDate", $row[
"agree_date"], null,
"agree_date");
211 if (strlen($row[
"auth_mode"]) > 0) {
212 $this->
__addElement(
"AuthMode", null, array(
"type" => $row[
"auth_mode"]),
"auth_mode",
true);
215 if (strlen($row[
"ext_account"]) > 0) {
216 $this->
__addElement(
"ExternalAccount", $row[
"ext_account"], null,
"ext_account",
true);
219 if (isset($prefs[
'skin'])
220 && isset($prefs[
'style'])
221 && $this->
canExport(
'Look',
'skin_style')) {
226 'Skin' => $prefs[
'skin'],
'Style' => $prefs[
'style']
234 $this->
__addElement(
"LastUpdate", $row[
"last_update"], null,
"last_update");
235 $this->
__addElement(
"LastLogin", $row[
"last_login"], null,
"last_login");
238 $udf_data->addToXML($this);
240 $this->
__addElement(
"AccountInfo", $row[
"ext_account"], array(
"Type" =>
"external"));
243 "longitude" => $row[
"longitude"],
244 "latitude" => $row[
"latitude"],
245 "zoom" => $row[
"loc_zoom"]));
249 if ($this->attachPreferences || $this->
canExport(
"prefs",
"preferences")) {
261 $prefs[
"mail_incoming_type"] = $mailOptions->getIncomingType();
262 $prefs[
"mail_address_option"] = $mailOptions->getEmailAddressMode();
263 $prefs[
"mail_signature"] = $mailOptions->getSignature();
264 $prefs[
"mail_linebreak"] = $mailOptions->getLinebreak();
267 foreach ($prefs as
$key => $value) {
268 if (self::isPrefExportable(
$key)) {
279 ?array $attrs = null,
280 ?
string $settingsname = null,
281 bool $requiredTag =
false 283 if (is_array($value) && count($value)) {
284 foreach ($value as $item) {
285 $this->
__addElement($tagname, $item, $attrs, $settingsname, $requiredTag);
294 ?
string $settingsname = null,
295 bool $requiredTag =
false 297 if ($this->
canExport($tagname, $settingsname)) {
298 if (strlen($value) > 0 || $requiredTag || (is_array($attrs) && count($attrs) > 0)) {
299 $this->
xmlElement($tagname, $attrs, (
string) $value);
306 ?
string $settingsname = null
309 || in_array(strtolower($tagname), $this->
settings) !==
false 310 || in_array($settingsname, $this->
settings) !==
false;
326 $ilDB = $DIC[
'ilDB'];
329 "SELECT value FROM usr_pref WHERE usr_id = %s AND keyword = %s",
330 $ilDB->quote($usr_id,
"integer"),
331 $ilDB->quote(
'profile_image',
"text")
333 $r =
$ilDB->query($q);
334 if (
$ilDB->numRows($r) == 1) {
336 $personal_picture = $personal_picture_data[
"value"];
338 $image_file = $webspace_dir .
"/usr_images/" . $personal_picture;
339 if (is_file($image_file)) {
340 $fh = fopen($image_file,
"rb");
342 $image_data = fread($fh, filesize($image_file));
344 $base64 = base64_encode($image_data);
345 $imagetype =
"image/jpeg";
346 if (preg_match(
"/.*\.(png|gif)$/", $personal_picture, $matches)) {
347 $imagetype =
"image/" . $matches[1];
351 "encoding" =>
"Base64",
352 "imagetype" => $imagetype
366 $this->attachPreferences = $attachPrefs;
380 'public_second_email',
383 'public_institution',
384 'public_matriculation',
387 'public_phone_mobile',
388 'public_phone_office',
395 'hide_own_online_status',
396 'bs_allow_to_contact_me',
397 'chat_osc_accept_msg',
398 'chat_broadcast_typing',
401 'mail_incoming_type',
404 'public_interests_general',
405 'public_interests_help_offered',
406 'public_interests_help_looking' 415 return in_array($key, self::getExportablePreferences());
static getWebspaceDir(string $mode="filesystem")
get webspace directory
Class ilMailOptions this class handles user mails.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
__handlePreferences(array $prefs, array $row)
Class ChatMainBarProvider .
static _getPreferences(int $user_id)
get preferences for user
getPictureValue(int $usr_id)
return array with base-encoded picture data as key value, encoding type as encoding, and image type as key type.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
xmlSetGenCmt(string $genCmt)
Sets generated comment.
canExport(string $tagname, ?string $settingsname=null)
setAttachPreferences(bool $attachPrefs)
if set to true, all preferences of a user will be set
static getExportSettings()
xmlEndTag(string $tag)
Writes an endtag.
xmlSetDtdDef(string $dtdDef)
Sets dtd definition.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
array $settings
fields to be exported
__addElementMulti(string $tagname, array $value, ?array $attrs=null, ?string $settingsname=null, bool $requiredTag=false)
header include for all ilias files.
xmlHeader()
Writes xml header.
__addElement(string $tagname, ?string $value, array $attrs=null, ?string $settingsname=null, bool $requiredTag=false)
setSettings(array $settings)
static isPrefExportable(string $key)
returns wether a key from db is exportable or not
setAttachRoles(bool $value)
__construct(Container $dic, ilPlugin $plugin)
xmlStartTag(string $tag, ?array $attrs=null, bool $empty=false, bool $encode=true, bool $escape=true)
Writes a starttag.
xmlElement(string $tag, $attrs=null, $data=null, $encode=true, $escape=true)
Writes a basic element (no children, just textual content)
static getExportablePreferences()
return exportable preference keys as found in db
xmlDumpMem(bool $format=true)
Returns xml document from memory.