5 include_once
"./Services/Xml/classes/class.ilXmlWriter.php";
6 include_once
'./Services/User/classes/class.ilObjUserFolder.php';
51 $this->user_id = $ilUser->getId();
52 $this->attachRoles =
false;
64 $this->attachRoles = $value == 1?
true :
false;
75 if (!is_array($this->users))
81 include_once (
"./Services/User/classes/class.ilUserDefinedFields.php");
83 $udf_data->addToXML($this);
85 foreach ($this->users as $user)
105 $this->
xmlSetDtdDef(
"<!DOCTYPE Users PUBLIC \"-//ILIAS//DTD UserImport//EN\" \"".ILIAS_HTTP_PATH.
"/xml/ilias_user_4_0.dtd\">");
122 if (!is_array ($this->settings)) {
123 include_once (
'./Services/User/classes/class.ilObjUserFolder.php');
129 if (strlen(
$row[
"language"]) == 0)
131 $row[
"language"] = $lng->getDefaultLanguage();
136 'Id' =>
"il_".IL_INST_ID.
"_usr_".
$row[
"usr_id"],
137 'Language' =>
$row[
"language"],
145 if ($this->attachRoles == TRUE)
147 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
149 $query = sprintf(
"SELECT object_data.title, object_data.description, rbac_fa.* ".
150 "FROM object_data, rbac_ua, rbac_fa WHERE rbac_ua.usr_id = %s ".
151 "AND rbac_ua.rol_id = rbac_fa.rol_id AND object_data.obj_id = rbac_fa.rol_id",
152 $ilDB->quote(
$row[
"usr_id"],
'integer')
154 $rbacresult = $ilDB->query(
$query);
158 if ($rbacrow[
"assign"] !=
"y")
163 if ($rbacrow[
"parent"] == ROLE_FOLDER_ID)
175 "il_".IL_INST_ID.
"_role_".$rbacrow[
"rol_id"],
"Type" => $type),
186 if ($this->
canExport(
"i2passwd",
"i2passwd") && strlen(
$row[
"i2passwd"]) > 0)
189 $this->
__addElement(
"Password",
$row[
"i2passwd"], array(
"Type" =>
"ILIAS2"),
"i2passwd");
191 if (!$i2passwd && strlen(
$row[
"passwd"]) > 0)
193 $this->
__addElement(
"Password",
$row[
"passwd"], array(
"Type" =>
"ILIAS3"),
"passwd");
201 if ($this->
canExport(
"PersonalPicture",
"upload"))
206 $value = array_shift($imageData);
207 $this->
__addElement (
"PersonalPicture", $value, $imageData,
"upload");
220 $this->
__addElement (
"PhoneOffice",
$row[
"phone_office"], null,
"phone_office");
222 $this->
__addElement (
"PhoneMobile",
$row[
"phone_mobile"], null,
"phone_mobile");
226 $this->
__addElement (
"Comment",
$row[
"referral_comment"], null,
"referral_comment");
230 $this->
__addElement (
"TimeLimitOwner",
$row[
"time_limit_owner"], null,
"time_limit_owner");
231 $this->
__addElement (
"TimeLimitUnlimited",
$row[
"time_limit_unlimited"], null,
"time_limit_unlimited");
232 $this->
__addElement (
"TimeLimitFrom",
$row[
"time_limit_from"], null,
"time_limit_from");
233 $this->
__addElement (
"TimeLimitUntil",
$row[
"time_limit_until"], null,
"time_limit_until");
234 $this->
__addElement (
"TimeLimitMessage",
$row[
"time_limit_message"], null,
"time_limit_message");
235 $this->
__addElement (
"ApproveDate",
$row[
"approve_date"], null,
"approve_date");
238 if ((
int)
$row[
"ilinc_id"] !=0) {
244 if (strlen(
$row[
"auth_mode"])>0)
246 $this->
__addElement (
"AuthMode", null, array (
"type" =>
$row[
"auth_mode"]),
"auth_mode",
true);
249 if (strlen(
$row[
"ext_account"])>0)
251 $this->
__addElement (
"ExternalAccount",
$row[
"ext_account"], null,
"ext_account",
true);
254 if ($this->
canExport(
"Look",
"skin_style"))
257 "Skin" => $prefs[
"skin"],
"Style" => $prefs[
"style"]
258 ),
"skin_style",
true);
263 $this->
__addElement (
"LastUpdate",
$row[
"last_update"], null,
"last_update");
266 include_once (
"./Services/User/classes/class.ilUserDefinedData.php");
268 $udf_data->addToXML($this, $this->settings);
270 $msgrs = array (
"skype" =>
"im_skype",
"yahoo" =>
"im_yahoo",
"msn"=>
"im_msn",
"aim"=>
"im_aim",
"icq"=>
"im_icq",
"delicious" =>
"delicious",
"external" =>
"ext_account",
"jabber" =>
"im_jabber",
"voip" =>
"im_voip");
271 foreach ($msgrs as $type => $fieldname) {
272 $this->
__addElement(
"AccountInfo",
$row[$fieldname], array(
"Type" => $type),
"instant_messengers");
276 "longitude" =>
$row[
"longitude"],
277 "latitude" =>
$row[
"latitude"],
278 "zoom" =>
$row[
"loc_zoom"]));
282 if ($this->attachPreferences || $this->
canExport(
"prefs",
"preferences"))
292 include_once (
"Services/Mail/classes/class.ilMailOptions.php");
294 $prefs[
"mail_incoming_type"] = $mailOptions->getIncomingType();
295 $prefs[
"mail_signature"] = $mailOptions->getSignature();
296 $prefs[
"mail_linebreak"] = $mailOptions->getLinebreak();
300 foreach ($prefs as $key => $value)
303 $this->
xmlElement(
"Pref", array(
"key" => $key), $value);
310 function __addElement ($tagname, $value, $attrs = null, $settingsname = null, $requiredTag =
false)
312 if ($this->
canExport($tagname, $settingsname))
313 if (strlen($value) > 0 || $requiredTag || (is_array($attrs) && count($attrs) > 0))
318 private function canExport ($tagname, $settingsname = null)
320 return !is_array($this->settings) ||
321 in_array(strtolower($tagname), $this->settings) !== FALSE ||
322 in_array($settingsname, $this->settings) !== FALSE;
342 $q = sprintf(
"SELECT value FROM usr_pref WHERE usr_id = %s AND keyword = %s",
343 $ilDB->quote(
$usr_id,
"integer"), $ilDB->quote(
'profile_image',
"text"));
344 $r = $ilDB->query($q);
345 if ($ilDB->numRows($r) == 1)
348 $personal_picture = $personal_picture_data[
"value"];
350 $image_file = $webspace_dir.
"/usr_images/".$personal_picture;
351 if (@is_file($image_file))
353 $fh = fopen($image_file,
"rb");
356 $image_data = fread($fh, filesize($image_file));
358 $base64 = base64_encode($image_data);
359 $imagetype =
"image/jpeg";
360 if (preg_match(
"/.*\.(png|gif)$/", $personal_picture, $matches))
362 $imagetype =
"image/".$matches[1];
366 "encoding" =>
"Base64",
367 "imagetype" => $imagetype
384 $this->attachPreferences = $attachPrefs;
401 'public_institution',
402 'public_matriculation',
405 'public_phone_mobile',
406 'public_phone_office',
413 'hide_own_online_status',
416 'mail_incoming_type',