4 include_once(
"./Services/DataSet/classes/class.ilDataSet.php");
27 return array(
"4.3.0",
"4.5.0",
"5.1.0",
"5.2.0",
"5.3.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") {
60 "Firstname" =>
"text",
65 "Institution" =>
"text",
66 "Department" =>
"text",
71 "SelCountry" =>
"text",
72 "PhoneOffice" =>
"text",
73 "PhoneHome" =>
"text",
74 "PhoneMobile" =>
"text",
77 "SecondEmail" =>
"text",
79 "ReferralComment" =>
"text",
80 "Matriculation" =>
"text",
82 "Longitude" =>
"text",
84 "Picture" =>
"directory" 89 if ($a_entity ==
"usr_setting") {
97 "UserId" =>
"integer",
104 if ($a_entity ==
"personal_data") {
105 switch ($a_version) {
117 if ($a_entity ==
"usr_multi") {
118 switch ($a_version) {
124 "UserId" =>
"integer",
145 if ($a_entity ==
"usr_profile") {
148 include_once(
"./Services/User/classes/class.ilObjUser.php");
150 $im = ilObjUser::_getPersonalPicturePath(
161 $this->temp_picture_dirs[$a_set[
"Id"]] = $tmp_dir;
163 $a_set[
"Picture"] = $tmp_dir;
177 if ($a_entity ==
"usr_profile") {
179 $tmp_dir = $this->temp_picture_dirs[$a_set[
"Id"]];
180 if ($tmp_dir !=
"" && is_dir($tmp_dir)) {
192 public function readData($a_entity, $a_version, $a_ids, $a_field =
"")
196 $ilDB = $DIC[
'ilDB'];
198 if (!is_array($a_ids)) {
199 $a_ids = array($a_ids);
202 if ($a_entity ==
"personal_data") {
203 switch ($a_version) {
209 $this->
data = array();
210 foreach ($a_ids as
$id) {
211 $this->
data[] = array(
"Id" => $id);
217 if ($a_entity ==
"usr_profile") {
218 switch ($a_version) {
223 " title, birthday, gender, institution, department, street, city, zipcode, country, sel_country, " .
224 " phone_office, phone_home, phone_mobile, fax, email, hobby, referral_comment, matriculation, " .
225 " delicious, latitude, longitude, loc_zoom" .
226 " FROM usr_data u " .
228 $ilDB->in(
"u.usr_id", $a_ids,
false,
"integer"));
233 " title, birthday, gender, institution, department, street, city, zipcode, country, sel_country, " .
234 " phone_office, phone_home, phone_mobile, fax, email, hobby, referral_comment, matriculation, " .
235 " latitude, longitude, loc_zoom" .
236 " FROM usr_data u " .
238 $ilDB->in(
"u.usr_id", $a_ids,
false,
"integer"));
242 " title, birthday, gender, institution, department, street, city, zipcode, country, sel_country, " .
243 " phone_office, phone_home, phone_mobile, fax, email, second_email, hobby, referral_comment, matriculation, " .
244 " latitude, longitude, loc_zoom" .
245 " FROM usr_data u " .
247 $ilDB->in(
"u.usr_id", $a_ids,
false,
"integer"));
252 if ($a_entity ==
"usr_setting") {
253 switch ($a_version) {
260 $prefs = array(
"date_format",
"day_end",
"day_start",
"bs_allow_to_contact_me",
"chat_osc_accept_msg",
"hide_own_online_status",
"hits_per_page",
"language",
261 "public_birthday",
"puplic_city",
"public_country",
"public_delicious",
"public_department",
"public_email",
"public_second_email",
262 "public_fax",
"public_gender",
"public_hobby",
"public_im_aim",
"public_im_icq",
"public_im_jabber",
263 "public_im_msn",
"public_im_skype",
"public_im_voip",
"public_im_yahoo",
"public_institution",
"public_location",
264 "public_matriculation",
"public_phone_home",
"public_phone_mobile",
"public_phone_office",
265 "public_profile",
"public_sel_country",
"public_street",
"public_title",
"public_upload",
"public_zipcode",
266 "screen_reader_optimization",
"show_users_online",
267 "store_last_visited",
"time_format",
"user_tz",
"weekstart",
268 "session_reminder_enabled",
"session_reminder_lead_time",
"usr_starting_point",
269 "char_selector_availability",
"char_selector_definition");
271 if (version_compare($a_version,
'5.2.0',
'>=')) {
273 $prefs[
'public_im_aim'], $prefs[
'public_im_icq'], $prefs[
'public_im_jabber'],
274 $prefs[
'public_im_msn'], $prefs[
'public_im_skype'], $prefs[
'public_im_voip'],
275 $prefs[
'public_im_yahoo'], $prefs[
'public_delicious']
279 $this->
data = array();
280 $set =
$ilDB->query(
"SELECT * FROM usr_pref " .
281 " WHERE " .
$ilDB->in(
"keyword", $prefs,
false,
"text") .
282 " AND " .
$ilDB->in(
"usr_id", $a_ids,
false,
"integer"));
283 while ($rec =
$ilDB->fetchAssoc($set)) {
284 $this->
data[] = array(
"UserId" => $rec[
"usr_id"],
"Keyword" => $rec[
"keyword"],
"Value" => $rec[
"value"]);
290 if ($a_entity ==
"usr_multi") {
291 switch ($a_version) {
296 $this->
data = array();
297 $set =
$ilDB->query(
"SELECT * FROM usr_data_multi" .
298 " WHERE " .
$ilDB->in(
"usr_id", $a_ids,
false,
"integer"));
299 while ($rec =
$ilDB->fetchAssoc($set)) {
300 $this->
data[] = array(
"UserId" => $rec[
"usr_id"],
"FieldId" => $rec[
"field_id"],
"Value" => $rec[
"value"]);
314 case "personal_data":
316 "usr_profile" => array(
"ids" => $a_rec[
"Id"]),
317 "usr_setting" => array(
"ids" => $a_rec[
"Id"]),
318 "usr_multi" => array(
"ids" => $a_rec[
"Id"])
331 public function importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
341 case "personal_data":
344 $a_mapping->addMapping(
"Services/User",
"usr", $a_rec[
"Id"],
$ilUser->getId());
348 $usr_id = $a_mapping->getMapping(
"Services/User",
"usr", $a_rec[
"Id"]);
350 if (!isset($this->users[$usr_id])) {
351 $this->users[$usr_id] =
new ilObjUser($usr_id);
353 $user = $this->users[$usr_id];
354 include_once(
"./Services/User/classes/class.ilUserProfile.php");
356 $prof->skipField(
"username");
357 $prof->skipField(
"password");
358 $prof->skipField(
"roles");
359 $prof->skipGroup(
"settings");
360 $fields = $prof->getStandardFields();
361 foreach ($fields as $k =>
$f) {
365 !
$ilSetting->get(
"usr_settings_disable_" . $k) &&
366 $f[
"method"] !=
"" && isset($a_rec[$up_k])) {
367 $set_method =
"set" . substr(
$f[
"method"], 3);
372 $user->setLatitude($a_rec[
"Latitude"]);
373 $user->setLongitude($a_rec[
"Longitude"]);
374 $user->setLocationZoom($a_rec[
"LocZoom"]);
379 $pic_dir = $this->
getImportDirectory() .
"/" . str_replace(
"..",
"", $a_rec[
"Picture"]);
380 if ($pic_dir !=
"" && is_dir($pic_dir)) {
381 $upload_file = $pic_dir .
"/upload_" . $a_rec[
"Id"] .
"pic";
382 if (is_file($upload_file)) {
390 $usr_id = $a_mapping->getMapping(
"Services/User",
"usr", $a_rec[
"UserId"]);
392 if (!isset($this->users[$usr_id])) {
393 $this->users[$usr_id] =
new ilObjUser($usr_id);
395 $user = $this->users[$usr_id];
401 $usr_id = $a_mapping->getMapping(
"Services/User",
"usr", $a_rec[
"UserId"]);
getDirectDataFromQuery($a_query, $a_convert_to_leading_upper=true, $a_set=true)
Get data from query.This is a standard procedure, all db field names are directly mapped to abstract ...
static userSettingVisible($a_setting)
Checks whether user setting is visible.
if(!array_key_exists('StateId', $_REQUEST)) $id
importRecord($a_entity, $a_types, $a_rec, $a_mapping, $a_schema_version)
Import record.
getImportDirectory()
Get import directory.
convertToLeadingUpper($a_str)
Make xyz_abc a XyzAbc string.
static copyProfilePicturesToDirectory($a_user_id, $a_dir)
Get profile picture direcotory.
static _uploadPersonalPicture($tmp_file, $obj_id)
Create a personal picture image file from a temporary image file.
static _lookupType($a_id, $a_reference=false)
lookup object type
readData($a_entity, $a_version, $a_ids, $a_field="")
Read data.
static makeDir($a_dir)
creates a new directory and inherits all filesystem permissions of the parent directory You may pass ...
getDependencies($a_entity, $a_version, $a_rec, $a_ids)
Determine the dependent sets of data.
static ilTempnam($a_temp_path=null)
Returns a unique and non existing Path for e temporary file or directory.
getXmlNamespace($a_entity, $a_schema_version)
Get xml namespace.
getSupportedVersions()
Get supported versions.
static secureString($a_str, $a_strip_html=true, $a_allow="")
Remove unsecure tags.
getXmlRecord($a_entity, $a_version, $a_set)
Get xml record.
A dataset contains in data in a common structure that can be shared and transformed for different pur...
getTypes($a_entity, $a_version)
Get field types for entity.
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
afterXmlRecordWriting($a_entity, $a_version, $a_set)
After xml record writing hook record.