6define(
"IL_PASSWD_PLAIN",
"plain");
7define(
"IL_PASSWD_CRYPTED",
"crypted");
10require_once
"./Services/Object/classes/class.ilObject.php";
11require_once
'./Services/User/exceptions/class.ilUserException.php';
12require_once
'./Modules/OrgUnit/classes/class.ilObjOrgUnit.php';
13require_once
'./Modules/OrgUnit/classes/class.ilObjOrgUnitTree.php';
189 public function __construct($a_user_id = 0, $a_call_by_reference =
false)
202 $this->auth_mode =
"default";
211 if ($a_user_id > 0) {
212 $this->
setId($a_user_id);
217 $this->prefs = array();
219 $this->prefs[
"language"] = $this->
ilias->ini->readVariable(
"language",
"default");
222 $this->skin = $this->
ilias->ini->readVariable(
"layout",
"skin");
228 $this->prefs[
"style"] = $this->
ilias->ini->readVariable(
"layout",
"style");
248 $r =
$ilDB->queryF(
"SELECT * FROM usr_data " .
249 "WHERE usr_id= %s", array(
"integer"), array($this->
id));
271 if ($this->prefs[
"language"] ==
"") {
272 $this->prefs[
"language"] = $this->oldPrefs[
"language"];
276 include_once(
"./Services/Style/System/classes/class.ilStyleDefinition.php");
277 if ($this->prefs[
"skin"] ==
"" ||
279 $this->prefs[
"skin"] = $this->oldPrefs[
"skin"];
282 $this->skin = $this->prefs[
"skin"];
285 if ($this->prefs[
"style"] ==
"" ||
289 $this->prefs[
"style"] = $this->
ilias->ini->readVariable(
"layout",
"style");
292 if (empty($this->prefs[
"hits_per_page"])) {
293 $this->prefs[
"hits_per_page"] = 10;
296 $ilErr->raiseError(
"<b>Error: There is no dataset with id " .
297 $this->
id .
"!</b><br />class: " . get_class($this) .
"<br />Script: " . __FILE__ .
298 "<br />Line: " . __LINE__,
$ilErr->FATAL);
320 $this->password_encoding_type = $password_encryption_type;
354 if (!$a_data[
"passwd_type"]) {
355 $ilErr->raiseError(
"<b>Error: passwd_type missing in function assignData(). " .
356 $this->
id .
"!</b><br />class: " . get_class($this) .
"<br />Script: "
357 . __FILE__ .
"<br />Line: " . __LINE__,
$ilErr->FATAL);
359 if ($a_data[
"passwd"] !=
"********" and strlen($a_data[
'passwd'])) {
360 $this->
setPasswd($a_data[
"passwd"], $a_data[
"passwd_type"]);
368 if (!is_array($a_data[
'birthday'])) {
378 $this->
setCity($a_data[
"city"]);
385 $this->
setFax($a_data[
"fax"]);
404 $this->create_date = $a_data[
"create_date"];
405 $this->
setComment($a_data[
"referral_comment"]);
406 $this->approve_date = $a_data[
"approve_date"];
407 $this->active = $a_data[
"active"];
408 $this->agree_date = $a_data[
"agree_date"];
435 public function saveAsNew($a_from_formular =
true)
439 $ilAppEventHandler =
$DIC[
'ilAppEventHandler'];
450 switch ($this->passwd_type) {
452 if (strlen($this->passwd)) {
453 require_once
'Services/User/classes/class.ilUserPasswordManager.php';
466 $ilErr->raiseError(
"<b>Error: passwd_type missing in function saveAsNew. " .
467 $this->
id .
"!</b><br />class: " . get_class($this) .
"<br />Script: " . __FILE__ .
468 "<br />Line: " . __LINE__,
$ilErr->FATAL);
471 if (!$this->active) {
477 $insert_array = array(
478 "usr_id" => array(
"integer", $this->
id),
479 "login" => array(
"text", $this->
login),
480 "passwd" => array(
"text", $pw_value),
483 "firstname" => array(
"text", $this->firstname),
484 "lastname" => array(
"text", $this->lastname),
485 "title" => array(
"text", $this->utitle),
486 "gender" => array(
"text", $this->gender),
487 "email" => array(
"text", trim($this->email)),
488 "second_email" => array(
"text", trim($this->second_email)),
489 "hobby" => array(
"text", (
string) $this->hobby),
490 "institution" => array(
"text", $this->institution),
491 "department" => array(
"text", $this->department),
492 "street" => array(
"text", $this->street),
493 "city" => array(
"text", $this->city),
494 "zipcode" => array(
"text", $this->zipcode),
495 "country" => array(
"text", $this->country),
496 "sel_country" => array(
"text", $this->sel_country),
497 "phone_office" => array(
"text", $this->phone_office),
498 "phone_home" => array(
"text", $this->phone_home),
499 "phone_mobile" => array(
"text", $this->phone_mobile),
500 "fax" => array(
"text", $this->fax),
502 "last_login" => array(
"timestamp",
null),
503 "first_login" => array(
"timestamp",
null),
504 "last_profile_prompt" => array(
"timestamp",
null),
505 "last_update" => array(
"timestamp",
ilUtil::now()),
506 "create_date" => array(
"timestamp",
ilUtil::now()),
507 "referral_comment" => array(
"text", $this->referral_comment),
508 "matriculation" => array(
"text", $this->matriculation),
509 "client_ip" => array(
"text", $this->client_ip),
510 "approve_date" => array(
"timestamp", $this->approve_date),
511 "agree_date" => array(
"timestamp", $this->agree_date),
512 "active" => array(
"integer", (
int) $this->active),
517 "auth_mode" => array(
"text", $this->
getAuthMode()),
520 "latitude" => array(
"text", $this->latitude),
521 "longitude" => array(
"text", $this->longitude),
522 "loc_zoom" => array(
"integer", (
int) $this->loc_zoom),
523 "last_password_change" => array(
"integer", (
int) $this->last_password_change_ts),
524 "passwd_policy_reset" => array(
"integer", (
int) $this->passwd_policy_reset),
525 'inactivation_date' => array(
'timestamp', $this->inactivation_date),
526 'is_self_registered' => array(
'integer', (
int) $this->is_self_registered),
528 $ilDB->insert(
"usr_data", $insert_array);
538 include_once(
"Services/Mail/classes/class.ilMailbox.php");
540 $mbox->createDefaultFolder();
542 include_once
"Services/Mail/classes/class.ilMailOptions.php";
544 $mail_options->createMailOptionsEntry();
547 $ilAppEventHandler->raise(
550 array(
"user_obj" => $this)
568 $ilAppEventHandler =
$DIC[
'ilAppEventHandler'];
574 } elseif ($this->active) {
578 $update_array = array(
579 "gender" => array(
"text", $this->gender),
580 "title" => array(
"text", $this->utitle),
581 "firstname" => array(
"text", $this->firstname),
582 "lastname" => array(
"text", $this->lastname),
583 "email" => array(
"text", trim($this->email)),
584 "second_email" => array(
"text", trim($this->second_email)),
586 "hobby" => array(
"text", $this->hobby),
587 "institution" => array(
"text", $this->institution),
588 "department" => array(
"text", $this->department),
589 "street" => array(
"text", $this->street),
590 "city" => array(
"text", $this->city),
591 "zipcode" => array(
"text", $this->zipcode),
592 "country" => array(
"text", $this->country),
593 "sel_country" => array(
"text", $this->sel_country),
594 "phone_office" => array(
"text", $this->phone_office),
595 "phone_home" => array(
"text", $this->phone_home),
596 "phone_mobile" => array(
"text", $this->phone_mobile),
597 "fax" => array(
"text", $this->fax),
598 "referral_comment" => array(
"text", $this->referral_comment),
599 "matriculation" => array(
"text", $this->matriculation),
600 "client_ip" => array(
"text", $this->client_ip),
601 "approve_date" => array(
"timestamp", $this->approve_date),
602 "active" => array(
"integer", $this->active),
609 "auth_mode" => array(
"text", $this->
getAuthMode()),
611 "latitude" => array(
"text", $this->latitude),
612 "longitude" => array(
"text", $this->longitude),
613 "loc_zoom" => array(
"integer", (
int) $this->loc_zoom),
614 "last_password_change" => array(
"integer", $this->last_password_change_ts),
615 "passwd_policy_reset" => array(
"integer", $this->passwd_policy_reset),
616 "last_update" => array(
"timestamp",
ilUtil::now()),
617 'inactivation_date' => array(
'timestamp', $this->inactivation_date),
621 if ($this->agree_date ===
null || (is_string($this->agree_date) && strtotime($this->agree_date) !==
false)) {
622 $update_array[
"agree_date"] = array(
"timestamp", $this->agree_date);
624 switch ($this->passwd_type) {
626 if (strlen($this->passwd)) {
627 require_once
'Services/User/classes/class.ilUserPasswordManager.php';
629 $update_array[
'passwd'] = array(
'text', $this->
getPasswd());
631 $update_array[
"passwd"] = array(
"text", (
string) $this->passwd);
636 $update_array[
"passwd"] = array(
"text", (
string) $this->passwd);
640 $ilErr->raiseError(
"<b>Error: passwd_type missing in function update()" . $this->
id .
"!</b><br />class: " .
641 get_class($this) .
"<br />Script: " . __FILE__ .
"<br />Line: " . __LINE__,
$ilErr->FATAL);
645 $update_array[
'passwd_salt'] = array(
'text', $this->
getPasswordSalt());
647 $ilDB->update(
"usr_data", $update_array, array(
"usr_id" => array(
"integer", $this->
id)));
657 parent::updateOwner();
661 $ilAppEventHandler->raise(
664 array(
"user_obj" => $this)
679 $ilDB->manipulateF(
"UPDATE usr_data SET agree_date = " .
$ilDB->now() .
680 " WHERE usr_id = %s", array(
"integer"), array($this->
getId()));
686 private static function _lookup($a_user_id, $a_field)
693 "SELECT " . $a_field .
" FROM usr_data WHERE usr_id = %s",
699 return $set[$a_field];
713 $set =
$ilDB->queryF(
714 "SELECT title, firstname, lastname FROM usr_data WHERE usr_id = %s",
719 if ($rec =
$ilDB->fetchAssoc($set)) {
723 if ($rec[
"firstname"]) {
726 if ($rec[
"lastname"]) {
783 "SELECT firstname, lastname, title, login FROM usr_data WHERE usr_id = %s",
788 return array(
"user_id" => $a_user_id,
789 "firstname" => $user_rec[
"firstname"],
790 "lastname" => $user_rec[
"lastname"],
791 "title" => $user_rec[
"title"],
792 "login" => $user_rec[
"login"]);
805 "SELECT * FROM usr_data WHERE usr_id = %s",
838 if (!is_array($a_user_str)) {
840 "SELECT usr_id FROM usr_data WHERE login = %s",
845 return $user_rec[
"usr_id"];
848 "SELECT usr_id FROM usr_data " .
849 " WHERE " .
$ilDB->in(
"login", $a_user_str,
false,
"text")
852 while ($rec =
$ilDB->fetchAssoc($set)) {
853 $ids[] = $rec[
"usr_id"];
888 "UPDATE usr_data SET " .
889 "last_login = " .
$ilDB->now() .
890 " WHERE usr_id = %s",
897 "UPDATE usr_data SET " .
898 "first_login = " .
$ilDB->now() .
899 " WHERE usr_id = %s",
914 public function resetPassword($raw, $raw_retype)
923 if (func_num_args() != 2) {
927 if (!isset($raw) || !isset($raw_retype)) {
931 if ($raw != $raw_retype) {
935 require_once
'Services/User/classes/class.ilUserPasswordManager.php';
940 SET passwd = %s, passwd_enc_type = %s, passwd_salt = %s
942 array(
'text',
'text',
'text',
'integer'),
967 SELECT * FROM loginname_history
994 $ilDB->setLimit(1, 0);
997 SELECT login, history_date FROM loginname_history
998 WHERE usr_id = %s ORDER BY history_date DESC',
1003 if (!is_array($row) || !count($row)) {
1008 $row[
'login'], $row[
'history_date']
1026 if (func_num_args() != 1) {
1030 if (!isset($a_login)) {
1037 if (0 == strcmp($a_login, $former_login)) {
1044 $last_history_entry =
null;
1048 if ((
int)
$ilSetting->get(
'allow_change_loginname') &&
1049 (
int)
$ilSetting->get(
'reuse_of_loginnames') == 0 &&
1050 self::_doesLoginnameExistInHistory($a_login)) {
1051 throw new ilUserException($this->lng->txt(
'loginname_already_exists'));
1052 } elseif ((
int)
$ilSetting->get(
'allow_change_loginname') &&
1053 (
int)
$ilSetting->get(
'loginname_change_blocking_time') &&
1054 is_array($last_history_entry) &&
1055 $last_history_entry[1] + (
int)
$ilSetting->get(
'loginname_change_blocking_time') > time()) {
1056 include_once
'Services/Calendar/classes/class.ilDate.php';
1059 $this->lng->txt(
'changing_loginname_not_possible_info'),
1070 if ((
int)
$ilSetting->get(
'allow_change_loginname') &&
1071 (
int)
$ilSetting->get(
'create_history_loginname')) {
1076 $this->
login = $a_login;
1083 array(
'text',
'integer'),
1100 $this->
setPref($a_keyword, $a_value);
1111 self::_deletePref($this->
getId(), $a_keyword);
1119 public static function _deletePref($a_user_id, $a_keyword)
1129 'DELETE FROM usr_pref WHERE usr_id = %s AND keyword = %s',
1130 array(
'integer',
'text'),
1131 array($a_user_id, $a_keyword)
1147 "DELETE FROM usr_pref WHERE usr_id = %s",
1159 public static function _writePref($a_usr_id, $a_keyword, $a_value)
1167 "usr_id" => array(
"integer", $a_usr_id),
1168 "keyword" => array(
"text", $a_keyword),
1171 "value" => array(
"text",$a_value)
1198 foreach ($this->prefs as $keyword => $value) {
1211 if ($tz = $this->
getPref(
'user_tz')) {
1214 include_once(
'Services/Calendar/classes/class.ilCalendarSettings.php');
1216 return $settings->getDefaultTimeZone();
1231 include_once(
'Services/Calendar/classes/class.ilCalendarSettings.php');
1233 return $settings->getDefaultTimeFormat();
1248 include_once(
'Services/Calendar/classes/class.ilCalendarSettings.php');
1250 return $settings->getDefaultDateFormat();
1262 if ($a_keyword !=
"") {
1263 $this->prefs[$a_keyword] = $a_value;
1274 if (array_key_exists($a_keyword, $this->prefs)) {
1275 return $this->prefs[$a_keyword];
1287 $query =
"SELECT * FROM usr_pref WHERE usr_id = " .
$ilDB->quote($a_usr_id,
"integer") .
" " .
1288 "AND keyword = " .
$ilDB->quote($a_keyword,
"text");
1307 if (is_array($this->prefs)) {
1319 public function delete()
1327 include_once(
'Services/LDAP/classes/class.ilLDAPRoleGroupMapping.php');
1329 $mapping->deleteUser($this->
getId());
1332 include_once(
"Services/Mail/classes/class.ilMailbox.php");
1335 $mailbox->updateMailsOfDeletedUser($this->
getLogin());
1338 include_once(
"./Services/Block/classes/class.ilCustomBlock.php");
1340 $costum_block->setContextObjId($this->
getId());
1341 $costum_block->setContextObjType(
"user");
1342 $c_blocks = $costum_block->queryBlocksForContext();
1343 include_once(
"./Services/Feeds/classes/class.ilPDExternalFeedBlock.php");
1344 foreach ($c_blocks as $c_block) {
1345 if ($c_block[
"type"] ==
"pdfeed") {
1353 include_once(
"./Services/Block/classes/class.ilBlockSetting.php");
1358 "DELETE FROM usr_data WHERE usr_id = %s",
1360 array($this->
getId())
1371 include_once(
"./Services/Authentication/classes/class.ilSession.php");
1379 $q =
"DELETE FROM bookmark_tree WHERE tree = " .
1381 $ilDB->manipulate($q);
1383 $q =
"DELETE FROM bookmark_data WHERE user_id = " .
1385 $ilDB->manipulate($q);
1388 include_once
'./Modules/Forum/classes/class.ilObjForum.php';
1392 include_once
'./Services/LinkChecker/classes/class.ilLinkCheckNotify.php';
1396 include_once
'./Modules/Course/classes/class.ilObjCourse.php';
1400 include_once
'./Services/Tracking/classes/class.ilObjUserTracking.php';
1403 include_once
'Modules/Session/classes/class.ilEventParticipants.php';
1407 include_once
'Modules/Scorm2004/classes/ilSCORM13Package.php';
1411 include_once
'Modules/ScormAicc/classes/class.ilObjSCORMLearningModule.php';
1415 include_once
"./Services/Notification/classes/class.ilNotification.php";
1419 include_once
"./Modules/Portfolio/classes/class.ilObjPortfolio.php";
1423 include_once
"./Services/PersonalWorkspace/classes/class.ilWorkspaceTree.php";
1425 $tree->cascadingDelete();
1428 require_once
'Services/User/classes/class.ilCronDeleteInactiveUserReminderMail.php';
1432 include_once
"Services/Badge/classes/class.ilBadgeAssignment.php";
1437 $ilOrgUnitUserAssignmentQueries->deleteAllAssignmentsOfUser($this->
getId());
1451 $ilAppEventHandler =
$DIC[
'ilAppEventHandler'];
1452 $ilAppEventHandler->raise(
1455 array(
'usr_id' => $this->
getId())
1472 public function setFullname($a_title =
"", $a_firstname =
"", $a_lastname =
"")
1474 $this->fullname =
"";
1478 } elseif ($this->utitle) {
1479 $this->fullname = $this->utitle .
" ";
1484 } elseif ($this->firstname) {
1485 $this->fullname .= $this->firstname .
" ";
1511 if (!$a_max_strlen) {
1515 if (strlen($this->fullname) <= $a_max_strlen) {
1519 if ((strlen($this->utitle) + strlen($this->lastname) + 4) <= $a_max_strlen) {
1520 return ilUtil::stripSlashes($this->utitle .
" " . substr($this->firstname, 0, 1) .
". " . $this->lastname);
1523 if ((strlen($this->firstname) + strlen($this->lastname) + 1) <= $a_max_strlen) {
1527 if ((strlen($this->lastname) + 3) <= $a_max_strlen) {
1541 $this->
login = $a_str;
1560 $this->passwd = $a_str;
1561 $this->passwd_type = $a_type;
1593 $this->gender = substr($a_str, -1);
1614 $this->utitle = $a_str;
1635 $this->firstname = $a_str;
1654 $this->lastname = $a_str;
1673 $this->institution = $a_str;
1692 $this->department = $a_str;
1711 $this->street = $a_str;
1730 $this->city = $a_str;
1749 $this->zipcode = $a_str;
1769 $this->country = $a_str;
1789 $this->sel_country = $a_val;
1809 $this->phone_office = $a_str;
1828 $this->phone_home = $a_str;
1847 $this->phone_mobile = $a_str;
1866 $this->fax = $a_str;
1885 $this->client_ip = $a_str;
1904 $this->matriculation = $a_str;
1928 $query =
"SELECT matriculation FROM usr_data " .
1929 "WHERE usr_id = " .
$ilDB->quote($a_usr_id);
1932 return $row->matriculation ? $row->matriculation :
'';
1942 $this->email = $a_str;
1977 $this->hobby = $a_str;
1996 $this->
setPref(
"language", $a_str);
2007 return $this->prefs[
"language"];
2012 $this->last_password_change_ts = $a_last_password_change_ts;
2033 $this->passwd_policy_reset = $status;
2043 $q =
"SELECT value FROM usr_pref WHERE usr_id= " .
2044 $ilDB->quote($a_usr_id,
"integer") .
" AND keyword = " .
2045 $ilDB->quote(
'language',
"text");
2046 $r =
$ilDB->query($q);
2048 while ($row =
$ilDB->fetchAssoc($r)) {
2049 return $row[
'value'];
2051 if (is_object(
$lng)) {
2052 return $lng->getDefaultLanguage();
2064 "UPDATE usr_data " .
2065 " SET ext_account = %s WHERE usr_id = %s",
2066 array(
"text",
"integer"),
2067 array($a_ext_id, $a_usr_id)
2078 "UPDATE usr_data " .
2079 " SET auth_mode = %s WHERE usr_id = %s",
2080 array(
"text",
"integer"),
2081 array($a_auth_mode, $a_usr_id)
2111 $this->last_login = $a_str;
2121 return $this->last_login;
2130 $this->first_login = $a_str;
2148 $this->last_profile_prompt = $a_str;
2167 $this->last_update = $a_str;
2181 $this->referral_comment = $a_str;
2201 $this->approve_date = $a_str;
2231 $this->agree_date = $a_str;
2272 $query =
'SELECT usr_id FROM usr_data ' .
2273 'WHERE active = ' .
$ilDB->quote(1,
'integer') .
' ' .
2274 'AND usr_id = ' .
$ilDB->quote($a_usr_id,
'integer');
2295 if ($this->active) {
2299 if ((!empty($storedActive) && empty($currentActive)) ||
2300 (empty($storedActive) && !empty($currentActive))) {
2325 $this->skin = $a_str;
2330 $this->time_limit_owner = $a_owner;
2334 return $this->time_limit_owner ? $this->time_limit_owner : 7;
2338 $this->time_limit_from = $a_from;
2342 return $this->time_limit_from;
2346 $this->time_limit_until = $a_until;
2350 return $this->time_limit_until;
2354 $this->time_limit_unlimited = $a_unlimited;
2358 return $this->time_limit_unlimited;
2362 return $this->time_limit_message = $a_time_limit_message;
2366 return $this->time_limit_message;
2371 $this->login_attempts = $a_login_attempts;
2392 $this->profile_incomplete = (boolean) $a_prof_inc;
2399 return $this->profile_incomplete;
2425 $passwordResetOnFirstLogin = (
2426 $security->isPasswordChangeOnFirstLoginEnabled() &&
2431 return ($authModeAllowsPasswordChange && ($passwordResetOnFirstLogin || $passwordResetOnChangedPolicy));
2440 require_once(
'./Services/PrivacySecurity/classes/class.ilSecuritySettings.php');
2443 $max_pass_age = $security->getPasswordMaxAge();
2444 if ($max_pass_age > 0) {
2445 $max_pass_age_ts = ($max_pass_age * 86400);
2447 $current_ts = time();
2449 if (($current_ts - $pass_change_ts) > $max_pass_age_ts) {
2462 $current_ts = time();
2464 $password_age = (int) (($current_ts - $pass_change_ts) / 86400);
2465 return $password_age;
2476 $query =
"UPDATE usr_data SET last_password_change = %s " .
2477 "WHERE usr_id = %s";
2478 $affected =
$ilDB->manipulateF(
2480 array(
'integer',
'integer'),
2496 $query =
"UPDATE usr_data SET last_password_change = 0 " .
2497 "WHERE usr_id = %s";
2498 $affected =
$ilDB->manipulateF(
2501 array($this->
getId())
2517 $this->latitude = $a_latitude;
2537 $this->longitude = $a_longitude;
2557 $this->loc_zoom = $a_locationzoom;
2582 $set =
$ilDB->queryf(
2584 SELECT COUNT(*) session_count
2585 FROM usr_session WHERE user_id = %s AND expires > %s AND session_id != %s ',
2586 array(
'integer',
'integer',
'text'),
2587 array($a_user_id, time(), $a_session_id)
2589 $row =
$ilDB->fetchAssoc($set);
2590 return (
bool) $row[
'session_count'];
2616 $uid =
$GLOBALS[
'DIC'][
'ilAuthSession']->getUserId();
2620 require_once(
'Services/WebDAV/classes/class.ilDAVActivationChecker.php');
2637 $pos = strrpos($a_login,
'/');
2638 $pos2 = strrpos($a_login,
'\\');
2639 if ($pos ===
false || $pos < $pos2) {
2642 if ($pos !==
false) {
2643 $a_login = substr($a_login, $pos + 1);
2660 $set =
$ilDB->queryF(
2661 "SELECT active FROM usr_data WHERE login= %s",
2666 if ($rec =
$ilDB->fetchAssoc($set)) {
2667 if ($rec[
"active"]) {
2704 "SELECT usr_id FROM usr_data " .
2705 "WHERE email = %s and active = 1",
2710 while ($row =
$ilDB->fetchObject(
$res)) {
2711 $ids[] = $row->usr_id;
2731 "SELECT login FROM usr_data " .
2732 "WHERE email = %s and active = 1",
2737 while ($row =
$ilDB->fetchObject(
$res)) {
2738 $ids[] = $row->login;
2768 public static function searchUsers($a_search_str,
$active = 1, $a_return_ids_only =
false, $filter_settings =
false)
2774 $ilLog =
$DIC[
'ilLog'];
2777 $query =
"SELECT usr_data.usr_id, usr_data.login, usr_data.firstname, usr_data.lastname, usr_data.email, usr_data.active FROM usr_data ";
2779 $without_anonymous_users =
true;
2782 $join_filter =
" WHERE ";
2783 if ($filter_settings !==
false && strlen($filter_settings)) {
2784 switch ($filter_settings) {
2787 $join_filter =
" LEFT JOIN obj_members ON usr_data.usr_id = obj_members.usr_id WHERE obj_members.usr_id IS NULL AND ";
2793 $join_filter =
" LEFT JOIN obj_members ON usr_data.usr_id = obj_members.usr_id WHERE obj_members.obj_id = " .
2794 "(SELECT obj_id FROM object_reference WHERE ref_id = " .
$ilDB->quote(
$ref_id,
"integer") .
") AND ";
2804 if (is_array($local_roles) && count($local_roles)) {
2805 $join_filter =
" LEFT JOIN rbac_ua ON usr_data.usr_id = rbac_ua.usr_id WHERE " .
2806 $ilDB->in(
"rbac_ua.rol_id", $local_roles,
false, $local_roles) .
" AND ";
2814 $rol_id =
$_SESSION[
"user_filter_data"];
2816 $join_filter =
" LEFT JOIN rbac_ua ON usr_data.usr_id = rbac_ua.usr_id WHERE rbac_ua.rol_id = " .
2817 $ilDB->quote($rol_id,
"integer") .
" AND ";
2818 $without_anonymous_users =
false;
2825 if (strtolower(substr($a_search_str, 0, 5)) ==
"role:") {
2826 $query =
"SELECT DISTINCT usr_data.usr_id,usr_data.login,usr_data.firstname,usr_data.lastname,usr_data.email " .
2827 "FROM object_data,rbac_ua,usr_data " .
2828 "WHERE " .
$ilDB->like(
"object_data.title",
"text",
"%" . substr($a_search_str, 5) .
"%") .
2829 " AND object_data.type = 'role' " .
2830 "AND rbac_ua.rol_id = object_data.obj_id " .
2831 "AND usr_data.usr_id = rbac_ua.usr_id " .
2835 "(" .
$ilDB->like(
"usr_data.login",
"text",
"%" . $a_search_str .
"%") .
" " .
2836 "OR " .
$ilDB->like(
"usr_data.firstname",
"text",
"%" . $a_search_str .
"%") .
" " .
2837 "OR " .
$ilDB->like(
"usr_data.lastname",
"text",
"%" . $a_search_str .
"%") .
" " .
2838 "OR " .
$ilDB->like(
"usr_data.email",
"text",
"%" . $a_search_str .
"%") .
") ";
2840 if ($filter_settings !==
false && strlen($filter_settings)) {
2841 switch ($filter_settings) {
2843 $query .=
" AND usr_data.active = " .
$ilDB->quote(0,
"integer") .
" ";
2846 $query .=
" AND usr_data.active = " .
$ilDB->quote(1,
"integer") .
" ";
2849 $query .=
" AND usr_data.time_limit_unlimited = " .
$ilDB->quote(0,
"integer") .
" ";
2852 $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"]));
2853 $query .=
" AND last_login < " .
$ilDB->quote($date,
"timestamp") .
" ";
2858 if ($without_anonymous_users) {
2862 if (is_numeric(
$active) &&
$active > -1 && $filter_settings ===
false) {
2868 while ($row =
$ilDB->fetchObject(
$res)) {
2870 "usr_id" => $row->usr_id,
2871 "login" => $row->login,
2872 "firstname" => $row->firstname,
2873 "lastname" => $row->lastname,
2874 "email" => $row->email,
2875 "active" => $row->active);
2876 $ids[] = $row->usr_id;
2878 if ($a_return_ids_only) {
2879 return $ids ? $ids : array();
2881 return $users ? $users : array();
2888 public static function getAllUserLogins()
2902 while ($row =
$ilDB->fetchAssoc(
$res)) {
2903 $logins[] = $row[
'login'];
2922 $res =
$ilDB->query(
"SELECT * FROM usr_data WHERE " .
2923 $ilDB->in(
"usr_id", $a_user_ids,
false,
"integer"));
2924 while ($row =
$ilDB->fetchAssoc(
$res)) {
2925 $user_data[
"$row[usr_id]"] = $row;
2927 return $user_data ? $user_data : array();
2944 $result_arr = array();
2948 if ($a_fields !==
null and is_array($a_fields)) {
2949 if (count($a_fields) == 0) {
2952 if (($usr_id_field = array_search(
"usr_id", $a_fields)) !==
false) {
2953 unset($a_fields[$usr_id_field]);
2956 $select = implode(
",", $a_fields) .
",usr_data.usr_id";
2958 if (in_array(
'online_time', $a_fields)) {
2959 $select .=
",ut_online.online_time ";
2963 $q =
"SELECT " . $select .
" FROM usr_data ";
2967 if (in_array(
'online_time', $a_fields)) {
2968 $q .=
"LEFT JOIN ut_online ON usr_data.usr_id = ut_online.usr_id ";
2974 $q .=
"WHERE active = " .
$ilDB->quote(
$active,
"integer");
2977 $q .=
"WHERE time_limit_unlimited= " .
$ilDB->quote(0,
"integer");;
2980 $qtemp = $q .
", rbac_ua, object_data WHERE rbac_ua.rol_id = object_data.obj_id AND " .
2981 $ilDB->like(
"object_data.title",
"text",
"%crs%") .
" AND usr_data.usr_id = rbac_ua.usr_id";
2982 $r =
$ilDB->query($qtemp);
2983 $course_users = array();
2984 while ($row =
$ilDB->fetchAssoc($r)) {
2985 array_push($course_users, $row[
"usr_id"]);
2987 if (count($course_users)) {
2988 $q .=
" WHERE " .
$ilDB->in(
"usr_data.usr_id", $course_users,
true,
"integer") .
" ";
2994 $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"]));
2995 $q .=
" AND last_login < " .
$ilDB->quote($date,
"timestamp");
3000 $q .=
" LEFT JOIN obj_members ON usr_data.usr_id = obj_members.usr_id " .
3001 "WHERE obj_members.obj_id = (SELECT obj_id FROM object_reference " .
3002 "WHERE ref_id = " .
$ilDB->quote(
$ref_id,
"integer") .
") ";
3012 if (is_array($local_roles) && count($local_roles)) {
3013 $q .=
" LEFT JOIN rbac_ua ON usr_data.usr_id = rbac_ua.usr_id WHERE " .
3014 $ilDB->in(
"rbac_ua.rol_id", $local_roles,
false,
"integer") .
" ";
3019 $rol_id =
$_SESSION[
"user_filter_data"];
3021 $q .=
" LEFT JOIN rbac_ua ON usr_data.usr_id = rbac_ua.usr_id WHERE rbac_ua.rol_id = " .
3022 $ilDB->quote($rol_id,
"integer");
3026 $r =
$ilDB->query($q);
3028 while ($row =
$ilDB->fetchAssoc($r)) {
3029 $result_arr[] = $row;
3045 $q =
"SELECT count(*) as cnt FROM usr_pref up1, usr_pref up2 " .
3046 " WHERE up1.keyword= " .
$ilDB->quote(
"style",
"text") .
3047 " AND up1.value= " .
$ilDB->quote($a_style,
"text") .
3048 " AND up2.keyword= " .
$ilDB->quote(
"skin",
"text") .
3049 " AND up2.value= " .
$ilDB->quote($a_skin,
"text") .
3050 " AND up1.usr_id = up2.usr_id ";
3052 $cnt_set =
$ilDB->query($q);
3054 $cnt_rec =
$ilDB->fetchAssoc($cnt_set);
3056 return $cnt_rec[
"cnt"];
3068 $q =
"SELECT DISTINCT up1.value style, up2.value skin FROM usr_pref up1, usr_pref up2 " .
3069 " WHERE up1.keyword = " .
$ilDB->quote(
"style",
"text") .
3070 " AND up2.keyword = " .
$ilDB->quote(
"skin",
"text") .
3071 " AND up1.usr_id = up2.usr_id";
3073 $sty_set =
$ilDB->query($q);
3076 while ($sty_rec =
$ilDB->fetchAssoc($sty_set)) {
3077 $styles[] = $sty_rec[
"skin"] .
":" . $sty_rec[
"style"];
3092 $q =
"SELECT up1.usr_id usr_id FROM usr_pref up1, usr_pref up2 " .
3093 " WHERE up1.keyword= " .
$ilDB->quote(
"style",
"text") .
3094 " AND up1.value= " .
$ilDB->quote($a_from_style,
"text") .
3095 " AND up2.keyword= " .
$ilDB->quote(
"skin",
"text") .
3096 " AND up2.value= " .
$ilDB->quote($a_from_skin,
"text") .
3097 " AND up1.usr_id = up2.usr_id ";
3099 $usr_set =
$ilDB->query($q);
3101 while ($usr_rec =
$ilDB->fetchAssoc($usr_set)) {
3134 $a_time = date(
"Y-m-d H:i:s", time());
3137 $item_set =
$ilDB->queryF(
3138 "SELECT * FROM personal_clipboard WHERE " .
3139 "parent = %s AND item_id = %s AND type = %s AND user_id = %s",
3140 array(
"integer",
"integer",
"text",
"integer"),
3141 array(0, $a_item_id, $a_type, $this->
getId())
3145 if (!
$d = $item_set->fetchRow()) {
3147 "INSERT INTO personal_clipboard " .
3148 "(item_id, type, user_id, title, parent, insert_time, order_nr) VALUES " .
3149 " (%s,%s,%s,%s,%s,%s,%s)",
3150 array(
"integer",
"text",
"integer",
"text",
"integer",
"timestamp",
"integer"),
3151 array($a_item_id, $a_type, $this->
getId(), $a_title, (
int) $a_parent, $a_time, (
int) $a_order_nr)
3155 "UPDATE personal_clipboard SET insert_time = %s " .
3156 "WHERE user_id = %s AND item_id = %s AND type = %s AND parent = 0",
3157 array(
"timestamp",
"integer",
"integer",
"text"),
3158 array($a_time, $this->
getId(), $a_item_id, $a_type)
3172 $a_time = date(
"Y-m-d H:i:s", time());
3175 $ilDB->insert(
"personal_pc_clipboard", array(
3176 "user_id" => array(
"integer", $this->
getId()),
3177 "content" => array(
"clob", $a_content),
3178 "insert_time" => array(
"timestamp", $a_time),
3179 "order_nr" => array(
"integer", $a_nr)
3196 $set =
$ilDB->queryF(
"SELECT MAX(insert_time) mtime FROM personal_pc_clipboard " .
3197 " WHERE user_id = %s", array(
"integer"), array($this->
getId()));
3198 $row =
$ilDB->fetchAssoc($set);
3200 $set =
$ilDB->queryF(
3201 "SELECT * FROM personal_pc_clipboard " .
3202 " WHERE user_id = %s AND insert_time = %s ORDER BY order_nr ASC",
3203 array(
"integer",
"timestamp"),
3204 array($this->
getId(), $row[
"mtime"])
3207 while ($row =
$ilDB->fetchAssoc($set)) {
3208 $content[] = $row[
"content"];
3223 $set =
$ilDB->queryF(
3224 "SELECT * FROM personal_clipboard WHERE " .
3225 "parent = %s AND type = %s AND user_id = %s",
3226 array(
"integer",
"text",
"integer"),
3227 array(0, $a_type, $this->
getId())
3229 if ($rec =
$ilDB->fetchAssoc($set)) {
3246 "DELETE FROM personal_clipboard WHERE " .
3247 "type = %s AND user_id = %s",
3248 array(
"text",
"integer"),
3249 array($a_type, $this->
getId())
3262 $ilDB->manipulateF(
"DELETE FROM personal_clipboard WHERE " .
3263 "user_id = %s", array(
"integer"), array($this->
getId()));
3276 if ($a_top_nodes_only) {
3277 $par =
" AND parent = " .
$ilDB->quote(0,
"integer") .
" ";
3280 $type_str = ($a_type !=
"")
3281 ?
" AND type = " .
$ilDB->quote($a_type,
"text") .
" "
3283 $q =
"SELECT * FROM personal_clipboard WHERE " .
3284 "user_id = " .
$ilDB->quote($this->
getId(),
"integer") .
" " .
3286 " ORDER BY order_nr";
3287 $objs =
$ilDB->query($q);
3289 while ($obj =
$ilDB->fetchAssoc($objs)) {
3290 if ($obj[
"type"] ==
"mob") {
3296 if ($obj[
"type"] ==
"incl") {
3297 include_once(
"./Modules/MediaPool/classes/class.ilMediaPoolPage.php");
3303 $objects[] = array(
"id" => $obj[
"item_id"],
3304 "type" => $obj[
"type"],
"title" => $obj[
"title"],
3305 "insert_time" => $obj[
"insert_time"]);
3320 $objs =
$ilDB->queryF(
3321 "SELECT * FROM personal_clipboard WHERE " .
3322 "user_id = %s AND parent = %s AND insert_time = %s " .
3323 " ORDER BY order_nr",
3324 array(
"integer",
"integer",
"timestamp"),
3325 array(
$ilUser->getId(), (
int) $a_parent, $a_insert_time)
3328 while ($obj =
$ilDB->fetchAssoc($objs)) {
3329 if ($obj[
"type"] ==
"mob") {
3332 $objects[] = array(
"id" => $obj[
"item_id"],
3333 "type" => $obj[
"type"],
"title" => $obj[
"title"],
"insert_time" => $obj[
"insert_time"]);
3352 $q =
"SELECT DISTINCT user_id FROM personal_clipboard WHERE " .
3353 "item_id = " .
$ilDB->quote($a_id,
"integer") .
" AND " .
3354 "type = " .
$ilDB->quote($a_type,
"text");
3355 $user_set =
$ilDB->query($q);
3357 while ($user_rec =
$ilDB->fetchAssoc($user_set)) {
3358 $users[] = $user_rec[
"user_id"];
3377 $q =
"DELETE FROM personal_clipboard WHERE " .
3378 "item_id = " .
$ilDB->quote($a_item_id,
"integer") .
3379 " AND type = " .
$ilDB->quote($a_type,
"text") .
" " .
3380 " AND user_id = " .
$ilDB->quote($this->
getId(),
"integer");
3381 $ilDB->manipulate($q);
3390 $query =
"SELECT obj_id FROM object_data WHERE import_id = " .
3391 $ilDB->quote($i2_id,
"text");
3394 while ($row =
$ilDB->fetchObject(
$res)) {
3407 require_once(
'./Modules/OrgUnit/classes/PathStorage/class.ilOrgUnitPathStorage.php');
3408 return ilOrgUnitPathStorage::getTextRepresentationOfUsersOrgUnits($a_usr_id);
3427 $this->auth_mode = $a_str;
3440 include_once(
'./Services/Authentication/classes/class.ilAuthUtils.php');
3453 $this->ext_account = $a_str;
3465 return $this->ext_account;
3486 include_once(
'./Services/Authentication/classes/class.ilAuthUtils.php');
3487 $q =
"SELECT login,usr_id,ext_account,auth_mode FROM usr_data " .
3488 "WHERE auth_mode = %s";
3490 $values[] = $a_auth_mode;
3492 $q .=
" OR auth_mode = %s ";
3494 $values[] =
'default';
3497 $res =
$ilDB->queryF($q, $types, $values);
3498 while ($row =
$ilDB->fetchObject(
$res)) {
3499 if ($row->auth_mode ==
'default') {
3500 $accounts[$row->usr_id] = $row->login;
3502 $accounts[$row->usr_id] = $row->ext_account;
3505 return $accounts ? $accounts : array();
3521 if (!is_array($a_usr_ids)) {
3527 $q =
"UPDATE usr_data SET active = 1, inactivation_date = NULL WHERE " .
3528 $ilDB->in(
"usr_id", $a_usr_ids,
false,
"integer");
3529 $ilDB->manipulate($q);
3531 $usrId_IN_usrIds =
$ilDB->in(
"usr_id", $a_usr_ids,
false,
"integer");
3533 $q =
"UPDATE usr_data SET active = 0 WHERE $usrId_IN_usrIds";
3534 $ilDB->manipulate($q);
3538 SET inactivation_date = %s
3539 WHERE inactivation_date IS NULL
3540 AND $usrId_IN_usrIds
3542 $ilDB->manipulateF($queryString, array(
'timestamp'), array(
ilUtil::now()));
3571 $settings =
$GLOBALS[
'DIC']->settings();
3575 "SELECT * FROM usr_data WHERE " .
3576 " ext_account = %s AND auth_mode = %s",
3577 array(
"text",
"text"),
3578 array($a_account, $a_auth)
3580 if ($usr =
$db->fetchAssoc($r)) {
3581 return $usr[
"login"];
3584 if (!$tryFallback) {
3590 "SELECT login FROM usr_data " .
3591 "WHERE login = %s AND auth_mode = %s AND (ext_account IS NULL OR ext_account = '') ",
3592 array(
"text",
"text"),
3593 array($a_account, $a_auth)
3595 if ($usr =
$db->fetchAssoc(
$res)) {
3596 return $usr[
'login'];
3602 "SELECT login FROM usr_data WHERE " .
3603 " ext_account = %s AND auth_mode = %s",
3604 array(
"text",
"text"),
3605 array($a_account,
"default")
3607 if ($usr =
$db->fetchAssoc(
$res)) {
3608 return $usr[
"login"];
3612 "SELECT login FROM usr_data " .
3613 "WHERE login = %s AND (ext_account IS NULL OR ext_account = '') AND auth_mode = %s",
3614 array(
"text",
"text"),
3615 array($a_account,
"default")
3617 if ($usr =
$db->fetchAssoc(
$res)) {
3618 return $usr[
"login"];
3633 $r =
$ilDB->query(
"SELECT count(*) AS cnt, auth_mode FROM usr_data " .
3634 "GROUP BY auth_mode");
3636 while ($cnt =
$ilDB->fetchAssoc($r)) {
3637 $cnt_arr[$cnt[
"auth_mode"]] = $cnt[
"cnt"];
3657 $q =
"SELECT * FROM usr_data WHERE " .
3658 " email = %s AND (auth_mode = %s ";
3659 $types = array(
"text",
"text");
3660 $values = array($a_email,
"local");
3663 $q .=
" OR auth_mode = %s";
3665 $values[] =
"default";
3671 $usr_set =
$ilDB->queryF($q, $types, $values);
3672 while ($usr_rec =
$ilDB->fetchAssoc($usr_set)) {
3673 $users[$usr_rec[
"usr_id"]] = $usr_rec[
"login"];
3690 $image_dir = $webspace_dir .
"/usr_images";
3691 $store_file =
"usr_" . $obj_id .
"." .
"jpg";
3693 chmod($tmp_file, 0770);
3697 $show_file =
"$image_dir/usr_" . $obj_id .
".jpg";
3698 $thumb_file =
"$image_dir/usr_" . $obj_id .
"_small.jpg";
3699 $xthumb_file =
"$image_dir/usr_" . $obj_id .
"_xsmall.jpg";
3700 $xxthumb_file =
"$image_dir/usr_" . $obj_id .
"_xxsmall.jpg";
3703 ilUtil::execConvert($tmp_file .
"[0] -geometry 200x200^ -gravity center -extent 200x200 -quality 100 JPEG:" . $show_file);
3704 ilUtil::execConvert($tmp_file .
"[0] -geometry 100x100^ -gravity center -extent 100x100 -quality 100 JPEG:" . $thumb_file);
3705 ilUtil::execConvert($tmp_file .
"[0] -geometry 75x75^ -gravity center -extent 75x75 -quality 100 JPEG:" . $xthumb_file);
3706 ilUtil::execConvert($tmp_file .
"[0] -geometry 30x30^ -gravity center -extent 30x30 -quality 100 JPEG:" . $xxthumb_file);
3709 ilUtil::execConvert($tmp_file .
"[0] -geometry 100x100 -quality 100 JPEG:" . $thumb_file);
3711 ilUtil::execConvert($tmp_file .
"[0] -geometry 30x30 -quality 100 JPEG:" . $xxthumb_file);
3731 if (isset(self::$personal_image_cache[$this->
getId()][$a_size][(
int) $a_force_pic])) {
3732 return self::$personal_image_cache[$this->
getId()][$a_size][(int) $a_force_pic];
3737 return self::$personal_image_cache[$this->
getId()][$a_size][(int) $a_force_pic];
3749 return $define->getAvatar();
3766 $a_force_pic =
false,
3767 $a_prevent_no_photo_image =
false,
3768 $html_export =
false
3771 $define->setForcePicture($a_force_pic);
3772 $define->setSize($a_size);
3785 $a_dir = trim(str_replace(
"..",
"", $a_dir));
3786 if ($a_dir ==
"" || !is_dir($a_dir)) {
3791 $image_dir = $webspace_dir .
"/usr_images";
3793 "upload_" . $a_user_id .
"pic",
3794 "usr_" . $a_user_id .
"." .
"jpg",
3795 "usr_" . $a_user_id .
"_small.jpg",
3796 "usr_" . $a_user_id .
"_xsmall.jpg",
3797 "usr_" . $a_user_id .
"_xxsmall.jpg",
3798 "upload_" . $a_user_id);
3799 foreach ($images as $image) {
3800 if (is_file($image_dir .
"/" . $image)) {
3801 copy($image_dir .
"/" . $image, $a_dir .
"/" . $image);
3813 $image_dir = $webspace_dir .
"/usr_images";
3814 $file = $image_dir .
"/usr_" . $this->getID() .
"." .
"jpg";
3815 $thumb_file = $image_dir .
"/usr_" . $this->getID() .
"_small.jpg";
3816 $xthumb_file = $image_dir .
"/usr_" . $this->getID() .
"_xsmall.jpg";
3817 $xxthumb_file = $image_dir .
"/usr_" . $this->getID() .
"_xxsmall.jpg";
3818 $upload_file = $image_dir .
"/upload_" . $this->getID();
3822 $this->
setPref(
"profile_image",
"");
3826 if (@is_file($file)) {
3829 if (@is_file($thumb_file)) {
3830 unlink($thumb_file);
3832 if (@is_file($xthumb_file)) {
3833 unlink($xthumb_file);
3835 if (@is_file($xxthumb_file)) {
3836 unlink($xxthumb_file);
3838 if (@is_file($upload_file)) {
3839 unlink($upload_file);
3846 if (!is_array($a_data)) {
3849 foreach ($a_data as $field =>
$data) {
3850 #$new_data[$field] = ilUtil::stripSlashes($data);
3852 $this->user_defined_data[
'f_' . $field] =
$data;
3854 #$this->user_defined_data = $new_data;
3861 return $this->user_defined_data ? $this->user_defined_data : array();
3872 $field_def = array();
3874 include_once(
"./Services/User/classes/class.ilUserDefinedData.php");
3877 foreach ($this->user_defined_data as $field => $value) {
3878 if ($field !=
'usr_id') {
3880 $udata->set($field, $value);
3914 include_once(
"./Services/User/classes/class.ilUserDefinedData.php");
3926 $this->user_defined_data = $udata->getAll();
3954 include_once(
"./Services/User/classes/class.ilUserDefinedData.php");
3970 public function getProfileAsString(&$a_language)
3972 include_once
'./Services/AccessControl/classes/class.ilObjRole.php';
3979 $language = &$a_language;
3980 $language->loadLanguageModule(
'registration');
3981 $language->loadLanguageModule(
'crs');
3984 $body .= ($language->txt(
"login") .
": " . $this->
getLogin() .
"\n");
3987 $body .= ($language->txt(
"title") .
": " . $this->
getUTitle() .
"\n");
3990 $body .= ($language->txt(
"gender") .
": " . $language->txt(
'gender_' . strtolower($this->
getGender())) .
"\n");
3993 $body .= ($language->txt(
"firstname") .
": " . $this->
getFirstname() .
"\n");
3996 $body .= ($language->txt(
"lastname") .
": " . $this->
getLastname() .
"\n");
3999 $body .= ($language->txt(
"institution") .
": " . $this->
getInstitution() .
"\n");
4002 $body .= ($language->txt(
"department") .
": " . $this->
getDepartment() .
"\n");
4005 $body .= ($language->txt(
"street") .
": " . $this->
getStreet() .
"\n");
4007 if (strlen($this->
getCity())) {
4008 $body .= ($language->txt(
"city") .
": " . $this->
getCity() .
"\n");
4011 $body .= ($language->txt(
"zipcode") .
": " . $this->
getZipcode() .
"\n");
4014 $body .= ($language->txt(
"country") .
": " . $this->
getCountry() .
"\n");
4017 $body .= ($language->txt(
"sel_country") .
": " . $this->
getSelectedCountry() .
"\n");
4020 $body .= ($language->txt(
"phone_office") .
": " . $this->
getPhoneOffice() .
"\n");
4023 $body .= ($language->txt(
"phone_home") .
": " . $this->
getPhoneHome() .
"\n");
4026 $body .= ($language->txt(
"phone_mobile") .
": " . $this->
getPhoneMobile() .
"\n");
4028 if (strlen($this->
getFax())) {
4029 $body .= ($language->txt(
"fax") .
": " . $this->
getFax() .
"\n");
4032 $body .= ($language->txt(
"email") .
": " . $this->
getEmail() .
"\n");
4035 $body .= ($language->txt(
"second_email") .
": " . $this->
getSecondEmail() .
"\n");
4038 $body .= ($language->txt(
"hobby") .
": " . $this->
getHobby() .
"\n");
4041 $body .= ($language->txt(
"referral_comment") .
": " . $this->
getComment() .
"\n");
4044 $body .= ($language->txt(
"matriculation") .
": " . $this->
getMatriculation() .
"\n");
4052 $body .= ($language->txt(
"create_date") .
": " . $date .
"\n");
4056 foreach (
$rbacreview->getGlobalRoles() as $role) {
4057 if (
$rbacreview->isAssigned($this->getId(), $role)) {
4062 $body .= ($language->txt(
'reg_role_info') .
': ' . implode(
',', $gr) .
"\n");
4067 $body .= ($language->txt(
'time_limit') .
": " . $language->txt(
'crs_unlimited') .
"\n");
4080 $body .= $language->txt(
'time_limit') .
': ' .
4081 $language->txt(
'from') .
" " .
4083 $body .= $language->txt(
'to') .
' ' . $end->get(
IL_CAL_DATETIME) .
"\n";
4086 include_once
'./Services/User/classes/class.ilUserDefinedFields.php';
4093 foreach ($user_defined_fields->getDefinitions() as $field_id => $definition) {
4095 if (strlen(
$data)) {
4097 $data = preg_replace(
'/<br(\s*)?\/?>/i',
"\n",
$data);
4101 $body .= $definition[
'field_name'] .
': ' .
$data .
"\n";
4117 if ($a_user_id > 0) {
4118 $set =
$ilDB->queryF(
4119 "SELECT feed_hash from usr_data WHERE usr_id = %s",
4123 if ($rec =
$ilDB->fetchAssoc($set)) {
4124 if (strlen($rec[
"feed_hash"]) == 32) {
4125 return $rec[
"feed_hash"];
4126 } elseif ($a_create) {
4127 $hash = md5(rand(1, 9999999) + str_replace(
" ",
"", (
string) microtime()));
4129 "UPDATE usr_data SET feed_hash = %s" .
4130 " WHERE usr_id = %s",
4131 array(
"text",
"integer"),
4132 array($hash, $a_user_id)
4153 if ($a_user_id > 0) {
4173 ($a_password ==
"") ?
"" : md5($a_password)
4192 $q =
"SELECT DISTINCT login, usr_id FROM usr_data " .
4195 $values[] = $a_login;
4197 if ($a_user_id != 0) {
4198 $q .=
" AND usr_id != %s ";
4199 $types[] =
"integer";
4200 $values[] = $a_user_id;
4203 $r =
$ilDB->queryF($q, $types, $values);
4205 if ($row =
$ilDB->fetchAssoc($r)) {
4206 return $row[
'usr_id'];
4228 "SELECT * FROM usr_data " .
4229 "WHERE ext_account = %s AND auth_mode = %s",
4230 array(
"text",
"text"),
4231 array($a_external_account, $a_auth_mode)
4253 if (count($ids) == 0) {
4257 $query =
"SELECT usr_data.*, usr_pref.value AS language
4259 LEFT JOIN usr_pref ON usr_pref.usr_id = usr_data.usr_id AND usr_pref.keyword = %s
4260 WHERE " .
$ilDB->in(
"usr_data.usr_id", $ids,
false,
"integer");
4261 $values[] =
"language";
4266 $query .=
" AND usr_data.active = %s";
4268 $types[] =
"integer";
4271 $query .=
" ORDER BY usr_data.lastname, usr_data.firstname ";
4275 while ($row =
$ilDB->fetchAssoc($r)) {
4293 $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 ";
4295 $values[] =
"language";
4298 $query .=
" AND usr_data.active = %s";
4300 $types[] =
"integer";
4304 $query .=
" AND usr_data.time_limit_owner = %s";
4306 $types[] =
"integer";
4309 $query .=
" AND usr_data.usr_id != %s ";
4311 $types[] =
"integer";
4313 $query .=
" ORDER BY usr_data.lastname, usr_data.firstname ";
4318 array_push(
$data, $row);
4349 $query =
"SELECT usr_data.*, usr_pref.value AS language
4351 LEFT JOIN usr_pref ON usr_pref.usr_id = usr_data.usr_id AND usr_pref.keyword = %s
4352 WHERE " .
$ilDB->in(
"usr_data.usr_id", $a_mem_ids,
false,
"integer") .
"
4353 AND usr_data.usr_id != %s";
4354 $values[] =
"language";
4357 $types[] =
"integer";
4360 $query .=
" AND active = %s";
4362 $types[] =
"integer";
4365 if ($timelimitowner !=
USER_FOLDER_ID && $timelimitowner != -1) {
4366 $query .=
" AND usr_data.time_limit_owner = %s";
4367 $values[] = $timelimitowner;
4368 $types[] =
"integer";
4371 $query .=
" ORDER BY usr_data.lastname, usr_data.firstname ";
4378 return $mem_arr ? $mem_arr : array();
4395 if (is_array($a_internalids)) {
4396 foreach ($a_internalids as $internalid) {
4397 if (is_numeric($internalid)) {
4398 $ids[] = $internalid;
4401 if (is_numeric($parsedid) && $parsedid > 0) {
4407 if (count($ids) == 0) {
4411 $query =
"SELECT usr_data.*, usr_pref.value AS language
4414 ON usr_pref.usr_id = usr_data.usr_id AND usr_pref.keyword = %s
4415 WHERE " .
$ilDB->in(
"usr_data.usr_id", $ids,
false,
"integer");
4416 $values[] =
"language";
4419 $query .=
" ORDER BY usr_data.lastname, usr_data.firstname ";
4444 "SELECT * FROM usr_pref WHERE usr_id = %s",
4449 while ($row =
$ilDB->fetchAssoc($r)) {
4450 $prefs[$row[
"keyword"]] = $row[
"value"];
4472 $set =
$ilDB->query(
4473 "SELECT usr_id FROM usr_pref " .
4474 " WHERE keyword = " .
$ilDB->quote($a_keyword,
"text") .
4475 " AND " .
$ilDB->in(
"usr_id", $a_user_ids,
false,
"integer") .
4476 " AND value = " .
$ilDB->quote($a_val,
"text")
4478 while ($rec =
$ilDB->fetchAssoc($set)) {
4479 $users[] = $rec[
"usr_id"];
4491 $query =
"UPDATE usr_data SET login_attempts = 0 WHERE usr_id = %s";
4492 $affected =
$ilDB->manipulateF(
$query, array(
'integer'), array($a_usr_id));
4507 $query =
"SELECT login_attempts FROM usr_data WHERE usr_id = %s";
4521 $query =
"UPDATE usr_data SET login_attempts = (login_attempts + 1) WHERE usr_id = %s";
4522 $affected =
$ilDB->manipulateF(
$query, array(
'integer'), array($a_usr_id));
4537 $query =
"UPDATE usr_data SET active = 0, inactivation_date = %s WHERE usr_id = %s";
4554 return in_array($this->
getPref(
"public_profile"), array(
"y",
"g"));
4580 'SELECT * FROM loginname_history WHERE usr_id = %s AND login = %s AND history_date = %s',
4581 array(
'integer',
'text',
'integer'),
4588 INSERT INTO loginname_history
4589 (usr_id, login, history_date)
4590 VALUES (%s, %s, %s)',
4591 array(
'integer',
'text',
'integer'),
4606 public static function _getUsersOnline($a_user_id = 0, $a_no_anonymous =
false)
4619 $atime = $pd_set->get(
'user_activity_time') * 60;
4624 if ($a_user_id == 0) {
4625 $where[] =
'user_id > 0';
4626 } elseif (is_array($a_user_id)) {
4627 $where[] =
$ilDB->in(
"user_id", $a_user_id,
false,
"integer");
4629 $where[] =
'user_id = ' .
$ilDB->quote($a_user_id,
'integer');
4632 if ($a_no_anonymous) {
4636 include_once
'Services/User/classes/class.ilUserAccountSettings.php';
4638 include_once
'Services/User/classes/class.ilUserFilter.php';
4642 $where[] =
'expires > ' .
$ilDB->quote($ctime,
'integer');
4643 $where[] =
'(p.value IS NULL OR NOT p.value = ' .
$ilDB->quote(
'y',
'text') .
')';
4645 $where =
'WHERE ' . implode(
' AND ', $where);
4649 SELECT COUNT(user_id) num, user_id, firstname, lastname, title, login, last_login, MAX(ctime) ctime, context, agree_date
4651 LEFT JOIN usr_data u
4652 ON user_id = u.usr_id
4653 LEFT JOIN usr_pref p
4654 ON (p.usr_id = u.usr_id AND p.keyword = %s)
4656 GROUP BY user_id, firstname, lastname, title, login, last_login, context, agree_date
4657 ORDER BY lastname, firstname
4660 array(
'hide_own_online_status')
4663 $log->debug(
"Query: " . $q);
4666 while ($user =
$ilDB->fetchAssoc($r)) {
4667 if ($atime <= 0 || $user[
'ctime'] + $atime > $ctime) {
4668 $users[$user[
'user_id']] = $user;
4672 $log->debug(
"Found users: " . count($users));
4674 require_once
'Services/TermsOfService/classes/class.ilTermsOfServiceHelper.php';
4676 $users = array_filter($users,
function ($user) {
4677 if ($user[
'agree_date'] || $user[
'user_id'] ==
SYSTEM_USER_ID ||
'root' === $user[
'login']) {
4684 $log->debug(
"TOS filtered to users: " . count($users));
4705 $hashcode = substr(md5(uniqid(rand(),
true)), 0, 16);
4709 SELECT COUNT(usr_id) cnt FROM usr_data
4710 WHERE reg_hash = %s',
4715 if ($row->cnt > 0) {
4730 array(
'text',
'integer'),
4731 array($hashcode, (
int) $a_usr_id)
4756 SELECT usr_id, create_date FROM usr_data
4757 WHERE reg_hash = %s',
4761 while ($row =
$ilDB->fetchAssoc(
$res)) {
4762 require_once
'Services/Registration/classes/class.ilRegistrationSettings.php';
4765 if ((
int) $oRegSettigs->getRegistrationHashLifetime() != 0 &&
4766 time() - (
int) $oRegSettigs->getRegistrationHashLifetime() > strtotime($row[
'create_date'])) {
4767 require_once
'Services/Registration/exceptions/class.ilRegConfirmationLinkExpiredException.php';
4776 array(
'text',
'integer'),
4777 array(
'', (
int) $row[
'usr_id'])
4780 return (
int) $row[
'usr_id'];
4783 require_once
'Services/Registration/exceptions/class.ilRegistrationHashNotFoundException.php';
4789 if (strlen($a_birthday)) {
4793 $this->birthday =
null;
4813 if (!is_numeric($periodInDays) && $periodInDays < 1) {
4814 throw new \ilException(
'Invalid period given');
4817 $date = date(
'Y-m-d H:i:s', (time() - ((
int) $periodInDays * 24 * 60 * 60)));
4819 $query =
"SELECT usr_id FROM usr_data WHERE last_login IS NOT NULL AND last_login < %s";
4823 $types = [
'timestamp'];
4827 while ($row =
$DIC->database()->fetchAssoc(
$res)) {
4828 $ids[] = $row[
'usr_id'];
4843 $date = date(
'Y-m-d H:i:s', (time() - ((
int) $thresholdInDays * 24 * 60 * 60)));
4845 $query =
"SELECT usr_id FROM usr_data WHERE last_login IS NULL AND create_date < %s";
4849 $types = [
'timestamp'];
4853 while ($row =
$DIC->database()->fetchAssoc(
$res)) {
4854 $ids[] = $row[
'usr_id'];
4871 $field =
'inactivation_date';
4874 if (!(
int) $period) {
4882 $date = date(
'Y-m-d H:i:s', (time() - ((
int) $period * 24 * 60 * 60)));
4884 $query =
"SELECT usr_id FROM usr_data WHERE $field < %s AND active = %s";
4886 $res =
$ilDB->queryF(
$query, array(
'timestamp',
'integer'), array($date, 0));
4890 $ids[] = $row->usr_id;
4907 if ($a_last_login !==
null) {
4908 $last_login = $a_last_login;
4910 $last_login = date(
'Y-m-d H:i:s');
4917 $query =
"UPDATE usr_data SET last_login = %s WHERE usr_id = %s";
4918 $affected =
$ilDB->manipulateF(
$query, array(
'timestamp',
'integer'), array($last_login, $a_usr_id));
4920 $query =
"UPDATE usr_data SET first_login = %s WHERE usr_id = %s AND first_login IS NULL";
4921 $ilDB->manipulateF(
$query, array(
'timestamp',
'integer'), array($last_login, $a_usr_id));
4937 $query =
"UPDATE object_data SET owner = 0 " .
4938 "WHERE owner = " .
$ilDB->quote($this->
getId(),
'integer');
4957 $q =
"SELECT DISTINCT " .
$ilDB->upper(
$ilDB->substr(
"lastname", 1, 1)) .
" let" .
4960 ($user_ids !==
null ?
" AND " .
$ilDB->in(
'usr_id', $user_ids,
false,
"integer") :
"") .
4962 $let_set =
$ilDB->query($q);
4965 while ($let_rec =
$ilDB->fetchAssoc($let_set)) {
4966 $let[$let_rec[
"let"]] = $let_rec[
"let"];
4978 $query =
'SELECT count(*) num FROM object_data od ' .
4979 'JOIN usr_data ud ON obj_id = usr_id ' .
4980 'WHERE ' .
$ilDB->in(
'obj_id', $a_usr_ids,
false,
'integer') .
' ';
4983 return $num_rows == count((array) $a_usr_ids);
4992 return (
boolean)
$_SESSION[
"user_captcha_verified"];
5002 $_SESSION[
"user_captcha_verified"] = $a_val;
5013 include_once(
"./Services/Export/classes/class.ilExport.php");
5036 include_once(
"./Services/Export/classes/class.ilExport.php");
5038 if (!is_dir($dir)) {
5042 if (is_int(strpos($entry[
"entry"],
".zip"))) {
5043 return $entry[
"entry"];
5058 include_once(
"./Services/Export/classes/class.ilExport.php");
5061 if (is_file($file)) {
5079 include_once(
"./Services/Export/classes/class.ilImport.php");
5082 $imp->addSkipImporter(
"Services/Bookmarks");
5083 if (!$a_profile_data) {
5084 $imp->addSkipEntity(
"Services/User",
"usr_profile");
5087 $imp->addSkipEntity(
"Services/User",
"usr_setting");
5090 $imp->addSkipEntity(
"Services/Notes",
"user_notes");
5093 $imp->addSkipEntity(
"Services/Calendar",
"calendar");
5096 $a_file[
"tmp_name"],
5114 $NOW =
$ilDB->now();
5116 $usrId_IN_usrIds =
$ilDB->in(
'usr_id', $usrIds,
false,
'integer');
5120 SET inactivation_date = $NOW
5121 WHERE inactivation_date IS NULL
5122 AND $usrId_IN_usrIds
5125 $ilDB->manipulate($queryString);
5139 $usrId_IN_usrIds =
$ilDB->in(
'usr_id', $usrIds,
false,
'integer');
5143 SET inactivation_date = NULL
5144 WHERE $usrId_IN_usrIds
5147 $ilDB->manipulate($queryString);
5175 require_once
'Services/TermsOfService/classes/class.ilTermsOfServiceHelper.php';
5179 null == $this->agree_date &&
5180 'root' != $this->
login &&
5202 $date_is = ($a_agreed)
5206 $users = (is_array($a_users))
5207 ?
" AND " .
$ilDB->in(
"usr_id", $a_users,
false,
"integer")
5210 $set =
$ilDB->query(
"SELECT usr_id FROM usr_data " .
5211 " WHERE agree_date " . $date_is .
5214 while ($rec =
$ilDB->fetchAssoc($set)) {
5215 $ret[] = $rec[
"usr_id"];
5227 if (
null === $status) {
5231 require_once
'Services/TermsOfService/classes/class.ilTermsOfServiceHelper.php';
5266 return (
bool) $this->
getPref(
"delete_flag");
5274 $this->is_self_registered = (bool) $status;
5294 $this->interests_general = $value;
5324 $this->interests_help_offered = $value;
5354 $this->interests_help_looking = $value;
5385 $current = $this->$a_attr;
5386 if (is_array($current) &&
sizeof($current)) {
5387 return implode(
", ", $current);
5400 if (!$this->
getId()) {
5404 $set =
$ilDB->query(
"SELECT field_id,value" .
5405 " FROM usr_data_multi" .
5406 " WHERE usr_id = " .
$ilDB->quote($this->getId(),
"integer") .
5408 while ($row =
$ilDB->fetchAssoc($set)) {
5409 $values[$row[
"field_id"]][] = $row[
"value"];
5412 if (isset($values[
"interests_general"])) {
5417 if (isset($values[
"interests_help_offered"])) {
5422 if (isset($values[
"interests_help_looking"])) {
5440 if (!$this->
getId()) {
5454 foreach ($map as
$id => $values) {
5455 if (is_array($values) &&
sizeof($values)) {
5456 foreach ($values as $value) {
5457 $value = trim($value);
5459 $uniq_id =
$ilDB->nextId(
'usr_data_multi');
5461 $ilDB->manipulate(
"INSERT usr_data_multi" .
5462 " (id,usr_id,field_id,value) VALUES" .
5463 " (" .
$ilDB->quote($uniq_id,
"integer") .
5464 "," .
$ilDB->quote($this->getId(),
"integer") .
5466 "," .
$ilDB->quote($value,
"text") .
5483 if (!$this->
getId()) {
5487 $ilDB->manipulate(
"DELETE FROM usr_data_multi" .
5488 " WHERE usr_id = " .
$ilDB->quote($this->getId(),
"integer"));
5491 public static function findInterests($a_term, $a_user_id =
null, $a_field_id =
null)
5499 $sql =
"SELECT DISTINCT(value)" .
5500 " FROM usr_data_multi" .
5501 " WHERE " .
$ilDB->like(
"value",
"text",
"%" . $a_term .
"%");
5503 $sql .=
" AND field_id = " .
$ilDB->quote($a_field_id,
"text");
5506 $sql .=
" AND usr_id <> " .
$ilDB->quote($a_user_id,
"integer");
5508 $sql .=
" ORDER BY value";
5509 $set =
$ilDB->query($sql);
5510 while ($row =
$ilDB->fetchAssoc($set)) {
5511 $res[] = $row[
"value"];
5532 $set =
$ilDB->query(
5533 "SELECT * FROM usr_pref " .
5534 " WHERE keyword = " .
$ilDB->quote(
"public_profile",
"text") .
5535 " AND " .
$ilDB->in(
"usr_id", $a_user_ids,
false,
"integer")
5538 "global" => array(),
5540 "public" => array(),
5541 "not_public" => array()
5543 while ($rec =
$ilDB->fetchAssoc($set)) {
5544 if ($rec[
"value"] ==
"g") {
5545 $r[
"global"][] = $rec[
"usr_id"];
5546 $r[
"public"][] = $rec[
"usr_id"];
5548 if ($rec[
"value"] ==
"y") {
5549 $r[
"local"][] = $rec[
"usr_id"];
5550 $r[
"public"][] = $rec[
"usr_id"];
5553 foreach ($a_user_ids as
$id) {
5554 if (!in_array(
$id, $r[
"public"])) {
5555 $r[
"not_public"][] =
$id;
if(!defined('PATH_SEPARATOR')) $GLOBALS['_PEAR_default_error_mode']
foreach($mandatory_scripts as $file) $timestamp
An exception for terminatinating execution or to throw for unit testing.
return true
Flag indicating whether or not HTTP headers will be sent when outputting captcha image/audio.
static _getAuthMode($a_auth_mode, $a_db_handler='')
static _needsExternalAccountByAuthMode($a_auth_mode)
Check if chosen auth mode needs an external account entry.
static _getAuthModeName($a_auth_key)
static deleteByUserId($a_user_id)
static _deleteSettingsOfUser($a_user)
Delete block settings of user.
static _getInstance()
get singleton instance
static removeSingleUserFromTable($usr_id)
This is the super class of all custom blocks.
static _isActive()
Static getter.
static resetToDefaults()
reset to defaults
static formatDate(ilDateTime $date, $a_skip_day=false, $a_include_wd=false, $include_seconds=false)
Format a date @access public.
static setLanguage($a_lng)
set language
static setUseRelativeDates($a_status)
set use relative dates
static formatPeriod(ilDateTime $start, ilDateTime $end, $a_skip_starting_day=false)
Format a period of two date Shows: 14.
@classDescription Date and time handling
static _deleteByUser($a_usr_id)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
static _getExportDirectory($a_obj_id, $a_type="xml", $a_obj_type="", $a_entity="")
Get export directory for an repository object.
static _getInstance()
Get singleton instance of this class.
static _deleteUser($a_usr_id)
static getLogger($a_component_id)
Get component logger.
Class ilMailOptions this class handles user mails.
Mail Box class Base class for creating and handling mail boxes.
static lookupTitle($a_page_id)
Lookup title.
static removeForUser($user_id)
Remove all notifications for given user.
static _deleteUser($a_usr_id)
static _deleteUser($a_usr_id)
static deleteUserPortfolios($a_user_id)
Delete all portfolio data for user.
static _removeTrackingDataForUser($user_id)
static _deleteUser($a_usr_id)
updateMultiTextFields($a_create=false)
Write multi-text values to DB.
setCity($a_str)
set city @access public
static _resetLoginAttempts($a_usr_id)
updateLogin($a_login)
update login name
getPasswdType()
get password type
static lookupMatriculation($a_usr_id)
Lookup matriculation.
getPhoneHome()
get home phone @access public
deleteMultiTextFields()
Remove multi-text values from DB.
static _lookupFirstLogin($a_user_id)
lookup first login
static getUserIdsNeverLoggedIn(int $thresholdInDays)
Get ids of all users that have never logged in.
static _writeExternalAccount($a_usr_id, $a_ext_id)
setCurrentLanguage($a_val)
Set current language.
static _getUsersForIds($a_mem_ids, $active=-1, $timelimitowner=-1)
return user data for given user id
setUTitle($a_str)
set user title (note: don't mix up this method with setTitle() that is derived from ilObject and sets...
static copyProfilePicturesToDirectory($a_user_id, $a_dir)
Get profile picture direcotory.
setInactivationDate($inactivation_date)
setter for inactivation date
static _getUsersForRole($role_id, $active=-1)
return array of complete users which belong to a specific role
readMultiTextFields()
Fetch multi-text values from DB.
static _lookupPref($a_usr_id, $a_keyword)
static _getLastHistoryDataByUserId($a_usr_id)
Returns the last used loginname and the changedate of the passed user_id.
setSecondEmail($second_email)
addToPCClipboard($a_content, $a_time, $a_nr)
Add a page content item to PC clipboard (should go to another class)
getAgreeDate()
get the date when the user accepted the user agreement @access public
static _verifyRegistrationHash($a_hash)
Verifies a registration hash.
static _getImportedUserId($i2_id)
getLatitude()
Get Latitude.
setLocationZoom($a_locationzoom)
Set Location Zoom.
static _lookupEmail($a_user_id)
Lookup email.
getLookingForHelpAsText()
Get help looking for as plain text.
getOfferingHelpAsText()
Get help offering as plain text.
setLanguage($a_str)
set user language @access public
setClientIP($a_str)
set client ip number @access public
getPhoneOffice()
get office phone @access public
setLatitude($a_latitude)
Set Latitude.
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 _getUserData($a_internalids)
return user data for given user ids
setInstitution($a_str)
set institution @access public
hasToAcceptTermsOfService()
setLastUpdate($a_str)
set last update of user data set @access public
getClipboardObjects($a_type="", $a_top_nodes_only=false)
get all clipboard objects of user and specified type
static initInactivationDate($usrIds)
@global type $ilDB
getActive()
get user active state @access public
static $personal_image_cache
sendPersonalDataFile()
Send personal data file.
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.
setAgreeDate($a_str)
set date the user account was accepted by the user nullindicates that the user has not accepted his a...
static _getAllUserData($a_fields=null, $active=-1)
STATIC METHOD get all user data.
setFirstname($a_str)
set firstname @access public
getGeneralInterests()
Get general interests.
static _lookupFields($a_user_id)
lookup fields (deprecated; use more specific methods instead)
$login
all user related data in single vars @access public
static _lookupLogin($a_user_id)
lookup login
setDepartment($a_str)
set department @access public
getCountry()
Get country (free text)
static _lookupSecondEmail($a_user_id)
Lookup second e-mail.
static _checkExternalAuthAccount($a_auth, $a_account, $tryFallback=true)
check whether external account and authentication method matches with a user
deletePref($a_keyword)
Deletes a userpref value of the user from the database @access public.
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.
writeAccepted()
write accept date of user agreement to db
getTimeZone()
get timezone of user
getFax()
get fax @access public
static getLoginFromAuth()
Gets the username from $ilAuth, and converts it into an ILIAS login name.
static getUserIdByLogin($a_login)
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
getLastname()
get lastname @access public
removeUserPicture($a_do_update=true)
Remove user picture.
static getUserIdsByEmail($a_email)
STATIC METHOD get all user_ids of an email address.
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.
setLookingForHelp(array $value=null)
Set help looking for.
static lookupOrgUnitsRepresentation($a_usr_id)
lokup org unit representation
static _writeAuthMode($a_usr_id, $a_auth_mode)
static _getPersonalPicturePath( $a_usr_id, $a_size="small", $a_force_pic=false, $a_prevent_no_photo_image=false, $html_export=false)
Get path to personal picture.
getMatriculation()
get matriculation number @access public
setPasswordEncodingType($password_encryption_type)
static resetInactivationDate($usrIds)
@global type $ilDB
resetLastPasswordChange()
buildTextFromArray($a_attr)
Convert multi-text values to plain text.
static findInterests($a_term, $a_user_id=null, $a_field_id=null)
setExternalAccount($a_str)
set external account
setLogin($a_str)
set login / username @access public
static userExists($a_usr_ids=array())
getFirstLogin()
returns first login date
static _getPreferences($user_id)
get preferences for user
clipboardDeleteAll()
Delete objects of type for user.
setTimeLimitFrom($a_from)
readPrefs()
get all user preferences @access private
static _writePref($a_usr_id, $a_keyword, $a_value)
static _incrementLoginAttempts($a_usr_id)
hasPublicProfile()
returns true if public is profile, false otherwise
static _lookupFeedHash($a_user_id, $a_create=false)
Lookup news feed hash for user.
static _uploadPersonalPicture($tmp_file, $obj_id)
Create a personal picture image file from a temporary image file.
getDateFormat()
get date format
setSkin($a_str)
set user skin (template set) @access public
getHobby()
get hobby @access public
static _getUsersForFolder($ref_id, $active)
get users for a category or from system folder
getCurrentLanguage()
returns the current language (may differ from user's pref setting!)
setSelectedCountry($a_val)
Set selected country (selection drop down)
getLongitude()
Get Longitude.
getEmail()
get email address @access public
getLoginByUserId($a_userid)
setCaptchaVerified($a_val)
Set captcha verified.
clipboardDeleteObjectsOfType($a_type)
Delete objects of type for user.
importPersonalData( $a_file, $a_profile_data, $a_settings, $a_notes, $a_calendar)
Import personal data.
static _lookupExternalAccount($a_user_id)
lookup external account for login and authmethod
setCountry($a_str)
Set country (free text)
setTimeLimitMessage($a_time_limit_message)
setPasswd($a_str, $a_type=IL_PASSWD_PLAIN)
set password @access public
static _lookupId($a_user_str)
Lookup id by login.
isPasswordChangeDemanded()
read()
loads a record "user" from database @access private
getLocationZoom()
Get Location Zoom.
getAuthMode($a_auth_key=false)
get auth mode @access public
setPasswordPolicyResetStatus(bool $status)
static _getAllUserAssignedStyles()
skins and styles
static _deleteAllPref($a_user_id)
Deletes a userpref value of the user from the database @access public.
static _getAvatar($a_usr_id)
setComment($a_str)
set referral comment @access public
getComment()
get referral comment @access public
static getUsersAgreed($a_agreed=true, $a_users=null)
Get users that have or have not agreed to the user agreement.
getTimeFormat()
get time format
getPersonalDataExportFile()
Get personal data export file.
setAuthMode($a_str)
set auth mode @access public
setPhoneHome($a_str)
set home phone @access public
static _lookupGender($a_user_id)
Lookup gender.
setPasswordSalt($password_salt)
setFirstLogin($a_str)
set user's first login
setFax($a_str)
set fax @access public
setTimeLimitUntil($a_until)
static _lookupName($a_user_id)
lookup user name
static _getNumberOfUsersPerAuthMode()
get number of users per auth mode
getStreet()
get street @access public
getPasswordPolicyResetStatus()
getClipboardChilds($a_parent, $a_insert_time)
Get childs of an item.
static _toggleActiveStatusOfUsers($a_usr_ids, $a_status)
Toggle active status of users.
getSelectedCountry()
Get selected country (selection drop down)
setTimeLimitOwner($a_owner)
getInstitution()
get institution @access public
getApproveDate()
get the date when the user account was approved @access public
getFirstname()
get firstname @access public
getZipcode()
get zipcode @access public
static _readUsersProfileData($a_user_ids)
STATIC METHOD get user data of selected users.
static _moveUsersToStyle($a_from_skin, $a_from_style, $a_to_skin, $a_to_style)
skins and styles
static _getUsersForClipboadObject($a_type, $a_id)
get all users, that have a certain object within their clipboard
setZipcode($a_str)
set zipcode @access public
setApproveDate($a_str)
set date the user account was activated null indicates that the user has not yet been activated @acce...
setLongitude($a_longitude)
Set Longitude.
getLogin()
get login / username @access public
getPref($a_keyword)
get a user preference
setFullname($a_title="", $a_firstname="", $a_lastname="")
builds a string with title + firstname + lastname method is used to build fullname in member variable...
setPref($a_keyword, $a_value)
set a user preference
getLastProfilePrompt()
returns user's last profile prompt
deleteUserDefinedFieldEntries()
setLastname($a_str)
set lastame @access public
hasToAcceptTermsOfServiceInSession($status=null)
static _getFeedPass($a_user_id)
Lookup news feed password for user.
setGeneralInterests(array $value=null)
Set general interests.
static _externalAccountExists($a_external_account, $a_auth_mode)
Check if an external account name already exists.
static _generateRegistrationHash($a_usr_id)
Generates a unique hashcode for activating a user profile after registration.
static _getUserIdsByInactivationPeriod($period)
get ids of all users that have been inactivated since at least the given period
static _setUserInactive($a_usr_id)
static _lookupFullname($a_user_id)
Lookup Full Name.
setOfferingHelp(array $value=null)
Set help offering.
static _lookupAuthMode($a_usr_id)
lookup auth mode
getStoredActive($a_id)
get user active state
setStreet($a_str)
set street @access public
setLastPasswordChangeTS($a_last_password_change_ts)
getLastLogin()
returns last login date @access public
static $is_desktop_item_loaded
setActive($a_active, $a_owner=0)
set user active state and updates system fields appropriately @access public
refreshLogin()
updates the login data of a "user" // TODO set date with now() should be enough @access public
setGender($a_str)
set gender @access public
static _getUsersForGroup($a_mem_ids, $active=-1)
return user data for group members
static _lookupLastLogin($a_user_id)
lookup last login
setProfileIncomplete($a_prof_inc)
static _setFeedPass($a_user_id, $a_password)
Set news feed password for user.
setTimeLimitUnlimited($a_unlimited)
static _doesLoginnameExistInHistory($a_login)
Checks wether the passed loginname already exists in history.
static _getLoginAttempts($a_usr_id)
getOrgUnitsRepresentation()
static getProfileStatusOfUsers($a_user_ids)
Get profile status.
getPhoneMobile()
get mobile phone @access public
getPublicName()
returns firstname lastname and login if profile is public, login otherwise
setEmail($a_str)
set email @access public
getFullname($a_max_strlen=0)
get fullname @access public
static _lookup($a_user_id, $a_field)
Private function for lookup methods.
clipboardHasObjectsOfType($a_type)
Check whether clipboard has objects of a certain type.
setIsSelfRegistered($status)
getCity()
get city @access public
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...
getLastPasswordChangeTS()
getLanguage()
returns a 2char-language-string @access public
__construct($a_user_id=0, $a_call_by_reference=false)
Constructor @access public.
setMatriculation($a_str)
set matriculation number @access public
static _writeHistory($a_usr_id, $a_login)
getOfferingHelp()
Get help offering.
addUserDefinedFieldEntry()
getPasswordEncodingType()
syncActive()
synchronizes current and stored user active values for the owner value to be set correctly,...
setLastLogin($a_str)
set user's last login @access public
writePrefs()
write all userprefs @access private
static _getLocalAccountsForEmail($a_email)
check whether external account and authentication method matches with a user
getInactivationDate()
getter for inactivation date
getDepartment()
get department @access public
setLastProfilePrompt($a_str)
set user's last profile prompt
assignData($a_data)
loads a record "user" from array @access public
setLastPasswordChangeToNow()
setHobby($a_str)
set hobby @access public
getLookingForHelp()
Get help looking for.
static _isAnonymous($usr_id)
static _lookupLanguage($a_usr_id)
getGeneralInterestsAsText()
Get general interests as plain text.
setPhoneOffice($a_str)
set office phone @access public
removeObjectFromClipboard($a_item_id, $a_type)
remove object from user's personal clipboard
getPCClipboardContent()
Add a page content item to PC clipboard (should go to another class)
exportPersonalData()
Export personal data.
setUserDefinedData($a_data)
static hasActiveSession($a_user_id, $a_session_id)
Check for simultaneous login.
setPhoneMobile($a_str)
set mobile phone @access public
static getUserLoginsByEmail($a_email)
get all user login names of an email address
static getUserIdsByInactivityPeriod(int $periodInDays)
Get ids of all users that have been inactive for at least the given period.
isCaptchaVerified()
Is user captcha verified?
setLoginAttempts($a_login_attempts)
getGender()
get gender @access public
getExternalAccount()
get external account
static getFirstLettersOfLastnames(?array $user_ids=null)
Get first letters of all lastnames.
static $is_desktop_item_cache
static _lookupClientIP($a_user_id)
Lookup client ip.
updateUserDefinedFields()
static toUsernameWithoutDomain($a_login)
Static function removes Microsoft domain name from username webdav related.
static _getNumberOfUsersForStyle($a_skin, $a_style)
skins and styles
writePref($a_keyword, $a_value)
write userpref to user table @access private
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...
static _lookupActive($a_usr_id)
Check user account active.
getClientIP()
get client ip number @access public
Class ilObject Basic functions for all objects.
setId($a_id)
set object id @access public
update()
update object in db
static _lookupTitle($a_id)
lookup object title
setOwner($a_owner)
set object owner
getId()
get object id @access public
static _lookupType($a_id, $a_reference=false)
lookup object type
getCreateDate()
get create date @access public
Custom block for external feeds on personal desktop.
static _exists($a_parent_type, $a_id, $a_lang="", $a_no_cache=false)
Checks whether page exists.
Class for user related exception handling in ILIAS.
Class for user related exception handling in ILIAS.
Class ilObjAuthSettingsGUI.
static _removeTrackingDataForUser($user_id)
static _getInstance()
Get instance of ilSecuritySettings.
static set($a_var, $a_val)
Set a value.
static _destroyByUserId($a_user_id)
Destroy session.
static get($a_var)
Get a value.
static skinExists($skin_id, ilSystemStyleConfig $system_style_config=null)
Check whether a skin exists.
static styleExistsForSkinId($skin_id, $style_id)
static styleExists($style_id)
static getInstance()
Singelton get instance.
Class ilUserAvatarResolver.
static deleteEntriesOfUser($a_user_id)
Delete data of user.
static _getInstance()
Get instance.
Class for user related exception handling in ILIAS.
static getInstance()
Singelton get instance.
static getInstance()
Single method to reduce footprint (included files, created instances)
static delDir($a_dir, $a_clean_only=false)
removes a dir and all its content (subdirs and files) recursively
static isConvertVersionAtLeast($a_version)
Compare convert version numbers.
static getWebspaceDir($mode="filesystem")
get webspace directory
static execConvert($args)
execute convert command
static getDir($a_dir, $a_rec=false, $a_sub_dir="")
get directory
static now()
Return current timestamp in Y-m-d H:i:s format.
static deliverFile( $a_file, $a_filename, $a_mime='', $isInline=false, $removeAfterDelivery=false, $a_exit_after=true)
deliver file for download via browser.
static stripSlashes($a_str, $a_strip_html=true, $a_allow="")
strip slashes if magic qoutes is enabled
static __extractId($ilias_id, $inst_id)
extract ref id from role title, e.g.
static signFile($path_to_file)
Tree handler for personal workspace.
const SYSTEM_USER_ID
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
for( $i=6;$i< 13;$i++) for($i=1; $i< 13; $i++) $d
This describes how a letter or a picture avatar could be modified during construction of UI.
__construct(Container $dic, ilPlugin $plugin)
@inheritDoc
redirection script todo: (a better solution should control the processing via a xml file)
foreach($_POST as $key=> $value) $res