4 define (
"IL_PASSWD_PLAIN",
"plain");
5 define (
"IL_PASSWD_CRYPTED",
"crypted");
8 require_once
"./Services/Object/classes/class.ilObject.php";
9 require_once
'./Services/User/exceptions/class.ilUserException.php';
10 require_once
'./Modules/OrgUnit/classes/class.ilObjOrgUnit.php';
11 require_once
'./Modules/OrgUnit/classes/class.ilObjOrgUnitTree.php';
174 public function __construct($a_user_id = 0, $a_call_by_reference =
false)
183 parent::__construct($a_user_id, $a_call_by_reference);
184 $this->auth_mode =
"default";
194 $this->
setId($a_user_id);
201 $this->prefs =
array();
203 $this->prefs[
"language"] = $this->
ilias->ini->readVariable(
"language",
"default");
206 $this->skin = $this->
ilias->ini->readVariable(
"layout",
"skin");
212 $this->prefs[
"style"] = $this->
ilias->ini->readVariable(
"layout",
"style");
229 $r = $ilDB->queryF(
"SELECT * FROM usr_data ".
230 "WHERE usr_id= %s",
array(
"integer"),
array($this->
id));
232 if (
$data = $ilDB->fetchAssoc(
$r))
252 if ($this->prefs[
"language"] ==
"")
254 $this->prefs[
"language"] = $this->oldPrefs[
"language"];
258 include_once(
"./Services/Style/System/classes/class.ilStyleDefinition.php");
259 if ($this->prefs[
"skin"] ==
"" ||
262 $this->prefs[
"skin"] = $this->oldPrefs[
"skin"];
265 $this->skin = $this->prefs[
"skin"];
268 if ($this->prefs[
"style"] ==
"" ||
272 $this->prefs[
"style"] = $this->
ilias->ini->readVariable(
"layout",
"style");
275 if (empty($this->prefs[
"hits_per_page"]))
277 $this->prefs[
"hits_per_page"] = 10;
282 $ilErr->raiseError(
"<b>Error: There is no dataset with id ".
283 $this->
id.
"!</b><br />class: ".get_class($this).
"<br />Script: ".__FILE__.
284 "<br />Line: ".__LINE__, $ilErr->FATAL);
306 $this->password_encoding_type = $password_encryption_type;
336 if (! $a_data[
"passwd_type"])
338 $ilErr->raiseError(
"<b>Error: passwd_type missing in function assignData(). ".
339 $this->
id.
"!</b><br />class: ".get_class($this).
"<br />Script: " 340 .__FILE__.
"<br />Line: ".__LINE__, $ilErr->FATAL);
342 if ($a_data[
"passwd"] !=
"********" and strlen($a_data[
'passwd']))
344 $this->
setPasswd($a_data[
"passwd"], $a_data[
"passwd_type"]);
352 if (!is_array($a_data[
'birthday']))
365 $this->
setCity($a_data[
"city"]);
372 $this->
setFax($a_data[
"fax"]);
388 $this->create_date = $a_data[
"create_date"];
389 $this->
setComment($a_data[
"referral_comment"]);
390 $this->approve_date = $a_data[
"approve_date"];
391 $this->active = $a_data[
"active"];
392 $this->agree_date = $a_data[
"agree_date"];
419 public function saveAsNew($a_from_formular =
true)
421 global $ilAppEventHandler;
429 switch ($this->passwd_type)
432 if(strlen($this->passwd))
434 require_once
'Services/User/classes/class.ilUserPasswordManager.php';
449 $ilErr->raiseError(
"<b>Error: passwd_type missing in function saveAsNew. ".
450 $this->
id.
"!</b><br />class: ".get_class($this).
"<br />Script: ".__FILE__.
451 "<br />Line: ".__LINE__, $ilErr->FATAL);
463 $insert_array =
array(
464 "usr_id" =>
array(
"integer", $this->
id),
465 "login" =>
array(
"text", $this->login),
466 "passwd" =>
array(
"text", $pw_value),
469 "firstname" =>
array(
"text", $this->firstname),
470 "lastname" =>
array(
"text", $this->lastname),
471 "title" =>
array(
"text", $this->utitle),
472 "gender" =>
array(
"text", $this->gender),
473 "email" =>
array(
"text", trim($this->email)),
474 "hobby" =>
array(
"text", (
string) $this->hobby),
475 "institution" =>
array(
"text", $this->institution),
476 "department" =>
array(
"text", $this->department),
477 "street" =>
array(
"text", $this->street),
478 "city" =>
array(
"text", $this->city),
479 "zipcode" =>
array(
"text", $this->zipcode),
480 "country" =>
array(
"text", $this->country),
481 "sel_country" =>
array(
"text", $this->sel_country),
482 "phone_office" =>
array(
"text", $this->phone_office),
483 "phone_home" =>
array(
"text", $this->phone_home),
484 "phone_mobile" =>
array(
"text", $this->phone_mobile),
485 "fax" =>
array(
"text", $this->fax),
487 "last_login" =>
array(
"timestamp", null),
490 "referral_comment" =>
array(
"text", $this->referral_comment),
491 "matriculation" =>
array(
"text", $this->matriculation),
492 "client_ip" =>
array(
"text", $this->client_ip),
493 "approve_date" =>
array(
"timestamp", $this->approve_date),
494 "agree_date" =>
array(
"timestamp", $this->agree_date),
495 "active" =>
array(
"integer", (
int) $this->active),
503 "latitude" =>
array(
"text", $this->latitude),
504 "longitude" =>
array(
"text", $this->longitude),
505 "loc_zoom" =>
array(
"integer", (
int) $this->loc_zoom),
506 "last_password_change" =>
array(
"integer", (
int) $this->last_password_change_ts),
507 'inactivation_date' =>
array(
'timestamp', $this->inactivation_date),
508 'is_self_registered' =>
array(
'integer', (
int)$this->is_self_registered),
510 $ilDB->insert(
"usr_data", $insert_array);
520 include_once (
"Services/Mail/classes/class.ilMailbox.php");
522 $mbox->createDefaultFolder();
524 include_once
"Services/Mail/classes/class.ilMailOptions.php";
526 $mail_options->createMailOptionsEntry();
529 include_once
"./Services/Bookmarks/classes/class.ilBookmarkFolder.php";
531 $bmf->createNewBookmarkTree();
533 $ilAppEventHandler->raise(
"Services/User",
"afterCreate",
534 array(
"user_obj" => $this));
556 else if($this->active)
561 $update_array =
array(
562 "gender" =>
array(
"text", $this->gender),
563 "title" =>
array(
"text", $this->utitle),
564 "firstname" =>
array(
"text", $this->firstname),
565 "lastname" =>
array(
"text", $this->lastname),
566 "email" =>
array(
"text", trim($this->email)),
568 "hobby" =>
array(
"text", $this->hobby),
569 "institution" =>
array(
"text", $this->institution),
570 "department" =>
array(
"text", $this->department),
571 "street" =>
array(
"text", $this->street),
572 "city" =>
array(
"text", $this->city),
573 "zipcode" =>
array(
"text", $this->zipcode),
574 "country" =>
array(
"text", $this->country),
575 "sel_country" =>
array(
"text", $this->sel_country),
576 "phone_office" =>
array(
"text", $this->phone_office),
577 "phone_home" =>
array(
"text", $this->phone_home),
578 "phone_mobile" =>
array(
"text", $this->phone_mobile),
579 "fax" =>
array(
"text", $this->fax),
580 "referral_comment" =>
array(
"text", $this->referral_comment),
581 "matriculation" =>
array(
"text", $this->matriculation),
582 "client_ip" =>
array(
"text", $this->client_ip),
583 "approve_date" =>
array(
"timestamp", $this->approve_date),
584 "active" =>
array(
"integer", $this->active),
593 "latitude" =>
array(
"text", $this->latitude),
594 "longitude" =>
array(
"text", $this->longitude),
595 "loc_zoom" =>
array(
"integer", (
int) $this->loc_zoom),
596 "last_password_change" =>
array(
"integer", $this->last_password_change_ts),
598 'inactivation_date' =>
array(
'timestamp', $this->inactivation_date)
601 if (isset($this->agree_date) && (strtotime($this->agree_date) !==
false || $this->agree_date == null))
603 $update_array[
"agree_date"] =
array(
"timestamp", $this->agree_date);
605 switch ($this->passwd_type)
608 if(strlen($this->passwd))
610 require_once
'Services/User/classes/class.ilUserPasswordManager.php';
616 $update_array[
"passwd"] =
array(
"text", (
string) $this->passwd);
621 $update_array[
"passwd"] =
array(
"text", (
string) $this->passwd);
625 $ilErr->raiseError(
"<b>Error: passwd_type missing in function update()".$this->
id.
"!</b><br />class: ".
626 get_class($this).
"<br />Script: ".__FILE__.
"<br />Line: ".__LINE__, $ilErr->FATAL);
632 $ilDB->update(
"usr_data", $update_array,
array(
"usr_id" =>
array(
"integer", $this->
id)));
642 parent::updateOwner();
646 $ilAppEventHandler->raise(
"Services/User",
"afterUpdate",
647 array(
"user_obj" => $this));
659 $ilDB->manipulateF(
"UPDATE usr_data SET agree_date = ".$ilDB->now().
666 private static function _lookup($a_user_id, $a_field)
670 $res = $ilDB->queryF(
"SELECT ".$a_field.
" FROM usr_data WHERE usr_id = %s",
673 while($set = $ilDB->fetchAssoc(
$res))
675 return $set[$a_field];
687 $set = $ilDB->queryF(
"SELECT title, firstname, lastname FROM usr_data WHERE usr_id = %s",
690 if ($rec = $ilDB->fetchAssoc($set))
694 $fullname = $rec[
"title"].
" ";
696 if ($rec[
"firstname"])
698 $fullname .= $rec[
"firstname"].
" ";
700 if ($rec[
"lastname"])
702 $fullname .= $rec[
"lastname"];
745 $res = $ilDB->queryF(
"SELECT firstname, lastname, title, login FROM usr_data WHERE usr_id = %s",
747 $user_rec = $ilDB->fetchAssoc(
$res);
748 return array(
"user_id" => $a_user_id,
749 "firstname" => $user_rec[
"firstname"],
750 "lastname" => $user_rec[
"lastname"],
751 "title" => $user_rec[
"title"],
752 "login" => $user_rec[
"login"]);
762 $res = $ilDB->queryF(
"SELECT * FROM usr_data WHERE usr_id = %s",
764 $user_rec = $ilDB->fetchAssoc(
$res);
791 if (!is_array($a_user_str))
793 $res = $ilDB->queryF(
"SELECT usr_id FROM usr_data WHERE login = %s",
795 $user_rec = $ilDB->fetchAssoc(
$res);
796 return $user_rec[
"usr_id"];
800 $set = $ilDB->query(
"SELECT usr_id FROM usr_data ".
801 " WHERE ".$ilDB->in(
"login", $a_user_str,
false,
"text")
804 while ($rec = $ilDB->fetchAssoc($set))
806 $ids[] = $rec[
"usr_id"];
830 $ilDB->manipulateF(
"UPDATE usr_data SET ".
831 "last_login = ".$ilDB->now().
832 " WHERE usr_id = %s",
844 public function resetPassword($raw, $raw_retype)
851 if(func_num_args() != 2)
856 if(!isset($raw) || !isset($raw_retype))
861 if($raw != $raw_retype)
866 require_once
'Services/User/classes/class.ilUserPasswordManager.php';
871 SET passwd = %s, passwd_enc_type = %s, passwd_salt = %s 873 array(
'text',
'text',
'text',
'integer'),
894 $res = $ilDB->queryF(
' 895 SELECT * FROM loginname_history 899 return $ilDB->fetchAssoc(
$res) ? true :
false;
918 $ilDB->setLimit(1, 0);
919 $res = $ilDB->queryF(
' 920 SELECT login, history_date FROM loginname_history 921 WHERE usr_id = %s ORDER BY history_date DESC',
942 if(func_num_args() != 1)
952 $former_login = self::_lookupLogin($this->
getId());
955 if(0 == strcmp($a_login, $former_login))
967 if((
int)$ilSetting->get(
'allow_change_loginname') &&
968 (int)$ilSetting->get(
'reuse_of_loginnames') == 0 &&
969 self::_doesLoginnameExistInHistory($a_login))
971 throw new ilUserException($this->lng->txt(
'loginname_already_exists'));
973 else if((
int)$ilSetting->get(
'allow_change_loginname') &&
974 (int)$ilSetting->get(
'loginname_change_blocking_time') &&
975 is_array($last_history_entry) &&
976 $last_history_entry[1] + (int)$ilSetting->get(
'loginname_change_blocking_time') >
time())
978 include_once
'Services/Calendar/classes/class.ilDate.php';
981 $this->lng->txt(
'changing_loginname_not_possible_info'),
985 new ilDateTime(($last_history_entry[1] + (
int)$ilSetting->get(
'loginname_change_blocking_time')),
IL_CAL_UNIX))
992 if((
int)$ilSetting->get(
'allow_change_loginname') &&
993 (int)$ilSetting->get(
'create_history_loginname'))
999 $this->login = $a_login;
1001 $ilDB->manipulateF(
' 1019 self::_writePref($this->
id, $a_keyword, $a_value);
1020 $this->
setPref($a_keyword, $a_value);
1031 self::_deletePref($this->
getId(), $a_keyword);
1039 public static function _deletePref($a_user_id, $a_keyword)
1047 'DELETE FROM usr_pref WHERE usr_id = %s AND keyword = %s',
1048 array(
'integer',
'text'),
1049 array($a_user_id, $a_keyword)
1062 $ilDB->manipulateF(
"DELETE FROM usr_pref WHERE usr_id = %s",
1072 public static function _writePref($a_usr_id, $a_keyword, $a_value)
1075 $ilDB->replace(
"usr_pref",
1077 "usr_id" =>
array(
"integer", $a_usr_id),
1078 "keyword" =>
array(
"text", $a_keyword),
1081 "value" =>
array(
"text",$a_value)
1106 foreach ($this->prefs as $keyword => $value)
1108 self::_writePref($this->
id, $keyword, $value);
1126 include_once(
'Services/Calendar/classes/class.ilCalendarSettings.php');
1128 return $settings->getDefaultTimeZone();
1140 if($format = $this->
getPref(
'time_format'))
1146 include_once(
'Services/Calendar/classes/class.ilCalendarSettings.php');
1148 return $settings->getDefaultTimeFormat();
1160 if($format = $this->
getPref(
'date_format'))
1166 include_once(
'Services/Calendar/classes/class.ilCalendarSettings.php');
1168 return $settings->getDefaultDateFormat();
1180 if ($a_keyword !=
"")
1182 $this->prefs[$a_keyword] = $a_value;
1193 if (array_key_exists($a_keyword, $this->prefs))
1195 return $this->prefs[$a_keyword];
1207 $query =
"SELECT * FROM usr_pref WHERE usr_id = ".$ilDB->quote($a_usr_id,
"integer").
" ".
1208 "AND keyword = ".$ilDB->quote($a_keyword,
"text");
1226 if (is_array($this->prefs))
1241 global $rbacadmin,
$ilDB;
1244 include_once(
'Services/LDAP/classes/class.ilLDAPRoleGroupMapping.php');
1246 $mapping->deleteUser($this->
getId());
1249 include_once (
"Services/Mail/classes/class.ilMailbox.php");
1252 $mailbox->updateMailsOfDeletedUser($this->
getLogin());
1255 include_once(
"./Services/Block/classes/class.ilCustomBlock.php");
1257 $costum_block->setContextObjId($this->
getId());
1258 $costum_block->setContextObjType(
"user");
1259 $c_blocks = $costum_block->queryBlocksForContext();
1260 include_once(
"./Services/Feeds/classes/class.ilPDExternalFeedBlock.php");
1261 foreach($c_blocks as $c_block)
1263 if ($c_block[
"type"] ==
"pdfeed")
1272 include_once(
"./Services/Block/classes/class.ilBlockSetting.php");
1276 $ilDB->manipulateF(
"DELETE FROM usr_data WHERE usr_id = %s",
1287 include_once(
"./Services/Authentication/classes/class.ilSession.php");
1291 $rbacadmin->removeUser($this->
getId());
1295 $q =
"DELETE FROM bookmark_tree WHERE tree = ".
1296 $ilDB->quote($this->
getId(),
"integer");
1297 $ilDB->manipulate($q);
1299 $q =
"DELETE FROM bookmark_data WHERE user_id = ".
1300 $ilDB->quote($this->
getId(),
"integer");
1301 $ilDB->manipulate($q);
1304 include_once
'./Modules/Forum/classes/class.ilObjForum.php';
1305 ilObjForum::_deleteUser($this->
getId());
1308 include_once
'./Services/LinkChecker/classes/class.ilLinkCheckNotify.php';
1312 include_once
'./Modules/Course/classes/class.ilObjCourse.php';
1316 include_once
'./Services/Tracking/classes/class.ilObjUserTracking.php';
1319 include_once
'Modules/Session/classes/class.ilEventParticipants.php';
1323 include_once
'Modules/Scorm2004/classes/ilSCORM13Package.php';
1327 include_once
'Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php';
1331 include_once
"./Services/Notification/classes/class.ilNotification.php";
1335 include_once
"./Modules/Portfolio/classes/class.ilObjPortfolio.php";
1339 include_once
"./Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
1341 $tree->cascadingDelete();
1344 include_once
"./Services/DiskQuota/classes/class.ilDiskQuotaHandler.php";
1348 require_once
'Services/User/classes/class.ilCronDeleteInactiveUserReminderMail.php';
1352 include_once
"Services/Badge/classes/class.ilBadgeAssignment.php";
1365 global $ilAppEventHandler;
1366 $ilAppEventHandler->raise(
1367 'Services/User',
'deleteUser',
array(
'usr_id' => $this->
getId())
1384 function setFullname($a_title =
"",$a_firstname =
"",$a_lastname =
"")
1386 $this->fullname =
"";
1390 $fullname = $a_title.
" ";
1392 elseif ($this->utitle)
1394 $this->fullname = $this->utitle.
" ";
1399 $fullname .= $a_firstname.
" ";
1401 elseif ($this->firstname)
1403 $this->fullname .= $this->firstname.
" ";
1408 return $fullname.$a_lastname;
1435 if (strlen($this->fullname) <= $a_max_strlen)
1440 if ((strlen($this->utitle) + strlen($this->lastname) + 4) <= $a_max_strlen)
1442 return ilUtil::stripSlashes($this->utitle.
" ".substr($this->firstname,0,1).
". ".$this->lastname);
1445 if ((strlen($this->firstname) + strlen($this->lastname) + 1) <= $a_max_strlen)
1450 if ((strlen($this->lastname) + 3) <= $a_max_strlen)
1465 $this->login = $a_str;
1484 $this->passwd = $a_str;
1517 $this->gender = substr($a_str,-1);
1538 $this->utitle = $a_str;
1559 $this->firstname = $a_str;
1578 $this->lastname = $a_str;
1597 $this->institution = $a_str;
1616 $this->department = $a_str;
1635 $this->street = $a_str;
1654 $this->city = $a_str;
1673 $this->zipcode = $a_str;
1693 $this->country = $a_str;
1713 $this->sel_country = $a_val;
1733 $this->phone_office = $a_str;
1752 $this->phone_home = $a_str;
1771 $this->phone_mobile = $a_str;
1790 $this->fax = $a_str;
1809 $this->client_ip = $a_str;
1828 $this->matriculation = $a_str;
1850 $query =
"SELECT matriculation FROM usr_data ".
1851 "WHERE usr_id = ".$ilDB->quote($a_usr_id);
1854 return $row->matriculation ?
$row->matriculation :
'';
1864 $this->email = $a_str;
1883 $this->hobby = $a_str;
1902 $this->
setPref(
"language",$a_str);
1913 return $this->prefs[
"language"];
1926 $this->
setPref(
"disk_quota",$a_disk_quota);
1940 return $this->prefs[
"disk_quota"] ? $this->prefs[
"disk_quota"] : 0;
1945 return $this->prefs[
"wsp_disk_quota"] ? $this->prefs[
"wsp_disk_quota"] : 0;
1950 $this->last_password_change_ts = $a_last_password_change_ts;
1963 $q =
"SELECT value FROM usr_pref WHERE usr_id= ".
1964 $ilDB->quote($a_usr_id,
"integer").
" AND keyword = ".
1965 $ilDB->quote(
'language',
"text");
1966 $r = $ilDB->query($q);
1968 while(
$row = $ilDB->fetchAssoc(
$r))
1970 return $row[
'value'];
1979 $ilDB->manipulateF(
"UPDATE usr_data ".
1980 " SET ext_account = %s WHERE usr_id = %s",
1981 array(
"text",
"integer"),
1982 array($a_ext_id, $a_usr_id));
1989 $ilDB->manipulateF(
"UPDATE usr_data ".
1990 " SET auth_mode = %s WHERE usr_id = %s",
1991 array(
"text",
"integer"),
1992 array($a_auth_mode, $a_usr_id));
2021 $this->last_login = $a_str;
2031 return $this->last_login;
2041 $this->last_update = $a_str;
2055 $this->referral_comment = $a_str;
2075 $this->approve_date = $a_str;
2106 $this->agree_date = $a_str;
2149 $query =
'SELECT usr_id FROM usr_data '.
2150 'WHERE active = '.$ilDB->quote(1,
'integer').
' '.
2151 'AND usr_id = '.$ilDB->quote($a_usr_id,
'integer');
2181 if ((!empty($storedActive) && empty($currentActive)) ||
2182 (empty($storedActive) && !empty($currentActive)))
2197 return $active ? true :
false;
2208 $this->skin = $a_str;
2213 $this->time_limit_owner = $a_owner;
2217 return $this->time_limit_owner ? $this->time_limit_owner : 7;
2221 $this->time_limit_from = $a_from;
2225 return $this->time_limit_from;
2229 $this->time_limit_until = $a_until;
2233 return $this->time_limit_until;
2237 $this->time_limit_unlimited = $a_unlimited;
2241 return $this->time_limit_unlimited;
2245 return $this->time_limit_message = $a_time_limit_message;
2249 return $this->time_limit_message;
2254 $this->login_attempts = $a_login_attempts;
2277 $this->profile_incomplete = (boolean) $a_prof_inc;
2281 if($this->
id == ANONYMOUS_USER_ID)
2285 return $this->profile_incomplete;
2293 if ($this->
id == ANONYMOUS_USER_ID) {
2297 if ($this->
id == SYSTEM_USER_ID) {
2298 require_once
'./Services/User/classes/class.ilUserPasswordManager.php';
2309 require_once(
'./Services/PrivacySecurity/classes/class.ilSecuritySettings.php');
2314 $security->isPasswordChangeOnFirstLoginEnabled() &&
2316 $this->is_self_registered == false
2326 if ($this->
id == ANONYMOUS_USER_ID) {
2330 require_once(
'./Services/PrivacySecurity/classes/class.ilSecuritySettings.php');
2333 $max_pass_age = $security->getPasswordMaxAge();
2334 if ($max_pass_age > 0) {
2335 $max_pass_age_ts = ($max_pass_age * 86400);
2337 $current_ts =
time();
2339 if (($current_ts - $pass_change_ts) > $max_pass_age_ts) {
2352 $current_ts =
time();
2354 $password_age = (int) ( ($current_ts - $pass_change_ts) / 86400 );
2355 return $password_age;
2364 $query =
"UPDATE usr_data SET last_password_change = %s " .
2365 "WHERE usr_id = %s";
2366 $affected = $ilDB->manipulateF(
$query,
2367 array(
'integer',
'integer'),
2369 if($affected)
return true;
2377 $query =
"UPDATE usr_data SET last_password_change = 0 " .
2378 "WHERE usr_id = %s";
2379 $affected = $ilDB->manipulateF(
$query,
array(
'integer'),
2381 if($affected)
return true;
2392 $this->latitude = $a_latitude;
2412 $this->longitude = $a_longitude;
2432 $this->loc_zoom = $a_locationzoom;
2455 $set = $ilDB->queryf(
' 2456 SELECT COUNT(*) session_count 2457 FROM usr_session WHERE user_id = %s AND expires > %s AND session_id != %s ',
2458 array(
'integer',
'integer',
'text'),
2459 array($a_user_id,
time(), $a_session_id));
2460 $row = $ilDB->fetchAssoc($set);
2461 return (
bool)
$row[
'session_count'];
2488 $uid =
$GLOBALS[
'DIC'][
'ilAuthSession']->getUserId();
2492 require_once (
'Services/WebDAV/classes/class.ilDAVActivationChecker.php');
2495 $login = self::toUsernameWithoutDomain($login);
2510 $pos = strrpos($a_login,
'/');
2511 $pos2 = strrpos($a_login,
'\\');
2512 if ($pos ===
false || $pos < $pos2)
2518 $a_login = substr($a_login, $pos + 1);
2530 global
$ilDB,$ilAuth;
2533 $set = $ilDB->queryF(
"SELECT active FROM usr_data WHERE login= %s",
2537 if ($rec = $ilDB->fetchAssoc($set))
2573 $res = $ilDB->queryF(
"SELECT login FROM usr_data ".
2574 "WHERE email = %s and active = 1",
2578 while(
$row = $ilDB->fetchObject(
$res))
2580 $ids[] =
$row->login;
2600 $res = $ilDB->queryF(
"SELECT usr_id FROM usr_data ".
2601 "WHERE email = %s",
array(
"text"),
array($a_email));
2604 return $row->usr_id ?
$row->usr_id : 0;
2618 return $login ?
$login :
false;
2631 static function searchUsers($a_search_str, $active = 1, $a_return_ids_only =
false, $filter_settings = FALSE)
2636 $query =
"SELECT usr_data.usr_id, usr_data.login, usr_data.firstname, usr_data.lastname, usr_data.email, usr_data.active FROM usr_data ";
2638 $without_anonymous_users =
true;
2641 $join_filter =
" WHERE ";
2642 if ($filter_settings !== FALSE && strlen($filter_settings))
2644 switch ($filter_settings)
2648 $join_filter =
" LEFT JOIN obj_members ON usr_data.usr_id = obj_members.usr_id WHERE obj_members.usr_id IS NULL AND ";
2655 $join_filter =
" LEFT JOIN obj_members ON usr_data.usr_id = obj_members.usr_id WHERE obj_members.obj_id = ".
2656 "(SELECT obj_id FROM object_reference WHERE ref_id = ".$ilDB->quote(
$ref_id,
"integer").
") AND ";
2664 $local_roles = $rbacreview->getRolesOfRoleFolder(
$ref_id,
false);
2665 if (is_array($local_roles) && count($local_roles))
2667 $join_filter =
" LEFT JOIN rbac_ua ON usr_data.usr_id = rbac_ua.usr_id WHERE ".
2668 $ilDB->in(
"rbac_ua.rol_id", $local_roles,
false, $local_roles).
" AND ";
2674 $rol_id =
$_SESSION[
"user_filter_data"];
2677 $join_filter =
" LEFT JOIN rbac_ua ON usr_data.usr_id = rbac_ua.usr_id WHERE rbac_ua.rol_id = ".
2678 $ilDB->quote($rol_id,
"integer").
" AND ";
2679 $without_anonymous_users =
false;
2686 if (strtolower(substr($a_search_str, 0, 5)) ==
"role:")
2688 $query =
"SELECT DISTINCT usr_data.usr_id,usr_data.login,usr_data.firstname,usr_data.lastname,usr_data.email ".
2689 "FROM object_data,rbac_ua,usr_data ".
2690 "WHERE ".$ilDB->like(
"object_data.title",
"text",
"%".substr($a_search_str,5).
"%").
2691 " AND object_data.type = 'role' ".
2692 "AND rbac_ua.rol_id = object_data.obj_id ".
2693 "AND usr_data.usr_id = rbac_ua.usr_id ".
2694 "AND rbac_ua.usr_id != ".$ilDB->quote(ANONYMOUS_USER_ID,
"integer");
2699 "(".$ilDB->like(
"usr_data.login",
"text",
"%".$a_search_str.
"%").
" ".
2700 "OR ".$ilDB->like(
"usr_data.firstname",
"text",
"%".$a_search_str.
"%").
" ".
2701 "OR ".$ilDB->like(
"usr_data.lastname",
"text",
"%".$a_search_str.
"%").
" ".
2702 "OR ".$ilDB->like(
"usr_data.email",
"text",
"%".$a_search_str.
"%").
") ";
2704 if ($filter_settings !== FALSE && strlen($filter_settings))
2706 switch ($filter_settings)
2709 $query.=
" AND usr_data.active = ".$ilDB->quote(0,
"integer").
" ";
2712 $query.=
" AND usr_data.active = ".$ilDB->quote(1,
"integer").
" ";
2715 $query.=
" AND usr_data.time_limit_unlimited = ".$ilDB->quote(0,
"integer").
" ";
2718 $date = strftime(
"%Y-%m-%d %H:%I:%S", mktime(0, 0, 0,
$_SESSION[
"user_filter_data"][
"m"],
$_SESSION[
"user_filter_data"][
"d"],
$_SESSION[
"user_filter_data"][
"y"]));
2719 $query.=
" AND last_login < ".$ilDB->quote($date,
"timestamp").
" ";
2724 if ($without_anonymous_users)
2726 $query.=
"AND usr_data.usr_id != ".$ilDB->quote(ANONYMOUS_USER_ID,
"integer");
2729 if (is_numeric($active) && $active > -1 && $filter_settings === FALSE)
2731 $query.=
" AND active = ".$ilDB->quote($active,
"integer").
" ";
2737 while (
$row = $ilDB->fetchObject(
$res))
2740 "usr_id" =>
$row->usr_id,
2741 "login" =>
$row->login,
2742 "firstname" =>
$row->firstname,
2743 "lastname" =>
$row->lastname,
2744 "email" =>
$row->email,
2745 "active" =>
$row->active);
2746 $ids[] =
$row->usr_id;
2748 if ($a_return_ids_only)
2749 return $ids ? $ids :
array();
2751 return $users ? $users :
array();
2757 public static function getAllUserLogins()
2766 $res = $ilDB->query(
2767 "SELECT login FROM usr_data WHERE " . $ilDB->in(
'usr_id',
array(ANONYMOUS_USER_ID),
true,
'integer')
2769 while(
$row = $ilDB->fetchAssoc(
$res))
2771 $logins[] =
$row[
'login'];
2788 $res = $ilDB->query(
"SELECT * FROM usr_data WHERE ".
2789 $ilDB->in(
"usr_id", $a_user_ids,
false,
"integer"));
2790 while (
$row = $ilDB->fetchAssoc(
$res))
2792 $user_data[
"$row[usr_id]"] =
$row;
2794 return $user_data ? $user_data :
array();
2809 $result_arr =
array();
2813 if ($a_fields !== NULL
and is_array($a_fields))
2815 if (count($a_fields) == 0)
2821 if (($usr_id_field = array_search(
"usr_id",$a_fields)) !==
false)
2822 unset($a_fields[$usr_id_field]);
2824 $select = implode(
",",$a_fields).
",usr_data.usr_id";
2826 if(in_array(
'online_time',$a_fields))
2828 $select .=
",ut_online.online_time ";
2832 $q =
"SELECT ".$select.
" FROM usr_data ";
2836 if(in_array(
'online_time',$a_fields))
2838 $q .=
"LEFT JOIN ut_online ON usr_data.usr_id = ut_online.usr_id ";
2845 $q .=
"WHERE active = ".$ilDB->quote($active,
"integer");
2848 $q .=
"WHERE time_limit_unlimited= ".$ilDB->quote(0,
"integer");;
2851 $qtemp = $q .
", rbac_ua, object_data WHERE rbac_ua.rol_id = object_data.obj_id AND ".
2852 $ilDB->like(
"object_data.title",
"text",
"%crs%").
" AND usr_data.usr_id = rbac_ua.usr_id";
2853 $r = $ilDB->query($qtemp);
2854 $course_users =
array();
2855 while (
$row = $ilDB->fetchAssoc(
$r))
2857 array_push($course_users,
$row[
"usr_id"]);
2859 if (count($course_users))
2861 $q .=
" WHERE ".$ilDB->in(
"usr_data.usr_id", $course_users,
true,
"integer").
" ";
2869 $date = strftime(
"%Y-%m-%d %H:%I:%S", mktime(0, 0, 0,
$_SESSION[
"user_filter_data"][
"m"],
$_SESSION[
"user_filter_data"][
"d"],
$_SESSION[
"user_filter_data"][
"y"]));
2870 $q.=
" AND last_login < ".$ilDB->quote($date,
"timestamp");
2876 $q .=
" LEFT JOIN obj_members ON usr_data.usr_id = obj_members.usr_id ".
2877 "WHERE obj_members.obj_id = (SELECT obj_id FROM object_reference ".
2878 "WHERE ref_id = ".$ilDB->quote(
$ref_id,
"integer").
") ";
2886 $local_roles = $rbacreview->getRolesOfRoleFolder(
$ref_id,
false);
2887 if (is_array($local_roles) && count($local_roles))
2889 $q.=
" LEFT JOIN rbac_ua ON usr_data.usr_id = rbac_ua.usr_id WHERE ".
2890 $ilDB->in(
"rbac_ua.rol_id", $local_roles,
false,
"integer").
" ";
2895 $rol_id =
$_SESSION[
"user_filter_data"];
2898 $q .=
" LEFT JOIN rbac_ua ON usr_data.usr_id = rbac_ua.usr_id WHERE rbac_ua.rol_id = ".
2899 $ilDB->quote($rol_id,
"integer");
2903 $r = $ilDB->query($q);
2905 while (
$row = $ilDB->fetchAssoc(
$r))
2907 $result_arr[] =
$row;
2921 $q =
"SELECT count(*) as cnt FROM usr_pref up1, usr_pref up2 ".
2922 " WHERE up1.keyword= ".$ilDB->quote(
"style",
"text").
2923 " AND up1.value= ".$ilDB->quote($a_style,
"text").
2924 " AND up2.keyword= ".$ilDB->quote(
"skin",
"text").
2925 " AND up2.value= ".$ilDB->quote($a_skin,
"text").
2926 " AND up1.usr_id = up2.usr_id ";
2928 $cnt_set = $ilDB->query($q);
2930 $cnt_rec = $ilDB->fetchAssoc($cnt_set);
2932 return $cnt_rec[
"cnt"];
2942 $q =
"SELECT DISTINCT up1.value style, up2.value skin FROM usr_pref up1, usr_pref up2 ".
2943 " WHERE up1.keyword = ".$ilDB->quote(
"style",
"text").
2944 " AND up2.keyword = ".$ilDB->quote(
"skin",
"text").
2945 " AND up1.usr_id = up2.usr_id";
2947 $sty_set = $ilDB->query($q);
2950 while($sty_rec = $ilDB->fetchAssoc($sty_set))
2952 $styles[] = $sty_rec[
"skin"].
":".$sty_rec[
"style"];
2965 $q =
"SELECT up1.usr_id usr_id FROM usr_pref up1, usr_pref up2 ".
2966 " WHERE up1.keyword= ".$ilDB->quote(
"style",
"text").
2967 " AND up1.value= ".$ilDB->quote($a_from_style,
"text").
2968 " AND up2.keyword= ".$ilDB->quote(
"skin",
"text").
2969 " AND up2.value= ".$ilDB->quote($a_from_skin,
"text").
2970 " AND up1.usr_id = up2.usr_id ";
2972 $usr_set = $ilDB->query($q);
2974 while ($usr_rec = $ilDB->fetchAssoc($usr_set))
2976 self::_writePref($usr_rec[
"usr_id"],
"skin", $a_to_skin);
2977 self::_writePref($usr_rec[
"usr_id"],
"style", $a_to_style);
2995 $item_set = $ilDB->queryF(
"SELECT * FROM desktop_item WHERE ".
2996 "item_id = %s AND type = %s AND user_id = %s",
2997 array(
"integer",
"text",
"integer"),
3001 if (!$ilDB->fetchAssoc($item_set))
3003 $ilDB->manipulateF(
"INSERT INTO desktop_item (item_id, type, user_id, parameters) VALUES ".
3004 " (%s,%s,%s,%s)",
array(
"integer",
"text",
"integer",
"text"),
3008 include_once
'./Services/Calendar/classes/class.ilCalendarCategories.php';
3036 $ilDB->manipulateF(
"UPDATE desktop_item SET parameters = %s ".
3037 " WHERE item_id = %s AND type = %s AND user_id = %s",
3038 array(
"text",
"integer",
"text",
"integer"),
3056 $ilDB->manipulateF(
"DELETE FROM desktop_item WHERE ".
3057 " item_id = %s AND type = %s AND user_id = %s",
3058 array(
"integer",
"text",
"integer"),
3061 include_once
'./Services/Calendar/classes/class.ilCalendarCategories.php';
3087 $r = $ilDB->queryF(
"SELECT user_id FROM desktop_item WHERE item_id = %s",
3092 while (
$row = $ilDB->fetchObject(
$r))
3094 $users[] =
$row->user_id;
3097 if (count($users) > 0)
3099 $ilDB->manipulateF(
"DELETE FROM desktop_item WHERE item_id = %s",
3119 if (self::$is_desktop_item_loaded[$a_usr_id.
":".$a_item_id])
3121 return self::$is_desktop_item_cache[$a_usr_id.
":".$a_item_id.
":".
$a_type];
3123 $item_set = $ilDB->queryF(
"SELECT item_id FROM desktop_item WHERE ".
3124 "item_id = %s AND type = %s AND user_id = %s",
3125 array(
"integer",
"text",
"integer"),
3128 if ($ilDB->fetchAssoc($item_set))
3148 if (!is_array($a_item_ids))
3153 $item_ids =
array();
3154 foreach ($a_item_ids as
$id)
3156 if (!self::$is_desktop_item_loaded[$a_usr_id.
":".$id])
3160 self::$is_desktop_item_loaded[$a_usr_id.
":".
$id] =
true;
3163 if (count($item_ids) > 0)
3165 $item_set = $ilDB->query(
"SELECT item_id, type FROM desktop_item WHERE ".
3166 $ilDB->in(
"item_id", $item_ids,
false,
"integer").
3167 " AND user_id = ".$ilDB->quote($a_usr_id,
"integer"));
3168 while (
$r = $ilDB->fetchAssoc($item_set))
3170 self::$is_desktop_item_cache[$a_usr_id.
":".
$r[
"item_id"].
":".
$r[
"type"]]
3205 $is_nested_set = ($tree->getTreeImplementation() instanceof
ilNestedSetTree);
3207 $item_set = $ilDB->queryF(
"SELECT obj.obj_id, obj.description, oref.ref_id, obj.title, obj.type ".
3208 " FROM desktop_item it, object_reference oref ".
3209 ", object_data obj".
3211 "it.item_id = oref.ref_id AND ".
3212 "oref.obj_id = obj.obj_id AND ".
3213 "it.user_id = %s",
array(
"integer"),
array($user_id));
3214 $items = $all_parent_path =
array();
3215 while ($item_rec = $ilDB->fetchAssoc($item_set))
3217 if ($tree->isInTree($item_rec[
"ref_id"])
3218 && $item_rec[
"type"] !=
"rolf" 3219 && $item_rec[
"type"] !=
"itgr")
3221 $parent_ref = $tree->getParentId($item_rec[
"ref_id"]);
3223 if(!isset($all_parent_path[$parent_ref]))
3233 $node = $tree->getNodeData($parent_ref);
3234 $all_parent_path[$parent_ref] = $node[
"title"];
3238 $parent_path = $all_parent_path[$parent_ref];
3242 $items[$parent_path.$title.$item_rec[
"ref_id"]] =
3243 array(
"ref_id" => $item_rec[
"ref_id"],
3244 "obj_id" => $item_rec[
"obj_id"],
3245 "type" => $item_rec[
"type"],
3247 "description" =>
$desc,
3248 "parent_ref" => $parent_ref);
3256 if (!is_array($a_types))
3258 $a_types =
array($a_types);
3261 $foundsurveys =
array();
3264 if ($a_type ==
"itgr")
3268 $item_set = $ilDB->queryF(
"SELECT obj.obj_id, obj.description, oref.ref_id, obj.title FROM desktop_item it, object_reference oref ".
3269 ", object_data obj WHERE ".
3270 "it.item_id = oref.ref_id AND ".
3271 "oref.obj_id = obj.obj_id AND ".
3272 "it.type = %s AND ".
3275 array(
"text",
"integer"),
3276 array($a_type, $user_id));
3278 while ($item_rec = $ilDB->fetchAssoc($item_set))
3282 $items[
$title.$a_type.$item_rec[
"ref_id"]] =
3283 array(
"ref_id" => $item_rec[
"ref_id"],
3284 "obj_id" => $item_rec[
"obj_id"],
"type" => $a_type,
3309 $a_parent = 0, $a_time = 0, $a_order_nr = 0)
3315 $a_time =
date(
"Y-m-d H:i:s",
time());
3318 $item_set = $ilDB->queryF(
"SELECT * FROM personal_clipboard WHERE ".
3319 "parent = %s AND item_id = %s AND type = %s AND user_id = %s",
3320 array(
"integer",
"integer",
"text",
"integer"),
3324 if (!
$d = $item_set->fetchRow())
3326 $ilDB->manipulateF(
"INSERT INTO personal_clipboard ".
3327 "(item_id, type, user_id, title, parent, insert_time, order_nr) VALUES ".
3328 " (%s,%s,%s,%s,%s,%s,%s)",
3329 array(
"integer",
"text",
"integer",
"text",
"integer",
"timestamp",
"integer"),
3330 array($a_item_id,
$a_type, $this->
getId(), $a_title, (
int) $a_parent, $a_time, (
int) $a_order_nr));
3334 $ilDB->manipulateF(
"UPDATE personal_clipboard SET insert_time = %s ".
3335 "WHERE user_id = %s AND item_id = %s AND type = %s AND parent = 0",
3336 array(
"timestamp",
"integer",
"integer",
"text"),
3349 $a_time =
date(
"Y-m-d H:i:s",
time());
3351 $ilDB->insert(
"personal_pc_clipboard",
array(
3352 "user_id" =>
array(
"integer", $this->
getId()),
3354 "insert_time" =>
array(
"timestamp", $a_time),
3355 "order_nr" =>
array(
"integer", $a_nr)
3366 $set = $ilDB->queryF(
"SELECT MAX(insert_time) mtime FROM personal_pc_clipboard ".
3368 $row = $ilDB->fetchAssoc($set);
3370 $set = $ilDB->queryF(
"SELECT * FROM personal_pc_clipboard ".
3371 " WHERE user_id = %s AND insert_time = %s ORDER BY order_nr ASC",
3372 array(
"integer",
"timestamp"),
3375 while (
$row = $ilDB->fetchAssoc($set))
3377 $content[] =
$row[
"content"];
3390 $set = $ilDB->queryF(
"SELECT * FROM personal_clipboard WHERE ".
3391 "parent = %s AND type = %s AND user_id = %s",
3392 array(
"integer",
"text",
"integer"),
3394 if ($rec = $ilDB->fetchAssoc($set))
3409 $ilDB->manipulateF(
"DELETE FROM personal_clipboard WHERE ".
3410 "type = %s AND user_id = %s",
3411 array(
"text",
"integer"),
3422 $ilDB->manipulateF(
"DELETE FROM personal_clipboard WHERE ".
3434 if ($a_top_nodes_only)
3436 $par =
" AND parent = ".$ilDB->quote(0,
"integer").
" ";
3440 ?
" AND type = ".$ilDB->quote(
$a_type,
"text").
" " 3442 $q =
"SELECT * FROM personal_clipboard WHERE ".
3443 "user_id = ".$ilDB->quote($this->
getId(),
"integer").
" ".
3445 " ORDER BY order_nr";
3446 $objs = $ilDB->query($q);
3448 while ($obj = $ilDB->fetchAssoc($objs))
3450 if ($obj[
"type"] ==
"mob")
3454 if ($obj[
"type"] ==
"incl")
3456 include_once(
"./Modules/MediaPool/classes/class.ilMediaPoolPage.php");
3459 $objects[] =
array (
"id" => $obj[
"item_id"],
3460 "type" => $obj[
"type"],
"title" => $obj[
"title"],
3461 "insert_time" => $obj[
"insert_time"]);
3473 $objs = $ilDB->queryF(
"SELECT * FROM personal_clipboard WHERE ".
3474 "user_id = %s AND parent = %s AND insert_time = %s ".
3475 " ORDER BY order_nr",
3476 array(
"integer",
"integer",
"timestamp"),
3477 array($ilUser->getId(), (int) $a_parent, $a_insert_time));
3479 while ($obj = $ilDB->fetchAssoc($objs))
3481 if ($obj[
"type"] ==
"mob")
3485 $objects[] =
array (
"id" => $obj[
"item_id"],
3486 "type" => $obj[
"type"],
"title" => $obj[
"title"],
"insert_time" => $obj[
"insert_time"]);
3503 $q =
"SELECT DISTINCT user_id FROM personal_clipboard WHERE ".
3504 "item_id = ".$ilDB->quote($a_id,
"integer").
" AND ".
3505 "type = ".$ilDB->quote(
$a_type,
"text");
3506 $user_set = $ilDB->query($q);
3508 while ($user_rec = $ilDB->fetchAssoc($user_set))
3510 $users[] = $user_rec[
"user_id"];
3527 $q =
"DELETE FROM personal_clipboard WHERE ".
3528 "item_id = ".$ilDB->quote($a_item_id,
"integer").
3529 " AND type = ".$ilDB->quote(
$a_type,
"text").
" ".
3530 " AND user_id = ".$ilDB->quote($this->
getId(),
"integer");
3531 $ilDB->manipulate($q);
3538 $query =
"SELECT obj_id FROM object_data WHERE import_id = ".
3539 $ilDB->quote($i2_id,
"text");
3542 while(
$row = $ilDB->fetchObject(
$res))
3556 require_once(
'./Modules/OrgUnit/classes/PathStorage/class.ilOrgUnitPathStorage.php');
3557 return ilOrgUnitPathStorage::getTextRepresentationOfUsersOrgUnits($a_usr_id);
3565 return self::lookupOrgUnitsRepresentation($this->
getId());
3575 $this->auth_mode = $a_str;
3589 include_once(
'./Services/Authentication/classes/class.ilAuthUtils.php');
3602 $this->ext_account = $a_str;
3614 return $this->ext_account;
3632 include_once(
'./Services/Authentication/classes/class.ilAuthUtils.php');
3633 $q =
"SELECT login,usr_id,ext_account,auth_mode FROM usr_data ".
3634 "WHERE auth_mode = %s";
3636 $values[] = $a_auth_mode;
3639 $q.=
" OR auth_mode = %s ";
3641 $values[] =
'default';
3644 $res = $ilDB->queryF($q, $types, $values);
3645 while (
$row = $ilDB->fetchObject(
$res))
3647 if(
$row->auth_mode ==
'default')
3649 $accounts[
$row->usr_id] =
$row->login;
3653 $accounts[
$row->usr_id] =
$row->ext_account;
3656 return $accounts ? $accounts :
array();
3670 if(!is_array($a_usr_ids))
3678 $q =
"UPDATE usr_data SET active = 1, inactivation_date = NULL WHERE ".
3679 $ilDB->in(
"usr_id", $a_usr_ids,
false,
"integer");
3680 $ilDB->manipulate($q);
3684 $usrId_IN_usrIds = $ilDB->in(
"usr_id", $a_usr_ids,
false,
"integer");
3686 $q =
"UPDATE usr_data SET active = 0 WHERE $usrId_IN_usrIds";
3687 $ilDB->manipulate($q);
3691 SET inactivation_date = %s 3692 WHERE inactivation_date IS NULL 3693 AND $usrId_IN_usrIds 3726 $r = $ilDB->queryF(
"SELECT * FROM usr_data WHERE ".
3727 " ext_account = %s AND auth_mode = %s",
3728 array(
"text",
"text"),
3729 array($a_account, $a_auth));
3730 if ($usr = $ilDB->fetchAssoc(
$r))
3732 return $usr[
"login"];
3736 $res = $ilDB->queryF(
"SELECT login FROM usr_data ".
3737 "WHERE login = %s AND auth_mode = %s AND ext_account IS NULL ",
3738 array(
"text",
"text"),
3739 array($a_account, $a_auth));
3740 if($usr = $ilDB->fetchAssoc(
$res))
3742 return $usr[
'login'];
3748 $res = $ilDB->queryF(
"SELECT login FROM usr_data WHERE ".
3749 " ext_account = %s AND auth_mode = %s",
3750 array(
"text",
"text"),
3751 array($a_account,
"default"));
3752 if ($usr = $ilDB->fetchAssoc(
$res))
3754 return $usr[
"login"];
3757 $res = $ilDB->queryF(
"SELECT login FROM usr_data ".
3758 "WHERE login = %s AND (ext_account IS NULL OR ext_account = '') AND auth_mode = %s",
3759 array(
"text",
"text"),
3760 array($a_account,
"default"));
3761 if($usr = $ilDB->fetchAssoc(
$res))
3763 return $usr[
"login"];
3776 $r = $ilDB->query(
"SELECT count(*) AS cnt, auth_mode FROM usr_data ".
3777 "GROUP BY auth_mode");
3779 while($cnt = $ilDB->fetchAssoc(
$r))
3781 $cnt_arr[$cnt[
"auth_mode"]] = $cnt[
"cnt"];
3798 $q =
"SELECT * FROM usr_data WHERE ".
3799 " email = %s AND (auth_mode = %s ";
3800 $types =
array(
"text",
"text");
3801 $values =
array($a_email,
"local");
3803 if ($ilSetting->get(
"auth_mode") == 1)
3805 $q.=
" OR auth_mode = %s";
3807 $values[] =
"default";
3813 $usr_set = $ilDB->queryF($q, $types, $values);
3814 while ($usr_rec = $ilDB->fetchAssoc($usr_set))
3816 $users[$usr_rec[
"usr_id"]] = $usr_rec[
"login"];
3833 $image_dir = $webspace_dir.
"/usr_images";
3834 $store_file =
"usr_".$obj_id.
".".
"jpg";
3835 $target_file = $image_dir.
"/$store_file";
3837 chmod($tmp_file, 0770);
3841 $show_file =
"$image_dir/usr_".$obj_id.
".jpg";
3842 $thumb_file =
"$image_dir/usr_".$obj_id.
"_small.jpg";
3843 $xthumb_file =
"$image_dir/usr_".$obj_id.
"_xsmall.jpg";
3844 $xxthumb_file =
"$image_dir/usr_".$obj_id.
"_xxsmall.jpg";
3852 self::_writePref($obj_id,
"profile_image", $store_file);
3868 if(isset(self::$personal_image_cache[$this->
getId()][$a_size][(
int)$a_force_pic]))
3870 return self::$personal_image_cache[$this->
getId()][$a_size][(int)$a_force_pic];
3875 return self::$personal_image_cache[$this->
getId()][$a_size][(int)$a_force_pic];
3888 $a_prevent_no_photo_image =
false)
3893 $res = $ilDB->queryF(
"SELECT * FROM usr_pref WHERE ".
3894 "keyword IN (%s,%s) ".
3896 array(
"text",
"text",
"integer"),
3897 array(
'public_upload',
'public_profile', $a_usr_id));
3898 while (
$row = $ilDB->fetchAssoc(
$res))
3900 switch (
$row[
'keyword'])
3902 case 'public_upload' :
3903 $upload =
$row[
'value'] ==
'y';
3905 case 'public_profile' :
3906 $profile = (
$row[
'value'] ==
'y' ||
3907 $row[
'value'] ==
'g');
3916 $webspace_dir = (
'.'.$webspace_dir);
3920 $image_dir = $webspace_dir.
"/usr_images";
3922 if ($a_size ==
'big')
3924 $thumb_file = $image_dir.
"/usr_".$a_usr_id.
".jpg";
3928 $thumb_file = $image_dir.
"/usr_".$a_usr_id.
"_".$a_size.
".jpg";
3932 if((($upload && $profile) || $a_force_pic)
3933 && @is_file($thumb_file))
3935 $file = $thumb_file.
"?t=".rand(1, 99999);
3939 if (!$a_prevent_no_photo_image)
3942 if($a_size ==
"small" || $a_size ==
"big")
3950 require_once(
'./Services/WebAccessChecker/classes/class.ilWACSignedPath.php');
3962 $a_dir = trim(str_replace(
"..",
"", $a_dir));
3963 if ($a_dir ==
"" || !is_dir($a_dir))
3969 $image_dir = $webspace_dir.
"/usr_images";
3971 "upload_".$a_user_id.
"pic",
3972 "usr_".$a_user_id.
".".
"jpg",
3973 "usr_".$a_user_id.
"_small.jpg",
3974 "usr_".$a_user_id.
"_xsmall.jpg",
3975 "usr_".$a_user_id.
"_xxsmall.jpg",
3976 "upload_".$a_user_id);
3977 foreach ($images as $image)
3979 if (is_file($image_dir.
"/".$image))
3981 copy($image_dir.
"/".$image, $a_dir.
"/".$image);
3993 $image_dir = $webspace_dir.
"/usr_images";
3994 $file = $image_dir.
"/usr_".$this->getID().
".".
"jpg";
3995 $thumb_file = $image_dir.
"/usr_".$this->getID().
"_small.jpg";
3996 $xthumb_file = $image_dir.
"/usr_".$this->getID().
"_xsmall.jpg";
3997 $xxthumb_file = $image_dir.
"/usr_".$this->getID().
"_xxsmall.jpg";
3998 $upload_file = $image_dir.
"/upload_".$this->getID();
4003 $this->
setPref(
"profile_image",
"");
4007 if (@is_file(
$file))
4011 if (@is_file($thumb_file))
4013 unlink($thumb_file);
4015 if (@is_file($xthumb_file))
4017 unlink($xthumb_file);
4019 if (@is_file($xxthumb_file))
4021 unlink($xxthumb_file);
4023 if (@is_file($upload_file))
4025 unlink($upload_file);
4032 if(!is_array($a_data))
4036 foreach($a_data as $field =>
$data)
4038 #$new_data[$field] = ilUtil::stripSlashes($data); 4040 $this->user_defined_data[
'f_'.$field] =
$data;
4042 #$this->user_defined_data = $new_data; 4049 return $this->user_defined_data ? $this->user_defined_data :
array();
4058 $field_def =
array();
4060 include_once(
"./Services/User/classes/class.ilUserDefinedData.php");
4063 foreach($this->user_defined_data as $field => $value)
4065 if($field !=
'usr_id')
4068 $udata->set($field, $value);
4100 include_once(
"./Services/User/classes/class.ilUserDefinedData.php");
4112 $this->user_defined_data = $udata->getAll();
4136 include_once(
"./Services/User/classes/class.ilUserDefinedData.php");
4152 function getProfileAsString(&$a_language)
4154 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
4156 global
$lng,$rbacreview;
4158 $language =& $a_language;
4159 $language->loadLanguageModule(
'registration');
4160 $language->loadLanguageModule(
'crs');
4163 $body .= ($language->txt(
"login").
": ".$this->
getLogin().
"\n");
4167 $body .= ($language->txt(
"title").
": ".$this->
getUTitle().
"\n");
4172 $language->txt(
'gender_m') :
4173 $language->txt(
'gender_f');
4174 $body .= ($language->txt(
"gender").
": ".$gender.
"\n");
4178 $body .= ($language->txt(
"firstname").
": ".$this->
getFirstname().
"\n");
4182 $body .= ($language->txt(
"lastname").
": ".$this->
getLastname().
"\n");
4186 $body .= ($language->txt(
"institution").
": ".$this->
getInstitution().
"\n");
4190 $body .= ($language->txt(
"department").
": ".$this->
getDepartment().
"\n");
4194 $body .= ($language->txt(
"street").
": ".$this->
getStreet().
"\n");
4198 $body .= ($language->txt(
"city").
": ".$this->
getCity().
"\n");
4202 $body .= ($language->txt(
"zipcode").
": ".$this->
getZipcode().
"\n");
4206 $body .= ($language->txt(
"country").
": ".$this->
getCountry().
"\n");
4214 $body .= ($language->txt(
"phone_office").
": ".$this->
getPhoneOffice().
"\n");
4218 $body .= ($language->txt(
"phone_home").
": ".$this->
getPhoneHome().
"\n");
4222 $body .= ($language->txt(
"phone_mobile").
": ".$this->
getPhoneMobile().
"\n");
4224 if(strlen($this->
getFax()))
4226 $body .= ($language->txt(
"fax").
": ".$this->
getFax().
"\n");
4230 $body .= ($language->txt(
"email").
": ".$this->
getEmail().
"\n");
4234 $body .= ($language->txt(
"hobby").
": ".$this->
getHobby().
"\n");
4238 $body .= ($language->txt(
"referral_comment").
": ".$this->
getComment().
"\n");
4242 $body .= ($language->txt(
"matriculation").
": ".$this->
getMatriculation().
"\n");
4251 $body .= ($language->txt(
"create_date").
": ".$date.
"\n");
4254 foreach($rbacreview->getGlobalRoles() as $role)
4256 if($rbacreview->isAssigned($this->getId(),$role))
4263 $body .= ($language->txt(
'reg_role_info').
': '.implode(
',',$gr).
"\n");
4269 $body .= ($language->txt(
'time_limit').
": ".$language->txt(
'crs_unlimited').
"\n");
4283 $body .= $language->txt(
'time_limit').
': '.$end->get(
IL_CAL_DATETIME);
4286 include_once
'./Services/User/classes/class.ilUserDefinedFields.php';
4293 foreach($user_defined_fields->getDefinitions() as $field_id => $definition)
4295 $data = $user_defined_data[
"f_".$field_id];
4300 $data = preg_replace(
'/<br(\s*)?\/?>/i',
"\n",
$data);
4304 $body .= $definition[
'field_name'].
': '.
$data .
"\n";
4320 $set = $ilDB->queryF(
"SELECT feed_hash from usr_data WHERE usr_id = %s",
4322 if ($rec = $ilDB->fetchAssoc($set))
4324 if (strlen($rec[
"feed_hash"]) == 32)
4326 return $rec[
"feed_hash"];
4330 $hash = md5(rand(1,9999999) + str_replace(
" ",
"", (
string) microtime()));
4331 $ilDB->manipulateF(
"UPDATE usr_data SET feed_hash = %s".
4332 " WHERE usr_id = %s",
4333 array(
"text",
"integer"),
4334 array($hash, $a_user_id));
4368 self::_writePref($a_user_id,
"priv_feed_pass",
4369 ($a_password==
"") ?
"" : md5($a_password));
4385 $q =
"SELECT DISTINCT login, usr_id FROM usr_data ".
4388 $values[] = $a_login;
4390 if ($a_user_id != 0)
4392 $q.=
" AND usr_id != %s ";
4393 $types[] =
"integer";
4394 $values[] = $a_user_id;
4397 $r = $ilDB->queryF($q, $types, $values);
4399 if (
$row = $ilDB->fetchAssoc(
$r))
4401 return $row[
'usr_id'];
4420 $res = $ilDB->queryF(
"SELECT * FROM usr_data ".
4421 "WHERE ext_account = %s AND auth_mode = %s",
4422 array(
"text",
"text"),
4423 array($a_external_account, $a_auth_mode));
4424 return $ilDB->fetchAssoc(
$res) ? true :
false;
4435 global
$ilDB, $rbacreview;
4438 $ids = $rbacreview->assignedUsers($role_id);
4440 if (count ($ids) == 0)
4445 $query =
"SELECT usr_data.*, usr_pref.value AS language 4447 LEFT JOIN usr_pref ON usr_pref.usr_id = usr_data.usr_id AND usr_pref.keyword = %s 4448 WHERE ".$ilDB->in(
"usr_data.usr_id", $ids,
false,
"integer");
4449 $values[] =
"language";
4453 if (is_numeric($active) && $active > -1)
4455 $query .=
" AND usr_data.active = %s";
4457 $types[] =
"integer";
4460 $query .=
" ORDER BY usr_data.lastname, usr_data.firstname ";
4462 $r = $ilDB->queryF(
$query, $types, $values);
4464 while (
$row = $ilDB->fetchAssoc(
$r))
4480 $query =
"SELECT usr_data.*, usr_pref.value AS language FROM usr_data LEFT JOIN usr_pref ON usr_pref.usr_id = usr_data.usr_id and usr_pref.keyword = %s WHERE 1 = 1 ";
4482 $values[] =
"language";
4484 if (is_numeric($active) && $active > -1)
4486 $query .=
" AND usr_data.active = %s";
4488 $types[] =
"integer";
4493 $query.=
" AND usr_data.time_limit_owner = %s";
4495 $types[] =
"integer";
4498 $query .=
" AND usr_data.usr_id != %s ";
4499 $values[] = ANONYMOUS_USER_ID;
4500 $types[] =
"integer";
4502 $query .=
" ORDER BY usr_data.lastname, usr_data.firstname ";
4533 global $rbacadmin, $rbacreview,
$ilDB;
4535 $query =
"SELECT usr_data.*, usr_pref.value AS language 4537 LEFT JOIN usr_pref ON usr_pref.usr_id = usr_data.usr_id AND usr_pref.keyword = %s 4538 WHERE ".$ilDB->in(
"usr_data.usr_id", $a_mem_ids,
false,
"integer").
" 4539 AND usr_data.usr_id != %s";
4540 $values[] =
"language";
4542 $values[] = ANONYMOUS_USER_ID;
4543 $types[] =
"integer";
4545 if (is_numeric($active) && $active > -1)
4547 $query .=
" AND active = %s";
4549 $types[] =
"integer";
4554 $query.=
" AND usr_data.time_limit_owner = %s";
4555 $values[] = $timelimitowner;
4556 $types[] =
"integer";
4560 $query .=
" ORDER BY usr_data.lastname, usr_data.firstname ";
4568 return $mem_arr ? $mem_arr :
array();
4582 if (is_array($a_internalids)) {
4583 foreach ($a_internalids as $internalid) {
4584 if (is_numeric ($internalid))
4586 $ids[] = $internalid;
4591 if (is_numeric($parsedid) && $parsedid > 0)
4598 if (count($ids) == 0)
4601 $query =
"SELECT usr_data.*, usr_pref.value AS language 4604 ON usr_pref.usr_id = usr_data.usr_id AND usr_pref.keyword = %s 4605 WHERE ".$ilDB->in(
"usr_data.usr_id", $ids,
false,
"integer");
4606 $values[] =
"language";
4609 $query .=
" ORDER BY usr_data.lastname, usr_data.firstname ";
4632 $r = $ilDB->queryF(
"SELECT * FROM usr_pref WHERE usr_id = %s",
4635 while(
$row = $ilDB->fetchAssoc(
$r))
4637 $prefs[
$row[
"keyword"]] = $row[
"value"];
4657 $set = $ilDB->query(
"SELECT usr_id FROM usr_pref ".
4658 " WHERE keyword = ".$ilDB->quote($a_keyword,
"text").
4659 " AND ".$ilDB->in(
"usr_id", $a_user_ids,
false,
"integer").
4660 " AND value = ".$ilDB->quote($a_val,
"text")
4662 while ($rec = $ilDB->fetchAssoc($set))
4664 $users[] = $rec[
"usr_id"];
4674 $query =
"UPDATE usr_data SET login_attempts = 0 WHERE usr_id = %s";
4675 $affected = $ilDB->manipulateF(
$query,
array(
'integer'),
array($a_usr_id) );
4677 if($affected)
return true;
4685 $query =
"SELECT login_attempts FROM usr_data WHERE usr_id = %s";
4687 $record = $ilDB->fetchAssoc(
$result );
4688 $login_attempts = $record[
'login_attempts'];
4697 $query =
"UPDATE usr_data SET login_attempts = (login_attempts + 1) WHERE usr_id = %s";
4698 $affected = $ilDB->manipulateF(
$query,
array(
'integer'),
array($a_usr_id) );
4700 if($affected)
return true;
4708 $query =
"UPDATE usr_data SET active = 0, inactivation_date = %s WHERE usr_id = %s";
4711 if($affected)
return true;
4721 return in_array($this->
getPref(
"public_profile"),
array(
"y",
"g"));
4744 $res = $ilDB->queryF(
'SELECT * FROM loginname_history WHERE usr_id = %s AND login = %s AND history_date = %s',
4745 array(
'integer',
'text',
'integer'),
4748 if( $ilDB->numRows(
$res) == 0 )
4750 $ilDB->manipulateF(
' 4751 INSERT INTO loginname_history 4752 (usr_id, login, history_date) 4753 VALUES (%s, %s, %s)',
4754 array(
'integer',
'text',
'integer'),
4768 public static function _getUsersOnline($a_user_id = 0, $a_no_anonymous =
false)
4775 $ilDB = $DIC->database();
4776 $rbacreview = $DIC->rbac()->review();
4779 $atime = $pd_set->get(
'user_activity_time') * 60;
4786 $where[] =
'user_id > 0';
4788 else if (is_array($a_user_id))
4790 $where[] =
$ilDB->in(
"user_id", $a_user_id,
false,
"integer");
4794 $where[] =
'user_id = ' .
$ilDB->quote($a_user_id,
'integer');
4799 $where[] =
'user_id != ' .
$ilDB->quote(ANONYMOUS_USER_ID,
'integer');
4802 include_once
'Services/User/classes/class.ilUserAccountSettings.php';
4805 include_once
'Services/User/classes/class.ilUserFilter.php';
4809 $where[] =
'expires > ' .
$ilDB->quote($ctime,
'integer');
4810 $where[] =
'(p.value IS NULL OR NOT p.value = ' .
$ilDB->quote(
'y',
'text') .
')';
4812 $where =
'WHERE ' . implode(
' AND ', $where);
4815 SELECT COUNT(user_id) num, user_id, firstname, lastname, title, login, last_login, MAX(ctime) ctime, agree_date 4817 LEFT JOIN usr_data u 4818 ON user_id = u.usr_id 4819 LEFT JOIN usr_pref p 4820 ON (p.usr_id = u.usr_id AND p.keyword = %s) 4822 GROUP BY user_id, firstname, lastname, title, login, last_login, agree_date 4823 ORDER BY lastname, firstname 4826 array(
'hide_own_online_status')
4830 while($user =
$ilDB->fetchAssoc(
$r))
4832 if($atime <= 0 || $user[
'ctime'] + $atime > $ctime)
4834 $users[$user[
'user_id']] = $user;
4838 require_once
'Services/TermsOfService/classes/class.ilTermsOfServiceHelper.php';
4840 $users = array_filter($users,
function($user) {
4841 if ($user[
'agree_date'] || $user[
'user_id'] == SYSTEM_USER_ID ||
'root' === $user[
'login']) {
4866 $atime = $pd_set->get(
"user_activity_time") * 60;
4868 $no_anonym = ($a_no_anonymous)
4869 ?
"AND user_id <> ".$ilDB->quote(ANONYMOUS_USER_ID,
"integer").
" " 4876 $q =
"SELECT DISTINCT dat.obj_id as obj_id ".
4878 "JOIN rbac_fa fa ON fa.rol_id = ua.rol_id ".
4879 "JOIN object_reference r1 ON r1.ref_id = fa.parent ".
4880 "JOIN tree ON tree.child = r1.ref_id ".
4881 "JOIN object_reference r2 ON r2.ref_id = tree.child ".
4882 "JOIN object_data dat ON dat.obj_id = r2.obj_id ".
4883 "WHERE ua.usr_id = ".$ilDB->quote($a_user_id,
"integer").
" ".
4884 "AND fa.assign = ".$ilDB->quote(
"y",
"text").
" ".
4885 "AND dat.type IN (".$ilDB->quote(
"crs",
"text").
",".
4886 $ilDB->quote(
"grp",
"text").
")";
4887 $r = $ilDB->query($q);
4889 while (
$row = $ilDB->fetchAssoc(
$r))
4891 $groups_and_courses_of_user[] =
$row[
"obj_id"];
4894 require_once
'Services/TermsOfService/classes/class.ilTermsOfServiceHelper.php';
4895 $tos_condition =
'';
4898 $tos_condition =
" AND (agree_date IS NOT NULL OR ud.usr_id = " . $ilDB->quote(SYSTEM_USER_ID,
'integer') .
") ";
4902 if (count($groups_and_courses_of_user) == 0)
4904 $q =
"SELECT count(user_id) as num,ctime,user_id,firstname,lastname,title,login,last_login ".
4905 "FROM usr_session ".
4906 "JOIN usr_data ud ON user_id = ud.usr_id ".
4907 "WHERE user_id = ".$ilDB->quote($a_user_id,
"integer").
" ".
4910 "AND expires > ".$ilDB->quote(
time(),
"integer").
" ".
4911 "GROUP BY user_id,ctime,firstname,lastname,title,login,last_login";
4912 $r = $ilDB->query($q);
4916 $q =
"SELECT count(user_id) as num,s.ctime,s.user_id,ud.firstname,ud.lastname,ud.title,ud.login,ud.last_login ".
4917 "FROM usr_session s ".
4918 "JOIN usr_data ud ON ud.usr_id = s.user_id ".
4919 "JOIN rbac_ua ua ON ua.usr_id = s.user_id ".
4920 "JOIN rbac_fa fa ON fa.rol_id = ua.rol_id ".
4921 "JOIN tree ON tree.child = fa.parent ".
4922 "JOIN object_reference or1 ON or1.ref_id = tree.child ".
4923 "JOIN object_data od ON od.obj_id = or1.obj_id ".
4924 "LEFT JOIN usr_pref p ON (p.usr_id = ud.usr_id AND p.keyword = ".
4925 $ilDB->quote(
"hide_own_online_status",
"text").
") ".
4926 "WHERE s.user_id != 0 ".
4928 "AND (p.value IS NULL OR NOT p.value = ".$ilDB->quote(
"y",
"text").
") ".
4929 "AND s.expires > ".$ilDB->quote(
time(),
"integer").
" ".
4930 "AND fa.assign = ".$ilDB->quote(
"y",
"text").
" ".
4932 "AND ".$ilDB->in(
"od.obj_id", $groups_and_courses_of_user,
false,
"integer").
" ".
4933 "GROUP BY s.user_id,s.ctime,ud.firstname,ud.lastname,ud.title,ud.login,ud.last_login ".
4934 "ORDER BY ud.lastname, ud.firstname";
4935 $r = $ilDB->query($q);
4938 while ($user = $ilDB->fetchAssoc(
$r))
4941 || $user[
"ctime"] + $atime > $ctime)
4943 $users[$user[
"user_id"]] = $user;
4947 return $users ? $users :
array();
4964 $hashcode = substr(md5(uniqid(rand(),
true)), 0, 16);
4966 $res = $ilDB->queryf(
' 4967 SELECT COUNT(usr_id) cnt FROM usr_data 4968 WHERE reg_hash = %s',
4973 if(
$row->cnt > 0) $continue =
true;
4977 if($continue)
continue;
4979 $ilDB->manipulateF(
' 4983 array(
'text',
'integer'),
4984 array($hashcode, (
int)$a_usr_id)
5006 $res = $ilDB->queryf(
' 5007 SELECT usr_id, create_date FROM usr_data 5008 WHERE reg_hash = %s',
5011 while(
$row = $ilDB->fetchAssoc(
$res))
5013 require_once
'Services/Registration/classes/class.ilRegistrationSettings.php';
5016 if((
int)$oRegSettigs->getRegistrationHashLifetime() != 0 &&
5017 time() - (int)$oRegSettigs->getRegistrationHashLifetime() > strtotime(
$row[
'create_date']))
5019 require_once
'Services/Registration/exceptions/class.ilRegConfirmationLinkExpiredException.php';
5023 $ilDB->manipulateF(
' 5027 array(
'text',
'integer'),
5031 return (
int)$row[
'usr_id'];
5034 require_once
'Services/Registration/exceptions/class.ilRegistrationHashNotFoundException.php';
5040 if (strlen($a_birthday))
5047 $this->birthday = null;
5066 if( !(
int)$period )
throw new ilException(
'no valid period given');
5070 $date =
date(
'Y-m-d H:i:s', (
time() - ((
int)$period * 24 * 60 * 60)) );
5072 $query =
"SELECT usr_id FROM usr_data WHERE last_login < %s OR (ISNULL(last_login) AND create_date < %s)";
5079 $ids[] =
$row->usr_id;
5096 $field =
'inactivation_date';
5099 if( !(
int)$period )
throw new ilException(
'no valid period given');
5103 $date =
date(
'Y-m-d H:i:s', (
time() - ((
int)$period * 24 * 60 * 60)) );
5105 $query =
"SELECT usr_id FROM usr_data WHERE $field < %s AND active = %s";
5112 $ids[] =
$row->usr_id;
5129 if($a_last_login !== null) $last_login = $a_last_login;
5130 else $last_login =
date(
'Y-m-d H:i:s');
5134 $query =
"UPDATE usr_data SET last_login = %s WHERE usr_id = %s";
5135 $affected = $ilDB->manipulateF(
$query,
array(
'timestamp',
'integer'),
array($last_login, $a_usr_id) );
5137 if($affected)
return $last_login;
5145 $query =
"UPDATE object_data SET owner = 0 ".
5146 "WHERE owner = ".$ilDB->quote($this->
getId(),
'integer');
5163 $q =
"SELECT DISTINCT ".$ilDB->upper($ilDB->substr(
"lastname", 1, 1)).
" let".
5165 " WHERE usr_id <> ".$ilDB->quote(ANONYMOUS_USER_ID,
"integer").
5167 $let_set = $ilDB->query($q);
5170 while ($let_rec = $ilDB->fetchAssoc($let_set))
5172 $let[$let_rec[
"let"]] = $let_rec[
"let"];
5182 $query =
'SELECT count(*) num FROM object_data od '.
5183 'JOIN usr_data ud ON obj_id = usr_id '.
5184 'WHERE '.$ilDB->in(
'obj_id',$a_usr_ids,
false,
'integer').
' ';
5187 return $num_rows == count((
array) $a_usr_ids);
5196 return (
boolean)
$_SESSION[
"user_captcha_verified"];
5206 $_SESSION[
"user_captcha_verified"] = $a_val;
5217 include_once(
"./Services/Export/classes/class.ilExport.php");
5222 $exp->exportEntity(
"personal_data", $this->
getId(),
"",
5223 "Services/User",
$title, $dir);
5234 include_once(
"./Services/Export/classes/class.ilExport.php");
5242 if (is_int(strpos($entry[
"entry"],
".zip")))
5244 return $entry[
"entry"];
5259 include_once(
"./Services/Export/classes/class.ilExport.php");
5261 "/".$this->getPersonalDataExportFile();
5275 $a_bookmarks, $a_notes, $a_calendar)
5277 include_once(
"./Services/Export/classes/class.ilImport.php");
5279 if (!$a_profile_data)
5281 $imp->addSkipEntity(
"Services/User",
"usr_profile");
5285 $imp->addSkipEntity(
"Services/User",
"usr_setting");
5289 $imp->addSkipEntity(
"Services/Bookmarks",
"bookmarks");
5293 $imp->addSkipEntity(
"Services/Notes",
"user_notes");
5297 $imp->addSkipEntity(
"Services/Calendar",
"calendar");
5299 $imp->importEntity($a_file[
"tmp_name"], $a_file[
"name"],
"personal_data",
5312 $NOW = $ilDB->now();
5314 $usrId_IN_usrIds = $ilDB->in(
'usr_id', $usrIds,
false,
'integer');
5318 SET inactivation_date = $NOW 5319 WHERE inactivation_date IS NULL 5320 AND $usrId_IN_usrIds 5323 $ilDB->manipulate($queryString);
5335 $usrId_IN_usrIds = $ilDB->in(
'usr_id', $usrIds,
false,
'integer');
5339 SET inactivation_date = NULL 5340 WHERE $usrId_IN_usrIds 5343 $ilDB->manipulate($queryString);
5371 require_once
'Services/TermsOfService/classes/class.ilTermsOfServiceHelper.php';
5375 null == $this->agree_date &&
5376 'root' != $this->login &&
5377 !in_array($this->
getId(),
array(ANONYMOUS_USER_ID, SYSTEM_USER_ID))
5390 public static function hasUserToAcceptTermsOfService($a_username)
5397 require_once
'Services/TermsOfService/classes/class.ilTermsOfServiceHelper.php';
5404 $in = $ilDB->in(
'usr_id',
array(ANONYMOUS_USER_ID, SYSTEM_USER_ID),
true,
'integer');
5405 $res = $ilDB->queryF(
5406 "SELECT usr_id FROM usr_data WHERE login = %s AND agree_date IS NULL $in",
5410 return $ilDB->fetchAssoc(
$res) ? true :
false;
5424 $date_is = ($a_agreed)
5428 $users = (is_array($a_users))
5429 ?
" AND ".$ilDB->in(
"usr_id", $a_users,
false,
"integer")
5432 $set = $ilDB->query(
"SELECT usr_id FROM usr_data ".
5433 " WHERE agree_date ".$date_is.
5436 while ($rec = $ilDB->fetchAssoc($set))
5438 $ret[] = $rec[
"usr_id"];
5450 if(null === $status)
5455 require_once
'Services/TermsOfService/classes/class.ilTermsOfServiceHelper.php';
5467 return self::_isAnonymous($this->
getId());
5476 return $usr_id == ANONYMOUS_USER_ID;
5491 return (
bool)$this->
getPref(
"delete_flag");
5499 $this->is_self_registered = (bool) $status;
5519 $this->interests_general = $value;
5549 $this->interests_help_offered = $value;
5579 $this->interests_help_looking = $value;
5610 $current = $this->$a_attr;
5611 if(is_array($current) &&
sizeof($current))
5613 return implode(
", ", $current);
5629 $set = $ilDB->query(
"SELECT field_id,value".
5630 " FROM usr_data_multi".
5631 " WHERE usr_id = ".$ilDB->quote($this->getId(),
"integer").
5633 while(
$row = $ilDB->fetchAssoc($set))
5635 $values[
$row[
"field_id"]][] = $row[
"value"];
5638 if(isset($values[
"interests_general"]))
5646 if(isset($values[
"interests_help_offered"]))
5654 if(isset($values[
"interests_help_looking"]))
5689 foreach($map as
$id => $values)
5691 if(is_array($values) &&
sizeof($values))
5693 foreach($values as $value)
5695 $value = trim($value);
5698 $uniq_id = $ilDB->nextId(
'usr_data_multi');
5700 $ilDB->manipulate(
"INSERT usr_data_multi".
5701 " (id,usr_id,field_id,value) VALUES".
5702 " (".$ilDB->quote($uniq_id,
"integer").
5703 ",".$ilDB->quote($this->
getId(),
"integer").
5704 ",".$ilDB->quote(
$id,
"text").
5705 ",".$ilDB->quote($value,
"text").
5725 $ilDB->manipulate(
"DELETE FROM usr_data_multi".
5726 " WHERE usr_id = ".$ilDB->quote($this->getId(),
"integer"));
5729 public static function findInterests($a_term, $a_user_id = null, $a_field_id = null)
5735 $sql =
"SELECT DISTINCT(value)".
5736 " FROM usr_data_multi".
5737 " WHERE ".$ilDB->like(
"value",
"text",
"%".$a_term.
"%");
5740 $sql .=
" AND field_id = ".$ilDB->quote($a_field_id,
"text");
5744 $sql .=
" AND usr_id <> ".$ilDB->quote($a_user_id,
"integer");
5746 $sql .=
" ORDER BY value";
5747 $set = $ilDB->query($sql);
5748 while(
$row = $ilDB->fetchAssoc($set))
getCurrentLanguage()
returns the current language (may differ from user's pref setting!)
static _lookupLogin($a_user_id)
lookup login
static _lookupName($a_user_id)
lookup user name
Class for user related exception handling in ILIAS.
static _getUserIdsByInactivationPeriod($period)
get ids of all users that have been inactivated since at least the given period
static getUserIdByLogin($a_login)
static toUsernameWithoutDomain($a_login)
Static function removes Microsoft domain name from username webdav related.
setActive($a_active, $a_owner=0)
set user active state and updates system fields appropriately public
Class UserMail this class handles user mails.
dropDesktopItem($a_item_id, $a_type)
drop an item from user's personal desktop
static _lookupExternalAccount($a_user_id)
lookup external account for login and authmethod
getClipboardObjects($a_type="", $a_top_nodes_only=false)
get all clipboard objects of user and specified type
static $is_desktop_item_loaded
static _getInstance()
get singleton instance
setInstitution($a_str)
set institution public
refreshLogin()
updates the login data of a "user" // TODO set date with now() should be enough public ...
static initInactivationDate($usrIds)
type $ilDB
static _getNumberOfUsersForStyle($a_skin, $a_style)
skins and styles
Base class for ILIAS Exception handling.
getAuthMode($a_auth_key=false)
get auth mode public
setLatitude($a_latitude)
Set Latitude.
getLogin()
get login / username public
setOfferingHelp(array $value=null)
Set help offering.
getActive()
get user active state public
addUserDefinedFieldEntry()
static _getInstance()
Get instance.
static _deleteUser($a_usr_id)
clipboardDeleteAll()
Delete objects of type for user.
static preloadIsDesktopItem($a_usr_id, $a_item_ids)
Preload desktop item information.
static lookupMatriculation($a_usr_id)
Lookup matriculation.
getTimeZone()
get timezone of user
setDepartment($a_str)
set department public
static _deleteSettingsOfUser($a_user)
Delete block settings of user.
static hasActiveSession($a_user_id, $a_session_id)
Check for simultaneous login.
getFirstname()
get firstname public
setSelectedCountry($a_val)
Set selected country (selection drop down)
getLoginByUserId($a_userid)
setLoginAttempts($a_login_attempts)
setCaptchaVerified($a_val)
Set captcha verified.
getMatriculation()
get matriculation number public
static _getFeedPass($a_user_id)
Lookup news feed password for user.
isPasswordChangeDemanded()
getGeneralInterestsAsText()
Get general interests as plain text.
setLanguage($a_str)
set user language public
removeUserPicture($a_do_update=true)
Remove user picture.
setFullname($a_title="", $a_firstname="", $a_lastname="")
builds a string with title + firstname + lastname method is used to build fullname in member variable...
getOrgUnitsRepresentation()
getDesktopItems($a_types="")
static _writePref($a_usr_id, $a_keyword, $a_value)
static _lookupFullname($a_user_id)
Lookup Full Name.
Class for user related exception handling in ILIAS.
setLastLogin($a_str)
set user's last login public
static _getAllUserData($a_fields=NULL, $active=-1)
STATIC METHOD get all user data.
static _getUsersForClipboadObject($a_type, $a_id)
get all users, that have a certain object within their clipboard
getInactivationDate()
getter for inactivation date
Class ilObject Basic functions for all objects.
setProfileIncomplete($a_prof_inc)
Custom block for external feeds on personal desktop.
getDepartment()
get department public
setAuthMode($a_str)
set auth mode public
static formatPeriod(ilDateTime $start, ilDateTime $end)
Format a period of two date Shows: 14.
static deleteByOwner($a_owner_id)
Delete all entries for owner.
static _incrementLoginAttempts($a_usr_id)
$GLOBALS['loaded']
Global hash that tracks already loaded includes.
$login
all user related data in single vars public
static get($a_var)
Get a value.
getLocationZoom()
Get Location Zoom.
setId($a_id)
set object id public
static _getExternalAccountsByAuthMode($a_auth_mode, $a_read_auth_default=false)
Get list of external account by authentication method Note: If login == ext_account for two user with...
setDesktopItemParameters($a_item_id, $a_type, $a_par)
set parameters of a desktop item entry
static set($a_var, $a_val)
Set a value.
static getDir($a_dir, $a_rec=false, $a_sub_dir="")
get directory
static resetToDefaults()
reset to defaults
static _getUserIdsByInactivityPeriod($period)
get ids of all users that have been inactive for at least the given period
static _getLastHistoryDataByUserId($a_usr_id)
Returns the last used loginname and the changedate of the passed user_id.
static _lookupId($a_user_str)
Lookup id by login.
getInstitution()
get institution public
setTimeLimitOwner($a_owner)
static setUseRelativeDates($a_status)
set use relative dates
assignData($a_data)
loads a record "user" from array public
static _lookupTitle($a_id)
lookup object title
static $personal_image_cache
static _isActive()
Static getter.
static deletePDItemsCache($a_usr_id)
Delete cache (add remove desktop item)
static _lookupClientIP($a_user_id)
Lookup client ip.
setLastname($a_str)
set lastame public
getCreateDate()
get create date public
Base class for nested set path based trees.
getLongitude()
Get Longitude.
getPhoneOffice()
get office phone public
static _needsExternalAccountByAuthMode($a_auth_mode)
Check if chosen auth mode needs an external account entry.
getStreet()
get street public
static userExists($a_usr_ids=array())
static getInstance()
Singelton get instance.
static _lookupGender($a_user_id)
Lookup gender.
setIsSelfRegistered($status)
getCountry()
Get country (free text)
static _resetLoginAttempts($a_usr_id)
static _getAuthMode($a_auth_mode, $a_db_handler='')
getPref($a_keyword)
get a user preference
static _getAuthModeName($a_auth_key)
static now()
Return current timestamp in Y-m-d H:i:s format.
static _getLoginAttempts($a_usr_id)
static _toggleActiveStatusOfUsers($a_usr_ids, $a_status)
Toggle active status of users.
static lookupTitle($a_page_id)
Lookup title.
for($col=0; $col< 50; $col++) $d
read()
loads a record "user" from database private
getPublicName()
returns firstname lastname and login if profile is public, login otherwise
deleteUserDefinedFieldEntries()
setCountry($a_str)
Set country (free text)
static _readUsersProfileData($a_user_ids)
STATIC METHOD get user data of selected users.
getLookingForHelp()
Get help looking for.
setPhoneHome($a_str)
set home phone public
getOfferingHelpAsText()
Get help offering as plain text.
setTimeLimitUnlimited($a_unlimited)
static styleExistsForSkinId($skin_id, $style_id)
Tree handler for personal workspace.
setPref($a_keyword, $a_value)
set a user preference
static _verifyRegistrationHash($a_hash)
Verifies a registration hash.
static _getImportedUserId($i2_id)
updateUserDefinedFields()
setInactivationDate($inactivation_date)
setter for inactivation date
setZipcode($a_str)
set zipcode public
setDiskQuota($a_disk_quota)
Sets the minimal disk quota imposed by this user account.
static _externalAccountExists($a_external_account, $a_auth_mode)
Check if an external account name already exists.
getDateFormat()
get date format
isDesktopItem($a_item_id, $a_type)
check wether an item is on the users desktop or not
addDesktopItem($a_item_id, $a_type, $a_par="")
add an item to user's personal desktop
setAgreeDate($a_str)
set date the user account was accepted by the user nullindicates that the user has not accepted his a...
static setLanguage($a_lng)
set language
getUserIdByEmail($a_email)
STATIC METHOD get the user_id of an email address.
getAgreeDate()
get the date when the user accepted the user agreement public
static removeForUser($user_id)
Remove all notifications for given user.
static _getInstance()
Get singleton instance of this class.
static _loginExists($a_login, $a_user_id=0)
check if a login name already exists You may exclude a user from the check by giving his user id as 2...
static _removeTrackingDataForUser($user_id)
setEmail($a_str)
set email public
getGeneralInterests()
Get general interests.
writeAccepted()
write accept date of user agreement to db
setPasswd($a_str, $a_type=IL_PASSWD_PLAIN)
set password public
static _removeItemFromDesktops($a_id)
removes object from all user's desktops public
static lookupOrgUnitsRepresentation($a_usr_id)
lokup org unit representation
getExternalAccount()
get external account
resetLastPasswordChange()
setTimeLimitUntil($a_until)
getPersonalWorkspaceDiskQuota()
setLogin($a_str)
set login / username public
getZipcode()
get zipcode public
getEmail()
get email address public
setUserDefinedData($a_data)
static copyProfilePicturesToDirectory($a_user_id, $a_dir)
Get profile picture direcotory.
getLastname()
get lastname public
setOwner($a_owner)
set object owner
static execConvert($args)
execute convert command
setExternalAccount($a_str)
set external account
getId()
get object id public
getLastPasswordChangeTS()
exportPersonalData()
Export personal data.
static getLoginFromAuth()
Gets the username from $ilAuth, and converts it into an ILIAS login name.
static _getLocalAccountsForEmail($a_email)
check whether external account and authentication method matches with a user
setComment($a_str)
set referral comment public
getDiskQuota()
Returns the minimal disk quota imposed by this user account.
static _lookup($a_user_id, $a_field)
Private function for lookup methods.
static getImagePath($img, $module_path="", $mode="output", $offline=false)
get image path (for images located in a template directory)
static _lookupDescription($a_id)
lookup object description
Mail Box class Base class for creating and handling mail boxes.
static searchUsers($a_search_str, $active=1, $a_return_ids_only=false, $filter_settings=FALSE)
STATIC METHOD get the user_ids which correspond a search string.
static _getNumberOfUsersPerAuthMode()
get number of users per auth mode
static _deleteByUser($a_usr_id)
clipboardDeleteObjectsOfType($a_type)
Delete objects of type for user.
deletePref($a_keyword)
Deletes a userpref value of the user from the database public.
date( 'd-M-Y', $objPHPExcel->getProperties() ->getCreated())
syncActive()
synchronizes current and stored user active values for the owner value to be set correctly, this function should only be called when an admin is approving a user account public
setHobby($a_str)
set hobby public
setLocationZoom($a_locationzoom)
Set Location Zoom.
setMatriculation($a_str)
set matriculation number public
writePref($a_keyword, $a_value)
write userpref to user table private
setTimeLimitMessage($a_time_limit_message)
static formatDate(ilDateTime $date)
Format a date public.
isCaptchaVerified()
Is user captcha verified?
getLastLogin()
returns last login date public
static _dropDesktopItem($a_usr_id, $a_item_id, $a_type)
drop an item from user's personal desktop
clipboardHasObjectsOfType($a_type)
Check whether clipboard has objects of a certain type.
getOfferingHelp()
Get help offering.
addObjectToClipboard($a_item_id, $a_type, $a_title, $a_parent=0, $a_time=0, $a_order_nr=0)
add an item to user's personal clipboard
redirection script todo: (a better solution should control the processing via a xml file) ...
getLookingForHelpAsText()
Get help looking for as plain text.
static _removeTrackingDataForUser($user_id)
static $is_desktop_item_cache
static _setFeedPass($a_user_id, $a_password)
Set news feed password for user.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
__construct($a_user_id=0, $a_call_by_reference=false)
Constructor public.
setGender($a_str)
set gender public
static signFile($path_to_file)
static deliverFile($a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
static _uploadPersonalPicture($tmp_file, $obj_id)
Create a personal picture image file from a temporary image file.
writePrefs()
write all userprefs private
static _destroyByUserId($a_user_id)
Destroy session.
static skinExists($skin_id, ilSystemStyleConfig $system_style_config=null)
Check whether a skin exists.
sendPersonalDataFile()
Send personal data file.
getUTitle()
get user title (note: don't mix up this method with getTitle() that is derived from ilObject and gets...
getPersonalPicturePath($a_size="small", $a_force_pic=false)
Get path to personal picture.
static _getAssociatedUsersOnline($a_user_id, $a_no_anonymous=false)
reads all active sessions from db and returns users that are online and who have a local role in a gr...
Create styles array
The data for the language used.
static deleteEntriesOfUser($a_user_id)
Delete data of user.
updateMultiTextFields($a_create=false)
Write multi-text values to DB.
setTimeLimitFrom($a_from)
static _getUsersForFolder($ref_id, $active)
get users for a category or from system folder
setCity($a_str)
set city public
getPCClipboardContent()
Add a page content item to PC clipboard (should go to another class)
This is the super class of all custom blocks.
if(php_sapi_name() !='cli') $in
setPhoneOffice($a_str)
set office phone public
setLastPasswordChangeTS($a_last_password_change_ts)
getLatitude()
Get Latitude.
foreach($mandatory_scripts as $file) $timestamp
static getUserSubsetByPreferenceValue($a_user_ids, $a_keyword, $a_val)
For a given set of user IDs return a subset that has a given user preference set. ...
getSelectedCountry()
Get selected country (selection drop down)
getComment()
get referral comment public
buildTextFromArray($a_attr)
Convert multi-text values to plain text.
Class ilObjAuthSettingsGUI.
deleteMultiTextFields()
Remove multi-text values from DB.
setClientIP($a_str)
set client ip number public
getPersonalDataExportFile()
Get personal data export file.
static _lookupAuthMode($a_usr_id)
lookup auth mode
static _addDesktopItem($a_usr_id, $a_item_id, $a_type, $a_par="")
add an item to user's personal desktop
static _lookupDesktopItems($user_id, $a_types="")
get all desktop items of user and specified type
static _setUserInactive($a_usr_id)
getFullname($a_max_strlen=0)
get fullname public
static _isAnonymous($usr_id)
static _lookupLanguage($a_usr_id)
setFirstname($a_str)
set firstname public
getPasswdType()
get password type
static _getUsersForGroup($a_mem_ids, $active=-1)
return user data for group members
removeObjectFromClipboard($a_item_id, $a_type)
remove object from user's personal clipboard
setGeneralInterests(array $value=null)
Set general interests.
bookmark folder (note: this class handles personal bookmarks folders only)
static resetInactivationDate($usrIds)
type $ilDB
static _lookupEmail($a_user_id)
Lookup email.
static _checkExternalAuthAccount($a_auth, $a_account)
check whether external account and authentication method matches with a user
static getInstance()
Singelton get instance.
static _lookupPref($a_usr_id, $a_keyword)
getTimeFormat()
get time format
static _generateRegistrationHash($a_usr_id)
Generates a unique hashcode for activating a user profile after registration.
setLookingForHelp(array $value=null)
Set help looking for.
static _lookupFeedHash($a_user_id, $a_create=false)
Lookup news feed hash for user.
static _getPersonalPicturePath($a_usr_id, $a_size="small", $a_force_pic=false, $a_prevent_no_photo_image=false)
Get path to personal picture.
static getFirstLettersOfLastnames()
Get first letters of all lastnames.
setFax($a_str)
set fax public
static removeSingleUserFromTable($usr_id)
getPhoneHome()
get home phone public
static _getUsersForIds($a_mem_ids, $active=-1, $timelimitowner=-1)
return user data for given user id
static _deleteUser($a_usr_id)
getHobby()
get hobby public
setPasswordSalt($password_salt)
static _getExportDirectory($a_obj_id, $a_type="xml", $a_obj_type="", $a_entity="")
Get export directory for an repository object.
static _updateLastLogin($a_usr_id, $a_last_login=null)
STATIC METHOD updates the last_login field of user with given id to given or current date...
getGender()
get gender public
const USER_FOLDER_ID
Class ilObjUserFolder.
setLastPasswordChangeToNow()
static findInterests($a_term, $a_user_id=null, $a_field_id=null)
static _getUserIdsByEmail($a_email)
STATIC METHOD get all user_ids of an email address.
setUTitle($a_str)
set user title (note: don't mix up this method with setTitle() that is derived from ilObject and sets...
setSkin($a_str)
set user skin (template set) public
setApproveDate($a_str)
set date the user account was activated null indicates that the user has not yet been activated publ...
static _moveUsersToStyle($a_from_skin, $a_from_style, $a_to_skin, $a_to_style)
skins and styles
setPasswordEncodingType($password_encryption_type)
static _lookupActive($a_usr_id)
Check user account active.
getStoredActive($a_id)
get user active state
getClipboardChilds($a_parent, $a_insert_time)
Get childs of an item.
Add data(end) time
Method that wraps PHPs time in order to allow simulations with the workflow.
if(!file_exists("$old.txt")) if($old===$new) if(file_exists("$new.txt")) $file
static _lookupFields($a_user_id)
lookup fields (deprecated; use more specific methods instead)
static _writeAuthMode($a_usr_id, $a_auth_mode)
getApproveDate()
get the date when the user account was approved public
setStreet($a_str)
set street public
static _getUsersForRole($role_id, $active=-1)
return array of complete users which belong to a specific role
update()
update object in db
setPhoneMobile($a_str)
set mobile phone public
Class for user related exception handling in ILIAS.
static getUsersAgreed($a_agreed=true, $a_users=null)
Get users that have or have not agreed to the user agreement.
defined( 'APPLICATION_ENV')||define( 'APPLICATION_ENV'
getClientIP()
get client ip number public
static deleteByUserId($a_user_id)
setLastUpdate($a_str)
set last update of user data set public
static _getPreferences($user_id)
get preferences for user
hasToAcceptTermsOfService()
readMultiTextFields()
Fetch multi-text values from DB.
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static getWebspaceDir($mode="filesystem")
get webspace directory
static __extractId($ilias_id, $inst_id)
extract ref id from role title, e.g.
getLanguage()
returns a 2char-language-string public
static _getInstance()
Get instance of ilSecuritySettings.
static _getUserData($a_internalids)
return user data for given user ids
getPasswordEncodingType()
static deleteUserPortfolios($a_user_id)
Delete all portfolio data for user.
static getInstance()
Single method to reduce footprint (included files, created instances)
hasToAcceptTermsOfServiceInSession($status=null)
static _writeHistory($a_usr_id, $a_login)
setCurrentLanguage($a_val)
Set current language.
static _writeExternalAccount($a_usr_id, $a_ext_id)
hasPublicProfile()
returns true if public is profile, false otherwise
static _getAllUserAssignedStyles()
skins and styles
static _doesLoginnameExistInHistory($a_login)
Checks wether the passed loginname already exists in history.
addToPCClipboard($a_content, $a_time, $a_nr)
Add a page content item to PC clipboard (should go to another class)
updateLogin($a_login)
update login name
static _deleteAllPref($a_user_id)
Deletes a userpref value of the user from the database public.
importPersonalData($a_file, $a_profile_data, $a_settings, $a_bookmarks, $a_notes, $a_calendar)
Import personal data.
static _deleteUser($a_usr_id)
setLongitude($a_longitude)
Set Longitude.
static _isDesktopItem($a_usr_id, $a_item_id, $a_type)
check wether an item is on the users desktop or not
readPrefs()
get all user preferences private
getPhoneMobile()
get mobile phone public
static _lookupLastLogin($a_user_id)
lookup last login