38 include_once
"./classes/class.ilXmlWriter.php";
39 include_once
'./Services/User/classes/class.ilObjUserFolder.php';
72 $this->user_id = $ilUser->getId();
73 $this->attachRoles =
false;
85 $this->attachRoles = $value == 1?
true :
false;
96 if (!is_array($this->users))
102 include_once (
"./Services/User/classes/class.ilUserDefinedFields.php");
104 $udf_data->addToXML($this);
106 foreach ($this->users as
$user)
126 $this->
xmlSetDtdDef(
"<!DOCTYPE Users PUBLIC \"-//ILIAS//DTD UserImport//EN\" \"".ILIAS_HTTP_PATH.
"/xml/ilias_user_3_10.dtd\">");
143 if (!is_array ($this->settings)) {
144 include_once (
'./Services/User/classes/class.ilObjUserFolder.php');
150 if (strlen($row[
"language"]) == 0) $row[
"language"] =
"en";
153 'Id' =>
"il_".IL_INST_ID.
"_usr_".$row[
"usr_id"],
154 'Language' => $row[
"language"],
160 $this->
xmlElement(
"Login", null, $row[
"login"]);
162 if ($this->attachRoles == TRUE)
164 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
166 $query = sprintf(
"SELECT object_data.title, object_data.description, rbac_fa.*
167 FROM object_data, rbac_ua, rbac_fa WHERE rbac_ua.usr_id = %s AND rbac_ua.rol_id = rbac_fa.rol_id AND object_data.obj_id = rbac_fa.rol_id",
168 $ilDB->quote($row[
"usr_id"])
170 $rbacresult = $ilDB->query($query);
174 if ($rbacrow[
"assign"] !=
"y")
179 if ($rbacrow[
"parent"] == ROLE_FOLDER_ID)
191 "il_".IL_INST_ID.
"_role_".$rbacrow[
"rol_id"],
"Type" => $type),
202 if ($this->
canExport(
"i2passwd",
"i2passwd") && strlen($row[
"i2passwd"]) > 0)
205 $this->
__addElement(
"Password",$row[
"i2passwd"], array(
"Type" =>
"ILIAS2"),
"i2passwd");
207 if (!$i2passwd && strlen($row[
"passwd"]) > 0)
209 $this->
__addElement(
"Password",$row[
"passwd"], array(
"Type" =>
"ILIAS3"),
"passwd");
217 if ($this->
canExport(
"PersonalPicture",
"upload"))
222 $value = array_shift($imageData);
223 $this->
__addElement (
"PersonalPicture", $value, $imageData,
"upload");
230 $this->
__addElement (
"Institution", $row[
"institution"]);
233 $this->
__addElement (
"PostalCode", $row[
"zipcode"], null,
"zipcode");
235 $this->
__addElement (
"PhoneOffice", $row[
"phone_office"], null,
"phone_office");
236 $this->
__addElement (
"PhoneHome", $row[
"phone_home"], null,
"phone_home");
237 $this->
__addElement (
"PhoneMobile", $row[
"phone_mobile"], null,
"phone_mobile");
241 $this->
__addElement (
"Comment", $row[
"referral_comment"], null,
"referral_comment");
242 $this->
__addElement (
"Matriculation", $row[
"matriculation"]);
243 $this->
__addElement (
"Active", $row[
"active"] ?
"true":
"false" );
244 $this->
__addElement (
"ClientIP", $row[
"client_ip"], null,
"client_ip");
245 $this->
__addElement (
"TimeLimitOwner", $row[
"time_limit_owner"], null,
"time_limit_owner");
246 $this->
__addElement (
"TimeLimitUnlimited", $row[
"time_limit_unlimited"], null,
"time_limit_unlimited");
247 $this->
__addElement (
"TimeLimitFrom", $row[
"time_limit_from"], null,
"time_limit_from");
248 $this->
__addElement (
"TimeLimitUntil", $row[
"time_limit_until"], null,
"time_limit_until");
249 $this->
__addElement (
"TimeLimitMessage", $row[
"time_limit_message"], null,
"time_limit_message");
250 $this->
__addElement (
"ApproveDate", $row[
"approve_date"], null,
"approve_date");
251 $this->
__addElement (
"AgreeDate", $row[
"agree_date"], null,
"agree_date");
253 if ((
int) $row[
"ilinc_id"] !=0) {
254 $this->
__addElement (
"iLincID", $row[
"ilinc_id"],
"ilinc_id");
255 $this->
__addElement (
"iLincUser", $row[
"ilinc_user"],
"ilinc_user");
256 $this->
__addElement (
"iLincPasswd", $row[
"ilinc_passwd"],
"ilinc_passwd");
259 if (strlen($row[
"auth_mode"])>0)
261 $this->
__addElement (
"AuthMode", null, array (
"type" => $row[
"auth_mode"]),
"auth_mode",
true);
264 if (strlen($row[
"ext_account"])>0)
266 $this->
__addElement (
"ExternalAccount", $row[
"ext_account"], null,
"ext_account",
true);
269 if ($this->
canExport(
"Look",
"skin_style"))
272 "Skin" => $prefs[
"skin"],
"Style" => $prefs[
"style"]
273 ),
"skin_style",
true);
278 $this->
__addElement (
"LastUpdate", $row[
"last_update"], null,
"last_update");
279 $this->
__addElement (
"LastLogin", $row[
"last_login"], null,
"last_login");
281 include_once (
"./Services/User/classes/class.ilUserDefinedData.php");
283 $udf_data->addToXML($this, $this->settings);
285 $msgrs = array (
"skype" =>
"im_skype",
"yahoo" =>
"im_yahoo",
"msn"=>
"im_msn",
"aim"=>
"im_aim",
"icq"=>
"im_icq",
"delicious" =>
"delicious",
"external" =>
"ext_account");
286 foreach ($msgrs as $type => $fieldname) {
287 $this->
__addElement(
"AccountInfo", $row[$fieldname], array(
"Type" => $type),
"instant_messengers");
291 "longitude" => $row[
"longitude"],
292 "latitude" => $row[
"latitude"],
293 "zoom" => $row[
"loc_zoom"]));
297 if ($this->attachPreferences || $this->
canExport(
"prefs",
"preferences"))
307 include_once (
"Services/Mail/classes/class.ilMailOptions.php");
309 $prefs[
"mail_incoming_type"] = $mailOptions->getIncomingType();
310 $prefs[
"mail_signature"] = $mailOptions->getSignature();
311 $prefs[
"mail_linebreak"] = $mailOptions->getLinebreak();
315 foreach ($prefs as $key => $value)
318 $this->
xmlElement(
"Pref", array(
"key" => $key), $value);
325 function __addElement ($tagname, $value, $attrs = null, $settingsname = null, $requiredTag =
false)
327 if ($this->
canExport($tagname, $settingsname))
328 if (strlen($value) > 0 || $requiredTag || (is_array($attrs) && count($attrs) > 0))
333 private function canExport ($tagname, $settingsname = null)
335 return !is_array($this->settings) ||
336 in_array(strtolower($tagname), $this->settings) !== FALSE ||
337 in_array($settingsname, $this->settings) !== FALSE;
357 $q = sprintf(
"SELECT value FROM usr_pref WHERE usr_id=%s AND keyword='profile_image'", $ilDB->quote($usr_id .
""));
358 $r = $ilDB->query($q);
359 if ($r->numRows() == 1)
362 $personal_picture = $personal_picture_data[
"value"];
364 $image_file = $webspace_dir.
"/usr_images/".$personal_picture;
365 if (@is_file($image_file))
367 $fh = fopen($image_file,
"rb");
370 $image_data = fread($fh, filesize($image_file));
372 $base64 = base64_encode($image_data);
373 $imagetype =
"image/jpeg";
374 if (preg_match(
"/.*\.(png|gif)$/", $personal_picture, $matches))
376 $imagetype =
"image/".$matches[1];
380 "encoding" =>
"Base64",
381 "imagetype" => $imagetype
398 $this->attachPreferences = $attachPrefs;
415 'public_institution',
416 'public_matriculation',
419 'public_phone_mobile',
420 'public_phone_office',
427 'hide_own_online_status',
430 'mail_incoming_type',