4 include_once(
"./Services/DataSet/classes/class.ilDataSet.php");
27 return array(
"4.3.0",
"4.5.0");
38 return "http://www.ilias.de/xml/Services/User/".$a_entity;
47 protected function getTypes($a_entity, $a_version)
50 if ($a_entity ==
"usr_profile")
59 "Firstname" =>
"text",
64 "Institution" =>
"text",
65 "Department" =>
"text",
70 "SelCountry" =>
"text",
71 "PhoneOffice" =>
"text",
72 "PhoneHome" =>
"text",
73 "PhoneMobile" =>
"text",
77 "ReferralComment" =>
"text",
78 "Matriculation" =>
"text",
79 "Delicious" =>
"text",
81 "Longitude" =>
"text",
82 "Picture" =>
"directory"
87 if ($a_entity ==
"usr_setting")
94 "UserId" =>
"integer",
101 if ($a_entity ==
"personal_data")
113 if ($a_entity ==
"usr_multi")
119 "UserId" =>
"integer",
138 if ($a_entity ==
"usr_profile")
142 include_once(
"./Services/User/classes/class.ilObjUser.php");
145 $this->temp_picture_dirs[$a_set[
"Id"]] = $tmp_dir;
147 $a_set[
"Picture"] = $tmp_dir;
161 if ($a_entity ==
"usr_profile")
164 $tmp_dir = $this->temp_picture_dirs[$a_set[
"Id"]];
165 if ($tmp_dir !=
"" && is_dir($tmp_dir))
178 function readData($a_entity, $a_version, $a_ids, $a_field =
"")
182 if (!is_array($a_ids))
184 $a_ids = array($a_ids);
187 if ($a_entity ==
"personal_data")
193 $this->data = array();
194 foreach ($a_ids as $id)
196 $this->data[] = array(
"Id" => $id);
202 if ($a_entity ==
"usr_profile")
209 " title, birthday, gender, institution, department, street, city, zipcode, country, sel_country, ".
210 " phone_office, phone_home, phone_mobile, fax, email, hobby, referral_comment, matriculation, ".
211 " delicious, latitude, longitude".
214 $ilDB->in(
"u.usr_id", $a_ids,
false,
"integer"));
219 if ($a_entity ==
"usr_setting")
226 $prefs = array(
"date_format",
"day_end",
"day_start",
"hide_own_online_status",
"hits_per_page",
"language",
227 "public_birthday",
"puplic_city",
"public_country",
"public_delicious",
"public_department",
"public_email",
228 "public_fax",
"public_gender",
"public_hobby",
"public_im_aim",
"public_im_icq",
"public_im_jabber",
229 "public_im_msn",
"public_im_skype",
"public_im_voip",
"public_im_yahoo",
"public_institution",
"public_location",
230 "public_matriculation",
"public_phone_home",
"public_phone_mobile",
"public_phone_office",
"public_profile",
231 "public_sel_country",
"public_street",
"public_title",
"public_upload",
"public_zipcode",
232 "screen_reader_optimization",
"show_users_online",
233 "store_last_visited",
"time_format",
"user_tz",
"weekstart");
234 $this->data = array();
235 $set = $ilDB->query(
"SELECT * FROM usr_pref ".
236 " WHERE ".$ilDB->in(
"keyword", $prefs,
false,
"text").
237 " AND ".$ilDB->in(
"usr_id", $a_ids,
false,
"integer"));
238 while ($rec = $ilDB->fetchAssoc($set))
240 $this->data[] = array(
"UserId" => $rec[
"usr_id"],
"Keyword" => $rec[
"keyword"],
"Value" => $rec[
"value"]);
258 if ($a_entity ==
"usr_multi")
263 $this->data = array();
264 $set = $ilDB->query(
"SELECT * FROM usr_data_multi".
265 " WHERE ".$ilDB->in(
"usr_id", $a_ids,
false,
"integer"));
266 while ($rec = $ilDB->fetchAssoc($set))
268 $this->data[] = array(
"UserId" => $rec[
"usr_id"],
"FieldId" => $rec[
"field_id"],
"Value" => $rec[
"value"]);
283 case "personal_data":
285 "usr_profile" => array(
"ids" => $a_rec[
"Id"]),
286 "usr_setting" => array(
"ids" => $a_rec[
"Id"]),
287 "usr_multi" => array(
"ids" => $a_rec[
"Id"])
300 function importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
308 case "personal_data":
311 $a_mapping->addMapping(
"Services/User",
"usr", $a_rec[
"Id"], $ilUser->getId());
315 $usr_id = $a_mapping->getMapping(
"Services/User",
"usr", $a_rec[
"Id"]);
318 if (!isset($this->users[$usr_id]))
320 $this->users[$usr_id] =
new ilObjUser($usr_id);
322 $user = $this->users[$usr_id];
323 include_once(
"./Services/User/classes/class.ilUserProfile.php");
325 $prof->skipField(
"username");
326 $prof->skipField(
"password");
327 $prof->skipField(
"roles");
328 $prof->skipGroup(
"settings");
329 $fields = $prof->getStandardFields();
330 foreach ($fields as $k => $f)
335 !$ilSetting->get(
"usr_settings_disable_".$k) &&
336 $f[
"method"] !=
"" && isset($a_rec[$up_k]))
338 $set_method =
"set".substr($f[
"method"], 3);
347 if ($pic_dir !=
"" && is_dir($pic_dir))
349 $upload_file = $pic_dir.
"/upload_".$a_rec[
"Id"].
"pic";
350 if (is_file($upload_file))
359 $usr_id = $a_mapping->getMapping(
"Services/User",
"usr", $a_rec[
"UserId"]);
362 if (!isset($this->users[$usr_id]))
364 $this->users[$usr_id] =
new ilObjUser($usr_id);
366 $user = $this->users[$usr_id];
372 $usr_id = $a_mapping->getMapping(
"Services/User",
"usr", $a_rec[
"UserId"]);