• Main Page
  • Related Pages
  • Namespaces
  • Data Structures
  • Files
  • File List
  • Globals

classes/class.ilObjUser.php

Go to the documentation of this file.
00001 <?php
00002 /*
00003         +-----------------------------------------------------------------------------+
00004         | ILIAS open source                                                           |
00005         +-----------------------------------------------------------------------------+
00006         | Copyright (c) 1998-2001 ILIAS open source, University of Cologne            |
00007         |                                                                             |
00008         | This program is free software; you can redistribute it and/or               |
00009         | modify it under the terms of the GNU General Public License                 |
00010         | as published by the Free Software Foundation; either version 2              |
00011         | of the License, or (at your option) any later version.                      |
00012         |                                                                             |
00013         | This program is distributed in the hope that it will be useful,             |
00014         | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
00015         | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
00016         | GNU General Public License for more details.                                |
00017         |                                                                             |
00018         | You should have received a copy of the GNU General Public License           |
00019         | along with this program; if not, write to the Free Software                 |
00020         | Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA. |
00021         +-----------------------------------------------------------------------------+
00022 */
00023 
00024 define ("IL_PASSWD_PLAIN", "plain");
00025 define ("IL_PASSWD_MD5", "md5");                        // ILIAS 3 Password
00026 define ("IL_PASSWD_CRYPT", "crypt");            // ILIAS 2 Password
00027 
00028 require_once "classes/class.ilObject.php";
00029 
00039 class ilObjUser extends ilObject
00040 {
00045         // personal data
00046 
00047         var $login;             // username in system
00048         var $passwd;    // md5 hash of password
00049         var $passwd_type;
00050         var $gender;    // 'm' or 'f'
00051         var $utitle;    // user title (keep in mind, that we derive $title from object also!)
00052         var $firstname;
00053         var $lastname;
00054         var $fullname;  // title + firstname + lastname in one string
00055         //var $archive_dir = "./image";  // point to image file (should be flexible)
00056         // address data
00057         var $institution;
00058         var $department;
00059         var $street;
00060         var $city;
00061         var $zipcode;
00062         var $country;
00063         var $phone_office;
00064         var $phone_home;
00065         var $phone_mobile;
00066         var $fax;
00067         var $email;
00068         var $hobby;
00069         var $matriculation;
00070     var $referral_comment;
00071     var $approve_date;
00072     var $active;
00073 
00079         var $prefs;
00080 
00086         var $skin;
00087 
00088 
00094         var $default_role;
00095 
00101         var $ilias;
00102 
00103 
00109         function ilObjUser($a_user_id = 0, $a_call_by_reference = false)
00110         {
00111                 global $ilias;
00112 
00113                 // init variables
00114                 $this->ilias =& $ilias;
00115 
00116                 $this->type = "usr";
00117                 $this->ilObject($a_user_id, $a_call_by_reference);
00118                 $this->passwd_type = IL_PASSWD_PLAIN;
00119 
00120                 // for gender selection. don't change this
00121                 /*$this->gender = array(
00122                                                           'm'    => "salutation_m",
00123                                                           'f'    => "salutation_f"
00124                                                           );*/
00125 
00126                 if (!empty($a_user_id))
00127                 {
00128                         $this->setId($a_user_id);
00129                         $this->read();
00130                 }
00131                 else
00132                 {
00133                         // TODO: all code in else-structure doesn't belongs in class user !!!
00134                         //load default data
00135                         $this->prefs = array();
00136                         //language
00137                         $this->prefs["language"] = $this->ilias->ini->readVariable("language","default");
00138 
00139                         //skin and pda support
00140                         if (strpos($_SERVER["HTTP_USER_AGENT"],"Windows CE") > 0)
00141                         {
00142                                 $this->skin = "pda";
00143                         }
00144                         else
00145                         {
00146                                 $this->skin = $this->ilias->ini->readVariable("layout","skin");
00147                         }
00148 
00149                         $this->prefs["skin"] = $this->skin;
00150                         $this->prefs["show_users_online"] = "y";
00151 
00152                         //style (css)
00153                         $this->prefs["style"] = $this->ilias->ini->readVariable("layout","style");
00154                 }
00155         }
00156 
00161         function read()
00162         {
00163                 // TODO: fetching default role should be done in rbacadmin
00164                 $q = "SELECT * FROM usr_data ".
00165                          "LEFT JOIN rbac_ua ON usr_data.usr_id=rbac_ua.usr_id ".
00166                          "WHERE usr_data.usr_id='".$this->id."'";
00167                 $r = $this->ilias->db->query($q);
00168 
00169                 if ($r->numRows() > 0)
00170                 {
00171                         $data = $r->fetchRow(DB_FETCHMODE_ASSOC);
00172 
00173                         // fill member vars in one shot
00174                         $this->assignData($data);
00175 
00176                         //get userpreferences from usr_pref table
00177                         $this->readPrefs();
00178 
00179                         //set language to default if not set
00180                         if ($this->prefs["language"] == "")
00181                         {
00182                                 $this->prefs["language"] = $this->oldPrefs["language"];
00183                         }
00184 
00185                         //check skin-setting
00186                         if ($this->prefs["skin"] == "" || file_exists($this->ilias->tplPath."/".$this->prefs["skin"]) == false)
00187                         {
00188                                 $this->prefs["skin"] = $this->oldPrefs["skin"];
00189                         }
00190 
00191                         //pda support
00192                         if (strpos($_SERVER["HTTP_USER_AGENT"],"Windows CE") > 0)
00193                         {
00194                                 $this->skin = "pda";
00195                         }
00196                         else
00197                         {
00198                                 $this->skin = $this->prefs["skin"];
00199                         }
00200 
00201                         //check style-setting (skins could have more than one stylesheet
00202                         if ($this->prefs["style"] == "" || file_exists($this->ilias->tplPath."/".$this->skin."/".$this->prefs["style"].".css") == false)
00203                         {
00204                                 //load default (css)
00205                                 $this->prefs["style"] = $this->ilias->ini->readVariable("layout","style");
00206                         }
00207                         
00208                         if (empty($this->prefs["hits_per_page"]))
00209                         {
00210                                 $this->prefs["hits_per_page"] = 10;
00211                         }
00212 
00213                 }
00214                 else
00215                 {
00216                          $this->ilias->raiseError("<b>Error: There is no dataset with id ".$this->id."!</b><br />class: ".get_class($this)."<br />Script: ".__FILE__."<br />Line: ".__LINE__, $this->ilias->FATAL);
00217                 }
00218 
00219                 parent::read();
00220         }
00221 
00227         function assignData($a_data)
00228         {
00229                 // basic personal data
00230                 $this->setLogin($a_data["login"]);
00231                 $this->setPasswd($a_data["passwd"]);
00232                 $this->setGender($a_data["gender"]);
00233                 $this->setUTitle($a_data["title"]);
00234                 $this->setFirstname($a_data["firstname"]);
00235                 $this->setLastname($a_data["lastname"]);
00236                 $this->setFullname();
00237 
00238                 // address data
00239                 $this->setInstitution($a_data["institution"]);
00240                 $this->setDepartment($a_data["department"]);
00241                 $this->setStreet($a_data["street"]);
00242                 $this->setCity($a_data["city"]);
00243                 $this->setZipcode($a_data["zipcode"]);
00244                 $this->setCountry($a_data["country"]);
00245                 $this->setPhoneOffice($a_data["phone_office"]);
00246                 $this->setPhoneHome($a_data["phone_home"]);
00247                 $this->setPhoneMobile($a_data["phone_mobile"]);
00248                 $this->setFax($a_data["fax"]);
00249                 $this->setMatriculation($a_data["matriculation"]);
00250                 $this->setEmail($a_data["email"]);
00251                 $this->setHobby($a_data["hobby"]);
00252 
00253                 // system data
00254                 $this->setLastLogin($a_data["last_login"]);
00255                 $this->setLastUpdate($a_data["last_update"]);
00256                 $this->create_date      = $a_data["create_date"];
00257         $this->setComment($a_data["referral_comment"]);
00258         $this->approve_date = $a_data["approve_date"];
00259         $this->active = $a_data["active"];
00260                 $this->accept_date = $a_data["agree_date"];
00261 
00262         // time limitation
00263         $this->setTimeLimitOwner($a_data["time_limit_owner"]);
00264         $this->setTimeLimitUnlimited($a_data["time_limit_unlimited"]);
00265         $this->setTimeLimitFrom($a_data["time_limit_from"]);
00266         $this->setTimeLimitUntil($a_data["time_limit_until"]);
00267                 $this->setTimeLimitMessage($a_data['time_limit_message']);
00268                 
00269         }
00270 
00277         function saveAsNew($a_from_formular = true)
00278         {
00279                 switch ($this->passwd_type)
00280                 {
00281                         case IL_PASSWD_PLAIN:
00282                                 $pw_field = "passwd";
00283                                 $pw_value = md5($this->passwd);
00284                                 break;
00285 
00286                         case IL_PASSWD_MD5:
00287                                 $pw_field = "passwd";
00288                                 $pw_value = $this->passwd;
00289                                 break;
00290 
00291                         case IL_PASSWD_CRYPT:
00292                                 $pw_field = "i2passwd";
00293                                 $pw_value = $this->passwd;
00294                                 break;
00295                 }
00296 
00297                 if ($a_from_formular)
00298                 {
00299             $q = "INSERT INTO usr_data "
00300                 . "(usr_id,login,".$pw_field.",firstname,lastname,title,gender,"
00301                 . "email,hobby,institution,department,street,city,zipcode,country,"
00302                 . "phone_office,phone_home,phone_mobile,fax,last_login,last_update,create_date,"
00303                 . "referral_comment,matriculation,approve_date,active,"
00304                 . "time_limit_unlimited,time_limit_until,time_limit_from,time_limit_owner) "
00305                 . "VALUES "
00306                 . "('".$this->id."','".$this->login."','".$pw_value."', "
00307                 . "'".ilUtil::addSlashes($this->firstname)."','".ilUtil::addSlashes($this->lastname)."', "
00308                 . "'".ilUtil::addSlashes($this->utitle)."','".$this->gender."', "
00309                 . "'".$this->email."','".ilUtil::addSlashes($this->hobby)."', "
00310                 . "'".ilUtil::addSlashes($this->institution)."','".ilUtil::addSlashes($this->department)."', "
00311                 . "'".ilUtil::addSlashes($this->street)."', "
00312                 . "'".ilUtil::addSlashes($this->city)."','".$this->zipcode."','".ilUtil::addSlashes($this->country)."', "
00313                 . "'".$this->phone_office."','".$this->phone_home."', "
00314                 . "'".$this->phone_mobile."','".$this->fax."', 0, now(), now(), "
00315                 . "'".ilUtil::addSlashes($this->referral_comment)."', '". ilUtil::addSlashes($this->matriculation) . "', '" .$this->approve_date."', '".$this->active."', "
00316                 . "'".$this->getTimeLimitUnlimited()."','" . $this->getTimeLimitUntil()."','".$this->getTimeLimitFrom()."','".$this->getTimeLimitOwner()."'"
00317                 . ")";
00318                 }
00319                 else
00320                 {
00321             $q = "INSERT INTO usr_data ".
00322                 "(usr_id,login,".$pw_field.",firstname,lastname,title,gender,"
00323                 . "email,hobby,institution,department,street,city,zipcode,country,"
00324                 . "phone_office,phone_home,phone_mobile,fax,last_login,last_update,create_date,"
00325                 . "referral_comment,matriculation,approve_date,active,"
00326                 . "time_limit_unlimited,time_limit_until,time_limit_from,time_limit_owner) "
00327                 . "VALUES "
00328                 . "('".$this->id."','".$this->login."','".$pw_value."', "
00329                 . "'".ilUtil::prepareDBString($this->firstname)."','".ilUtil::prepareDBString($this->lastname)."', "
00330                 . "'".ilUtil::prepareDBString($this->utitle)."','".$this->gender."', "
00331                 . "'".$this->email."','".ilUtil::prepareDBString($this->hobby)."', "
00332                 . "'".ilUtil::prepareDBString($this->institution)."','".ilUtil::prepareDBString($this->department)."', "
00333                 . "'".ilUtil::prepareDBString($this->street)."', "
00334                 . "'".ilUtil::prepareDBString($this->city)."','".$this->zipcode."','".ilUtil::prepareDBString($this->country)."', "
00335                 . "'".$this->phone_office."','".$this->phone_home."', "
00336                 . "'".$this->phone_mobile."','".$this->fax."', 0, now(), now(), "
00337                 . "'".ilUtil::prepareDBString($this->referral_comment)."', '".ilUtil::prepareDBString($this->matriculation)."', '".$this->approve_date."','".$this->active."', "
00338                 . "'".$this->getTimeLimitUnlimited()."','".$this->getTimeLimitUntil()."','".$this->getTimeLimitFrom()."','".$this->getTimeLimitOwner()."'"
00339                 . ")";
00340                 }
00341 
00342                 $this->ilias->db->query($q);
00343 
00344                 // CREATE ENTRIES FOR MAIL BOX
00345                 include_once ("classes/class.ilMailbox.php");
00346                 $mbox = new ilMailbox($this->id);
00347                 $mbox->createDefaultFolder();
00348 
00349                 include_once "classes/class.ilMailOptions.php";
00350                 $mail_options = new ilMailOptions($this->id);
00351                 $mail_options->createMailOptionsEntry();
00352 
00353                 // create personal bookmark folder tree
00354                 include_once "classes/class.ilBookmarkFolder.php";
00355                 $bmf = new ilBookmarkFolder(0, $this->id);
00356                 $bmf->createNewBookmarkTree();
00357 
00358         }
00359 
00364         function update()
00365         {
00366                 //$this->id = $this->data["Id"];
00367 
00368         $this->syncActive();
00369 
00370                 $q = "UPDATE usr_data SET ".
00371             "gender='".$this->gender."', ".
00372             "title='".ilUtil::prepareDBString($this->utitle)."', ".
00373             "firstname='".ilUtil::prepareDBString($this->firstname)."', ".
00374             "lastname='".ilUtil::prepareDBString($this->lastname)."', ".
00375             "email='".ilUtil::prepareDBString($this->email)."', ".
00376             "hobby='".ilUtil::prepareDBString($this->hobby)."', ".
00377             "institution='".ilUtil::prepareDBString($this->institution)."', ".
00378             "department='".ilUtil::prepareDBString($this->department)."', ".
00379             "street='".ilUtil::prepareDBString($this->street)."', ".
00380             "city='".ilUtil::prepareDBString($this->city)."', ".
00381             "zipcode='".ilUtil::prepareDBString($this->zipcode)."', ".
00382             "country='".ilUtil::prepareDBString($this->country)."', ".
00383             "phone_office='".ilUtil::prepareDBString($this->phone_office)."', ".
00384             "phone_home='".ilUtil::prepareDBString($this->phone_home)."', ".
00385             "phone_mobile='".ilUtil::prepareDBString($this->phone_mobile)."', ".
00386             "fax='".ilUtil::prepareDBString($this->fax)."', ".
00387             "referral_comment='".ilUtil::prepareDBString($this->referral_comment)."', ".
00388             "matriculation='".ilUtil::prepareDBString($this->matriculation)."', ".
00389             "approve_date='".ilUtil::prepareDBString($this->approve_date)."', ".
00390             "active='".ilUtil::prepareDBString($this->active)."', ".
00391             "time_limit_owner='".ilUtil::prepareDBString($this->getTimeLimitOwner())."', ".
00392             "time_limit_unlimited='".ilUtil::prepareDBString($this->getTimeLimitUnlimited())."', ".
00393             "time_limit_from='".ilUtil::prepareDBString($this->getTimeLimitFrom())."', ".
00394             "time_limit_until='".ilUtil::prepareDBString($this->getTimeLimitUntil())."', ".
00395             "time_limit_message='".$this->getTimeLimitMessage()."', ".
00396             "last_update=now() ".
00397             "WHERE usr_id='".$this->id."'";
00398 
00399                 $this->ilias->db->query($q);
00400 
00401                 $this->writePrefs();
00402 
00403                 parent::update();
00404         parent::updateOwner();
00405 
00406                 $this->read();
00407 
00408                 return true;
00409         }
00410                 
00414         function writeAccepted()
00415         {
00416                 global $ilDB;
00417                 
00418                 $q = "UPDATE usr_data SET agree_date = now()".
00419                          "WHERE usr_id = ".$ilDB->quote($this->getId());
00420                 $ilDB->query($q);
00421 
00422         }
00423 
00427         function _lookupName($a_user_id)
00428         {
00429                 global $ilDB;
00430 
00431                 $q = "SELECT firstname, lastname, title FROM usr_data".
00432                         " WHERE usr_id =".$ilDB->quote($a_user_id);
00433                 $user_set = $ilDB->query($q);
00434                 $user_rec = $user_set->fetchRow(DB_FETCHMODE_ASSOC);
00435                 return array("user_id" => $a_user_id,
00436                         "firstname" => $user_rec["firstname"],
00437                         "lastname" => $user_rec["lastname"],
00438                         "title" => $user_rec["title"]);
00439         }
00440 
00446         function refreshLogin()
00447         {
00448                 $q = "UPDATE usr_data SET ".
00449                          "last_login = now() ".
00450                          "WHERE usr_id = '".$this->id."'";
00451 
00452                 $this->ilias->db->query($q);
00453         }
00454 
00463         function updatePassword($a_old, $a_new1, $a_new2)
00464         {
00465                 if (func_num_args() != 3)
00466                 {
00467                         return false;
00468                 }
00469 
00470                 if (!isset($a_old) or !isset($a_new1) or !isset($a_new2))
00471                 {
00472                         return false;
00473                 }
00474 
00475                 if ($a_new1 != $a_new2)
00476                 {
00477                         return false;
00478                 }
00479 
00480                 // is catched by isset() ???
00481                 if ($a_new1 == "" || $a_old == "")
00482                 {
00483                         return false;
00484                 }
00485 
00486                 //check old password
00487                 if (md5($a_old) != $this->passwd)
00488                 {
00489                         return false;
00490                 }
00491 
00492                 //update password
00493                 $this->passwd = md5($a_new1);
00494 
00495                 $q = "UPDATE usr_data SET ".
00496                          "passwd='".$this->passwd."' ".
00497                          "WHERE usr_id='".$this->id."'";
00498                 $this->ilias->db->query($q);
00499 
00500                 return true;
00501         }
00502 
00510         function resetPassword($a_new1, $a_new2)
00511         {
00512                 if (func_num_args() != 2)
00513                 {
00514                         return false;
00515                 }
00516 
00517                 if (!isset($a_new1) or !isset($a_new2))
00518                 {
00519                         return false;
00520                 }
00521 
00522                 if ($a_new1 != $a_new2)
00523                 {
00524                         return false;
00525                 }
00526 
00527                 //update password
00528                 $this->passwd = md5($a_new1);
00529 
00530                 $q = "UPDATE usr_data SET ".
00531                          "passwd='".$this->passwd."' ".
00532                          "WHERE usr_id='".$this->id."'";
00533                 $this->ilias->db->query($q);
00534 
00535                 return true;
00536         }
00537 
00541         function _makeIlias2Password($a_passwd)
00542         {
00543                 return (crypt($a_passwd,substr($a_passwd,0,2)));
00544         }
00545 
00549         function _lookupHasIlias2Password($a_user_login)
00550         {
00551                 global $ilias;
00552 
00553                 $q = "SELECT i2passwd FROM usr_data ".
00554                          "WHERE login = '".$a_user_login."'";
00555                 $user_set = $ilias->db->query($q);
00556 
00557                 if ($user_rec = $user_set->fetchRow(DB_FETCHMODE_ASSOC))
00558                 {
00559                         if ($user_rec["i2passwd"] != "")
00560                         {
00561                                 return true;
00562                         }
00563                 }
00564 
00565                 return false;
00566         }
00567 
00568         function _switchToIlias3Password($a_user, $a_pw)
00569         {
00570                 global $ilias;
00571 
00572                 $q = "SELECT i2passwd FROM usr_data ".
00573                          "WHERE login = '".$a_user."'";
00574                 $user_set = $ilias->db->query($q);
00575 
00576                 if ($user_rec = $user_set->fetchRow(DB_FETCHMODE_ASSOC))
00577                 {
00578                         if ($user_rec["i2passwd"] == ilObjUser::_makeIlias2Password($a_pw))
00579                         {
00580                                 $q = "UPDATE usr_data SET passwd='".md5($a_pw)."', i2passwd=''".
00581                                         "WHERE login = '".$a_user."'";
00582                                 $ilias->db->query($q);
00583                                 return true;
00584                         }
00585                 }
00586 
00587                 return false;
00588         }
00589 
00596         function updateLogin($a_login)
00597         {
00598                 if (func_num_args() != 1)
00599                 {
00600                         return false;
00601                 }
00602 
00603                 if (!isset($a_login))
00604                 {
00605                         return false;
00606                 }
00607 
00608                 //update login
00609                 $this->login = $a_login;
00610 
00611                 $q = "UPDATE usr_data SET ".
00612                          "login='".$this->login."' ".
00613                          "WHERE usr_id='".$this->id."'";
00614                 $this->ilias->db->query($q);
00615 
00616                 return true;
00617         }
00618 
00625         function writePref($a_keyword, $a_value)
00626         {
00627                 //DELETE
00628                 $q = "DELETE FROM usr_pref ".
00629                          "WHERE usr_id='".$this->id."' ".
00630                          "AND keyword='".$a_keyword."'";
00631                 $this->ilias->db->query($q);
00632 
00633                 //INSERT
00634                 if ($a_value != "")
00635                 {
00636                         $q = "INSERT INTO usr_pref ".
00637                                  "(usr_id, keyword, value) ".
00638                                  "VALUES ".
00639                                  "('".$this->id."', '".$a_keyword."', '".$a_value."')";
00640 
00641                         $this->ilias->db->query($q);
00642                 }
00643         }
00644 
00649         function writePrefs()
00650         {
00651                 //DELETE
00652                 $q = "DELETE FROM usr_pref ".
00653                          "WHERE usr_id='".$this->id."'";
00654                 $this->ilias->db->query($q);
00655 
00656                 foreach ($this->prefs as $keyword => $value)
00657                 {
00658                         //INSERT
00659                         $q = "INSERT INTO usr_pref ".
00660                                  "(usr_id, keyword, value) ".
00661                                  "VALUES ".
00662                                  "('".$this->id."', '".$keyword."', '".$value."')";
00663                         $this->ilias->db->query($q);
00664                 }
00665         }
00666 /*
00667         function selectUserpref()
00668         {
00669                 $q="SELECT FROM urs_pref ".
00670                         "WHERE usr_id='".$this->id."'";
00671                 this->ilias->db->query($q);
00672                 echo "Hallo World";
00673         }
00674 */
00681         function setPref($a_keyword, $a_value)
00682         {
00683                 if ($a_keyword != "")
00684                 {
00685                         $this->prefs[$a_keyword] = $a_value;
00686                 }
00687         }
00688 
00694         function getPref($a_keyword)
00695         {
00696                 return $this->prefs[$a_keyword];
00697         }
00698 
00704         function readPrefs()
00705         {
00706                 if (is_array($this->prefs))
00707                 {
00708                         $this->oldPrefs = $this->prefs;
00709                 }
00710 
00711                 $this->prefs = array();
00712 
00713                 $q = "SELECT * FROM usr_pref WHERE usr_id='".$this->id."'";
00714         //      $q = "SELECT * FROM usr_pref WHERE value='"y"'";
00715                 $r = $this->ilias->db->query($q);
00716 
00717                 while($row = $r->fetchRow(DB_FETCHMODE_ASSOC))
00718                 {
00719                         $this->prefs[$row["keyword"]] = $row["value"];
00720                 } // while
00721 
00722                 return $r->numRows();
00723         }
00724 
00725 // Adding new function by
00726 // ratanatyrupp@yahoo.com
00727 // purpose: for unsing in usr_profile.php
00728 
00729 
00730 // End of testing purpose
00731 //
00732 //
00738         function delete()
00739         {
00740                 global $rbacadmin;
00741 
00742                 // remove mailbox / update sent mails
00743                 include_once ("classes/class.ilMailbox.php");
00744                 $mailbox = new ilMailbox($this->getId());
00745                 $mailbox->delete();
00746                 $mailbox->updateMailsOfDeletedUser();
00747 
00748                 // delete user_account
00749                 $this->ilias->db->query("DELETE FROM usr_data WHERE usr_id='".$this->getId()."'");
00750 
00751                 // delete user_prefs
00752                 $this->ilias->db->query("DELETE FROM usr_pref WHERE usr_id='".$this->getId()."'");
00753 
00754                 // remove user from rbac
00755                 $rbacadmin->removeUser($this->getId());
00756 
00757 
00758                 // remove bookmarks
00759                 // TODO: move this to class.ilBookmarkFolder
00760                 $q = "DELETE FROM bookmark_tree WHERE tree='".$this->getId()."'";
00761                 $this->ilias->db->query($q);
00762 
00763                 $q = "DELETE FROM bookmark_data WHERE user_id='".$this->getId()."'";
00764                 $this->ilias->db->query($q);
00765 
00766                 // DELETE FORUM ENTRIES (not complete in the moment)
00767                 include_once './classes/class.ilObjForum.php';
00768 
00769                 ilObjForum::_deleteUser($this->getId());
00770 
00771                 // Delete link check notify entries
00772                 include_once './classes/class.ilLinkCheckNotify.php';
00773 
00774                 ilLinkCheckNotify::_deleteUser($this->getId());
00775 
00776                 // delete object data
00777                 parent::delete();
00778                 return true;
00779         }
00780 
00790         function setFullname($a_title = "",$a_firstname = "",$a_lastname = "")
00791         {
00792                 $this->fullname = "";
00793 
00794                 if ($a_title)
00795                 {
00796                         $fullname = $a_title." ";
00797                 }
00798                 elseif ($this->utitle)
00799                 {
00800                         $this->fullname = $this->utitle." ";
00801                 }
00802 
00803                 if ($a_firstname)
00804                 {
00805                         $fullname .= $a_firstname." ";
00806                 }
00807                 elseif ($this->firstname)
00808                 {
00809                         $this->fullname .= $this->firstname." ";
00810                 }
00811 
00812                 if ($a_lastname)
00813                 {
00814                         return $fullname.$a_lastname;
00815                 }
00816 
00817                 $this->fullname .= $this->lastname;
00818         }
00819 
00824         function getFullname()
00825         {
00826                 return ilUtil::stripSlashes($this->fullname);
00827         }
00828 
00829 // ### AA 03.09.01 updated page access logger ###
00835         function getLastVisitedLessons()
00836         {
00837                 //query
00838                 $q = "SELECT * FROM lo_access ".
00839                         "WHERE usr_id='".$this->id."' ".
00840                         "ORDER BY timestamp DESC";
00841                 $rst = $this->ilias->db->query($q);
00842 
00843                 // fill array
00844                 $result = array();
00845                 while($record = $rst->fetchRow(DB_FETCHMODE_OBJECT))
00846                 {
00847                         $result[] = array(
00848                         "timestamp"     =>      $record->timestamp,
00849                         "usr_id"                =>      $record->usr_id,
00850                         "lm_id"         =>      $record->lm_id,
00851                         "obj_id"                =>      $record->obj_id,
00852                         "lm_title"      =>      $record->lm_title);
00853                 }
00854                 return $result;
00855         }
00856 
00857 // ### AA 03.09.01 updated page access logger ###
00863         function getLessons()
00864         {
00865                 //query
00866                 $q = "SELECT * FROM lo_access ".
00867                         "WHERE usr_id='".$this->id."' ";
00868                 $rst = $this->ilias->db->query($q);
00869 
00870                 // fill array
00871                 $result = array();
00872                 while($record = $rst->fetchRow(DB_FETCHMODE_OBJECT))
00873                 {
00874                         $result[] = array(
00875                         "timestamp"     =>      $record->timestamp,
00876                         "usr_id"                =>      $record->usr_id,
00877                         "lm_id"         =>      $record->lm_id,
00878                         "obj_id"                =>      $record->obj_id,
00879                         "lm_title"      =>      $record->lm_title);
00880                 }
00881                 return $result;
00882         }
00883 
00884 
00891         function getCourses()
00892         {
00893                 global $lng;
00894 
00895                 //initialize array
00896                 $courses = array();
00897                 //query
00898                 $sql = "SELECT * FROM courses
00899                                 WHERE user_fk='".$this->id."'
00900                                 AND read=1";
00901                 $courses[] = array(
00902                         "id" => 1,
00903                         "title" => "Course 1",
00904                         "desc" => "description of course one",
00905                         "content" => "This is Course One",
00906                         "datetime" => date("Y-m-d")
00907                         );
00908                 return $courses;
00909         }
00910 
00917         function getLiterature()
00918         {
00919                 //initialize array
00920                 $literature = array();
00921                 //query
00922                 $sql = "SELECT * FROM literature";
00923 
00924                 $literature[] = array(
00925                         "id" => 1,
00926                         "url" => "http://www.gutenberg.de",
00927                         "desc" => "project gutenberg",
00928                         );
00929 
00930                 return $literature;
00931         }
00932 
00936         function hasAcceptedUserAgreement()
00937         {
00938                 if ($this->accept_date != "0000-00-00 00:00:00" || $this->login == "root")
00939                 {
00940                         return true;
00941                 }
00942                 return false;
00943         }
00944 
00950         function setLogin($a_str)
00951         {
00952                 $this->login = $a_str;
00953         }
00954 
00959         function getLogin()
00960         {
00961                 return $this->login;
00962         }
00963 
00969         function setPasswd($a_str, $a_type = IL_PASSWD_PLAIN)
00970         {
00971                 $this->passwd = $a_str;
00972                 $this->passwd_type = $a_type;
00973         }
00974 
00979         function getPasswd()
00980         {
00981                 return $this->passwd;
00982         }
00983 
00989         function setGender($a_str)
00990         {
00991                 $this->gender = substr($a_str,-1);
00992         }
00993 
00998         function getGender()
00999         {
01000                 return $this->gender;
01001         }
01002 
01010         function setUTitle($a_str)
01011         {
01012                 $this->utitle = $a_str;
01013         }
01014 
01021         function getUTitle()
01022         {
01023                 return $this->utitle;
01024         }
01025 
01031         function setFirstname($a_str)
01032         {
01033                 $this->firstname = $a_str;
01034         }
01035 
01040         function getFirstname()
01041         {
01042                 return $this->firstname;
01043         }
01044 
01050         function setLastname($a_str)
01051         {
01052                 $this->lastname = $a_str;
01053         }
01054 
01059         function getLastname()
01060         {
01061                 return $this->lastname;
01062         }
01063 
01069         function setInstitution($a_str)
01070         {
01071                 $this->institution = $a_str;
01072         }
01073 
01078         function getInstitution()
01079         {
01080                 return $this->institution;
01081         }
01082 
01088         function setDepartment($a_str)
01089         {
01090                 $this->department = $a_str;
01091         }
01092 
01097         function getDepartment()
01098         {
01099                 return $this->department;
01100         }
01101 
01107         function setStreet($a_str)
01108         {
01109                 $this->street = $a_str;
01110         }
01111 
01116         function getStreet()
01117         {
01118                 return $this->street;
01119         }
01120 
01126         function setCity($a_str)
01127         {
01128                 $this->city = $a_str;
01129         }
01130 
01135         function getCity()
01136         {
01137                 return $this->city;
01138         }
01139 
01145         function setZipcode($a_str)
01146         {
01147                 $this->zipcode = $a_str;
01148         }
01149 
01154         function getZipcode()
01155         {
01156                 return $this->zipcode;
01157         }
01158 
01164         function setCountry($a_str)
01165         {
01166                 $this->country = $a_str;
01167         }
01168 
01173         function getCountry()
01174         {
01175                 return $this->country;
01176         }
01177 
01183         function setPhoneOffice($a_str)
01184         {
01185                 $this->phone_office = $a_str;
01186         }
01187 
01192         function getPhoneOffice()
01193         {
01194                 return $this->phone_office;
01195         }
01196 
01202         function setPhoneHome($a_str)
01203         {
01204                 $this->phone_home = $a_str;
01205         }
01206 
01211         function getPhoneHome()
01212         {
01213                 return $this->phone_home;
01214         }
01215 
01221         function setPhoneMobile($a_str)
01222         {
01223                 $this->phone_mobile = $a_str;
01224         }
01225 
01230         function getPhoneMobile()
01231         {
01232                 return $this->phone_mobile;
01233         }
01234 
01240         function setFax($a_str)
01241         {
01242                 $this->fax = $a_str;
01243         }
01244 
01249         function getFax()
01250         {
01251                 return $this->fax;
01252         }
01253 
01259         function setMatriculation($a_str)
01260         {
01261                 $this->matriculation = $a_str;
01262         }
01263 
01268         function getMatriculation()
01269         {
01270                 return $this->matriculation;
01271         }
01272 
01278         function setEmail($a_str)
01279         {
01280                 $this->email = $a_str;
01281         }
01282 
01287         function getEmail()
01288         {
01289                 return $this->email;
01290         }
01291 
01297         function setHobby($a_str)
01298         {
01299                 $this->hobby = $a_str;
01300         }
01301 
01306         function getHobby()
01307         {
01308                 return $this->hobby;
01309         }
01310 
01316         function setLanguage($a_str)
01317         {
01318                 $this->prefs["language"] = $a_str;
01319         }
01320 
01326         function getLanguage()
01327         {
01328                  return $this->prefs["language"];
01329         }
01330 
01336         function setLastLogin($a_str)
01337         {
01338                 $this->last_login = $a_str;
01339         }
01340 
01346         function getLastLogin()
01347         {
01348                  return $this->last_login;
01349         }
01350 
01356         function setLastUpdate($a_str)
01357         {
01358                 $this->last_update = $a_str;
01359         }
01360         function getLastUpdate()
01361         {
01362                 return $this->last_update;
01363         }
01364 
01370     function setComment($a_str)
01371     {
01372         $this->referral_comment = $a_str;
01373     }
01374 
01379     function getComment()
01380     {
01381         return $this->referral_comment;
01382     }
01383 
01390     function setApproveDate($a_str)
01391     {
01392         $this->approve_date = $a_str;
01393     }
01394 
01400     function getApproveDate()
01401     {
01402         return $this->approve_date;
01403     }
01404 
01411     function setActive($a_active, $a_owner = 6)
01412     {
01413         if (empty($a_owner))
01414         {
01415             $a_owner = 0;
01416         }
01417 
01418         if ($a_active)
01419         {
01420             $this->active = 1;
01421             $this->setApproveDate(date('Y-m-d H:i:s'));
01422             $this->setOwner($a_owner);
01423         }
01424         else
01425         {
01426             $this->active = 0;
01427             $this->setApproveDate('0000-00-00 00:00:00');
01428             $this->setOwner(0);
01429         }
01430     }
01431 
01436     function getActive()
01437     {
01438         return $this->active;
01439     }
01440 
01446     function syncActive()
01447     {
01448         $storedActive   = 0;
01449         if ($this->getStoredActive($this->id))
01450         {
01451             $storedActive   = 1;
01452         }
01453 
01454         $currentActive  = 0;
01455         if ($this->active)
01456         {
01457             $currentActive  = 1;
01458         }
01459 
01460         if ((!empty($storedActive) && empty($currentActive)) ||
01461                 (empty($storedActive) && !empty($currentActive)))
01462         {
01463             $this->setActive($currentActive, $this->getUserIdByLogin($this->ilias->auth->getUsername()));
01464         }
01465     }
01466 
01473     function getStoredActive($a_id)
01474     {
01475         global $ilias;
01476 
01477         $query = "SELECT active FROM usr_data ".
01478             "WHERE usr_id = '".$a_id."'";
01479 
01480         $row = $ilias->db->getRow($query,DB_FETCHMODE_OBJECT);
01481 
01482         return $row->active ? true : false;
01483     }
01484 
01490         function setSkin($a_str)
01491         {
01492                 // TODO: exception handling (dir exists)
01493                 $this->skin = $a_str;
01494         }
01495 
01496     function setTimeLimitOwner($a_owner)
01497     {
01498         $this->time_limit_owner = $a_owner;
01499     }
01500     function getTimeLimitOwner()
01501     {
01502         return $this->time_limit_owner;
01503     }
01504     function setTimeLimitFrom($a_from)
01505     {
01506         $this->time_limit_from = $a_from;
01507     }
01508     function getTimeLimitFrom()
01509     {
01510         return $this->time_limit_from ? $this->time_limit_from : time();
01511     }
01512     function setTimeLimitUntil($a_until)
01513     {
01514         $this->time_limit_until = $a_until;
01515     }
01516     function getTimeLimitUntil()
01517     {
01518         return $this->time_limit_until ? $this->time_limit_until : time();
01519     }
01520     function setTimeLimitUnlimited($a_unlimited)
01521     {
01522         $this->time_limit_unlimited = $a_unlimited;
01523     }
01524     function getTimeLimitUnlimited()
01525     {
01526         return $this->time_limit_unlimited;
01527     }
01528         function setTimeLimitMessage($a_time_limit_message)
01529         {
01530                 return $this->time_limit_message = $a_time_limit_message;
01531         }
01532         function getTimeLimitMessage()
01533         {
01534                 return $this->time_limit_message;
01535         }
01536                 
01537 
01538         function checkTimeLimit()
01539         {
01540                 if($this->getTimeLimitUnlimited())
01541                 {
01542                         return true;
01543                 }
01544                 if($this->getTimeLimitFrom() < time() and $this->getTimeLimitUntil() > time())
01545                 {
01546                         return true;
01547                 }
01548                 return false;
01549         }
01550 
01551         function &getAppliedUsers()
01552         {
01553                 $this->applied_users = array();
01554                 $this->__readAppliedUsers($this->getId());
01555 
01556                 return $this->applied_users ? $this->applied_users : array();
01557         }
01558 
01559         function isChild($a_usr_id)
01560         {
01561                 if($a_usr_id == $this->getId())
01562                 {
01563                         return true;
01564                 }
01565 
01566                 $this->applied_users = array();
01567                 $this->__readAppliedUsers($this->getId());
01568                 
01569                 return in_array($a_usr_id,$this->applied_users);
01570         }
01571 
01572         function __readAppliedUsers($a_parent_id)
01573         {
01574                 $query = "SELECT usr_id FROM usr_data ".
01575                         "WHERE time_limit_owner = '".$a_parent_id."'";
01576 
01577                 $res = $this->ilias->db->query($query);
01578                 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
01579                 {
01580                         $this->applied_users[] = $row->usr_id;
01581                         
01582                         // recursion
01583                         $this->__readAppliedUsers($row->usr_id);
01584                 }
01585                 return true;
01586         }
01587 
01588         /*
01589      * check user id with login name
01590      * @access  public
01591      */
01592         function checkUserId()
01593         {
01594                 $r = $this->ilias->db->query("SELECT usr_id FROM usr_data WHERE login='".$this->ilias->auth->getUsername()."'");
01595                 //query has got a result
01596                 if ($r->numRows() > 0)
01597                 {
01598                         $data = $r->fetchRow();
01599                         $this->id = $data[0];
01600 
01601                         return $this->id;
01602                 }
01603 
01604                 return false;
01605         }
01606 
01607     /*
01608      * check to see if current user has been made active
01609      * @access  public
01610      * @return  true if active, otherwise false
01611      */
01612     function isCurrentUserActive()
01613     {
01614         $r = $this->ilias->db->query("SELECT active FROM usr_data WHERE login='".$this->ilias->auth->getUsername()."'");
01615         //query has got a result
01616         if ($r->numRows() > 0)
01617         {
01618             $data = $r->fetchRow();
01619             if (!empty($data[0]))
01620             {
01621                 return true;
01622             }
01623         }
01624 
01625         return false;
01626     }
01627 
01628     /*
01629          * STATIC METHOD
01630          * get the user_id of a login name
01631          * @param       string login name
01632          * @return  integer id of user
01633          * @static
01634          * @access      public
01635          */
01636         function getUserIdByLogin($a_login)
01637         {
01638                 global $ilias;
01639 
01640                 $query = "SELECT usr_id FROM usr_data ".
01641                         "WHERE login = '".$a_login."'";
01642 
01643                 $row = $ilias->db->getRow($query,DB_FETCHMODE_OBJECT);
01644 
01645                 return $row->usr_id ? $row->usr_id : 0;
01646         }
01647 
01656         function getUserIdByEmail($a_email)
01657         {
01658                 $query = "SELECT usr_id FROM usr_data ".
01659                         "WHERE email = '".$a_email."'";
01660 
01661                 $row = $this->ilias->db->getRow($query,DB_FETCHMODE_OBJECT);
01662                 return $row->usr_id ? $row->usr_id : 0;
01663         }
01664 
01665     /*
01666      * STATIC METHOD
01667      * get the login name of a user_id
01668      * @param   integer id of user
01669      * @return  string login name; false if not found
01670      * @static
01671      * @access  public
01672      */
01673     function getLoginByUserId($a_userid)
01674     {
01675         global $ilias;
01676 
01677         $query = "SELECT login FROM usr_data ".
01678             "WHERE usr_id = '".$a_userid."'";
01679 
01680         $row = $ilias->db->getRow($query,DB_FETCHMODE_OBJECT);
01681 
01682         return $row->login ? $row->login : false;
01683     }
01684 
01692         function searchUsers($a_search_str)
01693         {
01694                 // NO CLASS VARIABLES IN STATIC METHODS
01695                 global $ilias;
01696 
01697         // This is a temporary hack to search users by their role
01698         // See Mantis #338. This is a hack due to Mantis #337.
01699         if (strtolower(substr($a_search_str, 0, 5)) == "role:") 
01700         { 
01701             $query = "SELECT DISTINCT usr_data.usr_id,usr_data.login,usr_data.firstname,usr_data.lastname,usr_data.email ". 
01702                    "FROM object_data,rbac_ua,usr_data ". 
01703              "WHERE object_data.title LIKE '%".substr($a_search_str,5)."%' and object_data.type = 'role' ". 
01704              "and rbac_ua.rol_id = object_data.obj_id ". 
01705              "and usr_data.usr_id = rbac_ua.usr_id ". 
01706              "AND rbac_ua.usr_id != '".ANONYMOUS_USER_ID."'"; 
01707         } 
01708         else
01709         { 
01710             $query = "SELECT usr_id,login,firstname,lastname,email,active FROM usr_data ".
01711                 "WHERE (login LIKE '%".$a_search_str."%' ".
01712                 "OR firstname LIKE '%".$a_search_str."%' ".
01713                 "OR lastname LIKE '%".$a_search_str."%' ".
01714                 "OR email LIKE '%".$a_search_str."%') ".
01715                 "AND usr_id != '".ANONYMOUS_USER_ID."'";
01716         }
01717 
01718         $res = $ilias->db->query($query);
01719         while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
01720         {
01721             $ids[] = array(
01722                 "usr_id"    => $row->usr_id,
01723                 "login"     => $row->login,
01724                 "firstname" => $row->firstname,
01725                 "lastname"  => $row->lastname,
01726                 "email"     => $row->email,
01727                 "active"    => $row->active);
01728         }
01729 
01730                 return $ids ? $ids : array();
01731         }
01732 
01740         function _search(&$a_search_obj)
01741         {
01742                 global $ilBench;
01743 
01744                 // NO CLASS VARIABLES IN STATIC METHODS
01745 
01746                 // TODO: CHECK IF ITEMS ARE PUBLIC VISIBLE
01747 
01748                 $where_condition = $a_search_obj->getWhereCondition("like",array("login","firstname","lastname","title",
01749                                                                                                                                                  "email","institution","street","city",
01750                                                                                                                                                  "zipcode","country","phone_home","fax"));
01751                 $in = $a_search_obj->getInStatement("usr_data.usr_id");
01752 
01753                 $query = "SELECT DISTINCT(usr_data.usr_id) FROM usr_data ".
01754                         "LEFT JOIN usr_pref USING (usr_id) ".
01755                         $where_condition." ".
01756                         $in." ".
01757                         "AND usr_data.usr_id != '".ANONYMOUS_USER_ID."' ";
01758 #                       "AND usr_pref.keyword = 'public_profile' ";
01759 #                       "AND usr_pref.value = 'y'";
01760 
01761 
01762                 $ilBench->start("Search", "ilObjUser_search");
01763                 $res = $a_search_obj->ilias->db->query($query);
01764                 $ilBench->stop("Search", "ilObjUser_search");
01765 
01766                 $counter = 0;
01767 
01768                 while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
01769                 {
01770                         $result_data[$counter++]["id"]                          =  $row->usr_id;
01771 
01772                         // LINKS AND TARGETS AREN'T SAVED ANYMORE, SEARCHGUI HAS TO CALL ilObjUser::_getSearchLink
01773                         // TO GET THE LINK OF SPECIFIC OBJECT
01774                         #$result_data[$counter]["link"]                         =  "profile.php?user=".$row->usr_id;
01775                         #$result_data[$counter++]["target"]                     =  "";
01776                 }
01777                 return $result_data ? $result_data : array();
01778         }
01779 
01789         function _getLinkToObject($a_id)
01790         {
01791                 return array("profile.php?user=".$a_id,"");
01792         }
01793 
01794         /*
01795         * get the memberships(group_ids) of groups that are subscribed to the current user object
01796         * @param        integer optional user_id
01797         * @access       public
01798         */
01799         function getGroupMemberships($a_user_id = "")
01800         {
01801                 global $rbacreview, $tree;
01802 
01803                 if (strlen($a_user_id) > 0)
01804                 {
01805                         $user_id = $a_user_id;
01806                 }
01807                 else
01808                 {
01809                         $user_id = $this->getId();
01810                 }
01811 
01812                 $grp_memberships = array();
01813                 
01814                 // get all roles which the user is assigned to
01815                 $roles = $rbacreview->assignedRoles($user_id);
01816 
01817                 foreach ($roles as $role)
01818                 {
01819                         $ass_rolefolders = $rbacreview->getFoldersAssignedToRole($role);        //rolef_refids
01820 
01821                         foreach ($ass_rolefolders as $role_folder)
01822                         {
01823                                 $node = $tree->getParentNodeData($role_folder);
01824 
01825                                 if ($node["type"] == "grp")
01826                                 {
01827                                         $group =& $this->ilias->obj_factory->getInstanceByRefId($node["child"]);
01828 
01829                                         if ($group->isMember($user_id) == true && !in_array($group->getId(), $grp_memberships) )
01830                                         {
01831                                                 array_push($grp_memberships, $group->getId());
01832                                         }
01833                                 }
01834 
01835                                 unset($group);
01836                         }
01837                 }
01838 
01839                 return $grp_memberships;
01840         }
01841 
01842 
01851         function updateActiveRoles($a_user_id)
01852         {
01853                 global $rbacreview, $ilDB;
01854                 
01855                 if (!count($user_online = ilUtil::getUsersOnline($a_user_id)) == 1)
01856                 {
01857                         return false;
01858                 }
01859                 
01860                 $role_arr = $rbacreview->assignedRoles($a_user_id);
01861 
01862                 if ($_SESSION["AccountId"] == $a_user_id)
01863                 {
01864                         $_SESSION["RoleId"] = $role_arr;
01865                 }
01866                 else
01867                 {
01868                         $roles = "RoleId|".serialize($role_arr);
01869                         $modified_data = preg_replace("/RoleId.*?;\}/",$roles,$user_online[$a_user_id]["data"]);
01870 
01871                         $q = "UPDATE usr_session SET data='".ilUtil::prepareDBString($modified_data)."' WHERE user_id = '".$a_user_id."'";
01872                         $ilDB->query($q);
01873                 }
01874 
01875                 return true;
01876         }
01877 
01886         function _getAllUserLogins(&$ilias)
01887         {
01888                 $query = "SELECT login FROM usr_data ";
01889 
01890                 $res = $ilias->db->query($query);
01891                 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
01892                 {
01893                         $logins[] = $row->login;
01894                 }
01895                 return $logins ? $logins : array();
01896         }
01897         
01906         function _getAllUserData($a_fields = NULL)
01907         {
01908         global $ilDB;
01909 
01910         $result_arr = array();
01911 
01912         if ($a_fields !== NULL and is_array($a_fields))
01913         {
01914             if (count($a_fields) == 0)
01915             {
01916                 $select = "*";
01917             }
01918             else
01919             {
01920                 if (($usr_id_field = array_search("usr_id",$a_fields)) !== false)
01921                     unset($a_fields[$usr_id_field]);
01922 
01923                 $select = implode(",",$a_fields).",usr_data.usr_id";
01924             }
01925 
01926                 $q = "SELECT ".$select." FROM usr_data ";
01927             $r = $ilDB->query($q);
01928 
01929             while ($row = $r->fetchRow(DB_FETCHMODE_ASSOC))
01930             {
01931                 $result_arr[] = $row;
01932             }
01933         }
01934         
01935                 return $result_arr;
01936         }
01937 
01945         function addDesktopItem($a_item_id, $a_type, $a_par = "")
01946         {
01947                 $q = "SELECT * FROM desktop_item WHERE ".
01948                         "item_id = '$a_item_id' AND type = '$a_type' AND user_id = '".
01949                         $this->getId()."'";
01950                 $item_set = $this->ilias->db->query($q);
01951 
01952                 // only insert if item is not already on desktop
01953                 if (!$d = $item_set->fetchRow())
01954                 {
01955                         $q = "INSERT INTO desktop_item (item_id, type, user_id, parameters) VALUES ".
01956                                 " ('$a_item_id','$a_type','".$this->getId()."' , '$a_par')";
01957                         $this->ilias->db->query($q);
01958                 }
01959         }
01960 
01969         function setDesktopItemParameters($a_item_id, $a_type, $a_par)
01970         {
01971                 $q = "UPDATE desktop_item SET parameters = '$a_par' ".
01972                         " WHERE item_id = '$a_item_id' AND type = '$a_type' ".
01973                         " AND user_id = '".$this->getId()."' ";
01974                 $this->ilias->db->query($q);
01975         }
01976 
01984         function dropDesktopItem($a_item_id, $a_type)
01985         {
01986                 $q = "DELETE FROM desktop_item WHERE ".
01987                         " item_id = '$a_item_id' AND".
01988                         " type = '$a_type' AND".
01989                         " user_id = '".$this->getId()."'";
01990                 $this->ilias->db->query($q);
01991         }
01992 
02000         function isDesktopItem($a_item_id, $a_type)
02001         {
02002                 $q = "SELECT * FROM desktop_item WHERE ".
02003                         "item_id = '$a_item_id' AND type = '$a_type' AND user_id = '".
02004                         $this->getId()."'";
02005                 $item_set = $this->ilias->db->query($q);
02006 
02007                 if ($d = $item_set->fetchRow())
02008                 {
02009                         return true;
02010                 }
02011                 else
02012                 {
02013                         return false;
02014                 }
02015         }
02016 
02024         function getDesktopItems($a_types)
02025         {
02026                 global $ilUser, $rbacsystem;
02027 
02028                 if (!is_array($a_types))
02029                 {
02030                         $a_types = array($a_types);
02031                 }
02032                 $items = array();
02033                 $foundsurveys = array();
02034                 foreach($a_types as $a_type)
02035                 {
02036                         switch ($a_type)
02037                         {
02038                                 case "lm":
02039                                 case "glo":
02040                                 case "tst":
02041                                 case "svy":
02042                                 case "dbk":
02043                                 case "sahs":
02044                                 case "htlm":
02045                                 case "mep":
02046                                 case "spl":
02047                                 case "qpl":
02048                                         $q = "SELECT obj.description, oref.ref_id, obj.title, parameters, oref.obj_id FROM desktop_item AS it, object_reference AS oref ".
02049                                                 ", object_data AS obj WHERE ".
02050                                                 "it.item_id = oref.ref_id AND ".
02051                                                 "oref.obj_id = obj.obj_id AND ".
02052                                                 "it.type = '$a_type' AND ".
02053                                                 "it.user_id = '".$this->getId()."' ".
02054                                                 "ORDER BY title";
02055                                         $item_set = $this->ilias->db->query($q);
02056                                         while ($item_rec = $item_set->fetchRow(DB_FETCHMODE_ASSOC))
02057                                         {
02058                                                 // check wether objects are online
02059                                                 $skip = false;
02060                                                 $continue_link = "";
02061                                                 switch($a_type)
02062                                                 {
02063                                                         case "lm":
02064                                                         case "dbk":
02065                                                                 include_once("content/classes/class.ilObjContentObject.php");
02066                                                                 if (!ilObjContentObject::_lookupOnline($item_rec["obj_id"]))
02067                                                                 {
02068                                                                         if (!$rbacsystem->checkAccess("write", $item_rec["ref_id"]))
02069                                                                         {
02070                                                                                 $skip = true;
02071                                                                         }
02072                                                                 }
02073                                                                 break;
02074 
02075                                                         case "htlm":
02076                                                                 include_once("content/classes/class.ilObjFileBasedLM.php");
02077                                                                 if (!ilObjFileBasedLM::_lookupOnline($item_rec["obj_id"]))
02078                                                                 {
02079                                                                         if (!$rbacsystem->checkAccess("write", $item_rec["ref_id"]))
02080                                                                         {
02081                                                                                 $skip = true;
02082                                                                         }
02083                                                                 }
02084                                                                 break;
02085 
02086                                                         case "sahs":
02087                                                                 include_once("content/classes/class.ilObjSAHSLearningModule.php");
02088                                                                 if (!ilObjSAHSLearningModule::_lookupOnline($item_rec["obj_id"]))
02089                                                                 {
02090                                                                         if (!$rbacsystem->checkAccess("write", $item_rec["ref_id"]))
02091                                                                         {
02092                                                                                 $skip = true;
02093                                                                         }
02094                                                                 }
02095                                                                 break;
02096 
02097                                                         case "glo":
02098                                                                 include_once("content/classes/class.ilObjGlossary.php");
02099                                                                 if (!ilObjGlossary::_lookupOnline($item_rec["obj_id"]))
02100                                                                 {
02101                                                                         if (!$rbacsystem->checkAccess("write", $item_rec["ref_id"]))
02102                                                                         {
02103                                                                                 $skip = true;
02104                                                                         }
02105                                                                 }
02106                                                                 break;
02107                                                 }
02108 
02109                                                 if($a_type == "glo")
02110                                                 {
02111                                                         $link = "content/glossary_presentation.php?ref_id=".$item_rec["ref_id"].
02112                                                                 "&obj_id=".$item_rec["parameters"];
02113                                                         $edit_link = "content/glossary_edit.php?ref_id=".$item_rec["ref_id"].
02114                                                                 "&obj_id=".$item_rec["parameters"];
02115                                                         $target = "bottom";
02116                                                 }
02117                                                 elseif ($a_type == "sahs")
02118                                                 {
02119                                                         $link = "content/sahs_presentation.php?ref_id=".$item_rec["ref_id"].
02120                                                                 "&obj_id=".$item_rec["parameters"];
02121                                                         $edit_link = "content/sahs_edit.php?ref_id=".$item_rec["ref_id"];
02122                                                         $target = "ilContObj".$item_rec["obj_id"];
02123                                                 }
02124                                                 elseif ($a_type == "htlm")
02125                                                 {
02126                                                         $link = "content/fblm_presentation.php?ref_id=".$item_rec["ref_id"];
02127                                                         $edit_link = "content/fblm_edit.php?ref_id=".$item_rec["ref_id"];
02128                                                         $target = "ilContObj".$item_rec["obj_id"];
02129                                                 }
02130                                                 elseif ($a_type == "tst")
02131                                                 {
02132                                                         $link = "assessment/test.php?ref_id=".$item_rec["ref_id"]."&cmd=run";
02133                                                         $target = "bottom";
02134                                                         $whereclause .= sprintf("obj_fi = %s OR ", $this->ilias->db->quote($item_rec["obj_id"]));
02135                                                         $edit_link = "";
02136                                                 }
02137                                                 elseif ($a_type == "svy")
02138                                                 {
02139                                                         $link = "survey/survey.php?ref_id=".$item_rec["ref_id"]."&cmd=run";
02140                                                         $target = "bottom";
02141                                                         $edit_link = "";
02142                                                         array_push($foundsurveys, $item_rec["obj_id"]);
02143                                                 }
02144                                                 elseif ($a_type == "mep")
02145                                                 {
02146                                                         $link = "content/mep_edit.php?ref_id=".$item_rec["ref_id"];
02147                                                         $target = "bottom";
02148                                                         $edit_link = "";
02149                                                 }
02150                                                 elseif ($a_type == "qpl")
02151                                                 {
02152                                                         $link = "assessment/questionpool.php?ref_id=".$item_rec["ref_id"];
02153                                                         $target = "bottom";
02154                                                         $edit_link = "";
02155                                                 }
02156                                                 elseif ($a_type == "spl")
02157                                                 {
02158                                                         $link = "survey/questionpool.php?ref_id=".$item_rec["ref_id"];
02159                                                         $target = "bottom";
02160                                                         $edit_link = "";
02161                                                 }
02162                                                 else
02163                                                 {
02164                                                         if ($item_rec["parameters"] != "")
02165                                                         {
02166                                                                 $continue_link = "content/lm_presentation.php?ref_id=".$item_rec["ref_id"].
02167                                                                         "&obj_id=".$item_rec["parameters"];
02168                                                         }
02169                                                         $link = "content/lm_presentation.php?ref_id=".$item_rec["ref_id"];
02170                                                         $edit_link = "content/lm_edit.php?ref_id=".$item_rec["ref_id"];
02171                                                         $target = "ilContObj".$item_rec["obj_id"];
02172                                                 }
02173 
02174                                                 if (!$skip)
02175                                                 {
02176                                                         $items[$item_rec["title"].$a_type.$item_rec["ref_id"]] =
02177                                                                 array ("type" => $a_type, "id" => $item_rec["ref_id"], "title" => $item_rec["title"],
02178                                                                 "parameters" => $item_rec["parameters"], "description" => $item_rec["description"],
02179                                                                 "link" => $link, "target" => $target, "edit_link" => $edit_link,
02180                                                                 "continue_link" => $continue_link);
02181                                                 }
02182                                         }
02183                                         break;
02184 
02185                                 case "frm":
02186                                         include_once './classes/class.ilRepositoryExplorer.php';
02187 
02188                                         $q = "SELECT obj.description, oref.ref_id, obj.title FROM desktop_item AS it, object_reference AS oref ".
02189                                                 ", object_data AS obj WHERE ".
02190                                                 "it.item_id = oref.ref_id AND ".
02191                                                 "oref.obj_id = obj.obj_id AND ".
02192                                                 "it.type = 'frm' AND ".
02193                                                 "it.user_id = '".$this->getId()."' ".
02194                                                 "ORDER BY title";
02195                                         $item_set = $this->ilias->db->query($q);
02196                                         while ($item_rec = $item_set->fetchRow(DB_FETCHMODE_ASSOC))
02197                                         {
02198                                                 $items[$item_rec["title"].$a_type.$item_rec["ref_id"]] =
02199                                                         array ("type" => $a_type, "id" => $item_rec["ref_id"], "title" => $item_rec["title"],
02200                                                                    "description" => $item_rec["description"],
02201                                                                    "link" => 'repository.php?ref_id='.$item_rec['ref_id'], "target" => "bottom");
02202 
02203                                                 if ($rbacsystem->checkAccess("write", $item_rec["ref_id"]))
02204                                                 {
02205                                                         $items[$item_rec["title"].$a_type.
02206                                                                    $item_rec["ref_id"]]["edit_link"] = 'repository.php?ref_id='.$item_rec['ref_id'].'&cmd=edit';
02207                                                 }
02208                                         }
02209                                         break;
02210 
02211                                 case "cat":
02212                                 case "fold":
02213                                         $q = "SELECT obj.description, oref.ref_id, obj.title FROM desktop_item AS it, object_reference AS oref ".
02214                                                 ", object_data AS obj WHERE ".
02215                                                 "it.item_id = oref.ref_id AND ".
02216                                                 "oref.obj_id = obj.obj_id AND ".
02217                                                 "it.type = '$a_type' AND ".
02218                                                 "it.user_id = '".$this->getId()."' ".
02219                                                 "ORDER BY title";
02220                                         $item_set = $this->ilias->db->query($q);
02221                                         while ($item_rec = $item_set->fetchRow(DB_FETCHMODE_ASSOC))
02222                                         {
02223                                                 $items[$item_rec["title"].$a_type.$item_rec["ref_id"]] =
02224                                                         array ("type" => $a_type, "id" => $item_rec["ref_id"], "title" => $item_rec["title"],
02225                                                         "description" => $item_rec["description"],
02226                                                         "link" => "repository.php?ref_id=".$item_rec["ref_id"], "target" => "bottom");
02227 
02228                                                 if ($rbacsystem->checkAccess("write", $item_rec["ref_id"]))
02229                                                 {
02230                                                         $items[$item_rec["title"].$a_type.$item_rec["ref_id"]]["edit_link"] = "repository.php?cmd=edit&ref_id=".$item_rec["ref_id"];
02231                                                 }
02232                                         }
02233                                         break;
02234                                 case "grp":
02235                                         $q = "SELECT obj.description, oref.ref_id, obj.title FROM desktop_item AS it, object_reference AS oref ".
02236                                                 ", object_data AS obj WHERE ".
02237                                                 "it.item_id = oref.ref_id AND ".
02238                                                 "oref.obj_id = obj.obj_id AND ".
02239                                                 "it.type = '$a_type' AND ".
02240                                                 "it.user_id = '".$this->getId()."' ".
02241                                                 "ORDER BY title";
02242                                         $item_set = $this->ilias->db->query($q);
02243                                         while ($item_rec = $item_set->fetchRow(DB_FETCHMODE_ASSOC))
02244                                         {
02245                                                 $items[$item_rec["title"].$a_type.$item_rec["ref_id"]] =
02246                                                         array ("type" => $a_type, "id" => $item_rec["ref_id"], "title" => $item_rec["title"],
02247                                                         "description" => $item_rec["description"],
02248                                                         "link" => "repository.php?ref_id=".$item_rec["ref_id"]."&cmdClass=ilobjgroupgui", "target" => "bottom");
02249 
02250                                                 if ($rbacsystem->checkAccess("write", $item_rec["ref_id"]))
02251                                                 {
02252                                                         $items[$item_rec["title"].$a_type.$item_rec["ref_id"]]["edit_link"] = "repository.php?cmdClass=ilobjgroupgui&cmd=edit&ref_id=".$item_rec["ref_id"];
02253                                                 }
02254                                         }
02255                                         break;
02256                                 case "crs":
02257                                         $q = "SELECT obj.description, oref.ref_id, obj.title FROM desktop_item AS it, object_reference AS oref ".
02258                                                 ", object_data AS obj WHERE ".
02259                                                 "it.item_id = oref.ref_id AND ".
02260                                                 "oref.obj_id = obj.obj_id AND ".
02261                                                 "it.type = 'crs' AND ".
02262                                                 "it.user_id = '".$this->getId()."' ".
02263                                                 "ORDER BY title";
02264                                         $item_set = $this->ilias->db->query($q);
02265                                         while ($item_rec = $item_set->fetchRow(DB_FETCHMODE_ASSOC))
02266                                         {
02267                                                 $items[$item_rec["title"].$a_type.$item_rec["ref_id"]] =
02268                                                         array ("type" => $a_type, "id" => $item_rec["ref_id"], "title" => $item_rec["title"],
02269                                                         "description" => $item_rec["description"],
02270                                                         "link" => "repository.php?ref_id=".$item_rec["ref_id"]."&cmdClass=ilobjcoursegui", "target" => "bottom");
02271 
02272                                                 if ($rbacsystem->checkAccess("write", $item_rec["ref_id"]))
02273                                                 {
02274                                                         $items[$item_rec["title"].$a_type.$item_rec["ref_id"]]["edit_link"] = "repository.php?cmdClass=ilobjcoursegui&cmd=edit&ref_id=".$item_rec["ref_id"];
02275                                                 }
02276                                         }
02277                                         break;
02278                                 case "file":
02279                                         $q = "SELECT obj.description, oref.ref_id, obj.title FROM desktop_item AS it, object_reference AS oref ".
02280                                                 ", object_data AS obj WHERE ".
02281                                                 "it.item_id = oref.ref_id AND ".
02282                                                 "oref.obj_id = obj.obj_id AND ".
02283                                                 "it.type = 'file' AND ".
02284                                                 "it.user_id = '".$this->getId()."' ".
02285                                                 "ORDER BY title";
02286                                         $item_set = $this->ilias->db->query($q);
02287                                         while ($item_rec = $item_set->fetchRow(DB_FETCHMODE_ASSOC))
02288                                         {
02289                                                 $items[$item_rec["title"].$a_type.$item_rec["ref_id"]] =
02290                                                         array ("type" => $a_type, "id" => $item_rec["ref_id"], "title" => $item_rec["title"],
02291                                                         "description" => $item_rec["description"],
02292                                                         "link" => "repository.php?cmd=sendfile&ref_id=".$item_rec["ref_id"]);
02293 
02294                                                 if ($rbacsystem->checkAccess("write", $item_rec["ref_id"]))
02295                                                 {
02296                                                         $items[$item_rec["title"].$a_type.$item_rec["ref_id"]]["edit_link"] = "repository.php?cmd=edit&cmdClass=ilobjfilegui&ref_id=".$item_rec["ref_id"];
02297                                                 }
02298                                         }
02299                                         break;
02300 
02301                                 case "exc":
02302                                         $q = "SELECT obj.description, oref.ref_id, obj.title FROM desktop_item AS it, object_reference AS oref ".
02303                                                 ", object_data AS obj WHERE ".
02304                                                 "it.item_id = oref.ref_id AND ".
02305                                                 "oref.obj_id = obj.obj_id AND ".
02306                                                 "it.type = 'exc' AND ".
02307                                                 "it.user_id = '".$this->getId()."' ".
02308                                                 "ORDER BY title";
02309                                         $item_set = $this->ilias->db->query($q);
02310                                         while ($item_rec = $item_set->fetchRow(DB_FETCHMODE_ASSOC))
02311                                         {
02312                                                 $items[$item_rec["title"].$a_type.$item_rec["ref_id"]] =
02313                                                         array ("type" => $a_type, "id" => $item_rec["ref_id"], "title" => $item_rec["title"],
02314                                                         "description" => $item_rec["description"],
02315                                                         "link" => "exercise.php?cmd=view&ref_id=".$item_rec["ref_id"], "target" => "bottom");
02316 
02317                                                 if ($rbacsystem->checkAccess("write", $item_rec["ref_id"]))
02318                                                 {
02319                                                         $items[$item_rec["title"].$a_type.$item_rec["ref_id"]]["edit_link"] = "exercise.php?cmd=edit&ref_id=".$item_rec["ref_id"];
02320                                                 }
02321                                         }
02322                                         break;
02323 
02324 
02325                                 case "chat":
02326                                         $q = "SELECT obj.description, oref.ref_id, obj.title FROM desktop_item AS it, object_reference AS oref ".
02327                                                 ", object_data AS obj WHERE ".
02328                                                 "it.item_id = oref.ref_id AND ".
02329                                                 "oref.obj_id = obj.obj_id AND ".
02330                                                 "it.type = 'chat' AND ".
02331                                                 "it.user_id = '".$this->getId()."' ".
02332                                                 "ORDER BY title";
02333                                         $item_set = $this->ilias->db->query($q);
02334                                         while ($item_rec = $item_set->fetchRow(DB_FETCHMODE_ASSOC))
02335                                         {
02336                                                 $items[$item_rec["title"].$a_type.$item_rec["ref_id"]] =
02337                                                         array ("type" => $a_type, "id" => $item_rec["ref_id"], "title" => $item_rec["title"],
02338                                                         "description" => $item_rec["description"],
02339                                                         "link" => "chat/chat_rep.php?ref_id=".$item_rec["ref_id"], "target" => "bottom");
02340 
02341                                                 if ($rbacsystem->checkAccess("write", $item_rec["ref_id"]))
02342                                                 {
02343                                                         $items[$item_rec["title"].$a_type.$item_rec["ref_id"]]["edit_link"] = "chat/chat_rep.php?cmd=edit&ref_id=".$item_rec["ref_id"];
02344                                                 }
02345                                         }
02346                                         break;
02347                         }
02348                         if ($a_type == "svy" && !empty($foundsurveys))
02349                         {
02350                                 $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)",
02351                                         join($foundsurveys, ",")
02352                                 );
02353                                 $result = $this->ilias->db->query($query);
02354                                 $states = array();
02355                                 while ($row = $result->fetchRow(DB_FETCHMODE_ASSOC))
02356                                 {
02357                                         if (strcmp($row["state"], "") == 0)
02358                                         {
02359                                                 $states[$row["ref_id"]] = $row["state"];
02360                                         }
02361                                         else
02362                                         {
02363                                                 $states[$row["ref_id"]] = (int)$row["state"];
02364                                         }
02365 
02366                                 }
02367                                 foreach ($items as $key => $value)
02368                                 {
02369                                         $items[$key]["finished"] = $states[$value["id"]];
02370                                 }
02371                         }
02372                         if ($a_type == "tst")
02373                         {
02374                                 $whereclause = preg_replace("/ OR $/", "", $whereclause);
02375                                 if ($whereclause) {
02376                                         $status_array = array();
02377                                         $whereclause = "WHERE ($whereclause) AND ";
02378                                         $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",
02379                                                 $this->ilias->db->quote($ilUser->id)
02380                                         );
02381                                         $item_set = $this->ilias->db->query($q);
02382                                         while ($item_rec = $item_set->fetchRow(DB_FETCHMODE_OBJECT)) {
02383                                                 $status_array[$item_rec->id] = $item_rec;
02384                                         }
02385                                         foreach ($items as $key => $value) {
02386                                                 $items[$key]["nr_of_tries"] = $status_array[$value["id"]]->nr_of_tries;
02387                                                 $items[$key]["used_tries"] = $status_array[$value["id"]]->tries;
02388                                                 if ($status_array[$value["id"]]->test_type_fi == 1) {
02389                                                         // assessment test. check starting time
02390                                                         if ($status_array[$value["id"]]->starting_time) {
02391                                                                 preg_match("/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/", $status_array[$value["id"]]->starting_time, $matches);
02392                                                                 $epoch_time = mktime($matches[4], $matches[5], $matches[6], $matches[2], $matches[3], $matches[1]);
02393                                                                 $now = mktime();
02394                                                                 if ($now < $epoch_time) {
02395                                                                         $items[$key]["starting_time_not_reached"] = 1;
02396                                                                 }
02397                                                         }
02398                                                 }
02399                                         }
02400                                 }
02401                         }
02402                 }
02403                 ksort($items);
02404                 return $items;
02405         }
02406 
02414         function addObjectToClipboard($a_item_id, $a_type, $a_title)
02415         {
02416                 $q = "SELECT * FROM personal_clipboard WHERE ".
02417                         "item_id = '$a_item_id' AND type = '$a_type' AND user_id = '".
02418                         $this->getId()."'";
02419                 $item_set = $this->ilias->db->query($q);
02420 
02421                 // only insert if item is not already on desktop
02422                 if (!$d = $item_set->fetchRow())
02423                 {
02424                         $q = "INSERT INTO personal_clipboard (item_id, type, user_id, title) VALUES ".
02425                                 " ('$a_item_id','$a_type','".$this->getId()."', '".$a_title."')";
02426                         $this->ilias->db->query($q);
02427                 }
02428         }
02429 
02433         function getClipboardObjects($a_type = "")
02434         {
02435                 $type_str = ($a_type != "")
02436                         ? " AND type = '$a_type' "
02437                         : "";
02438                 $q = "SELECT * FROM personal_clipboard WHERE ".
02439                         "user_id = '".$this->getId()."' ".
02440                         $type_str;
02441                 $objs = $this->ilias->db->query($q);
02442                 $objects = array();
02443                 while ($obj = $objs->fetchRow(DB_FETCHMODE_ASSOC))
02444                 {
02445                         if ($obj["type"] == "mob")
02446                         {
02447                                 $obj["title"] = ilObject::_lookupTitle($obj["item_id"]);
02448                         }
02449                         $objects[] = array ("id" => $obj["item_id"],
02450                                 "type" => $obj["type"], "title" => $obj["title"]);
02451                 }
02452                 return $objects;
02453         }
02454 
02463         function _getUsersForClipboadObject($a_type, $a_id)
02464         {
02465                 global $ilDB;
02466 
02467                 $q = "SELECT DISTINCT user_id FROM personal_clipboard WHERE ".
02468                         "item_id = '$a_id' AND ".
02469                         "type = '$a_type'";
02470                 $user_set = $ilDB->query($q);
02471                 $users = array();
02472                 while ($user_rec = $user_set->fetchRow(DB_FETCHMODE_ASSOC))
02473                 {
02474                         $users[] = $user_rec["user_id"];
02475                 }
02476 
02477                 return $users;
02478         }
02479 
02487         function removeObjectFromClipboard($a_item_id, $a_type)
02488         {
02489                 $q = "DELETE FROM personal_clipboard WHERE ".
02490                         "item_id = '$a_item_id' AND type = '$a_type' ".
02491                         " AND user_id = '".$this->getId()."'";
02492                 $this->ilias->db->query($q);
02493         }
02494 
02495         function _getImportedUserId($i2_id)
02496         {
02497                 $query = "SELECT obj_id FROM object_data WHERE import_id = '".$i2_id."'";
02498 
02499                 $res = $this->ilias->db->query($query);
02500                 while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
02501                 {
02502                         $id = $row->obj_id;
02503                 }
02504                 return $id ? $id : 0;
02505         }
02506 
02507 
02508 
02509 } // END class ilObjUser
02510 ?>

Generated on Fri Dec 13 2013 08:00:15 for ILIAS Release_3_3_x_branch .rev 46803 by  doxygen 1.7.1