00001 <?php
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 define ("IL_PASSWD_PLAIN", "plain");
00025 define ("IL_PASSWD_MD5", "md5");
00026 define ("IL_PASSWD_CRYPT", "crypt");
00027
00028
00029 require_once "classes/class.ilObject.php";
00030
00040 class ilObjUser extends ilObject
00041 {
00046
00047
00048 var $login;
00049
00050 var $passwd;
00051 var $passwd_type;
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068 var $gender;
00069 var $utitle;
00070 var $firstname;
00071 var $lastname;
00072 var $fullname;
00073
00074
00075 var $institution;
00076 var $department;
00077 var $street;
00078 var $city;
00079 var $zipcode;
00080 var $country;
00081 var $phone_office;
00082 var $phone_home;
00083 var $phone_mobile;
00084 var $fax;
00085 var $email;
00086 var $hobby;
00087 var $matriculation;
00088 var $referral_comment;
00089 var $approve_date;
00090 var $active;
00091 var $ilinc_id;
00092
00098 var $prefs;
00099
00105 var $skin;
00106
00107
00113 var $default_role;
00114
00120 var $ilias;
00121
00122
00128 function ilObjUser($a_user_id = 0, $a_call_by_reference = false)
00129 {
00130 global $ilias;
00131
00132
00133 $this->ilias =& $ilias;
00134
00135 $this->type = "usr";
00136 $this->ilObject($a_user_id, $a_call_by_reference);
00137 $this->passwd_type = IL_PASSWD_PLAIN;
00138
00139
00140
00141
00142
00143
00144
00145 if (!empty($a_user_id))
00146 {
00147 $this->setId($a_user_id);
00148 $this->read();
00149 }
00150 else
00151 {
00152
00153
00154 $this->prefs = array();
00155
00156 $this->prefs["language"] = $this->ilias->ini->readVariable("language","default");
00157
00158
00159 if (strpos($_SERVER["HTTP_USER_AGENT"],"Windows CE") > 0)
00160 {
00161 $this->skin = "pda";
00162 }
00163 else
00164 {
00165 $this->skin = $this->ilias->ini->readVariable("layout","skin");
00166 }
00167
00168 $this->prefs["skin"] = $this->skin;
00169 $this->prefs["show_users_online"] = "y";
00170
00171
00172 $this->prefs["style"] = $this->ilias->ini->readVariable("layout","style");
00173 }
00174 }
00175
00180 function read()
00181 {
00182 global $ilErr;
00183
00184
00185 $q = "SELECT * FROM usr_data ".
00186 "LEFT JOIN rbac_ua ON usr_data.usr_id=rbac_ua.usr_id ".
00187 "WHERE usr_data.usr_id='".$this->id."'";
00188 $r = $this->ilias->db->query($q);
00189
00190 if ($r->numRows() > 0)
00191 {
00192 $data = $r->fetchRow(DB_FETCHMODE_ASSOC);
00193
00194
00195
00196 if ($data["passwd"] == "" && $data["i2passwd"] != "")
00197 {
00198 $data["passwd_type"] = IL_PASSWD_CRYPT;
00199 $data["passwd"] = $data["i2passwd"];
00200 }
00201 else
00202 {
00203 $data["passwd_type"] = IL_PASSWD_MD5;
00204
00205 }
00206 unset($data["i2passw"]);
00207
00208
00209
00210 $this->assignData($data);
00211
00212
00213 $this->readPrefs();
00214
00215
00216 if ($this->prefs["language"] == "")
00217 {
00218 $this->prefs["language"] = $this->oldPrefs["language"];
00219 }
00220
00221
00222 if ($this->prefs["skin"] == "" || file_exists($this->ilias->tplPath."/".$this->prefs["skin"]) == false)
00223 {
00224 $this->prefs["skin"] = $this->oldPrefs["skin"];
00225 }
00226
00227
00228 if (strpos($_SERVER["HTTP_USER_AGENT"],"Windows CE") > 0)
00229 {
00230 $this->skin = "pda";
00231 }
00232 else
00233 {
00234 $this->skin = $this->prefs["skin"];
00235 }
00236
00237
00238 if ($this->prefs["style"] == "" || file_exists($this->ilias->tplPath."/".$this->skin."/".$this->prefs["style"].".css") == false)
00239 {
00240
00241 $this->prefs["style"] = $this->ilias->ini->readVariable("layout","style");
00242 }
00243
00244 if (empty($this->prefs["hits_per_page"]))
00245 {
00246 $this->prefs["hits_per_page"] = 10;
00247 }
00248
00249 }
00250 else
00251 {
00252 $ilErr->raiseError("<b>Error: There is no dataset with id ".$this->id."!</b><br />class: ".get_class($this)."<br />Script: ".__FILE__."<br />Line: ".__LINE__, $ilErr->FATAL);
00253 }
00254
00255 parent::read();
00256 }
00257
00263 function assignData($a_data)
00264 {
00265 global $ilErr;
00266
00267
00268 $this->setLogin($a_data["login"]);
00269 if (! $a_data["passwd_type"])
00270 {
00271 $ilErr->raiseError("<b>Error: passwd_type missing in function assignData(). ".
00272 $this->id."!</b><br />class: ".get_class($this)."<br />Script: "
00273 .__FILE__."<br />Line: ".__LINE__, $ilErr->FATAL);
00274 }
00275 if ($a_data["passwd"] != "********")
00276 {
00277 $this->setPasswd($a_data["passwd"], $a_data["passwd_type"]);
00278 }
00279 $this->setGender($a_data["gender"]);
00280 $this->setUTitle($a_data["title"]);
00281 $this->setFirstname($a_data["firstname"]);
00282 $this->setLastname($a_data["lastname"]);
00283 $this->setFullname();
00284
00285
00286 $this->setInstitution($a_data["institution"]);
00287 $this->setDepartment($a_data["department"]);
00288 $this->setStreet($a_data["street"]);
00289 $this->setCity($a_data["city"]);
00290 $this->setZipcode($a_data["zipcode"]);
00291 $this->setCountry($a_data["country"]);
00292 $this->setPhoneOffice($a_data["phone_office"]);
00293 $this->setPhoneHome($a_data["phone_home"]);
00294 $this->setPhoneMobile($a_data["phone_mobile"]);
00295 $this->setFax($a_data["fax"]);
00296 $this->setMatriculation($a_data["matriculation"]);
00297 $this->setEmail($a_data["email"]);
00298 $this->setHobby($a_data["hobby"]);
00299
00300
00301 $this->setLastLogin($a_data["last_login"]);
00302 $this->setLastUpdate($a_data["last_update"]);
00303 $this->create_date = $a_data["create_date"];
00304 $this->setComment($a_data["referral_comment"]);
00305 $this->approve_date = $a_data["approve_date"];
00306 $this->active = $a_data["active"];
00307 $this->accept_date = $a_data["agree_date"];
00308
00309
00310 $this->setTimeLimitOwner($a_data["time_limit_owner"]);
00311 $this->setTimeLimitUnlimited($a_data["time_limit_unlimited"]);
00312 $this->setTimeLimitFrom($a_data["time_limit_from"]);
00313 $this->setTimeLimitUntil($a_data["time_limit_until"]);
00314 $this->setTimeLimitMessage($a_data['time_limit_message']);
00315
00316
00317 $this->setiLincID($a_data['ilinc_id']);
00318 }
00319
00326 function saveAsNew($a_from_formular = true)
00327 {
00328 global $ilErr;
00329
00330 switch ($this->passwd_type)
00331 {
00332 case IL_PASSWD_PLAIN:
00333 $pw_field = "passwd";
00334 $pw_value = md5($this->passwd);
00335 break;
00336
00337 case IL_PASSWD_MD5:
00338 $pw_field = "passwd";
00339 $pw_value = $this->passwd;
00340 break;
00341
00342 case IL_PASSWD_CRYPT:
00343 $pw_field = "i2passwd";
00344 $pw_value = $this->passwd;
00345 break;
00346
00347 default :
00348 $ilErr->raiseError("<b>Error: passwd_type missing in function saveAsNew. ".$this->id."!</b><br />class: ".get_class($this)."<br />Script: ".__FILE__."<br />Line: ".__LINE__, $ilErr->FATAL);
00349 }
00350
00351 if ($a_from_formular)
00352 {
00353 $q = "INSERT INTO usr_data "
00354 . "(usr_id,login,".$pw_field.",firstname,lastname,title,gender,"
00355 . "email,hobby,institution,department,street,city,zipcode,country,"
00356 . "phone_office,phone_home,phone_mobile,fax,last_login,last_update,create_date,"
00357 . "referral_comment,matriculation,approve_date,active,"
00358 . "time_limit_unlimited,time_limit_until,time_limit_from,time_limit_owner) "
00359 . "VALUES "
00360 . "('".$this->id."','".$this->login."','".$pw_value."', "
00361 . "'".ilUtil::addSlashes($this->firstname)."','".ilUtil::addSlashes($this->lastname)."', "
00362 . "'".ilUtil::addSlashes($this->utitle)."','".ilUtil::addSlashes($this->gender)."', "
00363 . "'".ilUtil::addSlashes($this->email)."','".ilUtil::addSlashes($this->hobby)."', "
00364 . "'".ilUtil::addSlashes($this->institution)."','".ilUtil::addSlashes($this->department)."', "
00365 . "'".ilUtil::addSlashes($this->street)."', "
00366 . "'".ilUtil::addSlashes($this->city)."','".ilUtil::addSlashes($this->zipcode)."','".ilUtil::addSlashes($this->country)."', "
00367 . "'".ilUtil::addSlashes($this->phone_office)."','".ilUtil::addSlashes($this->phone_home)."', "
00368 . "'".ilUtil::addSlashes($this->phone_mobile)."','".ilUtil::addSlashes($this->fax)."', 0, now(), now(), "
00369 . "'".ilUtil::addSlashes($this->referral_comment)."', '". ilUtil::addSlashes($this->matriculation) . "', '" .$this->approve_date."', '".$this->active."', "
00370 . "'".$this->getTimeLimitUnlimited()."','" . $this->getTimeLimitUntil()."','".$this->getTimeLimitFrom()."','".$this->getTimeLimitOwner()."'"
00371 . ")";
00372 }
00373 else
00374 {
00375 $q = "INSERT INTO usr_data ".
00376 "(usr_id,login,".$pw_field.",firstname,lastname,title,gender,"
00377 . "email,hobby,institution,department,street,city,zipcode,country,"
00378 . "phone_office,phone_home,phone_mobile,fax,last_login,last_update,create_date,"
00379 . "referral_comment,matriculation,approve_date,active,"
00380 . "time_limit_unlimited,time_limit_until,time_limit_from,time_limit_owner) "
00381 . "VALUES "
00382 . "('".$this->id."','".$this->login."','".$pw_value."', "
00383 . "'".ilUtil::prepareDBString($this->firstname)."','".ilUtil::prepareDBString($this->lastname)."', "
00384 . "'".ilUtil::prepareDBString($this->utitle)."','".ilUtil::prepareDBString($this->gender)."', "
00385 . "'".ilUtil::prepareDBString($this->email)."','".ilUtil::prepareDBString($this->hobby)."', "
00386 . "'".ilUtil::prepareDBString($this->institution)."','".ilUtil::prepareDBString($this->department)."', "
00387 . "'".ilUtil::prepareDBString($this->street)."', "
00388 . "'".ilUtil::prepareDBString($this->city)."','".ilUtil::prepareDBString($this->zipcode)."','".ilUtil::prepareDBString($this->country)."', "
00389 . "'".ilUtil::prepareDBString($this->phone_office)."','".ilUtil::prepareDBString($this->phone_home)."', "
00390 . "'".ilUtil::prepareDBString($this->phone_mobile)."','".ilUtil::prepareDBString($this->fax)."', 0, now(), now(), "
00391 . "'".ilUtil::prepareDBString($this->referral_comment)."', '".ilUtil::prepareDBString($this->matriculation)."', '".$this->approve_date."','".$this->active."', "
00392 . "'".$this->getTimeLimitUnlimited()."','".$this->getTimeLimitUntil()."','".$this->getTimeLimitFrom()."','".$this->getTimeLimitOwner()."'"
00393 . ")";
00394 }
00395
00396 $this->ilias->db->query($q);
00397
00398
00399 include_once ("classes/class.ilMailbox.php");
00400 $mbox = new ilMailbox($this->id);
00401 $mbox->createDefaultFolder();
00402
00403 include_once "classes/class.ilMailOptions.php";
00404 $mail_options = new ilMailOptions($this->id);
00405 $mail_options->createMailOptionsEntry();
00406
00407
00408 include_once "classes/class.ilBookmarkFolder.php";
00409 $bmf = new ilBookmarkFolder(0, $this->id);
00410 $bmf->createNewBookmarkTree();
00411
00412 }
00413
00418 function update()
00419 {
00420 global $ilErr;
00421
00422
00423
00424 $this->syncActive();
00425
00426 $pw_udpate = '';
00427 switch ($this->passwd_type)
00428 {
00429 case IL_PASSWD_PLAIN:
00430 $pw_update = "i2passwd='', passwd='".md5($this->passwd)."'";
00431 break;
00432
00433 case IL_PASSWD_MD5:
00434 $pw_update = "i2passwd='', passwd='".$this->passwd."'";
00435 break;
00436
00437 case IL_PASSWD_CRYPT:
00438 $pw_update = "passwd='', i2passwd='".$this->passwd."'";
00439 break;
00440
00441 default :
00442 $ilErr->raiseError("<b>Error: passwd_type missing in function update()".$this->id."!</b><br />class: ".get_class($this)."<br />Script: ".__FILE__."<br />Line: ".__LINE__, $ilErr->FATAL);
00443 }
00444 $q = "UPDATE usr_data SET ".
00445 "gender='".$this->gender."', ".
00446 "title='".ilUtil::prepareDBString($this->utitle)."', ".
00447 "firstname='".ilUtil::prepareDBString($this->firstname)."', ".
00448 "lastname='".ilUtil::prepareDBString($this->lastname)."', ".
00449 "email='".ilUtil::prepareDBString($this->email)."', ".
00450 "hobby='".ilUtil::prepareDBString($this->hobby)."', ".
00451 "institution='".ilUtil::prepareDBString($this->institution)."', ".
00452 "department='".ilUtil::prepareDBString($this->department)."', ".
00453 "street='".ilUtil::prepareDBString($this->street)."', ".
00454 "city='".ilUtil::prepareDBString($this->city)."', ".
00455 "zipcode='".ilUtil::prepareDBString($this->zipcode)."', ".
00456 "country='".ilUtil::prepareDBString($this->country)."', ".
00457 "phone_office='".ilUtil::prepareDBString($this->phone_office)."', ".
00458 "phone_home='".ilUtil::prepareDBString($this->phone_home)."', ".
00459 "phone_mobile='".ilUtil::prepareDBString($this->phone_mobile)."', ".
00460 "fax='".ilUtil::prepareDBString($this->fax)."', ".
00461 "referral_comment='".ilUtil::prepareDBString($this->referral_comment)."', ".
00462 "matriculation='".ilUtil::prepareDBString($this->matriculation)."', ".
00463 "approve_date='".ilUtil::prepareDBString($this->approve_date)."', ".
00464 "active='".ilUtil::prepareDBString($this->active)."', ".
00465 "time_limit_owner='".ilUtil::prepareDBString($this->getTimeLimitOwner())."', ".
00466 "time_limit_unlimited='".ilUtil::prepareDBString($this->getTimeLimitUnlimited())."', ".
00467 "time_limit_from='".ilUtil::prepareDBString($this->getTimeLimitFrom())."', ".
00468 "time_limit_until='".ilUtil::prepareDBString($this->getTimeLimitUntil())."', ".
00469 "time_limit_message='".$this->getTimeLimitMessage()."', ".
00470 $pw_update.", ".
00471 "last_update=now(), ".
00472 "ilinc_id='".ilUtil::prepareDBString($this->ilinc_id)."' ".
00473 "WHERE usr_id='".$this->id."'";
00474
00475 $this->ilias->db->query($q);
00476
00477 $this->writePrefs();
00478
00479 parent::update();
00480 parent::updateOwner();
00481
00482 $this->read();
00483
00484 return true;
00485 }
00486
00490 function writeAccepted()
00491 {
00492 global $ilDB;
00493
00494 $q = "UPDATE usr_data SET agree_date = now()".
00495 "WHERE usr_id = ".$ilDB->quote($this->getId());
00496 $ilDB->query($q);
00497
00498 }
00499
00503 function _lookupName($a_user_id)
00504 {
00505 global $ilDB;
00506
00507 $q = "SELECT firstname, lastname, title FROM usr_data".
00508 " WHERE usr_id =".$ilDB->quote($a_user_id);
00509 $user_set = $ilDB->query($q);
00510 $user_rec = $user_set->fetchRow(DB_FETCHMODE_ASSOC);
00511 return array("user_id" => $a_user_id,
00512 "firstname" => $user_rec["firstname"],
00513 "lastname" => $user_rec["lastname"],
00514 "title" => $user_rec["title"]);
00515 }
00516
00522 function refreshLogin()
00523 {
00524 $q = "UPDATE usr_data SET ".
00525 "last_login = now() ".
00526 "WHERE usr_id = '".$this->id."'";
00527
00528 $this->ilias->db->query($q);
00529 }
00530
00539 function updatePassword($a_old, $a_new1, $a_new2)
00540 {
00541 if (func_num_args() != 3)
00542 {
00543 return false;
00544 }
00545
00546 if (!isset($a_old) or !isset($a_new1) or !isset($a_new2))
00547 {
00548 return false;
00549 }
00550
00551 if ($a_new1 != $a_new2)
00552 {
00553 return false;
00554 }
00555
00556
00557 if ($a_new1 == "" || $a_old == "")
00558 {
00559 return false;
00560 }
00561
00562
00563 switch ($this->passwd_type)
00564 {
00565 case IL_PASSWD_PLAIN:
00566 if ($a_old != $this->passwd)
00567 {
00568 return false;
00569 }
00570 break;
00571
00572 case IL_PASSWD_MD5:
00573 if (md5($a_old) != $this->passwd)
00574 {
00575 return false;
00576 }
00577 break;
00578
00579 case IL_PASSWD_CRYPT:
00580 if (_makeIlias2Password($a_old) != $this->passwd)
00581 {
00582 return false;
00583 }
00584 break;
00585 }
00586
00587
00588 $this->passwd = md5($a_new1);
00589 $this->passwd_type = IL_PASSWD_MD5;
00590
00591 $q = "UPDATE usr_data SET ".
00592 "passwd='".$this->passwd."' ".
00593 "WHERE usr_id='".$this->id."'";
00594 $this->ilias->db->query($q);
00595
00596 return true;
00597 }
00598
00606 function resetPassword($a_new1, $a_new2)
00607 {
00608 if (func_num_args() != 2)
00609 {
00610 return false;
00611 }
00612
00613 if (!isset($a_new1) or !isset($a_new2))
00614 {
00615 return false;
00616 }
00617
00618 if ($a_new1 != $a_new2)
00619 {
00620 return false;
00621 }
00622
00623
00624 $this->passwd = md5($a_new1);
00625 $this->passwd_type = IL_PASSWD_MD5;
00626
00627 $q = "UPDATE usr_data SET ".
00628 "passwd='".$this->passwd."' ".
00629 "WHERE usr_id='".$this->id."'";
00630 $this->ilias->db->query($q);
00631
00632 return true;
00633 }
00634
00638 function _makeIlias2Password($a_passwd)
00639 {
00640 return (crypt($a_passwd,substr($a_passwd,0,2)));
00641 }
00642
00646 function _lookupHasIlias2Password($a_user_login)
00647 {
00648 global $ilias, $ilDB;
00649
00650 $q = "SELECT i2passwd FROM usr_data ".
00651 "WHERE login = ".$ilDB->quote($a_user_login)."";
00652 $user_set = $ilias->db->query($q);
00653
00654 if ($user_rec = $user_set->fetchRow(DB_FETCHMODE_ASSOC))
00655 {
00656 if ($user_rec["i2passwd"] != "")
00657 {
00658 return true;
00659 }
00660 }
00661
00662 return false;
00663 }
00664
00665 function _switchToIlias3Password($a_user, $a_pw)
00666 {
00667 global $ilias;
00668
00669 $q = "SELECT i2passwd FROM usr_data ".
00670 "WHERE login = '".$a_user."'";
00671 $user_set = $ilias->db->query($q);
00672
00673 if ($user_rec = $user_set->fetchRow(DB_FETCHMODE_ASSOC))
00674 {
00675 if ($user_rec["i2passwd"] == ilObjUser::_makeIlias2Password($a_pw))
00676 {
00677 $q = "UPDATE usr_data SET passwd='".md5($a_pw)."', i2passwd=''".
00678 "WHERE login = '".$a_user."'";
00679 $ilias->db->query($q);
00680 return true;
00681 }
00682 }
00683
00684 return false;
00685 }
00686
00693 function updateLogin($a_login)
00694 {
00695 if (func_num_args() != 1)
00696 {
00697 return false;
00698 }
00699
00700 if (!isset($a_login))
00701 {
00702 return false;
00703 }
00704
00705
00706 $this->login = $a_login;
00707
00708 $q = "UPDATE usr_data SET ".
00709 "login='".$this->login."' ".
00710 "WHERE usr_id='".$this->id."'";
00711 $this->ilias->db->query($q);
00712
00713 return true;
00714 }
00715
00722 function writePref($a_keyword, $a_value)
00723 {
00724 ilObjUser::_writePref($this->id, $a_keyword, $a_value);
00725 $this->setPref($a_keyword, $a_value);
00726 }
00727
00728
00729 function _writePref($a_usr_id, $a_keyword, $a_value)
00730 {
00731 global $ilDB;
00732
00733
00734 $q = "DELETE FROM usr_pref ".
00735 "WHERE usr_id='".$a_usr_id."' ".
00736 "AND keyword='".$a_keyword."'";
00737 $ilDB->query($q);
00738
00739
00740 if ($a_value != "")
00741 {
00742 $q = "INSERT INTO usr_pref ".
00743 "(usr_id, keyword, value) ".
00744 "VALUES ".
00745 "('".$a_usr_id."', '".$a_keyword."', '".$a_value."')";
00746
00747 $ilDB->query($q);
00748 }
00749 }
00750
00755 function writePrefs()
00756 {
00757
00758 $q = "DELETE FROM usr_pref ".
00759 "WHERE usr_id='".$this->id."'";
00760 $this->ilias->db->query($q);
00761
00762 foreach ($this->prefs as $keyword => $value)
00763 {
00764
00765 $q = "INSERT INTO usr_pref ".
00766 "(usr_id, keyword, value) ".
00767 "VALUES ".
00768 "('".$this->id."', '".$keyword."', '".$value."')";
00769 $this->ilias->db->query($q);
00770 }
00771 }
00772
00773
00774
00775
00776
00777
00778
00779
00780
00787 function setPref($a_keyword, $a_value)
00788 {
00789 if ($a_keyword != "")
00790 {
00791 $this->prefs[$a_keyword] = $a_value;
00792 }
00793 }
00794
00800 function getPref($a_keyword)
00801 {
00802 return $this->prefs[$a_keyword];
00803 }
00804
00810 function readPrefs()
00811 {
00812 if (is_array($this->prefs))
00813 {
00814 $this->oldPrefs = $this->prefs;
00815 }
00816
00817 $this->prefs = array();
00818
00819 $q = "SELECT * FROM usr_pref WHERE usr_id='".$this->id."'";
00820
00821 $r = $this->ilias->db->query($q);
00822
00823 while($row = $r->fetchRow(DB_FETCHMODE_ASSOC))
00824 {
00825 $this->prefs[$row["keyword"]] = $row["value"];
00826 }
00827
00828 return $r->numRows();
00829 }
00830
00831
00832
00833
00834
00835
00836
00837
00838
00844 function delete()
00845 {
00846 global $rbacadmin;
00847
00848
00849 include_once ("classes/class.ilMailbox.php");
00850 $mailbox = new ilMailbox($this->getId());
00851 $mailbox->delete();
00852 $mailbox->updateMailsOfDeletedUser();
00853
00854
00855 $this->ilias->db->query("DELETE FROM usr_data WHERE usr_id='".$this->getId()."'");
00856
00857
00858 $this->ilias->db->query("DELETE FROM usr_pref WHERE usr_id='".$this->getId()."'");
00859
00860
00861 $this->ilias->db->query("DELETE FROM usr_session WHERE user_id='".$this->getId()."'");
00862
00863
00864 $rbacadmin->removeUser($this->getId());
00865
00866
00867
00868 $q = "DELETE FROM bookmark_tree WHERE tree='".$this->getId()."'";
00869 $this->ilias->db->query($q);
00870
00871 $q = "DELETE FROM bookmark_data WHERE user_id='".$this->getId()."'";
00872 $this->ilias->db->query($q);
00873
00874
00875 include_once './classes/class.ilObjForum.php';
00876
00877 ilObjForum::_deleteUser($this->getId());
00878
00879
00880 include_once './classes/class.ilLinkCheckNotify.php';
00881
00882 ilLinkCheckNotify::_deleteUser($this->getId());
00883
00884
00885 include_once './course/classes/class.ilCourseObjectiveResult.php';
00886
00887 ilCourseObjectiveResult::_deleteAll($this->getId());
00888
00889
00890 parent::delete();
00891 return true;
00892 }
00893
00903 function setFullname($a_title = "",$a_firstname = "",$a_lastname = "")
00904 {
00905 $this->fullname = "";
00906
00907 if ($a_title)
00908 {
00909 $fullname = $a_title." ";
00910 }
00911 elseif ($this->utitle)
00912 {
00913 $this->fullname = $this->utitle." ";
00914 }
00915
00916 if ($a_firstname)
00917 {
00918 $fullname .= $a_firstname." ";
00919 }
00920 elseif ($this->firstname)
00921 {
00922 $this->fullname .= $this->firstname." ";
00923 }
00924
00925 if ($a_lastname)
00926 {
00927 return $fullname.$a_lastname;
00928 }
00929
00930 $this->fullname .= $this->lastname;
00931 }
00932
00937 function getFullname()
00938 {
00939 return ilUtil::stripSlashes($this->fullname);
00940 }
00941
00942
00948 function getLastVisitedLessons()
00949 {
00950
00951 $q = "SELECT * FROM lo_access ".
00952 "WHERE usr_id='".$this->id."' ".
00953 "ORDER BY timestamp DESC";
00954 $rst = $this->ilias->db->query($q);
00955
00956
00957 $result = array();
00958 while($record = $rst->fetchRow(DB_FETCHMODE_OBJECT))
00959 {
00960 $result[] = array(
00961 "timestamp" => $record->timestamp,
00962 "usr_id" => $record->usr_id,
00963 "lm_id" => $record->lm_id,
00964 "obj_id" => $record->obj_id,
00965 "lm_title" => $record->lm_title);
00966 }
00967 return $result;
00968 }
00969
00970
00976 function getLessons()
00977 {
00978
00979 $q = "SELECT * FROM lo_access ".
00980 "WHERE usr_id='".$this->id."' ";
00981 $rst = $this->ilias->db->query($q);
00982
00983
00984 $result = array();
00985 while($record = $rst->fetchRow(DB_FETCHMODE_OBJECT))
00986 {
00987 $result[] = array(
00988 "timestamp" => $record->timestamp,
00989 "usr_id" => $record->usr_id,
00990 "lm_id" => $record->lm_id,
00991 "obj_id" => $record->obj_id,
00992 "lm_title" => $record->lm_title);
00993 }
00994 return $result;
00995 }
00996
00997
01004 function getCourses()
01005 {
01006 global $lng;
01007
01008
01009 $courses = array();
01010
01011 $sql = "SELECT * FROM courses
01012 WHERE user_fk='".$this->id."'
01013 AND read=1";
01014 $courses[] = array(
01015 "id" => 1,
01016 "title" => "Course 1",
01017 "desc" => "description of course one",
01018 "content" => "This is Course One",
01019 "datetime" => date("Y-m-d")
01020 );
01021 return $courses;
01022 }
01023
01030 function getLiterature()
01031 {
01032
01033 $literature = array();
01034
01035 $sql = "SELECT * FROM literature";
01036
01037 $literature[] = array(
01038 "id" => 1,
01039 "url" => "http://www.gutenberg.de",
01040 "desc" => "project gutenberg",
01041 );
01042
01043 return $literature;
01044 }
01045
01049 function hasAcceptedUserAgreement()
01050 {
01051 if ($this->accept_date != "0000-00-00 00:00:00" || $this->login == "root")
01052 {
01053 return true;
01054 }
01055 return false;
01056 }
01057
01063 function setLogin($a_str)
01064 {
01065 $this->login = $a_str;
01066 }
01067
01072 function getLogin()
01073 {
01074 return $this->login;
01075 }
01076
01082 function setPasswd($a_str, $a_type = IL_PASSWD_PLAIN)
01083 {
01084 $this->passwd = $a_str;
01085 $this->passwd_type = $a_type;
01086 }
01087
01095 function getPasswd()
01096 {
01097 return $this->passwd;
01098 }
01105 function getPasswdType()
01106 {
01107 return $this->passwd_type;
01108 }
01109
01115 function setGender($a_str)
01116 {
01117 $this->gender = substr($a_str,-1);
01118 }
01119
01124 function getGender()
01125 {
01126 return $this->gender;
01127 }
01128
01136 function setUTitle($a_str)
01137 {
01138 $this->utitle = $a_str;
01139 }
01140
01147 function getUTitle()
01148 {
01149 return $this->utitle;
01150 }
01151
01157 function setFirstname($a_str)
01158 {
01159 $this->firstname = $a_str;
01160 }
01161
01166 function getFirstname()
01167 {
01168 return $this->firstname;
01169 }
01170
01176 function setLastname($a_str)
01177 {
01178 $this->lastname = $a_str;
01179 }
01180
01185 function getLastname()
01186 {
01187 return $this->lastname;
01188 }
01189
01195 function setInstitution($a_str)
01196 {
01197 $this->institution = $a_str;
01198 }
01199
01204 function getInstitution()
01205 {
01206 return $this->institution;
01207 }
01208
01214 function setDepartment($a_str)
01215 {
01216 $this->department = $a_str;
01217 }
01218
01223 function getDepartment()
01224 {
01225 return $this->department;
01226 }
01227
01233 function setStreet($a_str)
01234 {
01235 $this->street = $a_str;
01236 }
01237
01242 function getStreet()
01243 {
01244 return $this->street;
01245 }
01246
01252 function setCity($a_str)
01253 {
01254 $this->city = $a_str;
01255 }
01256
01261 function getCity()
01262 {
01263 return $this->city;
01264 }
01265
01271 function setZipcode($a_str)
01272 {
01273 $this->zipcode = $a_str;
01274 }
01275
01280 function getZipcode()
01281 {
01282 return $this->zipcode;
01283 }
01284
01290 function setCountry($a_str)
01291 {
01292 $this->country = $a_str;
01293 }
01294
01299 function getCountry()
01300 {
01301 return $this->country;
01302 }
01303
01309 function setPhoneOffice($a_str)
01310 {
01311 $this->phone_office = $a_str;
01312 }
01313
01318 function getPhoneOffice()
01319 {
01320 return $this->phone_office;
01321 }
01322
01328 function setPhoneHome($a_str)
01329 {
01330 $this->phone_home = $a_str;
01331 }
01332
01337 function getPhoneHome()
01338 {
01339 return $this->phone_home;
01340 }
01341
01347 function setPhoneMobile($a_str)
01348 {
01349 $this->phone_mobile = $a_str;
01350 }
01351
01356 function getPhoneMobile()
01357 {
01358 return $this->phone_mobile;
01359 }
01360
01366 function setFax($a_str)
01367 {
01368 $this->fax = $a_str;
01369 }
01370
01375 function getFax()
01376 {
01377 return $this->fax;
01378 }
01379
01385 function setMatriculation($a_str)
01386 {
01387 $this->matriculation = $a_str;
01388 }
01389
01394 function getMatriculation()
01395 {
01396 return $this->matriculation;
01397 }
01398
01404 function setEmail($a_str)
01405 {
01406 $this->email = $a_str;
01407 }
01408
01413 function getEmail()
01414 {
01415 return $this->email;
01416 }
01417
01423 function setHobby($a_str)
01424 {
01425 $this->hobby = $a_str;
01426 }
01427
01432 function getHobby()
01433 {
01434 return $this->hobby;
01435 }
01436
01442 function setLanguage($a_str)
01443 {
01444 $this->setPref("language",$a_str);
01445 unset($_SESSION['lang']);
01446 }
01447
01453 function getLanguage()
01454 {
01455 return $this->prefs["language"];
01456 }
01457
01462 function getCurrentLanguage()
01463 {
01464 return $_SESSION['lang'];
01465 }
01466
01472 function setLastLogin($a_str)
01473 {
01474 $this->last_login = $a_str;
01475 }
01476
01482 function getLastLogin()
01483 {
01484 return $this->last_login;
01485 }
01486
01492 function setLastUpdate($a_str)
01493 {
01494 $this->last_update = $a_str;
01495 }
01496 function getLastUpdate()
01497 {
01498 return $this->last_update;
01499 }
01500
01506 function setComment($a_str)
01507 {
01508 $this->referral_comment = $a_str;
01509 }
01510
01515 function getComment()
01516 {
01517 return $this->referral_comment;
01518 }
01519
01525 function setClientIP($a_ip)
01526 {
01527
01528 }
01529
01534 function getClientIP()
01535 {
01536
01537 return null;
01538 }
01539
01546 function setApproveDate($a_str)
01547 {
01548 $this->approve_date = $a_str;
01549 }
01550
01556 function getApproveDate()
01557 {
01558 return $this->approve_date;
01559 }
01560
01567 function setActive($a_active, $a_owner = 6)
01568 {
01569 if (empty($a_owner))
01570 {
01571 $a_owner = 0;
01572 }
01573
01574 if ($a_active)
01575 {
01576 $this->active = 1;
01577 $this->setApproveDate(date('Y-m-d H:i:s'));
01578 $this->setOwner($a_owner);
01579 }
01580 else
01581 {
01582 $this->active = 0;
01583 $this->setApproveDate('0000-00-00 00:00:00');
01584 $this->setOwner(0);
01585 }
01586 }
01587
01592 function getActive()
01593 {
01594 return $this->active;
01595 }
01596
01602 function syncActive()
01603 {
01604 $storedActive = 0;
01605 if ($this->getStoredActive($this->id))
01606 {
01607 $storedActive = 1;
01608 }
01609
01610 $currentActive = 0;
01611 if ($this->active)
01612 {
01613 $currentActive = 1;
01614 }
01615
01616 if ((!empty($storedActive) && empty($currentActive)) ||
01617 (empty($storedActive) && !empty($currentActive)))
01618 {
01619 $this->setActive($currentActive, $this->getUserIdByLogin($this->ilias->auth->getUsername()));
01620 }
01621 }
01622
01629 function getStoredActive($a_id)
01630 {
01631 global $ilias;
01632
01633 $query = "SELECT active FROM usr_data ".
01634 "WHERE usr_id = '".$a_id."'";
01635
01636 $row = $ilias->db->getRow($query,DB_FETCHMODE_OBJECT);
01637
01638 return $row->active ? true : false;
01639 }
01640
01646 function setSkin($a_str)
01647 {
01648
01649 $this->skin = $a_str;
01650 }
01651
01652 function setTimeLimitOwner($a_owner)
01653 {
01654 $this->time_limit_owner = $a_owner;
01655 }
01656 function getTimeLimitOwner()
01657 {
01658 return $this->time_limit_owner;
01659 }
01660 function setTimeLimitFrom($a_from)
01661 {
01662 $this->time_limit_from = $a_from;
01663 }
01664 function getTimeLimitFrom()
01665 {
01666 return $this->time_limit_from ? $this->time_limit_from : time();
01667 }
01668 function setTimeLimitUntil($a_until)
01669 {
01670 $this->time_limit_until = $a_until;
01671 }
01672 function getTimeLimitUntil()
01673 {
01674 return $this->time_limit_until ? $this->time_limit_until : time();
01675 }
01676 function setTimeLimitUnlimited($a_unlimited)
01677 {
01678 $this->time_limit_unlimited = $a_unlimited;
01679 }
01680 function getTimeLimitUnlimited()
01681 {
01682 return $this->time_limit_unlimited;
01683 }
01684 function setTimeLimitMessage($a_time_limit_message)
01685 {
01686 return $this->time_limit_message = $a_time_limit_message;
01687 }
01688 function getTimeLimitMessage()
01689 {
01690 return $this->time_limit_message;
01691 }
01692
01693
01694 function checkTimeLimit()
01695 {
01696 if($this->getTimeLimitUnlimited())
01697 {
01698 return true;
01699 }
01700 if($this->getTimeLimitFrom() < time() and $this->getTimeLimitUntil() > time())
01701 {
01702 return true;
01703 }
01704 return false;
01705 }
01706
01707 function &getAppliedUsers()
01708 {
01709 $this->applied_users = array();
01710 $this->__readAppliedUsers($this->getId());
01711
01712 return $this->applied_users ? $this->applied_users : array();
01713 }
01714
01715 function isChild($a_usr_id)
01716 {
01717 if($a_usr_id == $this->getId())
01718 {
01719 return true;
01720 }
01721
01722 $this->applied_users = array();
01723 $this->__readAppliedUsers($this->getId());
01724
01725 return in_array($a_usr_id,$this->applied_users);
01726 }
01727
01728 function __readAppliedUsers($a_parent_id)
01729 {
01730 $query = "SELECT usr_id FROM usr_data ".
01731 "WHERE time_limit_owner = '".$a_parent_id."'";
01732
01733 $res = $this->ilias->db->query($query);
01734 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
01735 {
01736 $this->applied_users[] = $row->usr_id;
01737
01738
01739 $this->__readAppliedUsers($row->usr_id);
01740 }
01741 return true;
01742 }
01743
01744
01745
01746
01747
01748 function checkUserId()
01749 {
01750 $r = $this->ilias->db->query("SELECT usr_id FROM usr_data WHERE login='".$this->ilias->auth->getUsername()."'");
01751
01752 if ($r->numRows() > 0)
01753 {
01754 $data = $r->fetchRow();
01755 $this->id = $data[0];
01756
01757 return $this->id;
01758 }
01759
01760 return false;
01761 }
01762
01763
01764
01765
01766
01767
01768 function isCurrentUserActive()
01769 {
01770 $r = $this->ilias->db->query("SELECT active FROM usr_data WHERE login='".$this->ilias->auth->getUsername()."'");
01771
01772 if ($r->numRows() > 0)
01773 {
01774 $data = $r->fetchRow();
01775 if (!empty($data[0]))
01776 {
01777 return true;
01778 }
01779 }
01780
01781 return false;
01782 }
01783
01784
01785
01786
01787
01788
01789
01790
01791
01792 function getUserIdByLogin($a_login)
01793 {
01794 global $ilias;
01795
01796 $query = "SELECT usr_id FROM usr_data ".
01797 "WHERE login = '".$a_login."'";
01798
01799 $row = $ilias->db->getRow($query,DB_FETCHMODE_OBJECT);
01800
01801 return $row->usr_id ? $row->usr_id : 0;
01802 }
01803
01812 function getUserIdByEmail($a_email)
01813 {
01814 $query = "SELECT usr_id FROM usr_data ".
01815 "WHERE email = '".$a_email."'";
01816
01817 $row = $this->ilias->db->getRow($query,DB_FETCHMODE_OBJECT);
01818 return $row->usr_id ? $row->usr_id : 0;
01819 }
01820
01821
01822
01823
01824
01825
01826
01827
01828
01829 function getLoginByUserId($a_userid)
01830 {
01831 global $ilias;
01832
01833 $query = "SELECT login FROM usr_data ".
01834 "WHERE usr_id = '".$a_userid."'";
01835
01836 $row = $ilias->db->getRow($query,DB_FETCHMODE_OBJECT);
01837
01838 return $row->login ? $row->login : false;
01839 }
01840
01848 function searchUsers($a_search_str)
01849 {
01850
01851 global $ilias;
01852
01853
01854
01855 if (strtolower(substr($a_search_str, 0, 5)) == "role:")
01856 {
01857 $query = "SELECT DISTINCT usr_data.usr_id,usr_data.login,usr_data.firstname,usr_data.lastname,usr_data.email ".
01858 "FROM object_data,rbac_ua,usr_data ".
01859 "WHERE object_data.title LIKE '%".substr($a_search_str,5)."%' and object_data.type = 'role' ".
01860 "and rbac_ua.rol_id = object_data.obj_id ".
01861 "and usr_data.usr_id = rbac_ua.usr_id ".
01862 "AND rbac_ua.usr_id != '".ANONYMOUS_USER_ID."'";
01863 }
01864 else
01865 {
01866 $query = "SELECT usr_id,login,firstname,lastname,email,active FROM usr_data ".
01867 "WHERE (login LIKE '%".$a_search_str."%' ".
01868 "OR firstname LIKE '%".$a_search_str."%' ".
01869 "OR lastname LIKE '%".$a_search_str."%' ".
01870 "OR email LIKE '%".$a_search_str."%') ".
01871 "AND usr_id != '".ANONYMOUS_USER_ID."'";
01872 }
01873
01874 $res = $ilias->db->query($query);
01875 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
01876 {
01877 $ids[] = array(
01878 "usr_id" => $row->usr_id,
01879 "login" => $row->login,
01880 "firstname" => $row->firstname,
01881 "lastname" => $row->lastname,
01882 "email" => $row->email,
01883 "active" => $row->active);
01884 }
01885
01886 return $ids ? $ids : array();
01887 }
01888
01896 function _search(&$a_search_obj)
01897 {
01898 global $ilBench;
01899
01900
01901
01902
01903
01904 $where_condition = $a_search_obj->getWhereCondition("like",array("login","firstname","lastname","title",
01905 "email","institution","street","city",
01906 "zipcode","country","phone_home","fax"));
01907 $in = $a_search_obj->getInStatement("usr_data.usr_id");
01908
01909 $query = "SELECT DISTINCT(usr_data.usr_id) FROM usr_data ".
01910 "LEFT JOIN usr_pref USING (usr_id) ".
01911 $where_condition." ".
01912 $in." ".
01913 "AND usr_data.usr_id != '".ANONYMOUS_USER_ID."' ";
01914 # "AND usr_pref.keyword = 'public_profile' ";
01915 # "AND usr_pref.value = 'y'";
01916
01917
01918 $ilBench->start("Search", "ilObjUser_search");
01919 $res = $a_search_obj->ilias->db->query($query);
01920 $ilBench->stop("Search", "ilObjUser_search");
01921
01922 $counter = 0;
01923
01924 while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
01925 {
01926 $result_data[$counter++]["id"] = $row->usr_id;
01927
01928
01929
01930 #$result_data[$counter]["link"] = "profile.php?user=".$row->usr_id;
01931 #$result_data[$counter++]["target"] = "";
01932 }
01933 return $result_data ? $result_data : array();
01934 }
01935
01945 function _getLinkToObject($a_id)
01946 {
01947 return array("profile.php?user=".$a_id,"");
01948 }
01949
01950
01951
01952
01953
01954
01955 function getGroupMemberships($a_user_id = "")
01956 {
01957 global $rbacreview, $tree;
01958
01959 if (strlen($a_user_id) > 0)
01960 {
01961 $user_id = $a_user_id;
01962 }
01963 else
01964 {
01965 $user_id = $this->getId();
01966 }
01967
01968 $grp_memberships = array();
01969
01970
01971 $roles = $rbacreview->assignedRoles($user_id);
01972
01973 foreach ($roles as $role)
01974 {
01975 $ass_rolefolders = $rbacreview->getFoldersAssignedToRole($role);
01976
01977 foreach ($ass_rolefolders as $role_folder)
01978 {
01979 $node = $tree->getParentNodeData($role_folder);
01980
01981 if ($node["type"] == "grp")
01982 {
01983 $group =& $this->ilias->obj_factory->getInstanceByRefId($node["child"]);
01984
01985 if ($group->isMember($user_id) == true && !in_array($group->getId(), $grp_memberships) )
01986 {
01987 array_push($grp_memberships, $group->getId());
01988 }
01989 }
01990
01991 unset($group);
01992 }
01993 }
01994
01995 return $grp_memberships;
01996 }
01997
01998
02007 function updateActiveRoles($a_user_id)
02008 {
02009 global $rbacreview, $ilDB;
02010
02011 if (!count($user_online = ilUtil::getUsersOnline($a_user_id)) == 1)
02012 {
02013 return false;
02014 }
02015
02016 $role_arr = $rbacreview->assignedRoles($a_user_id);
02017
02018 if ($_SESSION["AccountId"] == $a_user_id)
02019 {
02020 $_SESSION["RoleId"] = $role_arr;
02021 }
02022 else
02023 {
02024 $roles = "RoleId|".serialize($role_arr);
02025 $modified_data = preg_replace("/RoleId.*?;\}/",$roles,$user_online[$a_user_id]["data"]);
02026
02027 $q = "UPDATE usr_session SET data='".ilUtil::prepareDBString($modified_data)."' WHERE user_id = '".$a_user_id."'";
02028 $ilDB->query($q);
02029 }
02030
02031 return true;
02032 }
02033
02042 function _getAllUserLogins(&$ilias)
02043 {
02044 $query = "SELECT login FROM usr_data ";
02045
02046 $res = $ilias->db->query($query);
02047 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
02048 {
02049 $logins[] = $row->login;
02050 }
02051 return $logins ? $logins : array();
02052 }
02053
02062 function _getAllUserData($a_fields = NULL)
02063 {
02064 global $ilDB;
02065
02066 $result_arr = array();
02067
02068 if ($a_fields !== NULL and is_array($a_fields))
02069 {
02070 if (count($a_fields) == 0)
02071 {
02072 $select = "*";
02073 }
02074 else
02075 {
02076 if (($usr_id_field = array_search("usr_id",$a_fields)) !== false)
02077 unset($a_fields[$usr_id_field]);
02078
02079 $select = implode(",",$a_fields).",usr_data.usr_id";
02080 }
02081
02082 $q = "SELECT ".$select." FROM usr_data ";
02083 $r = $ilDB->query($q);
02084
02085 while ($row = $r->fetchRow(DB_FETCHMODE_ASSOC))
02086 {
02087 $result_arr[] = $row;
02088 }
02089 }
02090
02091 return $result_arr;
02092 }
02093
02097 function _getNumberOfUsersForStyle($a_skin, $a_style)
02098 {
02099 global $ilDB;
02100
02101 $q = "SELECT count(*) as cnt FROM usr_pref AS up1, usr_pref AS up2 ".
02102 " WHERE up1.keyword= ".$ilDB->quote("style")." AND up1.value= ".$ilDB->quote($a_style).
02103 " AND up2.keyword= ".$ilDB->quote("skin")." AND up2.value= ".$ilDB->quote($a_skin).
02104 " AND up1.usr_id = up2.usr_id ";
02105
02106 $cnt_set = $ilDB->query($q);
02107
02108 $cnt_rec = $cnt_set->fetchRow(DB_FETCHMODE_ASSOC);
02109
02110 return $cnt_rec["cnt"];
02111 }
02112
02116 function _moveUsersToStyle($a_from_skin, $a_from_style, $a_to_skin, $a_to_style)
02117 {
02118 global $ilDB;
02119
02120 $q = "SELECT up1.usr_id as usr_id FROM usr_pref AS up1, usr_pref AS up2 ".
02121 " WHERE up1.keyword= ".$ilDB->quote("style")." AND up1.value= ".$ilDB->quote($a_from_style).
02122 " AND up2.keyword= ".$ilDB->quote("skin")." AND up2.value= ".$ilDB->quote($a_from_skin).
02123 " AND up1.usr_id = up2.usr_id ";
02124
02125 $usr_set = $ilDB->query($q);
02126
02127 while ($usr_rec = $usr_set->fetchRow(DB_FETCHMODE_ASSOC))
02128 {
02129 ilObjUser::_writePref($usr_rec["usr_id"], "skin", $a_to_skin);
02130 ilObjUser::_writePref($usr_rec["usr_id"], "style", $a_to_style);
02131 }
02132 }
02133
02141 function addDesktopItem($a_item_id, $a_type, $a_par = "")
02142 {
02143 $q = "SELECT * FROM desktop_item WHERE ".
02144 "item_id = '$a_item_id' AND type = '$a_type' AND user_id = '".
02145 $this->getId()."'";
02146 $item_set = $this->ilias->db->query($q);
02147
02148
02149 if (!$d = $item_set->fetchRow())
02150 {
02151 $q = "INSERT INTO desktop_item (item_id, type, user_id, parameters) VALUES ".
02152 " ('$a_item_id','$a_type','".$this->getId()."' , '$a_par')";
02153 $this->ilias->db->query($q);
02154 }
02155 }
02156
02165 function setDesktopItemParameters($a_item_id, $a_type, $a_par)
02166 {
02167 $q = "UPDATE desktop_item SET parameters = '$a_par' ".
02168 " WHERE item_id = '$a_item_id' AND type = '$a_type' ".
02169 " AND user_id = '".$this->getId()."' ";
02170 $this->ilias->db->query($q);
02171 }
02172
02180 function dropDesktopItem($a_item_id, $a_type)
02181 {
02182 $q = "DELETE FROM desktop_item WHERE ".
02183 " item_id = '$a_item_id' AND".
02184 " type = '$a_type' AND".
02185 " user_id = '".$this->getId()."'";
02186 $this->ilias->db->query($q);
02187 }
02188
02196 function isDesktopItem($a_item_id, $a_type)
02197 {
02198 $q = "SELECT * FROM desktop_item WHERE ".
02199 "item_id = '$a_item_id' AND type = '$a_type' AND user_id = '".
02200 $this->getId()."'";
02201 $item_set = $this->ilias->db->query($q);
02202
02203 if ($d = $item_set->fetchRow())
02204 {
02205 return true;
02206 }
02207 else
02208 {
02209 return false;
02210 }
02211 }
02212
02220 function getDesktopItems($a_types)
02221 {
02222 global $ilUser, $rbacsystem;
02223
02224 if (!is_array($a_types))
02225 {
02226 $a_types = array($a_types);
02227 }
02228 $items = array();
02229 $foundsurveys = array();
02230 foreach($a_types as $a_type)
02231 {
02232 switch ($a_type)
02233 {
02234 case "lm":
02235 case "glo":
02236 case "tst":
02237 case "svy":
02238 case "dbk":
02239 case "sahs":
02240 case "htlm":
02241 case "mep":
02242 case "spl":
02243 case "qpl":
02244 $q = "SELECT obj.description, oref.ref_id, obj.title, parameters, oref.obj_id FROM desktop_item AS it, object_reference AS oref ".
02245 ", object_data AS obj WHERE ".
02246 "it.item_id = oref.ref_id AND ".
02247 "oref.obj_id = obj.obj_id AND ".
02248 "it.type = '$a_type' AND ".
02249 "it.user_id = '".$this->getId()."' ".
02250 "ORDER BY title";
02251 $item_set = $this->ilias->db->query($q);
02252 while ($item_rec = $item_set->fetchRow(DB_FETCHMODE_ASSOC))
02253 {
02254
02255 $skip = false;
02256 $continue_link = "";
02257 switch($a_type)
02258 {
02259 case "lm":
02260 case "dbk":
02261 include_once("content/classes/class.ilObjContentObject.php");
02262 if (!ilObjContentObject::_lookupOnline($item_rec["obj_id"]))
02263 {
02264 if (!$rbacsystem->checkAccess("write", $item_rec["ref_id"]))
02265 {
02266 $skip = true;
02267 }
02268 }
02269 break;
02270
02271 case "htlm":
02272 include_once("content/classes/class.ilObjFileBasedLM.php");
02273 if (!ilObjFileBasedLM::_lookupOnline($item_rec["obj_id"]))
02274 {
02275 if (!$rbacsystem->checkAccess("write", $item_rec["ref_id"]))
02276 {
02277 $skip = true;
02278 }
02279 }
02280 break;
02281
02282 case "sahs":
02283 include_once("content/classes/class.ilObjSAHSLearningModule.php");
02284 if (!ilObjSAHSLearningModule::_lookupOnline($item_rec["obj_id"]))
02285 {
02286 if (!$rbacsystem->checkAccess("write", $item_rec["ref_id"]))
02287 {
02288 $skip = true;
02289 }
02290 }
02291 break;
02292
02293 case "glo":
02294 include_once("content/classes/class.ilObjGlossary.php");
02295 if (!ilObjGlossary::_lookupOnline($item_rec["obj_id"]))
02296 {
02297 if (!$rbacsystem->checkAccess("write", $item_rec["ref_id"]))
02298 {
02299 $skip = true;
02300 }
02301 }
02302 break;
02303 }
02304
02305 if($a_type == "glo")
02306 {
02307 $link = "content/glossary_presentation.php?ref_id=".$item_rec["ref_id"].
02308 "&obj_id=".$item_rec["parameters"];
02309 $edit_link = "content/glossary_edit.php?ref_id=".$item_rec["ref_id"].
02310 "&obj_id=".$item_rec["parameters"];
02311 $target = "bottom";
02312 }
02313 elseif ($a_type == "sahs")
02314 {
02315 $link = "content/sahs_presentation.php?ref_id=".$item_rec["ref_id"].
02316 "&obj_id=".$item_rec["parameters"];
02317 $edit_link = "content/sahs_edit.php?ref_id=".$item_rec["ref_id"];
02318 $target = "ilContObj".$item_rec["obj_id"];
02319 }
02320 elseif ($a_type == "htlm")
02321 {
02322 $link = "content/fblm_presentation.php?ref_id=".$item_rec["ref_id"];
02323 $edit_link = "content/fblm_edit.php?ref_id=".$item_rec["ref_id"];
02324 $target = "ilContObj".$item_rec["obj_id"];
02325 }
02326 elseif ($a_type == "tst")
02327 {
02328 $link = "assessment/test.php?ref_id=".$item_rec["ref_id"]."&cmd=run";
02329 $target = "bottom";
02330 $whereclause .= sprintf("obj_fi = %s OR ", $this->ilias->db->quote($item_rec["obj_id"]));
02331 $edit_link = "";
02332 }
02333 elseif ($a_type == "svy")
02334 {
02335 $link = "survey/survey.php?ref_id=".$item_rec["ref_id"]."&cmd=run";
02336 $target = "bottom";
02337 $edit_link = "";
02338 array_push($foundsurveys, $item_rec["obj_id"]);
02339 }
02340 elseif ($a_type == "mep")
02341 {
02342 $link = "content/mep_edit.php?ref_id=".$item_rec["ref_id"];
02343 $target = "bottom";
02344 $edit_link = "";
02345 }
02346 elseif ($a_type == "qpl")
02347 {
02348 $link = "assessment/questionpool.php?ref_id=".$item_rec["ref_id"];
02349 $target = "bottom";
02350 $edit_link = "";
02351 }
02352 elseif ($a_type == "spl")
02353 {
02354 $link = "survey/questionpool.php?ref_id=".$item_rec["ref_id"];
02355 $target = "bottom";
02356 $edit_link = "";
02357 }
02358 else
02359 {
02360 if ($item_rec["parameters"] != "")
02361 {
02362 $continue_link = "content/lm_presentation.php?ref_id=".$item_rec["ref_id"].
02363 "&obj_id=".$item_rec["parameters"];
02364 }
02365 $link = "content/lm_presentation.php?ref_id=".$item_rec["ref_id"];
02366 $edit_link = "content/lm_edit.php?ref_id=".$item_rec["ref_id"];
02367 $target = "ilContObj".$item_rec["obj_id"];
02368 }
02369
02370 if (!$skip)
02371 {
02372 $items[$item_rec["title"].$a_type.$item_rec["ref_id"]] =
02373 array ("type" => $a_type, "id" => $item_rec["ref_id"], "title" => $item_rec["title"],
02374 "parameters" => $item_rec["parameters"], "description" => $item_rec["description"],
02375 "link" => $link, "target" => $target, "edit_link" => $edit_link,
02376 "continue_link" => $continue_link);
02377 }
02378 }
02379 break;
02380
02381 case "frm":
02382 include_once './classes/class.ilRepositoryExplorer.php';
02383
02384 $q = "SELECT obj.description, oref.ref_id, obj.title FROM desktop_item AS it, object_reference AS oref ".
02385 ", object_data AS obj WHERE ".
02386 "it.item_id = oref.ref_id AND ".
02387 "oref.obj_id = obj.obj_id AND ".
02388 "it.type = 'frm' AND ".
02389 "it.user_id = '".$this->getId()."' ".
02390 "ORDER BY title";
02391 $item_set = $this->ilias->db->query($q);
02392 while ($item_rec = $item_set->fetchRow(DB_FETCHMODE_ASSOC))
02393 {
02394 $items[$item_rec["title"].$a_type.$item_rec["ref_id"]] =
02395 array ("type" => $a_type, "id" => $item_rec["ref_id"], "title" => $item_rec["title"],
02396 "description" => $item_rec["description"],
02397 "link" => 'repository.php?ref_id='.$item_rec['ref_id'], "target" => "bottom");
02398
02399 if ($rbacsystem->checkAccess("write", $item_rec["ref_id"]))
02400 {
02401 $items[$item_rec["title"].$a_type.
02402 $item_rec["ref_id"]]["edit_link"] = 'repository.php?ref_id='.$item_rec['ref_id'].'&cmd=edit';
02403 }
02404 }
02405 break;
02406
02407 case "cat":
02408 case "fold":
02409 $q = "SELECT obj.description, oref.ref_id, obj.title FROM desktop_item AS it, object_reference AS oref ".
02410 ", object_data AS obj WHERE ".
02411 "it.item_id = oref.ref_id AND ".
02412 "oref.obj_id = obj.obj_id AND ".
02413 "it.type = '$a_type' AND ".
02414 "it.user_id = '".$this->getId()."' ".
02415 "ORDER BY title";
02416 $item_set = $this->ilias->db->query($q);
02417 while ($item_rec = $item_set->fetchRow(DB_FETCHMODE_ASSOC))
02418 {
02419 $items[$item_rec["title"].$a_type.$item_rec["ref_id"]] =
02420 array ("type" => $a_type, "id" => $item_rec["ref_id"], "title" => $item_rec["title"],
02421 "description" => $item_rec["description"],
02422 "link" => "repository.php?ref_id=".$item_rec["ref_id"], "target" => "bottom");
02423
02424 if ($rbacsystem->checkAccess("write", $item_rec["ref_id"]))
02425 {
02426 $items[$item_rec["title"].$a_type.$item_rec["ref_id"]]["edit_link"] = "repository.php?cmd=edit&ref_id=".$item_rec["ref_id"];
02427 }
02428 }
02429 break;
02430
02431 case "webr":
02432 $q = "SELECT obj.description, oref.ref_id, obj.title FROM desktop_item AS it, object_reference AS oref ".
02433 ", object_data AS obj WHERE ".
02434 "it.item_id = oref.ref_id AND ".
02435 "oref.obj_id = obj.obj_id AND ".
02436 "it.type = '$a_type' AND ".
02437 "it.user_id = '".$this->getId()."' ".
02438 "ORDER BY title";
02439 $item_set = $this->ilias->db->query($q);
02440 while ($item_rec = $item_set->fetchRow(DB_FETCHMODE_ASSOC))
02441 {
02442 $items[$item_rec["title"].$a_type.$item_rec["ref_id"]] =
02443 array ("type" => $a_type, "id" => $item_rec["ref_id"], "title" => $item_rec["title"],
02444 "description" => $item_rec["description"],
02445 "link" => "link/link_resources.php?ref_id=".$item_rec["ref_id"], "target" => "bottom");
02446
02447 if ($rbacsystem->checkAccess("write", $item_rec["ref_id"]))
02448 {
02449 $items[$item_rec["title"].$a_type.$item_rec["ref_id"]]["edit_link"] =
02450 "link/link_resources.php?cmd=edit&ref_id=".$item_rec["ref_id"];
02451 }
02452 }
02453 break;
02454 case "grp":
02455 $q = "SELECT obj.description, oref.ref_id, obj.title FROM desktop_item AS it, object_reference AS oref ".
02456 ", object_data AS obj WHERE ".
02457 "it.item_id = oref.ref_id AND ".
02458 "oref.obj_id = obj.obj_id AND ".
02459 "it.type = '$a_type' AND ".
02460 "it.user_id = '".$this->getId()."' ".
02461 "ORDER BY title";
02462 $item_set = $this->ilias->db->query($q);
02463 while ($item_rec = $item_set->fetchRow(DB_FETCHMODE_ASSOC))
02464 {
02465 $items[$item_rec["title"].$a_type.$item_rec["ref_id"]] =
02466 array ("type" => $a_type, "id" => $item_rec["ref_id"], "title" => $item_rec["title"],
02467 "description" => $item_rec["description"],
02468 "link" => "repository.php?ref_id=".$item_rec["ref_id"]."&cmdClass=ilobjgroupgui", "target" => "bottom");
02469
02470 if ($rbacsystem->checkAccess("write", $item_rec["ref_id"]))
02471 {
02472 $items[$item_rec["title"].$a_type.$item_rec["ref_id"]]["edit_link"] = "repository.php?cmdClass=ilobjgroupgui&cmd=edit&ref_id=".$item_rec["ref_id"];
02473 }
02474 }
02475 break;
02476 case "crs":
02477 $q = "SELECT obj.description, oref.ref_id, obj.title FROM desktop_item AS it, object_reference AS oref ".
02478 ", object_data AS obj WHERE ".
02479 "it.item_id = oref.ref_id AND ".
02480 "oref.obj_id = obj.obj_id AND ".
02481 "it.type = 'crs' AND ".
02482 "it.user_id = '".$this->getId()."' ".
02483 "ORDER BY title";
02484 $item_set = $this->ilias->db->query($q);
02485 while ($item_rec = $item_set->fetchRow(DB_FETCHMODE_ASSOC))
02486 {
02487 $items[$item_rec["title"].$a_type.$item_rec["ref_id"]] =
02488 array ("type" => $a_type, "id" => $item_rec["ref_id"], "title" => $item_rec["title"],
02489 "description" => $item_rec["description"],
02490 "link" => "repository.php?ref_id=".$item_rec["ref_id"]."&cmdClass=ilobjcoursegui", "target" => "bottom");
02491
02492 if ($rbacsystem->checkAccess("write", $item_rec["ref_id"]))
02493 {
02494 $items[$item_rec["title"].$a_type.$item_rec["ref_id"]]["edit_link"] =
02495 "repository.php?cmdClass=ilobjcoursegui&ref_id=".$item_rec["ref_id"];
02496 }
02497 }
02498 break;
02499 case "file":
02500 $q = "SELECT obj.description, oref.ref_id, obj.title FROM desktop_item AS it, object_reference AS oref ".
02501 ", object_data AS obj WHERE ".
02502 "it.item_id = oref.ref_id AND ".
02503 "oref.obj_id = obj.obj_id AND ".
02504 "it.type = 'file' AND ".
02505 "it.user_id = '".$this->getId()."' ".
02506 "ORDER BY title";
02507 $item_set = $this->ilias->db->query($q);
02508 while ($item_rec = $item_set->fetchRow(DB_FETCHMODE_ASSOC))
02509 {
02510 $items[$item_rec["title"].$a_type.$item_rec["ref_id"]] =
02511 array ("type" => $a_type, "id" => $item_rec["ref_id"], "title" => $item_rec["title"],
02512 "description" => $item_rec["description"],
02513 "link" => "repository.php?cmd=sendfile&ref_id=".$item_rec["ref_id"]);
02514
02515 if ($rbacsystem->checkAccess("write", $item_rec["ref_id"]))
02516 {
02517 $items[$item_rec["title"].$a_type.$item_rec["ref_id"]]["edit_link"] = "repository.php?cmd=edit&cmdClass=ilobjfilegui&ref_id=".$item_rec["ref_id"];
02518 }
02519 }
02520 break;
02521
02522 case "exc":
02523 $q = "SELECT obj.description, oref.ref_id, obj.title FROM desktop_item AS it, object_reference AS oref ".
02524 ", object_data AS obj WHERE ".
02525 "it.item_id = oref.ref_id AND ".
02526 "oref.obj_id = obj.obj_id AND ".
02527 "it.type = 'exc' AND ".
02528 "it.user_id = '".$this->getId()."' ".
02529 "ORDER BY title";
02530 $item_set = $this->ilias->db->query($q);
02531 while ($item_rec = $item_set->fetchRow(DB_FETCHMODE_ASSOC))
02532 {
02533 $items[$item_rec["title"].$a_type.$item_rec["ref_id"]] =
02534 array ("type" => $a_type, "id" => $item_rec["ref_id"], "title" => $item_rec["title"],
02535 "description" => $item_rec["description"],
02536 "link" => "exercise.php?cmd=view&ref_id=".$item_rec["ref_id"], "target" => "bottom");
02537
02538 if ($rbacsystem->checkAccess("write", $item_rec["ref_id"]))
02539 {
02540 $items[$item_rec["title"].$a_type.$item_rec["ref_id"]]["edit_link"] = "exercise.php?cmd=edit&ref_id=".$item_rec["ref_id"];
02541 }
02542 }
02543 break;
02544
02545
02546 case "chat":
02547 $q = "SELECT obj.description, oref.ref_id, obj.title FROM desktop_item AS it, object_reference AS oref ".
02548 ", object_data AS obj WHERE ".
02549 "it.item_id = oref.ref_id AND ".
02550 "oref.obj_id = obj.obj_id AND ".
02551 "it.type = 'chat' AND ".
02552 "it.user_id = '".$this->getId()."' ".
02553 "ORDER BY title";
02554 $item_set = $this->ilias->db->query($q);
02555 while ($item_rec = $item_set->fetchRow(DB_FETCHMODE_ASSOC))
02556 {
02557 $items[$item_rec["title"].$a_type.$item_rec["ref_id"]] =
02558 array ("type" => $a_type, "id" => $item_rec["ref_id"], "title" => $item_rec["title"],
02559 "description" => $item_rec["description"],
02560 "link" => "chat/chat_rep.php?ref_id=".$item_rec["ref_id"], "target" => "bottom");
02561
02562 if ($rbacsystem->checkAccess("write", $item_rec["ref_id"]))
02563 {
02564 $items[$item_rec["title"].$a_type.$item_rec["ref_id"]]["edit_link"] = "chat/chat_rep.php?cmd=edit&ref_id=".$item_rec["ref_id"];
02565 }
02566 }
02567 break;
02568 case "icrs":
02569 $q = "SELECT obj.description, oref.ref_id, obj.title FROM desktop_item AS it, object_reference AS oref ".
02570 ", object_data AS obj WHERE ".
02571 "it.item_id = oref.ref_id AND ".
02572 "oref.obj_id = obj.obj_id AND ".
02573 "it.type = 'icrs' AND ".
02574 "it.user_id = '".$this->getId()."' ".
02575 "ORDER BY title";
02576 $item_set = $this->ilias->db->query($q);
02577 while ($item_rec = $item_set->fetchRow(DB_FETCHMODE_ASSOC))
02578 {
02579 $items[$item_rec["title"].$a_type.$item_rec["ref_id"]] =
02580 array ("type" => $a_type, "id" => $item_rec["ref_id"], "title" => $item_rec["title"],
02581 "description" => $item_rec["description"],
02582 "link" => "repository.php?ref_id=".$item_rec["ref_id"]."&cmdClass=ilobjilinccoursegui", "target" => "bottom");
02583
02584 }
02585 break;
02586 case "icla":
02587 $q = "SELECT obj.description, oref.ref_id, obj.title FROM desktop_item AS it, object_reference AS oref ".
02588 ", object_data AS obj WHERE ".
02589 "it.item_id = oref.ref_id AND ".
02590 "oref.obj_id = obj.obj_id AND ".
02591 "it.type = 'icla' AND ".
02592 "it.user_id = '".$this->getId()."' ".
02593 "ORDER BY title";
02594 $item_set = $this->ilias->db->query($q);
02595 while ($item_rec = $item_set->fetchRow(DB_FETCHMODE_ASSOC))
02596 {
02597
02598 $items[$item_rec["title"].$a_type.$item_rec["ref_id"]] =
02599 array ("type" => $a_type, "id" => $item_rec["ref_id"], "title" => $item_rec["title"],
02600 "description" => $item_rec["description"],
02601 "link" => "repository.php?cmd=join&ref_id=".$item_rec["ref_id"]."&cmdClass=ilobjilincclassroomgui&cmdNode=60", "target" => "_blank");
02602
02603 }
02604 break;
02605 }
02606 if ($a_type == "svy" && !empty($foundsurveys))
02607 {
02608 $query = sprintf("SELECT survey_finished.state, survey_survey.obj_fi, object_reference.ref_id FROM survey_finished, survey_survey, object_reference WHERE survey_finished.survey_fi = survey_survey.survey_id AND object_reference.obj_id = survey_survey.obj_fi AND survey_survey.obj_fi IN (%s)",
02609 join($foundsurveys, ",")
02610 );
02611 $result = $this->ilias->db->query($query);
02612 $states = array();
02613 while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
02614 {
02615 if (strcmp($row["state"], "") == 0)
02616 {
02617 $states[$row["ref_id"]] = $row["state"];
02618 }
02619 else
02620 {
02621 $states[$row["ref_id"]] = (int)$row["state"];
02622 }
02623
02624 }
02625 foreach ($items as $key => $value)
02626 {
02627 $items[$key]["finished"] = $states[$value["id"]];
02628 }
02629 }
02630 if ($a_type == "tst")
02631 {
02632 $whereclause = preg_replace("/ OR $/", "", $whereclause);
02633 if ($whereclause) {
02634 $status_array = array();
02635 $whereclause = "WHERE ($whereclause) AND ";
02636 $q = sprintf("SELECT tst_tests.test_type_fi, tst_tests.starting_time, object_reference.ref_id as id, tst_tests.nr_of_tries, tst_active.tries FROM tst_tests, tst_active, object_reference $whereclause tst_tests.test_id = tst_active.test_fi AND object_reference.obj_id = tst_tests.obj_fi AND tst_active.user_fi = %s",
02637 $this->ilias->db->quote($ilUser->id)
02638 );
02639 $item_set = $this->ilias->db->query($q);
02640 while ($item_rec = $item_set->fetchRow(DB_FETCHMODE_OBJECT)) {
02641 $status_array[$item_rec->id] = $item_rec;
02642 }
02643 foreach ($items as $key => $value) {
02644 $items[$key]["nr_of_tries"] = $status_array[$value["id"]]->nr_of_tries;
02645 $items[$key]["used_tries"] = $status_array[$value["id"]]->tries;
02646 if ($status_array[$value["id"]]->test_type_fi == 1) {
02647
02648 if ($status_array[$value["id"]]->starting_time) {
02649 preg_match("/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $status_array[$value["id"]]->starting_time, $matches);
02650 $epoch_time = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
02651 $now = mktime();
02652 if ($now < $epoch_time) {
02653 $items[$key]["starting_time_not_reached"] = 1;
02654 }
02655 }
02656 }
02657 }
02658 }
02659 }
02660 }
02661 ksort($items);
02662 return $items;
02663 }
02664
02672 function addObjectToClipboard($a_item_id, $a_type, $a_title)
02673 {
02674 $q = "SELECT * FROM personal_clipboard WHERE ".
02675 "item_id = '$a_item_id' AND type = '$a_type' AND user_id = '".
02676 $this->getId()."'";
02677 $item_set = $this->ilias->db->query($q);
02678
02679
02680 if (!$d = $item_set->fetchRow())
02681 {
02682 $q = "INSERT INTO personal_clipboard (item_id, type, user_id, title) VALUES ".
02683 " ('$a_item_id','$a_type','".$this->getId()."', '".$a_title."')";
02684 $this->ilias->db->query($q);
02685 }
02686 }
02687
02691 function getClipboardObjects($a_type = "")
02692 {
02693 $type_str = ($a_type != "")
02694 ? " AND type = '$a_type' "
02695 : "";
02696 $q = "SELECT * FROM personal_clipboard WHERE ".
02697 "user_id = '".$this->getId()."' ".
02698 $type_str;
02699 $objs = $this->ilias->db->query($q);
02700 $objects = array();
02701 while ($obj = $objs->fetchRow(DB_FETCHMODE_ASSOC))
02702 {
02703 if ($obj["type"] == "mob")
02704 {
02705 $obj["title"] = ilObject::_lookupTitle($obj["item_id"]);
02706 }
02707 $objects[] = array ("id" => $obj["item_id"],
02708 "type" => $obj["type"], "title" => $obj["title"]);
02709 }
02710 return $objects;
02711 }
02712
02721 function _getUsersForClipboadObject($a_type, $a_id)
02722 {
02723 global $ilDB;
02724
02725 $q = "SELECT DISTINCT user_id FROM personal_clipboard WHERE ".
02726 "item_id = '$a_id' AND ".
02727 "type = '$a_type'";
02728 $user_set = $ilDB->query($q);
02729 $users = array();
02730 while ($user_rec = $user_set->fetchRow(DB_FETCHMODE_ASSOC))
02731 {
02732 $users[] = $user_rec["user_id"];
02733 }
02734
02735 return $users;
02736 }
02737
02745 function removeObjectFromClipboard($a_item_id, $a_type)
02746 {
02747 $q = "DELETE FROM personal_clipboard WHERE ".
02748 "item_id = '$a_item_id' AND type = '$a_type' ".
02749 " AND user_id = '".$this->getId()."'";
02750 $this->ilias->db->query($q);
02751 }
02752
02753 function _getImportedUserId($i2_id)
02754 {
02755 $query = "SELECT obj_id FROM object_data WHERE import_id = '".$i2_id."'";
02756
02757 $res = $this->ilias->db->query($query);
02758 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
02759 {
02760 $id = $row->obj_id;
02761 }
02762 return $id ? $id : 0;
02763 }
02764
02769 function setiLincID($a_str)
02770 {
02771 $this->ilinc_id = $a_str;
02772 }
02773
02778 function getiLincID()
02779 {
02780 return $this->ilinc_id;
02781 }
02782
02783 }
02784 ?>