Public Member Functions | Static Public Member Functions | Data Fields

ilObjUser Class Reference

user class for ilias More...

Inheritance diagram for ilObjUser:
Collaboration diagram for ilObjUser:

Public Member Functions

 ilObjUser ($a_user_id=0, $a_call_by_reference=false)
 Constructor public.
 read ()
 loads a record "user" from database private
 assignData ($a_data)
 loads a record "user" from array public
 saveAsNew ($a_from_formular=true)
 TODO: drop fields last_update & create_date.
 update ()
 updates a record "user" and write it into database public
 writeAccepted ()
 write accept date of user agreement to db
 _lookupEmail ($a_user_id)
 _lookupClientIP ($a_user_id)
 _lookupName ($a_user_id)
 lookup user name
 _lookupLogin ($a_user_id)
 lookup login
 _lookupId ($a_user_str)
 lookup id by login
 _lookupLastLogin ($a_user_id)
 lookup last login
 refreshLogin ()
 updates the login data of a "user" // TODO set date with now() should be enough public
 replacePassword ($new_md5)
 replaces password with new md5 hash
 updatePassword ($a_old, $a_new1, $a_new2)
 updates password
 resetPassword ($a_new1, $a_new2)
 reset password
 _makeIlias2Password ($a_passwd)
 get encrypted Ilias 2 password (needed for imported ilias 2 users)
 _lookupHasIlias2Password ($a_user_login)
 check if user has ilias 2 password (imported user)
 _switchToIlias3Password ($a_user, $a_pw)
 updateLogin ($a_login)
 update login name
 writePref ($a_keyword, $a_value)
 write userpref to user table private
 _writePref ($a_usr_id, $a_keyword, $a_value)
 writePrefs ()
 write all userprefs private
 setPref ($a_keyword, $a_value)
 set a user preference
 getPref ($a_keyword)
 get a user preference
 _lookupPref ($a_usr_id, $a_keyword)
 readPrefs ()
 get all user preferences private
 delete ()
 deletes a user public
 setFullname ($a_title="", $a_firstname="", $a_lastname="")
 builds a string with title + firstname + lastname method is used to build fullname in member variable $this->fullname.
 getFullname ($a_max_strlen=0)
 get fullname public
 getLastVisitedLessons ()
 get read lessons, ordered by timestamp public
 getLessons ()
 get all lessons, unordered public
 getCourses ()
 get courses the user has access to public
 getLiterature ()
 get literature bookmarks public
 hasAcceptedUserAgreement ()
 check wether user has accepted user agreement
 setLogin ($a_str)
 set login / username public
 getLogin ()
 get login / username public
 setPasswd ($a_str, $a_type=IL_PASSWD_PLAIN)
 set password public
 getPasswd ()
 get password
 getPasswdType ()
 get password type
 setGender ($a_str)
 set gender public
 getGender ()
 get gender public
 setUTitle ($a_str)
 set user title (note: don't mix up this method with setTitle() that is derived from ilObject and sets the user object's title) public
 getUTitle ()
 get user title (note: don't mix up this method with getTitle() that is derived from ilObject and gets the user object's title) public
 setFirstname ($a_str)
 set firstname public
 getFirstname ()
 get firstname public
 setLastname ($a_str)
 set lastame public
 getLastname ()
 get lastname public
 setInstitution ($a_str)
 set institution public
 getInstitution ()
 get institution public
 setDepartment ($a_str)
 set department public
 getDepartment ()
 get department public
 setStreet ($a_str)
 set street public
 getStreet ()
 get street public
 setCity ($a_str)
 set city public
 getCity ()
 get city public
 setZipcode ($a_str)
 set zipcode public
 getZipcode ()
 get zipcode public
 setCountry ($a_str)
 set country public
 getCountry ()
 get country public
 setPhoneOffice ($a_str)
 set office phone public
 getPhoneOffice ()
 get office phone public
 setPhoneHome ($a_str)
 set home phone public
 getPhoneHome ()
 get home phone public
 setPhoneMobile ($a_str)
 set mobile phone public
 getPhoneMobile ()
 get mobile phone public
 setFax ($a_str)
 set fax public
 getFax ()
 get fax public
 setClientIP ($a_str)
 set client ip number public
 getClientIP ()
 get client ip number public
 setMatriculation ($a_str)
 set matriculation number public
 getMatriculation ()
 get matriculation number public
 setEmail ($a_str)
 set email public
 getEmail ()
 get email address public
 setHobby ($a_str)
 set hobby public
 getHobby ()
 get hobby public
 setLanguage ($a_str)
 set user language public
 getLanguage ()
 returns a 2char-language-string public
 _lookupLanguage ($a_usr_id)
 _checkPassword ($a_usr_id, $a_pw)
 _writeExternalAccount ($a_usr_id, $a_ext_id)
 _writeAuthMode ($a_usr_id, $a_auth_mode)
 getCurrentLanguage ()
 returns the current language (may differ from user's pref setting!)
 setLastLogin ($a_str)
 set user's last login public
 getLastLogin ()
 returns last login date public
 setLastUpdate ($a_str)
 set last update of user data set public
 getLastUpdate ()
 setComment ($a_str)
 set referral comment public
 getComment ()
 get referral comment public
 setApproveDate ($a_str)
 set date the user account was activated 0000-00-00 00:00:00 indicates that the user has not yet been activated public
 getApproveDate ()
 get date the user account was activated public
 setActive ($a_active, $a_owner=6)
 set user active state and updates system fields appropriately public
 getActive ()
 get user active state public
 syncActive ()
 synchronizes current and stored user active values for the owner value to be set correctly, this function should only be called when an admin is approving a user account public
 getStoredActive ($a_id)
 get user active state
 setSkin ($a_str)
 set user skin (template set) public
 setTimeLimitOwner ($a_owner)
 getTimeLimitOwner ()
 setTimeLimitFrom ($a_from)
 getTimeLimitFrom ()
 setTimeLimitUntil ($a_until)
 getTimeLimitUntil ()
 setTimeLimitUnlimited ($a_unlimited)
 getTimeLimitUnlimited ()
 setTimeLimitMessage ($a_time_limit_message)
 getTimeLimitMessage ()
 checkTimeLimit ()
 setProfileIncomplete ($a_prof_inc)
 getProfileIncomplete ()
getAppliedUsers ()
 isChild ($a_usr_id)
 __readAppliedUsers ($a_parent_id)
 checkUserId ()
 isCurrentUserActive ()
 getUserIdByLogin ($a_login)
 getLoginByUserId ($a_userid)
 getGroupMemberships ($a_user_id="")
 _getNumberOfUsersForStyle ($a_skin, $a_style)
 skins and styles
 _getAllUserAssignedStyles ()
 skins and styles
 _moveUsersToStyle ($a_from_skin, $a_from_style, $a_to_skin, $a_to_style)
 skins and styles
 addDesktopItem ($a_item_id, $a_type, $a_par="")
 add an item to user's personal desktop
 setDesktopItemParameters ($a_item_id, $a_type, $a_par)
 set parameters of a desktop item entry
 dropDesktopItem ($a_item_id, $a_type)
 drop an item from user's personal desktop
 isDesktopItem ($a_item_id, $a_type)
 check wether an item is on the users desktop or not
 getDesktopItems ($a_types="")
 get all desktop items of user and specified type
 addObjectToClipboard ($a_item_id, $a_type, $a_title)
 add an item to user's personal clipboard
 getClipboardObjects ($a_type="")
 get all clipboard objects of user and specified type
 _getUsersForClipboadObject ($a_type, $a_id)
 get all users, that have a certain object within their clipboard
 removeObjectFromClipboard ($a_item_id, $a_type)
 remove object from user's personal clipboard
 _getImportedUserId ($i2_id)
 setAuthMode ($a_str)
 set auth mode public
 getAuthMode ($a_auth_key=false)
 get auth mode public
 setExternalAccount ($a_str)
 set external account
 getExternalAccount ()
 get external account
 _checkExternalAuthAccount ($a_auth, $a_account)
 check whether external account and authentication method matches with a user
 _getNumberOfUsersPerAuthMode ()
 get number of users per auth mode
 _getLocalAccountsForEmail ($a_email)
 check whether external account and authentication method matches with a user
 _uploadPersonalPicture ($tmp_file, $obj_id)
 Create a personal picture image file from a temporary image file.
 getPersonalPicturePath ($a_size="small", $a_force_pic=false)
 get path to personal picture
 _getPersonalPicturePath ($a_usr_id, $a_size="small", $a_force_pic=false)
 get path to personal picture
 setUserDefinedData ($a_data)
 getUserDefinedData ()
 updateUserDefinedFields ()
 readUserDefinedFields ()
 addUserDefinedFieldEntry ()
 deleteUserDefinedFieldEntries ()
 getProfileAsString (&$a_language, $a_with_access_limits=true)
 Get formatted mail body text of user profile data.

Static Public Member Functions

 _getUserIdsByEmail ($a_email)
 STATIC METHOD get all user_ids of an email address.
 getUserIdByEmail ($a_email)
 STATIC METHOD get the user_id of an email address.
 searchUsers ($a_search_str, $active=1)
 STATIC METHOD get the user_ids which correspond a search string.
 _search (&$a_search_obj, $active=1)
 STATIC METHOD search for user data.
 _getLinkToObject ($a_id)
 STATIC METHOD create a link to the object This method used by class.ilSearchGUI.php to a link to the results.
 updateActiveRoles ($a_user_id)
 STATIC METHOD updates Session roles.
 _getAllUserLogins (&$ilias)
 STATIC METHOD get all user logins.
 _getAllUserData ($a_fields=NULL, $active=-1)
 STATIC METHOD get all user data.

Data Fields

 $login
 all user related data in single vars public
 $passwd
 $passwd_type
 $gender
 $utitle
 $firstname
 $lastname
 $fullname
 $institution
 $department
 $street
 $city
 $zipcode
 $country
 $phone_office
 $phone_home
 $phone_mobile
 $fax
 $email
 $hobby
 $matriculation
 $referral_comment
 $approve_date
 $active
 $client_ip
 $auth_mode
 $user_defined_data = array()
 $prefs
 $skin
 $default_role
 $ilias

Detailed Description

user class for ilias

Author:
Sascha Hofmann <saschahofmann@gmx.de>
Stefan Meyer <smeyer@databay.de>
Peter Gabriel <pgabriel@databay.de>
Version:
Id:
class.ilObjUser.php 14143 2007-06-14 14:07:34Z akill

Definition at line 40 of file class.ilObjUser.php.


Member Function Documentation

ilObjUser::__readAppliedUsers ( a_parent_id  ) 

Definition at line 1965 of file class.ilObjUser.php.

References $query, $res, and $row.

Referenced by getAppliedUsers(), and isChild().

        {
                $query = "SELECT usr_id FROM usr_data ".
                        "WHERE time_limit_owner = '".$a_parent_id."'";

                $res = $this->ilias->db->query($query);
                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        $this->applied_users[] = $row->usr_id;
                        
                        // recursion
                        $this->__readAppliedUsers($row->usr_id);
                }
                return true;
        }

Here is the caller graph for this function:

ilObjUser::_checkExternalAuthAccount ( a_auth,
a_account 
)

check whether external account and authentication method matches with a user

Definition at line 2768 of file class.ilObjUser.php.

Referenced by ilSoapAuthenticationCAS::authenticate(), ShibAuth::generateLogin(), ilUserImportParser::importEndTag(), ilCASAuth::login(), ilObjUserGUI::updateObject(), ilSOAPAuth::validateSOAPUser(), and ilUserImportParser::verifyEndTag().

        {
                global $ilDB;
                
                $r = $ilDB->query("SELECT * FROM usr_data WHERE ".
                        " ext_account = ".$ilDB->quote($a_account)." AND ".
                        " auth_mode = ".$ilDB->quote($a_auth));
                if ($usr = $r->fetchRow(DB_FETCHMODE_ASSOC))
                {
                        return $usr["login"];
                }
                else
                {
                        return false;
                }
        }

Here is the caller graph for this function:

ilObjUser::_checkPassword ( a_usr_id,
a_pw 
)

Definition at line 1669 of file class.ilObjUser.php.

References $q.

Referenced by ilSOAPAuth::login().

        {
                global $ilDB;

                $q = "SELECT passwd FROM usr_data ".
                        " WHERE usr_id=".$ilDB->quote($a_usr_id);
                $usr_set = $ilDB->query($q);

                if($usr_rec = $usr_set->fetchRow(DB_FETCHMODE_ASSOC))
                {
                        if ($usr_rec["passwd"] == md5($a_pw))
                        {
                                return true;
                        }
                }
                return false;
        }

Here is the caller graph for this function:

ilObjUser::_getAllUserAssignedStyles (  ) 

skins and styles

Definition at line 2402 of file class.ilObjUser.php.

References $q.

Referenced by ilObjStyleSettingsGUI::editSystemStylesObject(), ilUserImportParser::ilUserImportParser(), and ilObjStyleSettingsGUI::saveStyleSettingsObject().

        {
                global $ilDB;
                
                $q = "SELECT DISTINCT up1.value as style, up2.value as skin FROM usr_pref AS up1, usr_pref AS up2 ".
                        " WHERE up1.keyword= ".$ilDB->quote("style").
                        " AND up2.keyword= ".$ilDB->quote("skin").
                        " AND up1.usr_id = up2.usr_id ";
                
                
                $sty_set = $ilDB->query($q);
                
                $styles = array();
                while($sty_rec = $sty_set->fetchRow(DB_FETCHMODE_ASSOC))
                {
                        $styles[] = $sty_rec["skin"].":".$sty_rec["style"];
                }
                
                return $styles;
        }

Here is the caller graph for this function:

ilObjUser::_getAllUserData ( a_fields = NULL,
active = -1 
) [static]

STATIC METHOD get all user data.

Parameters:
array desired columns
Returns:
array of user data public

Definition at line 2331 of file class.ilObjUser.php.

References $active, $q, and $row.

Referenced by ilObjUserFolderGUI::_addLearningProgressWorksheet(), ilLocalUser::_getUserData(), ilObjUserFolderGUI::learningProgressObject(), and ilObjUserFolderGUI::viewObject().

        {
        global $ilDB;

        $result_arr = array();

        if ($a_fields !== NULL and is_array($a_fields))
        {
            if (count($a_fields) == 0)
            {
                $select = "*";
            }
            else
            {
                if (($usr_id_field = array_search("usr_id",$a_fields)) !== false)
                    unset($a_fields[$usr_id_field]);

                $select = implode(",",$a_fields).",usr_data.usr_id";
                                // online time
                                if(in_array('online_time',$a_fields))
                                {
                                        $select .= ",ut_online.online_time ";
                                }
            }

                $q = "SELECT ".$select." FROM usr_data ";

                        // Add online_time if desired
                        // Need left join here to show users that never logged in
                        if(in_array('online_time',$a_fields))
                        {
                                $q .= "LEFT JOIN ut_online ON usr_data.usr_id = ut_online.usr_id ";
                        }

                
                if (is_numeric($active) && $active > -1)
                        $q .= "WHERE active='$active'";
                        
            $r = $ilDB->query($q);

            while ($row = $r->fetchRow(DB_FETCHMODE_ASSOC))
            {
                $result_arr[] = $row;
            }
        }
        
                return $result_arr;
        }

Here is the caller graph for this function:

ilObjUser::_getAllUserLogins ( &$  ilias  )  [static]

STATIC METHOD get all user logins.

Parameters:
ilias object
Returns:
array of logins public

Definition at line 2311 of file class.ilObjUser.php.

References $ilias, $query, $res, and $row.

Referenced by ilMail::__checkSystemRecipients().

        {
                $query = "SELECT login FROM usr_data ";

                $res = $ilias->db->query($query);
                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        $logins[] = $row->login;
                }
                return $logins ? $logins : array();
        }

Here is the caller graph for this function:

ilObjUser::_getImportedUserId ( i2_id  ) 

Definition at line 2685 of file class.ilObjUser.php.

References ilObject::$id, $query, $res, and $row.

Referenced by ilCourseXMLParser::__parseId(), ilGroupImportParser::__parseId(), ilMailImportParser::handlerBeginTag(), and ilForumImportParser::handlerBeginTag().

        {
                $query = "SELECT obj_id FROM object_data WHERE import_id = '".$i2_id."'";

                $res = $this->ilias->db->query($query);
                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        $id = $row->obj_id;
                }
                return $id ? $id : 0;
        }

Here is the caller graph for this function:

ilObjUser::_getLinkToObject ( a_id  )  [static]

STATIC METHOD create a link to the object This method used by class.ilSearchGUI.php to a link to the results.

Parameters:
int uniq id
Returns:
array array('link','target') public

Definition at line 2214 of file class.ilObjUser.php.

Referenced by ilSearchGUI::__formatUserResult(), and ilSearchResult::createLink().

        {
                return array("profile.php?user=".$a_id,"");
        }

Here is the caller graph for this function:

ilObjUser::_getLocalAccountsForEmail ( a_email  ) 

check whether external account and authentication method matches with a user

Definition at line 2808 of file class.ilObjUser.php.

References $users.

Referenced by ilSOAPAuth::login(), and ilStartUpGUI::showUserMappingSelection().

        {
                global $ilDB, $ilSetting;
                
                // default set to local (1)?
                $or_str = "";
                if ($ilSetting->get("auth_mode") == 1)
                {
                        $or_str = " OR auth_mode = ".$ilDB->quote("default");
                }
                
                $usr_set = $ilDB->query("SELECT * FROM usr_data WHERE ".
                        " email = ".$ilDB->quote($a_email)." AND ".
                        " (auth_mode = ".$ilDB->quote("local").$or_str.")");

                $users = array();

                while ($usr_rec = $usr_set->fetchRow(DB_FETCHMODE_ASSOC))
                {
                        $users[$usr_rec["usr_id"]] = $usr_rec["login"];
                }

                return $users;
        }

Here is the caller graph for this function:

ilObjUser::_getNumberOfUsersForStyle ( a_skin,
a_style 
)

skins and styles

Definition at line 2383 of file class.ilObjUser.php.

References $q.

Referenced by ilObjStyleSettingsGUI::editSystemStylesObject(), and ilObjStyleSettingsGUI::saveStyleSettingsObject().

        {
                global $ilDB;
                
                $q = "SELECT count(*) as cnt FROM usr_pref AS up1, usr_pref AS up2 ".
                        " WHERE up1.keyword= ".$ilDB->quote("style")." AND up1.value= ".$ilDB->quote($a_style).
                        " AND up2.keyword= ".$ilDB->quote("skin")." AND up2.value= ".$ilDB->quote($a_skin).
                        " AND up1.usr_id = up2.usr_id ";
                        
                $cnt_set = $ilDB->query($q);
                
                $cnt_rec = $cnt_set->fetchRow(DB_FETCHMODE_ASSOC);
                
                return $cnt_rec["cnt"];
        }

Here is the caller graph for this function:

ilObjUser::_getNumberOfUsersPerAuthMode (  ) 

get number of users per auth mode

Definition at line 2788 of file class.ilObjUser.php.

Referenced by ilObjAuthSettingsGUI::authSettingsObject().

        {
                global $ilDB;
                
                $r = $ilDB->query("SELECT count(*) AS cnt, auth_mode FROM usr_data ".
                        "GROUP BY auth_mode");
                $cnt_arr = array();
                while($cnt = $r->fetchRow(DB_FETCHMODE_ASSOC))
                {
                        $cnt_arr[$cnt["auth_mode"]] = $cnt["cnt"];
                }

                return $cnt_arr;
        }

Here is the caller graph for this function:

ilObjUser::_getPersonalPicturePath ( a_usr_id,
a_size = "small",
a_force_pic = false 
)

get path to personal picture

Parameters:
string size "small", "xsmall" or "xxsmall" STATIC

Definition at line 2884 of file class.ilObjUser.php.

References $file, $query, $res, and ilUtil::getImagePath().

Referenced by ilLPListOfObjectsGUI::__showEditUser(), getPersonalPicturePath(), and ilLPUserItemListGUI::renderTypeImage().

        {
                global $ilDB;
                
                $query = "SELECT * FROM usr_pref WHERE ".
                        "keyword = 'public_upload' ".
                        "AND value = 'y' ".
                        "AND usr_id = '".$a_usr_id."'";

                $res = $ilDB->query($query);
                $upload = $res->numRows() ? true : false;

                $query = "SELECT * FROM usr_pref WHERE ".
                        "keyword = 'public_profile' ".
                        "AND value = 'y' ".
                        "AND usr_id = '".$a_usr_id."'";

                $res = $ilDB->query($query);
                $profile = $res->numRows() ? true : false;

                if(defined('ILIAS_MODULE'))
                {
                        $webspace_dir = ('.'.$webspace_dir);
                }
                $webspace_dir .= ('./'.ilUtil::getWebspaceDir());

                $image_dir = $webspace_dir."/usr_images";
                $thumb_file = $image_dir."/usr_".$a_usr_id."_".$a_size.".jpg";

                if((($upload && $profile) || $a_force_pic)
                        && @is_file($thumb_file))
                {
                        $file = $thumb_file."?t=".rand(1, 99999);
                }
                else
                {
                        $file = ilUtil::getImagePath("no_photo_".$a_size.".jpg");
                }

                return $file;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjUser::_getUserIdsByEmail ( a_email  )  [static]

STATIC METHOD get all user_ids of an email address.

Parameters:
string email of user
Returns:
integer id of user public

Definition at line 2049 of file class.ilObjUser.php.

References $ilias, $query, $res, and $row.

Referenced by ilPasswordAssistanceGUI::submitUsernameAssistanceForm().

        {
                global $ilias, $ilDB;
                
                $query = "SELECT login FROM usr_data ".
                        "WHERE email = ".$ilDB->quote($a_email)." and active=1";

                $res = $ilias->db->query($query);
                $ids = array ();
        while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
        {
            $ids[] = $row->login;
        }

                return $ids;    
        }

Here is the caller graph for this function:

ilObjUser::_getUsersForClipboadObject ( a_type,
a_id 
)

get all users, that have a certain object within their clipboard

Parameters:
string $a_type object type
string $a_type object type
Returns:
array array of user IDs

Definition at line 2653 of file class.ilObjUser.php.

References $q, $user_set, and $users.

Referenced by ilObjMediaObject::getUsages().

        {
                global $ilDB;

                $q = "SELECT DISTINCT user_id FROM personal_clipboard WHERE ".
                        "item_id = '$a_id' AND ".
                        "type = '$a_type'";
                $user_set = $ilDB->query($q);
                $users = array();
                while ($user_rec = $user_set->fetchRow(DB_FETCHMODE_ASSOC))
                {
                        $users[] = $user_rec["user_id"];
                }

                return $users;
        }

Here is the caller graph for this function:

ilObjUser::_lookupClientIP ( a_user_id  ) 

Definition at line 546 of file class.ilObjUser.php.

References $query, $res, and $row.

Referenced by ilObjTest::inviteGroup(), and ilObjTest::inviteRole().

        {
                global $ilDB;

                $query = "SELECT client_ip FROM usr_data WHERE usr_id = '".(int) $a_user_id."'";
                $res = $ilDB->query($query);
                
                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        return $row->client_ip;
                }
                return "";
        }

Here is the caller graph for this function:

ilObjUser::_lookupEmail ( a_user_id  ) 

Definition at line 532 of file class.ilObjUser.php.

References $query, $res, and $row.

Referenced by ilMail::distributeMail().

        {
                global $ilDB;

                $query = "SELECT email FROM usr_data WHERE usr_id = '".(int) $a_user_id."'";
                $res = $ilDB->query($query);
                
                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        return $row->email;
                }
                return false;
        }

Here is the caller graph for this function:

ilObjUser::_lookupHasIlias2Password ( a_user_login  ) 

check if user has ilias 2 password (imported user)

Definition at line 770 of file class.ilObjUser.php.

References $ilias, $q, and $user_set.

Referenced by ilInitialisation::initILIAS().

        {
                global $ilias, $ilDB;

                $q = "SELECT i2passwd FROM usr_data ".
                         "WHERE login = ".$ilDB->quote($a_user_login)."";
                $user_set = $ilias->db->query($q);

                if ($user_rec = $user_set->fetchRow(DB_FETCHMODE_ASSOC))
                {
                        if ($user_rec["i2passwd"] != "")
                        {
                                return true;
                        }
                }

                return false;
        }

Here is the caller graph for this function:

ilObjUser::_lookupId ( a_user_str  ) 

lookup id by login

Definition at line 595 of file class.ilObjUser.php.

References $q, and $user_set.

Referenced by ilPermissionGUI::changeOwner(), ilObjectStatusGUI::ilObjectStatusGUI(), ilRegistrationSettings::setApproveRecipientLogins(), ilRegistrationSettings::validate(), and ilUserImportParser::verifyEndTag().

        {
                global $ilDB;

                $q = "SELECT usr_id FROM usr_data".
                        " WHERE login =".$ilDB->quote($a_user_str);
                $user_set = $ilDB->query($q);
                $user_rec = $user_set->fetchRow(DB_FETCHMODE_ASSOC);
                return $user_rec["usr_id"];
        }

Here is the caller graph for this function:

ilObjUser::_lookupLanguage ( a_usr_id  ) 

Definition at line 1654 of file class.ilObjUser.php.

References $q, and $row.

Referenced by ilRegistrationGUI::__distributeMails().

        {
                global $ilDB;

                $q = "SELECT value FROM usr_pref WHERE usr_id='".$a_usr_id."' AND keyword = 'language'";
                $r = $ilDB->query($q);

                while($row = $r->fetchRow(DB_FETCHMODE_ASSOC))
                {
                        return $row['value'];
                }
                return 'en';
        }

Here is the caller graph for this function:

ilObjUser::_lookupLastLogin ( a_user_id  ) 

lookup last login

Definition at line 609 of file class.ilObjUser.php.

References $q, and $user_set.

Referenced by ilLPItemListGUI::renderObjectInfoXML().

        {
                global $ilDB;

                $q = "SELECT last_login FROM usr_data".
                        " WHERE usr_id =".$ilDB->quote($a_user_id);
                $user_set = $ilDB->query($q);
                $user_rec = $user_set->fetchRow(DB_FETCHMODE_ASSOC);
                return $user_rec["last_login"];
        }

Here is the caller graph for this function:

ilObjUser::_lookupLogin ( a_user_id  ) 
ilObjUser::_lookupName ( a_user_id  ) 
ilObjUser::_lookupPref ( a_usr_id,
a_keyword 
)

Definition at line 921 of file class.ilObjUser.php.

References $query, $res, and $row.

Referenced by ilObjUserFolder::createXMLExport().

        {
                global $ilDB;

                $query = "SELECT * FROM usr_pref WHERE usr_id='".$a_usr_id."' ".
                        "AND keyword = '".$a_keyword."'";
                $res = $ilDB->query($query);

                while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        return $row->value;
                }
                return false;
        }

Here is the caller graph for this function:

ilObjUser::_makeIlias2Password ( a_passwd  ) 

get encrypted Ilias 2 password (needed for imported ilias 2 users)

Definition at line 762 of file class.ilObjUser.php.

Referenced by _switchToIlias3Password(), and updatePassword().

        {
                return (crypt($a_passwd,substr($a_passwd,0,2)));
        }

Here is the caller graph for this function:

ilObjUser::_moveUsersToStyle ( a_from_skin,
a_from_style,
a_to_skin,
a_to_style 
)

skins and styles

Definition at line 2426 of file class.ilObjUser.php.

References $q, and _writePref().

Referenced by ilObjStyleSettingsGUI::saveStyleSettingsObject().

        {
                global $ilDB;
                
                $q = "SELECT up1.usr_id as usr_id FROM usr_pref AS up1, usr_pref AS up2 ".
                        " WHERE up1.keyword= ".$ilDB->quote("style")." AND up1.value= ".$ilDB->quote($a_from_style).
                        " AND up2.keyword= ".$ilDB->quote("skin")." AND up2.value= ".$ilDB->quote($a_from_skin).
                        " AND up1.usr_id = up2.usr_id ";

                $usr_set = $ilDB->query($q);

                while ($usr_rec = $usr_set->fetchRow(DB_FETCHMODE_ASSOC))
                {
                        ilObjUser::_writePref($usr_rec["usr_id"], "skin", $a_to_skin);
                        ilObjUser::_writePref($usr_rec["usr_id"], "style", $a_to_style);
                }
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjUser::_search ( &$  a_search_obj,
active = 1 
) [static]

STATIC METHOD search for user data.

This method is called from class.ilSearch

Parameters:
object object of search class public

Definition at line 2163 of file class.ilObjUser.php.

References $active, $counter, $ilBench, $query, $res, and $row.

Referenced by ilSearch::performSearch().

        {
                global $ilBench;

                // NO CLASS VARIABLES IN STATIC METHODS

                // TODO: CHECK IF ITEMS ARE PUBLIC VISIBLE

                $where_condition = $a_search_obj->getWhereCondition("like",array("login","firstname","lastname","title",
                                                                                                                                                 "email","institution","street","city",
                                                                                                                                                 "zipcode","country","phone_home","fax"));
                $in = $a_search_obj->getInStatement("usr_data.usr_id");

                $query = "SELECT DISTINCT(usr_data.usr_id) FROM usr_data ".
                        "LEFT JOIN usr_pref USING (usr_id) ".
                        $where_condition." ".
                        $in." ".
                        "AND usr_data.usr_id != '".ANONYMOUS_USER_ID."' ";
#                       "AND usr_pref.keyword = 'public_profile' ";
#                       "AND usr_pref.value = 'y'";
                
                if (is_numeric($active)  && $active > -1)
                $query .= "AND active = '$active'";

                $ilBench->start("Search", "ilObjUser_search");
                $res = $a_search_obj->ilias->db->query($query);
                $ilBench->stop("Search", "ilObjUser_search");

                $counter = 0;

                while ($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        $result_data[$counter++]["id"]                          =  $row->usr_id;

                        // LINKS AND TARGETS AREN'T SAVED ANYMORE, SEARCHGUI HAS TO CALL ilObjUser::_getSearchLink
                        // TO GET THE LINK OF SPECIFIC OBJECT
                        #$result_data[$counter]["link"]                         =  "profile.php?user=".$row->usr_id;
                        #$result_data[$counter++]["target"]                     =  "";
                }
                return $result_data ? $result_data : array();
        }

Here is the caller graph for this function:

ilObjUser::_switchToIlias3Password ( a_user,
a_pw 
)

Definition at line 789 of file class.ilObjUser.php.

References $ilias, $q, $user_set, and _makeIlias2Password().

Referenced by ilInitialisation::initILIAS().

        {
                global $ilias, $ilDB;

                $q = "SELECT i2passwd FROM usr_data ".
                         "WHERE login = ".$ilDB->quote($a_user)."";
                $user_set = $ilias->db->query($q);

                if ($user_rec = $user_set->fetchRow(DB_FETCHMODE_ASSOC))
                {
                        if ($user_rec["i2passwd"] == ilObjUser::_makeIlias2Password($a_pw))
                        {
                                $q = "UPDATE usr_data SET passwd=".$ilDB->quote(md5($a_pw)).", i2passwd=''".
                                        "WHERE login = ".$ilDB->quote($a_user);
                                $ilias->db->query($q);
                                return true;
                        }
                }

                return false;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjUser::_uploadPersonalPicture ( tmp_file,
obj_id 
)

Create a personal picture image file from a temporary image file.

Parameters:
string $tmp_file Complete path to the temporary image file
int $obj_id The object id of the related user account
Returns:
returns TRUE on success, otherwise FALSE

Definition at line 2841 of file class.ilObjUser.php.

References $obj_id, _writePref(), ilUtil::getConvertCmd(), and ilUtil::getWebspaceDir().

Referenced by ilUserImportParser::importEndTag().

        {
                $webspace_dir = ilUtil::getWebspaceDir();
                $image_dir = $webspace_dir."/usr_images";
                $store_file = "usr_".$obj_id."."."jpg";
                $target_file = $image_dir."/$store_file";
        
                chmod($tmp_file, 0770);
        
                // take quality 100 to avoid jpeg artefacts when uploading jpeg files
                // taking only frame [0] to avoid problems with animated gifs
                $show_file  = "$image_dir/usr_".$obj_id.".jpg"; 
                $thumb_file = "$image_dir/usr_".$obj_id."_small.jpg";
                $xthumb_file = "$image_dir/usr_".$obj_id."_xsmall.jpg"; 
                $xxthumb_file = "$image_dir/usr_".$obj_id."_xxsmall.jpg";
        
                system(ilUtil::getConvertCmd()." $tmp_file" . "[0] -geometry 200x200 -quality 100 JPEG:$show_file");
                system(ilUtil::getConvertCmd()." $tmp_file" . "[0] -geometry 100x100 -quality 100 JPEG:$thumb_file");
                system(ilUtil::getConvertCmd()." $tmp_file" . "[0] -geometry 75x75 -quality 100 JPEG:$xthumb_file");
                system(ilUtil::getConvertCmd()." $tmp_file" . "[0] -geometry 30x30 -quality 100 JPEG:$xxthumb_file");

                // store filename
                ilObjUser::_writePref($obj_id, "profile_image", $store_file);

                return TRUE;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjUser::_writeAuthMode ( a_usr_id,
a_auth_mode 
)

Definition at line 1697 of file class.ilObjUser.php.

References $q.

Referenced by ilSOAPAuth::login().

        {
                global $ilDB;

                $q = "UPDATE usr_data ".
                        " SET auth_mode = ".$ilDB->quote($a_auth_mode).
                        " WHERE usr_id=".$ilDB->quote($a_usr_id);
                $usr_set = $ilDB->query($q);
        }

Here is the caller graph for this function:

ilObjUser::_writeExternalAccount ( a_usr_id,
a_ext_id 
)

Definition at line 1687 of file class.ilObjUser.php.

References $q.

Referenced by ilSOAPAuth::login().

        {
                global $ilDB;

                $q = "UPDATE usr_data ".
                        " SET ext_account = ".$ilDB->quote($a_ext_id).
                        " WHERE usr_id=".$ilDB->quote($a_usr_id);
                $usr_set = $ilDB->query($q);
        }

Here is the caller graph for this function:

ilObjUser::_writePref ( a_usr_id,
a_keyword,
a_value 
)

Definition at line 853 of file class.ilObjUser.php.

References $q.

Referenced by _moveUsersToStyle(), _uploadPersonalPicture(), and writePref().

        {
                global $ilDB;

                //DELETE
                $q = "DELETE FROM usr_pref ".
                         "WHERE usr_id='".$a_usr_id."' ".
                         "AND keyword='".$a_keyword."'";
                $ilDB->query($q);

                //INSERT
                if ($a_value != "")
                {
                        $q = "INSERT INTO usr_pref ".
                                 "(usr_id, keyword, value) ".
                                 "VALUES ".
                                 "('".$a_usr_id."', '".$a_keyword."', '".$a_value."')";

                        $ilDB->query($q);
                }
        }

Here is the caller graph for this function:

ilObjUser::addDesktopItem ( a_item_id,
a_type,
a_par = "" 
)

add an item to user's personal desktop

Parameters:
int $a_item_id ref_id for objects, that are in the main tree (learning modules, forums) obj_id for others
string $a_type object type

Definition at line 2451 of file class.ilObjUser.php.

References $d, $q, and ilObject::getId().

        {
                $q = "SELECT * FROM desktop_item WHERE ".
                        "item_id = '$a_item_id' AND type = '$a_type' AND user_id = '".
                        $this->getId()."'";
                $item_set = $this->ilias->db->query($q);

                // only insert if item is not already on desktop
                if (!$d = $item_set->fetchRow())
                {
                        $q = "INSERT INTO desktop_item (item_id, type, user_id, parameters) VALUES ".
                                " ('$a_item_id','$a_type','".$this->getId()."' , '$a_par')";
                        $this->ilias->db->query($q);
                }
        }

Here is the call graph for this function:

ilObjUser::addObjectToClipboard ( a_item_id,
a_type,
a_title 
)

add an item to user's personal clipboard

Parameters:
int $a_item_id ref_id for objects, that are in the main tree (learning modules, forums) obj_id for others
string $a_type object type

Definition at line 2604 of file class.ilObjUser.php.

References $d, $q, and ilObject::getId().

        {
                $q = "SELECT * FROM personal_clipboard WHERE ".
                        "item_id = '$a_item_id' AND type = '$a_type' AND user_id = '".
                        $this->getId()."'";
                $item_set = $this->ilias->db->query($q);

                // only insert if item is not already on desktop
                if (!$d = $item_set->fetchRow())
                {
                        $q = "INSERT INTO personal_clipboard (item_id, type, user_id, title) VALUES ".
                                " ('$a_item_id','$a_type','".$this->getId()."', '".$a_title."')";
                        $this->ilias->db->query($q);
                }
        }

Here is the call graph for this function:

ilObjUser::addUserDefinedFieldEntry (  ) 

Definition at line 2979 of file class.ilObjUser.php.

References $query.

Referenced by saveAsNew().

        {
                $query = "INSERT INTO usr_defined_data ".
                        "SET usr_id = '".$this->getId()."'";
                $this->db->query($query);

                return true;
        }

Here is the caller graph for this function:

ilObjUser::assignData ( a_data  ) 

loads a record "user" from array public

Parameters:
array userdata

Definition at line 257 of file class.ilObjUser.php.

References $ilErr, setAuthMode(), setCity(), setClientIP(), setComment(), setCountry(), setDepartment(), setEmail(), setExternalAccount(), setFax(), setFirstname(), setFullname(), setGender(), setHobby(), setInstitution(), setLastLogin(), setLastname(), setLastUpdate(), setLogin(), setMatriculation(), setPasswd(), setPhoneHome(), setPhoneMobile(), setPhoneOffice(), setProfileIncomplete(), setStreet(), setTimeLimitFrom(), setTimeLimitMessage(), setTimeLimitOwner(), setTimeLimitUnlimited(), setTimeLimitUntil(), setUTitle(), and setZipcode().

Referenced by read().

        {
                global $ilErr;

                // basic personal data
                $this->setLogin($a_data["login"]);
                if (! $a_data["passwd_type"])
                {
                         $ilErr->raiseError("<b>Error: passwd_type missing in function assignData(). ".
                                                                $this->id."!</b><br />class: ".get_class($this)."<br />Script: "
                                                                .__FILE__."<br />Line: ".__LINE__, $ilErr->FATAL);
                }

                if ($a_data["passwd"] != "********")
                {
                        $this->setPasswd($a_data["passwd"], $a_data["passwd_type"]);
                }

                $this->setGender($a_data["gender"]);
                $this->setUTitle($a_data["title"]);
                $this->setFirstname($a_data["firstname"]);
                $this->setLastname($a_data["lastname"]);
                $this->setFullname();

                // address data
                $this->setInstitution($a_data["institution"]);
                $this->setDepartment($a_data["department"]);
                $this->setStreet($a_data["street"]);
                $this->setCity($a_data["city"]);
                $this->setZipcode($a_data["zipcode"]);
                $this->setCountry($a_data["country"]);
                $this->setPhoneOffice($a_data["phone_office"]);
                $this->setPhoneHome($a_data["phone_home"]);
                $this->setPhoneMobile($a_data["phone_mobile"]);
                $this->setFax($a_data["fax"]);
                $this->setMatriculation($a_data["matriculation"]);
                $this->setEmail($a_data["email"]);
                $this->setHobby($a_data["hobby"]);
                $this->setClientIP($a_data["client_ip"]);

                // system data
                $this->setLastLogin($a_data["last_login"]);
                $this->setLastUpdate($a_data["last_update"]);
                $this->create_date      = $a_data["create_date"];
        $this->setComment($a_data["referral_comment"]);
        $this->approve_date = $a_data["approve_date"];
        $this->active = $a_data["active"];
                $this->accept_date = $a_data["agree_date"];

        // time limitation
        $this->setTimeLimitOwner($a_data["time_limit_owner"]);
        $this->setTimeLimitUnlimited($a_data["time_limit_unlimited"]);
        $this->setTimeLimitFrom($a_data["time_limit_from"]);
        $this->setTimeLimitUntil($a_data["time_limit_until"]);
                $this->setTimeLimitMessage($a_data['time_limit_message']);
                
                // user profile incomplete?
                $this->setProfileIncomplete($a_data["profile_incomplete"]);

                //iLinc
                //$this->setiLincData($a_data['ilinc_id'],$a_data['ilinc_login'],$a_data['ilinc_passwd']);
                
                //authentication
                $this->setAuthMode($a_data['auth_mode']);
                $this->setExternalAccount($a_data['ext_account']);
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjUser::checkTimeLimit (  ) 

Definition at line 1923 of file class.ilObjUser.php.

References getTimeLimitFrom(), getTimeLimitUnlimited(), and getTimeLimitUntil().

        {
                if($this->getTimeLimitUnlimited())
                {
                        return true;
                }
                if($this->getTimeLimitFrom() < time() and $this->getTimeLimitUntil() > time())
                {
                        return true;
                }
                return false;
        }

Here is the call graph for this function:

ilObjUser::checkUserId (  ) 

Definition at line 1985 of file class.ilObjUser.php.

References $data.

        {
                $r = $this->ilias->db->query("SELECT usr_id FROM usr_data WHERE login='".$this->ilias->auth->getUsername()."'");
                //query has got a result
                if ($r->numRows() > 0)
                {
                        $data = $r->fetchRow();
                        $this->id = $data[0];

                        return $this->id;
                }

                return false;
        }

ilObjUser::delete (  ) 

deletes a user public

Parameters:
integer user_id

Reimplemented from ilObject.

Definition at line 975 of file class.ilObjUser.php.

References $q, $rbacadmin, ilEventParticipants::_deleteByUser(), ilObjUserTracking::_deleteUser(), ilObjCourse::_deleteUser(), ilLinkCheckNotify::_deleteUser(), ilObjForum::_deleteUser(), deleteUserDefinedFieldEntries(), and ilObject::getId().

        {
                global $rbacadmin;

                // remove mailbox / update sent mails
                include_once ("classes/class.ilMailbox.php");
                $mailbox = new ilMailbox($this->getId());
                $mailbox->delete();
                $mailbox->updateMailsOfDeletedUser();

                // delete user_account
                $this->ilias->db->query("DELETE FROM usr_data WHERE usr_id='".$this->getId()."'");

                // delete user_prefs
                $this->ilias->db->query("DELETE FROM usr_pref WHERE usr_id='".$this->getId()."'");
                
                // delete user_session
                $this->ilias->db->query("DELETE FROM usr_session WHERE user_id='".$this->getId()."'");

                // remove user from rbac
                $rbacadmin->removeUser($this->getId());

                // remove bookmarks
                // TODO: move this to class.ilBookmarkFolder
                $q = "DELETE FROM bookmark_tree WHERE tree='".$this->getId()."'";
                $this->ilias->db->query($q);

                $q = "DELETE FROM bookmark_data WHERE user_id='".$this->getId()."'";
                $this->ilias->db->query($q);

                // DELETE FORUM ENTRIES (not complete in the moment)
                include_once './classes/class.ilObjForum.php';
                ilObjForum::_deleteUser($this->getId());

                // Delete link check notify entries
                include_once './classes/class.ilLinkCheckNotify.php';
                ilLinkCheckNotify::_deleteUser($this->getId());

                // Delete crs entries
                include_once './course/classes/class.ilObjCourse.php';
                ilObjCourse::_deleteUser($this->getId());

                // Delete user tracking
                include_once './Services/Tracking/classes/class.ilObjUserTracking.php';
                ilObjUserTracking::_deleteUser($this->getId());

                include_once 'course/classes/Event/class.ilEventParticipants.php';
                ilEventParticipants::_deleteByUser($this->getId());

                // Delete group registrations
                $q = "DELETE FROM grp_registration WHERE user_id='".$this->getId()."'";
                $this->ilias->db->query($q);

                // Delete user defined field entries
                $this->deleteUserDefinedFieldEntries();

                // delete object data
                parent::delete();
                return true;
        }

Here is the call graph for this function:

ilObjUser::deleteUserDefinedFieldEntries (  ) 

Definition at line 2988 of file class.ilObjUser.php.

References $query.

Referenced by delete().

        {
                $query = "DELETE FROM usr_defined_data ".
                        "WHERE usr_id = '".$this->getId()."'";
                $this->db->query($query);

                return true;
        }

Here is the caller graph for this function:

ilObjUser::dropDesktopItem ( a_item_id,
a_type 
)

drop an item from user's personal desktop

Parameters:
int $a_item_id ref_id for objects, that are in the main tree (learning modules, forums) obj_id for others
string $a_type object type

Definition at line 2490 of file class.ilObjUser.php.

References $q.

        {
                $q = "DELETE FROM desktop_item WHERE ".
                        " item_id = '$a_item_id' AND".
                        " type = '$a_type' AND".
                        " user_id = '".$this->getId()."'";
                $this->ilias->db->query($q);
        }

ilObjUser::getActive (  ) 

get user active state public

Definition at line 1821 of file class.ilObjUser.php.

    {
        return $this->active;
    }

& ilObjUser::getAppliedUsers (  ) 

Definition at line 1944 of file class.ilObjUser.php.

References __readAppliedUsers(), and ilObject::getId().

        {
                $this->applied_users = array();
                $this->__readAppliedUsers($this->getId());

                return $this->applied_users ? $this->applied_users : array();
        }

Here is the call graph for this function:

ilObjUser::getApproveDate (  ) 

get date the user account was activated public

Returns:
string date of last update

Definition at line 1785 of file class.ilObjUser.php.

    {
        return $this->approve_date;
    }

ilObjUser::getAuthMode ( a_auth_key = false  ) 

get auth mode public

Definition at line 2728 of file class.ilObjUser.php.

References ilAuthUtils::_getAuthMode().

Referenced by saveAsNew(), and update().

        {
                if (!$a_auth_key)
                {
                        return $this->auth_mode;
                }
                
                include_once('classes/class.ilAuthUtils.php');
                return ilAuthUtils::_getAuthMode($this->auth_mode);
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjUser::getCity (  ) 

get city public

Definition at line 1438 of file class.ilObjUser.php.

Referenced by getProfileAsString().

        {
                return $this->city;
        }

Here is the caller graph for this function:

ilObjUser::getClientIP (  ) 

get client ip number public

Definition at line 1571 of file class.ilObjUser.php.

        {
                return $this->client_ip;
        }

ilObjUser::getClipboardObjects ( a_type = ""  ) 

get all clipboard objects of user and specified type

Definition at line 2623 of file class.ilObjUser.php.

References $q, and ilObject::_lookupTitle().

        {
                $type_str = ($a_type != "")
                        ? " AND type = '$a_type' "
                        : "";
                $q = "SELECT * FROM personal_clipboard WHERE ".
                        "user_id = '".$this->getId()."' ".
                        $type_str;
                $objs = $this->ilias->db->query($q);
                $objects = array();
                while ($obj = $objs->fetchRow(DB_FETCHMODE_ASSOC))
                {
                        if ($obj["type"] == "mob")
                        {
                                $obj["title"] = ilObject::_lookupTitle($obj["item_id"]);
                        }
                        $objects[] = array ("id" => $obj["item_id"],
                                "type" => $obj["type"], "title" => $obj["title"]);
                }
                return $objects;
        }

Here is the call graph for this function:

ilObjUser::getComment (  ) 

get referral comment public

Definition at line 1764 of file class.ilObjUser.php.

Referenced by getProfileAsString().

    {
        return $this->referral_comment;
    }

Here is the caller graph for this function:

ilObjUser::getCountry (  ) 

get country public

Definition at line 1476 of file class.ilObjUser.php.

Referenced by getProfileAsString().

        {
                return $this->country;
        }

Here is the caller graph for this function:

ilObjUser::getCourses (  ) 

get courses the user has access to public

Returns:
array lessons // TODO: query wird nicht abgeschickt!!!

Definition at line 1181 of file class.ilObjUser.php.

References ilObject::$lng.

        {
                global $lng;

                //initialize array
                $courses = array();
                //query
                $sql = "SELECT * FROM courses
                                WHERE user_fk='".$this->id."'
                                AND read=1";
                $courses[] = array(
                        "id" => 1,
                        "title" => "Course 1",
                        "desc" => "description of course one",
                        "content" => "This is Course One",
                        "datetime" => date("Y-m-d")
                        );
                return $courses;
        }

ilObjUser::getCurrentLanguage (  ) 

returns the current language (may differ from user's pref setting!)

Definition at line 1711 of file class.ilObjUser.php.

References $_SESSION.

        {
                return $_SESSION['lang'];
        }

ilObjUser::getDepartment (  ) 

get department public

Definition at line 1400 of file class.ilObjUser.php.

Referenced by getProfileAsString().

        {
                return $this->department;
        }

Here is the caller graph for this function:

ilObjUser::getDesktopItems ( a_types = ""  ) 

get all desktop items of user and specified type

note: the implementation of this method is not good style (directly reading tables object_data and object_reference), must be revised someday...

Definition at line 2529 of file class.ilObjUser.php.

References $q, $rbacsystem, and $tree.

        {
                global $ilUser, $rbacsystem, $tree;

                
                if ($a_types == "")
                {
                        $q = "SELECT obj.obj_id, obj.description, oref.ref_id, obj.title, obj.type ".
                                " FROM desktop_item AS it, object_reference AS oref ".
                                        ", object_data AS obj".
                                " WHERE ".
                                "it.item_id = oref.ref_id AND ".
                                "oref.obj_id = obj.obj_id AND ".
                                "it.user_id = '".$this->getId()."'";

                        $item_set = $this->ilias->db->query($q);
                        $items = array();
                        while ($item_rec = $item_set->fetchRow(DB_FETCHMODE_ASSOC))
                        {
                                if ($tree->isInTree($item_rec["ref_id"]))
                                {
                                        $parent_ref = $tree->getParentId($item_rec["ref_id"]);
                                        $par_left = $tree->getLeftValue($parent_ref);
                                        $par_left = sprintf("%010d", $par_left);
                                        $items[$par_left.$item_rec["title"].$item_rec["ref_id"]] =
                                                array("ref_id" => $item_rec["ref_id"], 
                                                        "obj_id" => $item_rec["obj_id"],
                                                        "type" => $item_rec["type"],
                                                        "title" => $item_rec["title"],
                                                        "description" => $item_rec["description"],
                                                        "parent_ref" => $parent_ref);
                                }
                        }
                        ksort($items);
                }
                else
                {
                        if (!is_array($a_types))
                        {
                                $a_types = array($a_types);
                        }
                        $items = array();
                        $foundsurveys = array();
                        foreach($a_types as $a_type)
                        {
                                $q = "SELECT obj.obj_id, obj.description, oref.ref_id, obj.title FROM desktop_item AS it, object_reference AS oref ".
                                        ", object_data AS obj WHERE ".
                                        "it.item_id = oref.ref_id AND ".
                                        "oref.obj_id = obj.obj_id AND ".
                                        "it.type = '$a_type' AND ".
                                        "it.user_id = '".$this->getId()."' ".
                                        "ORDER BY title";
        
                                $item_set = $this->ilias->db->query($q);
                                while ($item_rec = $item_set->fetchRow(DB_FETCHMODE_ASSOC))
                                {
                                        $items[$item_rec["title"].$a_type.$item_rec["ref_id"]] =
                                                array("ref_id" => $item_rec["ref_id"], 
                                                "obj_id" => $item_rec["obj_id"], "type" => $a_type,
                                                "title" => $item_rec["title"], "description" => $item_rec["description"]);
                                }
                                
                        }
                        ksort($items);
                }
                return $items;
        }

ilObjUser::getEmail (  ) 

get email address public

Definition at line 1609 of file class.ilObjUser.php.

Referenced by getProfileAsString().

        {
                return $this->email;
        }

Here is the caller graph for this function:

ilObjUser::getExternalAccount (  ) 

get external account

note: 3.7.0 uses this field only for cas and soap authentication.

public

Definition at line 2758 of file class.ilObjUser.php.

Referenced by saveAsNew(), and update().

        {
                return $this->ext_account;
        }

Here is the caller graph for this function:

ilObjUser::getFax (  ) 

get fax public

Definition at line 1552 of file class.ilObjUser.php.

Referenced by getProfileAsString().

        {
                return $this->fax;
        }

Here is the caller graph for this function:

ilObjUser::getFirstname (  ) 

get firstname public

Definition at line 1343 of file class.ilObjUser.php.

Referenced by getProfileAsString().

        {
                return $this->firstname;
        }

Here is the caller graph for this function:

ilObjUser::getFullname ( a_max_strlen = 0  ) 

get fullname public

Parameters:
integer max. string length to return (optional) if string length of fullname is greater than given a_max_strlen the name is shortened in the following way: 1. abreviate firstname (-> Dr. J. Smith) if fullname is still too long 2. drop title (-> John Smith) if fullname is still too long 3. drop title and abreviate first name (J. Smith) if fullname is still too long 4. drop title and firstname and shorten lastname to max length (--> Smith)

Definition at line 1089 of file class.ilObjUser.php.

References ilUtil::stripSlashes().

        {
                if (!$a_max_strlen)
                {
                        return ilUtil::stripSlashes($this->fullname);
                }
                
                if (strlen($this->fullname) <= $a_max_strlen)
                {
                        return ilUtil::stripSlashes($this->fullname);
                }
                
                if ((strlen($this->utitle) + strlen($this->lastname) + 4) <= $a_max_strlen)
                {
                        return ilUtil::stripSlashes($this->utitle." ".substr($this->firstname,0,1).". ".$this->lastname);
                }
                
                if ((strlen($this->firstname) + strlen($this->lastname) + 1) <= $a_max_strlen)
                {
                        return ilUtil::stripSlashes($this->firstname." ".$this->lastname);
                }

                if ((strlen($this->lastname) + 3) <= $a_max_strlen)
                {
                        return ilUtil::stripSlashes(substr($this->firstname,0,1).". ".$this->lastname);
                }
                
                return ilUtil::stripSlashes(substr($this->lastname,0,$a_max_strlen));
        }

Here is the call graph for this function:

ilObjUser::getGender (  ) 

get gender public

Definition at line 1301 of file class.ilObjUser.php.

Referenced by getProfileAsString().

        {
                return $this->gender;
        }

Here is the caller graph for this function:

ilObjUser::getGroupMemberships ( a_user_id = ""  ) 

Definition at line 2224 of file class.ilObjUser.php.

References $rbacreview, $tree, $user_id, and ilObject::getId().

        {
                global $rbacreview, $tree;

                if (strlen($a_user_id) > 0)
                {
                        $user_id = $a_user_id;
                }
                else
                {
                        $user_id = $this->getId();
                }

                $grp_memberships = array();
                
                // get all roles which the user is assigned to
                $roles = $rbacreview->assignedRoles($user_id);

                foreach ($roles as $role)
                {
                        $ass_rolefolders = $rbacreview->getFoldersAssignedToRole($role);        //rolef_refids

                        foreach ($ass_rolefolders as $role_folder)
                        {
                                $node = $tree->getParentNodeData($role_folder);

                                if ($node["type"] == "grp")
                                {
                                        $group =& $this->ilias->obj_factory->getInstanceByRefId($node["child"]);

                                        if ($group->isMember($user_id) == true && !in_array($group->getId(), $grp_memberships) )
                                        {
                                                array_push($grp_memberships, $group->getId());
                                        }
                                }

                                unset($group);
                        }
                }

                return $grp_memberships;
        }

Here is the call graph for this function:

ilObjUser::getHobby (  ) 

get hobby public

Definition at line 1628 of file class.ilObjUser.php.

Referenced by getProfileAsString().

        {
                return $this->hobby;
        }

Here is the caller graph for this function:

ilObjUser::getInstitution (  ) 

get institution public

Definition at line 1381 of file class.ilObjUser.php.

Referenced by getProfileAsString().

        {
                return $this->institution;
        }

Here is the caller graph for this function:

ilObjUser::getLanguage (  ) 

returns a 2char-language-string public

Returns:
string language

Definition at line 1649 of file class.ilObjUser.php.

        {
                 return $this->prefs["language"];
        }

ilObjUser::getLastLogin (  ) 

returns last login date public

Returns:
string date

Definition at line 1731 of file class.ilObjUser.php.

        {
                 return $this->last_login;
        }

ilObjUser::getLastname (  ) 

get lastname public

Definition at line 1362 of file class.ilObjUser.php.

Referenced by getProfileAsString().

        {
                return $this->lastname;
        }

Here is the caller graph for this function:

ilObjUser::getLastUpdate (  ) 

Definition at line 1745 of file class.ilObjUser.php.

        {
                return $this->last_update;
        }

ilObjUser::getLastVisitedLessons (  ) 

get read lessons, ordered by timestamp public

Returns:
array lessons

Definition at line 1125 of file class.ilObjUser.php.

References $q, and $result.

        {
                //query
                $q = "SELECT * FROM lo_access ".
                        "WHERE usr_id='".$this->id."' ".
                        "ORDER BY timestamp DESC";
                $rst = $this->ilias->db->query($q);

                // fill array
                $result = array();
                while($record = $rst->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        $result[] = array(
                        "timestamp"     =>      $record->timestamp,
                        "usr_id"                =>      $record->usr_id,
                        "lm_id"         =>      $record->lm_id,
                        "obj_id"                =>      $record->obj_id,
                        "lm_title"      =>      $record->lm_title);
                }
                return $result;
        }

ilObjUser::getLessons (  ) 

get all lessons, unordered public

Returns:
array lessons

Definition at line 1153 of file class.ilObjUser.php.

References $q, and $result.

        {
                //query
                $q = "SELECT * FROM lo_access ".
                        "WHERE usr_id='".$this->id."' ";
                $rst = $this->ilias->db->query($q);

                // fill array
                $result = array();
                while($record = $rst->fetchRow(DB_FETCHMODE_OBJECT))
                {
                        $result[] = array(
                        "timestamp"     =>      $record->timestamp,
                        "usr_id"                =>      $record->usr_id,
                        "lm_id"         =>      $record->lm_id,
                        "obj_id"                =>      $record->obj_id,
                        "lm_title"      =>      $record->lm_title);
                }
                return $result;
        }

ilObjUser::getLiterature (  ) 

get literature bookmarks public

Returns:
array lessons // TODO: query wird nicht abgeschickt!!!

Definition at line 1207 of file class.ilObjUser.php.

        {
                //initialize array
                $literature = array();
                //query
                $sql = "SELECT * FROM literature";

                $literature[] = array(
                        "id" => 1,
                        "url" => "http://www.gutenberg.de",
                        "desc" => "project gutenberg",
                        );

                return $literature;
        }

ilObjUser::getLogin (  ) 

get login / username public

Definition at line 1249 of file class.ilObjUser.php.

Referenced by getProfileAsString().

        {
                return $this->login;
        }

Here is the caller graph for this function:

ilObjUser::getLoginByUserId ( a_userid  ) 

Definition at line 2093 of file class.ilObjUser.php.

References $ilias, $query, and $row.

Referenced by ilObjPaymentSettingsGUI::editVendor().

    {
        global $ilias;

        $query = "SELECT login FROM usr_data ".
            "WHERE usr_id = '".$a_userid."'";

        $row = $ilias->db->getRow($query,DB_FETCHMODE_OBJECT);

        return $row->login ? $row->login : false;
    }

Here is the caller graph for this function:

ilObjUser::getMatriculation (  ) 

get matriculation number public

Definition at line 1590 of file class.ilObjUser.php.

Referenced by getProfileAsString().

        {
                return $this->matriculation;
        }

Here is the caller graph for this function:

ilObjUser::getPasswd (  ) 

get password

Returns:
password. The password is encoded depending on the current password type. public
See also:
getPasswdType

Definition at line 1272 of file class.ilObjUser.php.

        {
                return $this->passwd;
        }

ilObjUser::getPasswdType (  ) 

get password type

Returns:
password type (IL_PASSWD_PLAIN, IL_PASSWD_MD5 or IL_PASSWD_CRYPT). public
See also:
getPasswd

Definition at line 1282 of file class.ilObjUser.php.

        {
                return $this->passwd_type;
        }

ilObjUser::getPersonalPicturePath ( a_size = "small",
a_force_pic = false 
)

get path to personal picture

Parameters:
string size "small", "xsmall" or "xxsmall"

Definition at line 2873 of file class.ilObjUser.php.

References _getPersonalPicturePath(), and ilObject::getId().

        {
                return ilObjUser::_getPersonalPicturePath($this->getId(),$a_size,$a_force_pic);
        }

Here is the call graph for this function:

ilObjUser::getPhoneHome (  ) 

get home phone public

Definition at line 1514 of file class.ilObjUser.php.

Referenced by getProfileAsString().

        {
                return $this->phone_home;
        }

Here is the caller graph for this function:

ilObjUser::getPhoneMobile (  ) 

get mobile phone public

Definition at line 1533 of file class.ilObjUser.php.

Referenced by getProfileAsString().

        {
                return $this->phone_mobile;
        }

Here is the caller graph for this function:

ilObjUser::getPhoneOffice (  ) 

get office phone public

Definition at line 1495 of file class.ilObjUser.php.

Referenced by getProfileAsString().

        {
                return $this->phone_office;
        }

Here is the caller graph for this function:

ilObjUser::getPref ( a_keyword  ) 

get a user preference

Parameters:
string name of parameter public

Definition at line 916 of file class.ilObjUser.php.

        {
                return $this->prefs[$a_keyword];
        }

ilObjUser::getProfileAsString ( &$  a_language,
a_with_access_limits = true 
)

Get formatted mail body text of user profile data.

Parameters:
object Language object (choose user language of recipient) or null to use language of current user

Definition at line 3002 of file class.ilObjUser.php.

References $gender, ilObject::$lng, $rbacreview, ilObject::_lookupTitle(), getCity(), getComment(), getCountry(), ilObject::getCreateDate(), getDepartment(), getEmail(), getFax(), getFirstname(), getGender(), getHobby(), getInstitution(), getLastname(), getLogin(), getMatriculation(), getPhoneHome(), getPhoneMobile(), getPhoneOffice(), getStreet(), getTimeLimitFrom(), getTimeLimitUnlimited(), getTimeLimitUntil(), getUTitle(), and getZipcode().

        {
                include_once 'classes/class.ilObjRole.php';

                global $lng,$rbacreview;

                $language =& $a_language;
                $language->loadLanguageModule('registration');
                $language->loadLanguageModule('crs');

                $body = '';
        $body .= ($language->txt("login").": ".$this->getLogin()."\n");
                
                if(strlen($this->getUTitle()))
                {
                        $body .= ($language->txt("title").": ".$this->getUTitle()."\n");
                }
                if(strlen($this->getGender()))
                {
                        $gender = ($this->getGender() == 'm') ? 
                                $language->txt('gender_m') :
                                $language->txt('gender_f');
                        $body .= ($language->txt("gender").": ".$gender."\n");
                }
                if(strlen($this->getFirstname()))
                {
                        $body .= ($language->txt("firstname").": ".$this->getFirstname()."\n");
                }
                if(strlen($this->getLastname()))
                {
                        $body .= ($language->txt("lastname").": ".$this->getLastname()."\n");
                }
                if(strlen($this->getInstitution()))
                {
                        $body .= ($language->txt("institution").": ".$this->getInstitution()."\n");
                }
                if(strlen($this->getDepartment()))
                {
                        $body .= ($language->txt("department").": ".$this->getDepartment()."\n");
                }
                if(strlen($this->getStreet()))
                {
                        $body .= ($language->txt("street").": ".$this->getStreet()."\n");
                }
                if(strlen($this->getCity()))
                {
                        $body .= ($language->txt("city").": ".$this->getCity()."\n");
                }
                if(strlen($this->getZipcode()))
                {
                        $body .= ($language->txt("zipcode").": ".$this->getZipcode()."\n");
                }
                if(strlen($this->getCountry()))
                {
                        $body .= ($language->txt("country").": ".$this->getCountry()."\n");
                }
                if(strlen($this->getPhoneOffice()))
                {
                        $body .= ($language->txt("phone_office").": ".$this->getPhoneOffice()."\n");
                }
                if(strlen($this->getPhoneHome()))
                {
                        $body .= ($language->txt("phone_home").": ".$this->getPhoneHome()."\n");
                }
                if(strlen($this->getPhoneMobile()))
                {
                        $body .= ($language->txt("phone_mobile").": ".$this->getPhoneMobile()."\n");
                }
                if(strlen($this->getFax()))
                {
                        $body .= ($language->txt("fax").": ".$this->getFax()."\n");
                }
                if(strlen($this->getEmail()))
                {
                        $body .= ($language->txt("email").": ".$this->getEmail()."\n");
                }
                if(strlen($this->getHobby()))
                {
                        $body .= ($language->txt("hobby").": ".$this->getHobby()."\n");
                }
                if(strlen($this->getComment()))
                {
                        $body .= ($language->txt("referral_comment").": ".$this->getComment()."\n");
                }
                if(strlen($this->getMatriculation()))
                {
                        $body .= ($language->txt("matriculation").": ".$this->getMatriculation()."\n");
                }
                if(strlen($this->getCreateDate()))
                {
                        $body .= ($language->txt("create_date").": ".$this->getCreateDate()."\n");
                }

                foreach($rbacreview->getGlobalRoles() as $role)
                {
                        if($rbacreview->isAssigned($this->getId(),$role))
                        {
                                $gr[] = ilObjRole::_lookupTitle($role);
                        }
                }
                if(count($gr))
                {
                        $body .= ($language->txt('reg_role_info').': '.implode(',',$gr)."\n");
                }

                // Time limit
                if($a_with_access_limits)
                {
                        if($this->getTimeLimitUnlimited())
                        {
                                $body .= ($language->txt('time_limit').": ".$language->txt('crs_unlimited')."\n");
                        }
                        else
                        {
                                $body .= ($language->txt('time_limit').": ".$language->txt('crs_from')." ".
                                                  strftime('%c',$this->getTimeLimitFrom())." ".
                                                  $language->txt('crs_to')." ".
                                                  strftime('%c',$this->getTimeLimitUntil())."\n");
                        }
                }
                return $body;
        }

Here is the call graph for this function:

ilObjUser::getProfileIncomplete (  ) 

Definition at line 1939 of file class.ilObjUser.php.

Referenced by saveAsNew(), and update().

    {
        return $this->profile_incomplete;
    }

Here is the caller graph for this function:

ilObjUser::getStoredActive ( a_id  ) 

get user active state

Parameters:
integer $a_id user id public
Returns:
true if active, otherwise false

Definition at line 1858 of file class.ilObjUser.php.

References $ilias, $query, and $row.

Referenced by syncActive().

    {
        global $ilias;

        $query = "SELECT active FROM usr_data ".
            "WHERE usr_id = '".$a_id."'";

        $row = $ilias->db->getRow($query,DB_FETCHMODE_OBJECT);

        return $row->active ? true : false;
    }

Here is the caller graph for this function:

ilObjUser::getStreet (  ) 

get street public

Definition at line 1419 of file class.ilObjUser.php.

Referenced by getProfileAsString().

        {
                return $this->street;
        }

Here is the caller graph for this function:

ilObjUser::getTimeLimitFrom (  ) 

Definition at line 1893 of file class.ilObjUser.php.

Referenced by checkTimeLimit(), getProfileAsString(), saveAsNew(), and update().

    {
        return $this->time_limit_from ? $this->time_limit_from : time();
    }

Here is the caller graph for this function:

ilObjUser::getTimeLimitMessage (  ) 

Definition at line 1917 of file class.ilObjUser.php.

        {
                return $this->time_limit_message;
        }

ilObjUser::getTimeLimitOwner (  ) 

Definition at line 1885 of file class.ilObjUser.php.

Referenced by saveAsNew(), and update().

    {
        return $this->time_limit_owner ? $this->time_limit_owner : 7;
    }

Here is the caller graph for this function:

ilObjUser::getTimeLimitUnlimited (  ) 

Definition at line 1909 of file class.ilObjUser.php.

Referenced by checkTimeLimit(), getProfileAsString(), and update().

    {
        return $this->time_limit_unlimited;
    }

Here is the caller graph for this function:

ilObjUser::getTimeLimitUntil (  ) 

Definition at line 1901 of file class.ilObjUser.php.

Referenced by checkTimeLimit(), getProfileAsString(), saveAsNew(), and update().

    {
        return $this->time_limit_until ? $this->time_limit_until : time();
    }

Here is the caller graph for this function:

ilObjUser::getUserDefinedData (  ) 

Definition at line 2941 of file class.ilObjUser.php.

        {
                return $this->user_defined_data ? $this->user_defined_data : array();
        }

ilObjUser::getUserIdByEmail ( a_email  )  [static]

STATIC METHOD get the user_id of an email address.

Parameters:
string email of user
Returns:
integer id of user public

Definition at line 2076 of file class.ilObjUser.php.

References $query, and $row.

        {
                $query = "SELECT usr_id FROM usr_data ".
                        "WHERE email = '".$a_email."'";

                $row = $this->ilias->db->getRow($query,DB_FETCHMODE_OBJECT);
                return $row->usr_id ? $row->usr_id : 0;
        }

ilObjUser::getUserIdByLogin ( a_login  ) 
ilObjUser::getUTitle (  ) 

get user title (note: don't mix up this method with getTitle() that is derived from ilObject and gets the user object's title) public

Definition at line 1324 of file class.ilObjUser.php.

Referenced by getProfileAsString().

        {
                return $this->utitle;
        }

Here is the caller graph for this function:

ilObjUser::getZipcode (  ) 

get zipcode public

Definition at line 1457 of file class.ilObjUser.php.

Referenced by getProfileAsString().

        {
                return $this->zipcode;
        }

Here is the caller graph for this function:

ilObjUser::hasAcceptedUserAgreement (  ) 

check wether user has accepted user agreement

Definition at line 1226 of file class.ilObjUser.php.

References login().

        {
                if ($this->accept_date != "0000-00-00 00:00:00" || $this->login == "root")
                {
                        return true;
                }
                return false;
        }

Here is the call graph for this function:

ilObjUser::ilObjUser ( a_user_id = 0,
a_call_by_reference = false 
)

Constructor public.

Parameters:
integer user_id

Definition at line 132 of file class.ilObjUser.php.

References $ilias, ilObject::ilObject(), read(), and ilObject::setId().

        {
                global $ilias,$ilDB;

                // init variables
                $this->ilias =& $ilias;
                $this->db =& $ilDB;

                $this->type = "usr";
                $this->ilObject($a_user_id, $a_call_by_reference);
                $this->auth_mode = "default";
                $this->passwd_type = IL_PASSWD_PLAIN;

                // for gender selection. don't change this
                /*$this->gender = array(
                                                          'm'    => "salutation_m",
                                                          'f'    => "salutation_f"
                                                          );*/
                if (!empty($a_user_id))
                {
                        $this->setId($a_user_id);
                        $this->read();
                }
                else
                {
                        // TODO: all code in else-structure doesn't belongs in class user !!!
                        //load default data
                        $this->prefs = array();
                        //language
                        $this->prefs["language"] = $this->ilias->ini->readVariable("language","default");

                        //skin and pda support
                        $this->skin = $this->ilias->ini->readVariable("layout","skin");

                        $this->prefs["skin"] = $this->skin;
                        $this->prefs["show_users_online"] = "y";

                        //style (css)
                        $this->prefs["style"] = $this->ilias->ini->readVariable("layout","style");
                }
        }

Here is the call graph for this function:

ilObjUser::isChild ( a_usr_id  ) 

Definition at line 1952 of file class.ilObjUser.php.

References __readAppliedUsers(), and ilObject::getId().

        {
                if($a_usr_id == $this->getId())
                {
                        return true;
                }

                $this->applied_users = array();
                $this->__readAppliedUsers($this->getId());

                return in_array($a_usr_id,$this->applied_users);
        }

Here is the call graph for this function:

ilObjUser::isCurrentUserActive (  ) 

Definition at line 2005 of file class.ilObjUser.php.

References $data.

    {
        $r = $this->ilias->db->query("SELECT active FROM usr_data WHERE login='".$this->ilias->auth->getUsername()."'");
        //query has got a result
        if ($r->numRows() > 0)
        {
            $data = $r->fetchRow();
            if (!empty($data[0]))
            {
                return true;
            }
        }

        return false;
    }

ilObjUser::isDesktopItem ( a_item_id,
a_type 
)

check wether an item is on the users desktop or not

Parameters:
int $a_item_id ref_id for objects, that are in the main tree (learning modules, forums) obj_id for others
string $a_type object type

Definition at line 2506 of file class.ilObjUser.php.

References $d, $q, and ilObject::getId().

        {
                $q = "SELECT * FROM desktop_item WHERE ".
                        "item_id = '$a_item_id' AND type = '$a_type' AND user_id = '".
                        $this->getId()."'";
                $item_set = $this->ilias->db->query($q);

                if ($d = $item_set->fetchRow())
                {
                        return true;
                }
                else
                {
                        return false;
                }
        }

Here is the call graph for this function:

ilObjUser::read (  ) 

loads a record "user" from database private

Definition at line 178 of file class.ilObjUser.php.

References $data, $ilErr, $q, assignData(), readPrefs(), and readUserDefinedFields().

Referenced by ilObjUser(), and update().

        {
                global $ilErr;

                // TODO: fetching default role should be done in rbacadmin
                $q = "SELECT * FROM usr_data ".
                         "LEFT JOIN rbac_ua ON usr_data.usr_id=rbac_ua.usr_id ".
                         "WHERE usr_data.usr_id='".$this->id."'";
                $r = $this->ilias->db->query($q);

                if ($r->numRows() > 0)
                {
                        $data = $r->fetchRow(DB_FETCHMODE_ASSOC);

                        // convert password storage layout used by table usr_data into
                        // storage layout used by class ilObjUser
                        if ($data["passwd"] == "" && $data["i2passwd"] != "")
                        {
                                $data["passwd_type"] = IL_PASSWD_CRYPT;
                                $data["passwd"] = $data["i2passwd"];
                        }
                        else 
                        {
                                $data["passwd_type"] = IL_PASSWD_MD5;
                                //$data["passwd"] = $data["passwd"]; (implicit)
                        }
                        unset($data["i2passw"]);


                        // fill member vars in one shot
                        $this->assignData($data);

                        //get userpreferences from usr_pref table
                        $this->readPrefs();

                        //set language to default if not set
                        if ($this->prefs["language"] == "")
                        {
                                $this->prefs["language"] = $this->oldPrefs["language"];
                        }

                        //check skin-setting
                        if ($this->prefs["skin"] == "" || file_exists($this->ilias->tplPath."/".$this->prefs["skin"]) == false)
                        {
                                $this->prefs["skin"] = $this->oldPrefs["skin"];
                        }
                        
                        $this->skin = $this->prefs["skin"];

                        //check style-setting (skins could have more than one stylesheet
                        if ($this->prefs["style"] == "" || !file_exists($this->ilias->tplPath."/".$this->skin."/".$this->prefs["style"].".css"))
                        {
                                //load default (css)
                                $this->prefs["style"] = $this->ilias->ini->readVariable("layout","style");
                        }
                        
                        if (empty($this->prefs["hits_per_page"]))
                        {
                                $this->prefs["hits_per_page"] = 10;
                        }

                }
                else
                {
                        $ilErr->raiseError("<b>Error: There is no dataset with id ".
                                                           $this->id."!</b><br />class: ".get_class($this)."<br />Script: ".__FILE__.
                                                           "<br />Line: ".__LINE__, $ilErr->FATAL);
                }

                $this->readUserDefinedFields();

                parent::read();
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjUser::readPrefs (  ) 

get all user preferences private

Returns:
integer number of preferences

Definition at line 941 of file class.ilObjUser.php.

References $q, and $row.

Referenced by read().

        {
                if (is_array($this->prefs))
                {
                        $this->oldPrefs = $this->prefs;
                }

                $this->prefs = array();

                $q = "SELECT * FROM usr_pref WHERE usr_id='".$this->id."'";
        //      $q = "SELECT * FROM usr_pref WHERE value='"y"'";
                $r = $this->ilias->db->query($q);

                while($row = $r->fetchRow(DB_FETCHMODE_ASSOC))
                {
                        $this->prefs[$row["keyword"]] = $row["value"];
                } // while

                return $r->numRows();
        }

Here is the caller graph for this function:

ilObjUser::readUserDefinedFields (  ) 

Definition at line 2966 of file class.ilObjUser.php.

References $query, $res, and $row.

Referenced by read().

        {
                $query = "SELECT * FROM usr_defined_data ".
                        "WHERE usr_id = '".$this->getId()."'";

                $res = $this->db->query($query);
                while($row = $res->fetchRow(DB_FETCHMODE_ASSOC))
                {
                        $this->user_defined_data = $row;
                }
                return true;
        }

Here is the caller graph for this function:

ilObjUser::refreshLogin (  ) 

updates the login data of a "user" // TODO set date with now() should be enough public

Definition at line 626 of file class.ilObjUser.php.

References $q.

        {
                $q = "UPDATE usr_data SET ".
                         "last_login = now() ".
                         "WHERE usr_id = '".$this->id."'";

                $this->ilias->db->query($q);
        }

ilObjUser::removeObjectFromClipboard ( a_item_id,
a_type 
)

remove object from user's personal clipboard

Parameters:
int $a_item_id ref_id for objects, that are in the main tree (learning modules, forums) obj_id for others
string $a_type object type

Definition at line 2677 of file class.ilObjUser.php.

References $q.

        {
                $q = "DELETE FROM personal_clipboard WHERE ".
                        "item_id = '$a_item_id' AND type = '$a_type' ".
                        " AND user_id = '".$this->getId()."'";
                $this->ilias->db->query($q);
        }

ilObjUser::replacePassword ( new_md5  ) 

replaces password with new md5 hash

Parameters:
string new password as md5
Returns:
boolean true on success; otherwise false public

Definition at line 641 of file class.ilObjUser.php.

References $q.

        {
                $this->passwd_type = IL_PASSWD_MD5;
                $this->passwd = $new_md5;

                $q = "UPDATE usr_data SET ".
                         "passwd='".$this->passwd."' ".
                         "WHERE usr_id='".$this->id."'";

                $this->ilias->db->query($q);

                return true;
        }

ilObjUser::resetPassword ( a_new1,
a_new2 
)

reset password

Parameters:
string new password1 as plaintext
string new password2 as plaintext
Returns:
boolean true on success; otherwise false public

Definition at line 730 of file class.ilObjUser.php.

References $q.

        {
                if (func_num_args() != 2)
                {
                        return false;
                }

                if (!isset($a_new1) or !isset($a_new2))
                {
                        return false;
                }

                if ($a_new1 != $a_new2)
                {
                        return false;
                }

                //update password
                $this->passwd = md5($a_new1);
                $this->passwd_type = IL_PASSWD_MD5;

                $q = "UPDATE usr_data SET ".
                         "passwd='".$this->passwd."' ".
                         "WHERE usr_id='".$this->id."'";
                $this->ilias->db->query($q);

                return true;
        }

ilObjUser::saveAsNew ( a_from_formular = true  ) 

TODO: drop fields last_update & create_date.

redundant data in object_data! saves a new record "user" to database public

Parameters:
boolean user data from formular (addSlashes) or not (prepareDBString)

Definition at line 330 of file class.ilObjUser.php.

References $ilErr, $mbox, $q, ilUtil::addSlashes(), addUserDefinedFieldEntry(), getAuthMode(), getExternalAccount(), getProfileIncomplete(), getTimeLimitFrom(), getTimeLimitOwner(), getTimeLimitUntil(), login(), ilUtil::prepareDBString(), and updateUserDefinedFields().

        {
                global $ilErr;

                switch ($this->passwd_type)
                {
                        case IL_PASSWD_PLAIN:
                                $pw_field = "passwd";
                                $pw_value = md5($this->passwd);
                                break;

                        case IL_PASSWD_MD5:
                                $pw_field = "passwd";
                                $pw_value = $this->passwd;
                                break;

                        case IL_PASSWD_CRYPT:
                                $pw_field = "i2passwd";
                                $pw_value = $this->passwd;
                                break;

                        default :
                                 $ilErr->raiseError("<b>Error: passwd_type missing in function saveAsNew. ".
                                                                        $this->id."!</b><br />class: ".get_class($this)."<br />Script: ".__FILE__.
                                                                        "<br />Line: ".__LINE__, $ilErr->FATAL);
                }

                if ($a_from_formular)
                {
            $q = "INSERT INTO usr_data "
                . "(usr_id,login,".$pw_field.",firstname,lastname,title,gender,"
                . "email,hobby,institution,department,street,city,zipcode,country,"
                . "phone_office,phone_home,phone_mobile,fax,last_login,last_update,create_date,"
                . "referral_comment,matriculation,client_ip, approve_date,active,"
                . "time_limit_unlimited,time_limit_until,time_limit_from,time_limit_owner,auth_mode,ext_account,profile_incomplete) "
                . "VALUES "
                . "('".$this->id."','".$this->login."','".$pw_value."', "
                . "'".ilUtil::addSlashes($this->firstname)."','".ilUtil::addSlashes($this->lastname)."', "
                . "'".ilUtil::addSlashes($this->utitle)."','".ilUtil::addSlashes($this->gender)."', "
                . "'".ilUtil::addSlashes($this->email)."','".ilUtil::addSlashes($this->hobby)."', "
                . "'".ilUtil::addSlashes($this->institution)."','".ilUtil::addSlashes($this->department)."', "
                . "'".ilUtil::addSlashes($this->street)."', "
                . "'".ilUtil::addSlashes($this->city)."','".ilUtil::addSlashes($this->zipcode)."','".
                                ilUtil::addSlashes($this->country)."', "
                . "'".ilUtil::addSlashes($this->phone_office)."','".ilUtil::addSlashes($this->phone_home)."', "
                . "'".ilUtil::addSlashes($this->phone_mobile)."','".ilUtil::addSlashes($this->fax)."', 0, now(), now(), "
                . "'".ilUtil::addSlashes($this->referral_comment)."', '". ilUtil::addSlashes($this->matriculation) . "', '".
                                ilUtil::addSlashes($this->client_ip) . "', '" .$this->approve_date."', '".$this->active."', "
                . "'".$this->getTimeLimitUnlimited()."','" . $this->getTimeLimitUntil()."','".$this->getTimeLimitFrom()."','".
                                $this->getTimeLimitOwner()."', "
                . "'".$this->getAuthMode()."', "
                                . "'".$this->getExternalAccount()."', "
                                . "'".$this->getProfileIncomplete()."')";
                }
                else
                {
            $q = "INSERT INTO usr_data ".
                "(usr_id,login,".$pw_field.",firstname,lastname,title,gender,"
                . "email,hobby,institution,department,street,city,zipcode,country,"
                . "phone_office,phone_home,phone_mobile,fax,last_login,last_update,create_date,"
                . "referral_comment,matriculation,client_ip, approve_date,active,"
                . "time_limit_unlimited,time_limit_until,time_limit_from,time_limit_owner,auth_mode,ext_account,profile_incomplete) "
                . "VALUES "
                . "('".$this->id."','".$this->login."','".$pw_value."', "
                . "'".ilUtil::prepareDBString($this->firstname)."','".ilUtil::prepareDBString($this->lastname)."', "
                . "'".ilUtil::prepareDBString($this->utitle)."','".ilUtil::prepareDBString($this->gender)."', "
                . "'".ilUtil::prepareDBString($this->email)."','".ilUtil::prepareDBString($this->hobby)."', "
                . "'".ilUtil::prepareDBString($this->institution)."','".ilUtil::prepareDBString($this->department)."', "
                . "'".ilUtil::prepareDBString($this->street)."', "
                . "'".ilUtil::prepareDBString($this->city)."','".ilUtil::prepareDBString($this->zipcode)."','".
                                ilUtil::prepareDBString($this->country)."', "
                . "'".ilUtil::prepareDBString($this->phone_office)."','".ilUtil::prepareDBString($this->phone_home)."', "
                . "'".ilUtil::prepareDBString($this->phone_mobile)."','".ilUtil::prepareDBString($this->fax)."', 0, now(), now(), "
                . "'".ilUtil::prepareDBString($this->referral_comment)."', '".ilUtil::prepareDBString($this->matriculation)."', '".
                                ilUtil::prepareDBString($this->client_ip)."', '".$this->approve_date."','".$this->active."', "
                . "'".$this->getTimeLimitUnlimited()."','".$this->getTimeLimitUntil()."','".$this->getTimeLimitFrom()."','".
                                $this->getTimeLimitOwner()."',"
                                ."'".$this->getAuthMode()."', "
                                ."'".$this->getExternalAccount()."', "
                                ."'".$this->getProfileIncomplete()."'"
                . ")";
                }

                $this->ilias->db->query($q);

                // add new entry in usr_defined_data
                $this->addUserDefinedFieldEntry();
                // ... and update
                $this->updateUserDefinedFields();

                // CREATE ENTRIES FOR MAIL BOX
                include_once ("classes/class.ilMailbox.php");
                $mbox = new ilMailbox($this->id);
                $mbox->createDefaultFolder();

                include_once "classes/class.ilMailOptions.php";
                $mail_options = new ilMailOptions($this->id);
                $mail_options->createMailOptionsEntry();

                // create personal bookmark folder tree
                include_once "classes/class.ilBookmarkFolder.php";
                $bmf = new ilBookmarkFolder(0, $this->id);
                $bmf->createNewBookmarkTree();

        }

Here is the call graph for this function:

ilObjUser::searchUsers ( a_search_str,
active = 1 
) [static]

STATIC METHOD get the user_ids which correspond a search string.

Parameters:
string search string public

Definition at line 2112 of file class.ilObjUser.php.

References $active, $ilias, $query, $res, and $row.

Referenced by ilObjUserFolderGUI::searchUserObject().

        {
                // NO CLASS VARIABLES IN STATIC METHODS
                global $ilias;

        // This is a temporary hack to search users by their role
        // See Mantis #338. This is a hack due to Mantis #337.
        if (strtolower(substr($a_search_str, 0, 5)) == "role:") 
        { 
            $query = "SELECT DISTINCT usr_data.usr_id,usr_data.login,usr_data.firstname,usr_data.lastname,usr_data.email ". 
                   "FROM object_data,rbac_ua,usr_data ". 
             "WHERE object_data.title LIKE '%".substr($a_search_str,5)."%' and object_data.type = 'role' ". 
             "and rbac_ua.rol_id = object_data.obj_id ". 
             "and usr_data.usr_id = rbac_ua.usr_id ". 
             "AND rbac_ua.usr_id != '".ANONYMOUS_USER_ID."'"; 
        } 
        else
        { 
            $query = "SELECT usr_id,login,firstname,lastname,email,active FROM usr_data ".
                "WHERE (login LIKE '%".$a_search_str."%' ".
                "OR firstname LIKE '%".$a_search_str."%' ".
                "OR lastname LIKE '%".$a_search_str."%' ".
                "OR email LIKE '%".$a_search_str."%') ".
                "AND usr_id != '".ANONYMOUS_USER_ID."'";
        }
        
        if (is_numeric($active) && $active > -1)
                $query .= "AND active = '$active'";

        $res = $ilias->db->query($query);
        while($row = $res->fetchRow(DB_FETCHMODE_OBJECT))
        {
            $ids[] = array(
                "usr_id"    => $row->usr_id,
                "login"     => $row->login,
                "firstname" => $row->firstname,
                "lastname"  => $row->lastname,
                "email"     => $row->email,
                "active"    => $row->active);
        }

                return $ids ? $ids : array();
        }

Here is the caller graph for this function:

ilObjUser::setActive ( a_active,
a_owner = 6 
)

set user active state and updates system fields appropriately public

Parameters:
string $a_active the active state of the user account
string $a_owner the id of the person who approved the account, defaults to 6 (root)

Definition at line 1796 of file class.ilObjUser.php.

References setApproveDate(), and ilObject::setOwner().

Referenced by syncActive().

    {
        if (empty($a_owner))
        {
            $a_owner = 0;
        }

        if ($a_active)
        {
            $this->active = 1;
            $this->setApproveDate(date('Y-m-d H:i:s'));
            $this->setOwner($a_owner);
        }
        else
        {
            $this->active = 0;
            $this->setApproveDate('0000-00-00 00:00:00');
            $this->setOwner(0);
        }
    }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjUser::setApproveDate ( a_str  ) 

set date the user account was activated 0000-00-00 00:00:00 indicates that the user has not yet been activated public

Returns:
string date of last update

Definition at line 1775 of file class.ilObjUser.php.

Referenced by setActive().

    {
        $this->approve_date = $a_str;
    }

Here is the caller graph for this function:

ilObjUser::setAuthMode ( a_str  ) 

set auth mode public

Definition at line 2719 of file class.ilObjUser.php.

Referenced by assignData().

        {
                $this->auth_mode = $a_str;
        }

Here is the caller graph for this function:

ilObjUser::setCity ( a_str  ) 

set city public

Parameters:
string city

Definition at line 1429 of file class.ilObjUser.php.

Referenced by assignData().

        {
                $this->city = $a_str;
        }

Here is the caller graph for this function:

ilObjUser::setClientIP ( a_str  ) 

set client ip number public

Parameters:
string client ip

Definition at line 1562 of file class.ilObjUser.php.

Referenced by assignData().

        {
                $this->client_ip = $a_str;
        }

Here is the caller graph for this function:

ilObjUser::setComment ( a_str  ) 

set referral comment public

Parameters:
string hobby

Definition at line 1755 of file class.ilObjUser.php.

Referenced by assignData().

    {
        $this->referral_comment = $a_str;
    }

Here is the caller graph for this function:

ilObjUser::setCountry ( a_str  ) 

set country public

Parameters:
string country

Definition at line 1467 of file class.ilObjUser.php.

Referenced by assignData().

        {
                $this->country = $a_str;
        }

Here is the caller graph for this function:

ilObjUser::setDepartment ( a_str  ) 

set department public

Parameters:
string department

Definition at line 1391 of file class.ilObjUser.php.

Referenced by assignData().

        {
                $this->department = $a_str;
        }

Here is the caller graph for this function:

ilObjUser::setDesktopItemParameters ( a_item_id,
a_type,
a_par 
)

set parameters of a desktop item entry

Parameters:
int $a_item_id ref_id for objects, that are in the main tree (learning modules, forums) obj_id for others
string $a_type object type
string $a_par parameters

Definition at line 2475 of file class.ilObjUser.php.

References $q.

        {
                $q = "UPDATE desktop_item SET parameters = '$a_par' ".
                        " WHERE item_id = '$a_item_id' AND type = '$a_type' ".
                        " AND user_id = '".$this->getId()."' ";
                $this->ilias->db->query($q);
        }

ilObjUser::setEmail ( a_str  ) 

set email public

Parameters:
string email address

Definition at line 1600 of file class.ilObjUser.php.

Referenced by assignData().

        {
                $this->email = $a_str;
        }

Here is the caller graph for this function:

ilObjUser::setExternalAccount ( a_str  ) 

set external account

note: 3.7.0 uses this field only for cas and soap authentication.

public

Definition at line 2746 of file class.ilObjUser.php.

Referenced by assignData().

        {
                $this->ext_account = $a_str;
        }

Here is the caller graph for this function:

ilObjUser::setFax ( a_str  ) 

set fax public

Parameters:
string fax

Definition at line 1543 of file class.ilObjUser.php.

Referenced by assignData().

        {
                $this->fax = $a_str;
        }

Here is the caller graph for this function:

ilObjUser::setFirstname ( a_str  ) 

set firstname public

Parameters:
string firstname

Definition at line 1334 of file class.ilObjUser.php.

Referenced by assignData().

        {
                $this->firstname = $a_str;
        }

Here is the caller graph for this function:

ilObjUser::setFullname ( a_title = "",
a_firstname = "",
a_lastname = "" 
)

builds a string with title + firstname + lastname method is used to build fullname in member variable $this->fullname.

But you may use the function in static manner. static

Parameters:
string title (opt.)
string firstname (opt.)
string lastname (opt.)

Definition at line 1045 of file class.ilObjUser.php.

References $fullname.

Referenced by assignData(), and ilPersonalDesktopGUI::displayUsersOnline().

        {
                $this->fullname = "";

                if ($a_title)
                {
                        $fullname = $a_title." ";
                }
                elseif ($this->utitle)
                {
                        $this->fullname = $this->utitle." ";
                }

                if ($a_firstname)
                {
                        $fullname .= $a_firstname." ";
                }
                elseif ($this->firstname)
                {
                        $this->fullname .= $this->firstname." ";
                }

                if ($a_lastname)
                {
                        return $fullname.$a_lastname;
                }

                $this->fullname .= $this->lastname;
        }

Here is the caller graph for this function:

ilObjUser::setGender ( a_str  ) 

set gender public

Parameters:
string gender

Definition at line 1292 of file class.ilObjUser.php.

Referenced by assignData().

        {
                $this->gender = substr($a_str,-1);
        }

Here is the caller graph for this function:

ilObjUser::setHobby ( a_str  ) 

set hobby public

Parameters:
string hobby

Definition at line 1619 of file class.ilObjUser.php.

Referenced by assignData().

        {
                $this->hobby = $a_str;
        }

Here is the caller graph for this function:

ilObjUser::setInstitution ( a_str  ) 

set institution public

Parameters:
string institution

Definition at line 1372 of file class.ilObjUser.php.

Referenced by assignData().

        {
                $this->institution = $a_str;
        }

Here is the caller graph for this function:

ilObjUser::setLanguage ( a_str  ) 

set user language public

Parameters:
string lang_key (i.e. de,en,fr,...)

Definition at line 1638 of file class.ilObjUser.php.

References $_SESSION, and setPref().

        {
                $this->setPref("language",$a_str);
                unset($_SESSION['lang']);
        }

Here is the call graph for this function:

ilObjUser::setLastLogin ( a_str  ) 

set user's last login public

Parameters:
string login date

Definition at line 1721 of file class.ilObjUser.php.

Referenced by assignData().

        {
                $this->last_login = $a_str;
        }

Here is the caller graph for this function:

ilObjUser::setLastname ( a_str  ) 

set lastame public

Parameters:
string lastname

Definition at line 1353 of file class.ilObjUser.php.

Referenced by assignData().

        {
                $this->lastname = $a_str;
        }

Here is the caller graph for this function:

ilObjUser::setLastUpdate ( a_str  ) 

set last update of user data set public

Parameters:
string date

Definition at line 1741 of file class.ilObjUser.php.

Referenced by assignData().

        {
                $this->last_update = $a_str;
        }

Here is the caller graph for this function:

ilObjUser::setLogin ( a_str  ) 

set login / username public

Parameters:
string username

Definition at line 1240 of file class.ilObjUser.php.

References login().

Referenced by assignData().

        {
                $this->login = $a_str;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjUser::setMatriculation ( a_str  ) 

set matriculation number public

Parameters:
string matriculation number

Definition at line 1581 of file class.ilObjUser.php.

Referenced by assignData().

        {
                $this->matriculation = $a_str;
        }

Here is the caller graph for this function:

ilObjUser::setPasswd ( a_str,
a_type = IL_PASSWD_PLAIN 
)

set password public

Parameters:
string passwd

Definition at line 1259 of file class.ilObjUser.php.

Referenced by assignData().

        {
                $this->passwd = $a_str;
                $this->passwd_type = $a_type;
        }

Here is the caller graph for this function:

ilObjUser::setPhoneHome ( a_str  ) 

set home phone public

Parameters:
string home phone

Definition at line 1505 of file class.ilObjUser.php.

Referenced by assignData().

        {
                $this->phone_home = $a_str;
        }

Here is the caller graph for this function:

ilObjUser::setPhoneMobile ( a_str  ) 

set mobile phone public

Parameters:
string mobile phone

Definition at line 1524 of file class.ilObjUser.php.

Referenced by assignData().

        {
                $this->phone_mobile = $a_str;
        }

Here is the caller graph for this function:

ilObjUser::setPhoneOffice ( a_str  ) 

set office phone public

Parameters:
string office phone

Definition at line 1486 of file class.ilObjUser.php.

Referenced by assignData().

        {
                $this->phone_office = $a_str;
        }

Here is the caller graph for this function:

ilObjUser::setPref ( a_keyword,
a_value 
)

set a user preference

Parameters:
string name of parameter
string value public

Definition at line 903 of file class.ilObjUser.php.

Referenced by setLanguage(), and writePref().

        {
                if ($a_keyword != "")
                {
                        $this->prefs[$a_keyword] = $a_value;
                }
        }

Here is the caller graph for this function:

ilObjUser::setProfileIncomplete ( a_prof_inc  ) 

Definition at line 1935 of file class.ilObjUser.php.

Referenced by assignData().

    {
        $this->profile_incomplete = (boolean) $a_prof_inc;
    }

Here is the caller graph for this function:

ilObjUser::setSkin ( a_str  ) 

set user skin (template set) public

Parameters:
string directory name of template set

Definition at line 1875 of file class.ilObjUser.php.

        {
                // TODO: exception handling (dir exists)
                $this->skin = $a_str;
        }

ilObjUser::setStreet ( a_str  ) 

set street public

Parameters:
string street

Definition at line 1410 of file class.ilObjUser.php.

Referenced by assignData().

        {
                $this->street = $a_str;
        }

Here is the caller graph for this function:

ilObjUser::setTimeLimitFrom ( a_from  ) 

Definition at line 1889 of file class.ilObjUser.php.

Referenced by assignData().

    {
        $this->time_limit_from = $a_from;
    }

Here is the caller graph for this function:

ilObjUser::setTimeLimitMessage ( a_time_limit_message  ) 

Definition at line 1913 of file class.ilObjUser.php.

Referenced by assignData().

        {
                return $this->time_limit_message = $a_time_limit_message;
        }

Here is the caller graph for this function:

ilObjUser::setTimeLimitOwner ( a_owner  ) 

Definition at line 1881 of file class.ilObjUser.php.

Referenced by assignData().

    {
        $this->time_limit_owner = $a_owner;
    }

Here is the caller graph for this function:

ilObjUser::setTimeLimitUnlimited ( a_unlimited  ) 

Definition at line 1905 of file class.ilObjUser.php.

Referenced by assignData().

    {
        $this->time_limit_unlimited = $a_unlimited;
    }

Here is the caller graph for this function:

ilObjUser::setTimeLimitUntil ( a_until  ) 

Definition at line 1897 of file class.ilObjUser.php.

Referenced by assignData().

    {
        $this->time_limit_until = $a_until;
    }

Here is the caller graph for this function:

ilObjUser::setUserDefinedData ( a_data  ) 

Definition at line 2926 of file class.ilObjUser.php.

References $data, and ilUtil::stripSlashes().

        {
                if(!is_array($a_data))
                {
                        return false;
                }
                foreach($a_data as $field => $data)
                {
                        $new_data[$field] = ilUtil::stripSlashes($data);
                }
                $this->user_defined_data = $new_data;

                return true;
        }

Here is the call graph for this function:

ilObjUser::setUTitle ( a_str  ) 

set user title (note: don't mix up this method with setTitle() that is derived from ilObject and sets the user object's title) public

Parameters:
string title

Definition at line 1313 of file class.ilObjUser.php.

Referenced by assignData().

        {
                $this->utitle = $a_str;
        }

Here is the caller graph for this function:

ilObjUser::setZipcode ( a_str  ) 

set zipcode public

Parameters:
string zipcode

Definition at line 1448 of file class.ilObjUser.php.

Referenced by assignData().

        {
                $this->zipcode = $a_str;
        }

Here is the caller graph for this function:

ilObjUser::syncActive (  ) 

synchronizes current and stored user active values for the owner value to be set correctly, this function should only be called when an admin is approving a user account public

Definition at line 1831 of file class.ilObjUser.php.

References getStoredActive(), getUserIdByLogin(), and setActive().

Referenced by update().

    {
        $storedActive   = 0;
        if ($this->getStoredActive($this->id))
        {
            $storedActive   = 1;
        }

        $currentActive  = 0;
        if ($this->active)
        {
            $currentActive  = 1;
        }

        if ((!empty($storedActive) && empty($currentActive)) ||
                (empty($storedActive) && !empty($currentActive)))
        {
            $this->setActive($currentActive, $this->getUserIdByLogin($this->ilias->auth->getUsername()));
        }
    }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjUser::update (  ) 

updates a record "user" and write it into database public

Reimplemented from ilObject.

Definition at line 440 of file class.ilObjUser.php.

References $ilErr, $q, getAuthMode(), getExternalAccount(), getProfileIncomplete(), getTimeLimitFrom(), getTimeLimitOwner(), getTimeLimitUnlimited(), getTimeLimitUntil(), read(), syncActive(), ilObject::updateOwner(), updateUserDefinedFields(), and writePrefs().

        {
                global $ilErr, $ilDB;

                //$this->id = $this->data["Id"];

        $this->syncActive();

                $pw_udpate = '';
                switch ($this->passwd_type)
                {
                        case IL_PASSWD_PLAIN:
                                $pw_update = "i2passwd='', passwd='".md5($this->passwd)."'";
                                break;

                        case IL_PASSWD_MD5:
                                $pw_update = "i2passwd='', passwd='".$this->passwd."'";
                                break;

                        case IL_PASSWD_CRYPT:
                                $pw_update = "passwd='', i2passwd='".$this->passwd."'";
                                break;

                        default :
                                $ilErr->raiseError("<b>Error: passwd_type missing in function update()".$this->id."!</b><br />class: ".
                                                                   get_class($this)."<br />Script: ".__FILE__."<br />Line: ".__LINE__, $ilErr->FATAL);
                }
                $q = "UPDATE usr_data SET ".
            "gender='".$this->gender."', ".
            "title='".ilUtil::prepareDBString($this->utitle)."', ".
            "firstname='".ilUtil::prepareDBString($this->firstname)."', ".
            "lastname='".ilUtil::prepareDBString($this->lastname)."', ".
            "email='".ilUtil::prepareDBString($this->email)."', ".
            "hobby='".ilUtil::prepareDBString($this->hobby)."', ".
            "institution='".ilUtil::prepareDBString($this->institution)."', ".
            "department='".ilUtil::prepareDBString($this->department)."', ".
            "street='".ilUtil::prepareDBString($this->street)."', ".
            "city='".ilUtil::prepareDBString($this->city)."', ".
            "zipcode='".ilUtil::prepareDBString($this->zipcode)."', ".
            "country='".ilUtil::prepareDBString($this->country)."', ".
            "phone_office='".ilUtil::prepareDBString($this->phone_office)."', ".
            "phone_home='".ilUtil::prepareDBString($this->phone_home)."', ".
            "phone_mobile='".ilUtil::prepareDBString($this->phone_mobile)."', ".
            "fax='".ilUtil::prepareDBString($this->fax)."', ".
            "referral_comment='".ilUtil::prepareDBString($this->referral_comment)."', ".
            "matriculation='".ilUtil::prepareDBString($this->matriculation)."', ".
            "client_ip='".ilUtil::prepareDBString($this->client_ip)."', ".
            "approve_date='".ilUtil::prepareDBString($this->approve_date)."', ".
            "active='".ilUtil::prepareDBString($this->active)."', ".
            "time_limit_owner='".ilUtil::prepareDBString($this->getTimeLimitOwner())."', ".
            "time_limit_unlimited='".ilUtil::prepareDBString($this->getTimeLimitUnlimited())."', ".
            "time_limit_from='".ilUtil::prepareDBString($this->getTimeLimitFrom())."', ".
            "time_limit_until='".ilUtil::prepareDBString($this->getTimeLimitUntil())."', ".
            "time_limit_message='".$this->getTimeLimitMessage()."', ".
                        "profile_incomplete = ".$ilDB->quote($this->getProfileIncomplete()).", ".
            "auth_mode='".ilUtil::prepareDBString($this->getAuthMode())."', ".
                        "ext_account='".ilUtil::prepareDBString($this->getExternalAccount())."', ".
                        $pw_update.", ".
            "last_update=now() ".
                //      "ilinc_id='".ilUtil::prepareDBString($this->ilinc_id)."', ".
                //      "ilinc_login='".ilUtil::prepareDBString($this->ilinc_login)."', ".
                //      "ilinc_passwd='".ilUtil::prepareDBString($this->ilinc_passwd)."' ".
            "WHERE usr_id='".$this->id."'";

                $this->ilias->db->query($q);
                $this->writePrefs();

                // update user defined fields
                $this->updateUserDefinedFields();
                

                parent::update();
        parent::updateOwner();

                $this->read();

                return true;
        }

Here is the call graph for this function:

ilObjUser::updateActiveRoles ( a_user_id  )  [static]

STATIC METHOD updates Session roles.

Parameters:
integer user_id
Returns:
boolean true if user is online and session was updated public

Definition at line 2276 of file class.ilObjUser.php.

References $_SESSION, $q, $rbacreview, and ilUtil::getUsersOnline().

Referenced by ilForumImportParser::__addModerator(), ilCourseMembers::add(), ilCourseMembers::delete(), ilObjGroup::ilClone(), ilObjForum::ilClone(), ilObjiLincCourse::join(), ilObjGroup::join(), ilObjiLincCourse::leave(), ilObjGroup::leave(), ilObjForumGUI::saveObject(), ilObjChatGUI::saveObject(), ilCourseRegisterGUI::subscribe(), and ilCourseMembers::update().

        {
                global $rbacreview, $ilDB;
                
                if (!count($user_online = ilUtil::getUsersOnline($a_user_id)) == 1)
                {
                        return false;
                }
                
                $role_arr = $rbacreview->assignedRoles($a_user_id);

                if ($_SESSION["AccountId"] == $a_user_id)
                {
                        $_SESSION["RoleId"] = $role_arr;
                }
                else
                {
                        $roles = "RoleId|".serialize($role_arr);
                        $modified_data = preg_replace("/RoleId.*?;\}/",$roles,$user_online[$a_user_id]["data"]);

                        $q = "UPDATE usr_session SET data='".ilUtil::prepareDBString($modified_data)."' WHERE user_id = '".$a_user_id."'";
                        $ilDB->query($q);
                }

                return true;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjUser::updateLogin ( a_login  ) 

update login name

Parameters:
string new login
Returns:
boolean true on success; otherwise false public

Definition at line 817 of file class.ilObjUser.php.

References $q, and login().

        {
                if (func_num_args() != 1)
                {
                        return false;
                }

                if (!isset($a_login))
                {
                        return false;
                }

                //update login
                $this->login = $a_login;

                $q = "UPDATE usr_data SET ".
                         "login='".$this->login."' ".
                         "WHERE usr_id='".$this->id."'";
                $this->ilias->db->query($q);

                return true;
        }

Here is the call graph for this function:

ilObjUser::updatePassword ( a_old,
a_new1,
a_new2 
)

updates password

Parameters:
string old password as plaintext
string new password1 as plaintext
string new password2 as plaintext
Returns:
boolean true on success; otherwise false public

Definition at line 663 of file class.ilObjUser.php.

References $q, and _makeIlias2Password().

        {
                if (func_num_args() != 3)
                {
                        return false;
                }

                if (!isset($a_old) or !isset($a_new1) or !isset($a_new2))
                {
                        return false;
                }

                if ($a_new1 != $a_new2)
                {
                        return false;
                }

                // is catched by isset() ???
                if ($a_new1 == "" || $a_old == "")
                {
                        return false;
                }

                //check old password
                switch ($this->passwd_type)
                {
                        case IL_PASSWD_PLAIN:
                                if ($a_old != $this->passwd)
                                {
                                        return false;
                                }
                                break;

                        case IL_PASSWD_MD5:
                                if (md5($a_old) != $this->passwd)
                                {
                                        return false;
                                }
                                break;

                        case IL_PASSWD_CRYPT:
                                if (_makeIlias2Password($a_old) != $this->passwd)
                                {
                                        return false;
                                }
                                break;
                }

                //update password
                $this->passwd = md5($a_new1);
                $this->passwd_type = IL_PASSWD_MD5;

                $q = "UPDATE usr_data SET ".
                         "passwd='".$this->passwd."' ".
                         "WHERE usr_id='".$this->id."'";
                $this->ilias->db->query($q);

                return true;
        }

Here is the call graph for this function:

ilObjUser::updateUserDefinedFields (  ) 

Definition at line 2946 of file class.ilObjUser.php.

References $fields, $query, and ilUtil::prepareDBString().

Referenced by saveAsNew(), and update().

        {
                $fields = '';

                foreach($this->user_defined_data as $field => $value)
                {
                        if($field != 'usr_id')
                        {
                                $fields .= ("`".$field."` = '".ilUtil::prepareDBString($value)."', ");
                        }
                } 

                $query = "REPLACE INTO usr_defined_data ".
                        "SET ".$fields." ".
                        "usr_id = '".$this->getId()."'";
                
                $this->db->query($query);
                return true;
        }

Here is the call graph for this function:

Here is the caller graph for this function:

ilObjUser::writeAccepted (  ) 

write accept date of user agreement to db

Definition at line 522 of file class.ilObjUser.php.

References $q, and ilObject::getId().

        {
                global $ilDB;
                
                $q = "UPDATE usr_data SET agree_date = now()".
                         "WHERE usr_id = ".$ilDB->quote($this->getId());
                $ilDB->query($q);

        }

Here is the call graph for this function:

ilObjUser::writePref ( a_keyword,
a_value 
)

write userpref to user table private

Parameters:
string keyword
string value

Definition at line 846 of file class.ilObjUser.php.

References _writePref(), and setPref().

        {
                ilObjUser::_writePref($this->id, $a_keyword, $a_value);
                $this->setPref($a_keyword, $a_value);
        }

Here is the call graph for this function:

ilObjUser::writePrefs (  ) 

write all userprefs private

Definition at line 879 of file class.ilObjUser.php.

References $q.

Referenced by update().

        {
                //DELETE
                $q = "DELETE FROM usr_pref ".
                         "WHERE usr_id='".$this->id."'";
                $this->ilias->db->query($q);

                foreach ($this->prefs as $keyword => $value)
                {
                        //INSERT
                        $q = "INSERT INTO usr_pref ".
                                 "(usr_id, keyword, value) ".
                                 "VALUES ".
                                 "('".$this->id."', '".$keyword."', '".$value."')";
                        $this->ilias->db->query($q);
                }
        }

Here is the caller graph for this function:


Field Documentation

ilObjUser::$active

Definition at line 90 of file class.ilObjUser.php.

Referenced by _getAllUserData(), _search(), and searchUsers().

ilObjUser::$approve_date

Definition at line 89 of file class.ilObjUser.php.

ilObjUser::$auth_mode

Definition at line 93 of file class.ilObjUser.php.

ilObjUser::$city

Definition at line 78 of file class.ilObjUser.php.

ilObjUser::$client_ip

Definition at line 92 of file class.ilObjUser.php.

ilObjUser::$country

Definition at line 80 of file class.ilObjUser.php.

ilObjUser::$default_role

Definition at line 117 of file class.ilObjUser.php.

ilObjUser::$department

Definition at line 76 of file class.ilObjUser.php.

ilObjUser::$email

Definition at line 85 of file class.ilObjUser.php.

ilObjUser::$fax

Definition at line 84 of file class.ilObjUser.php.

ilObjUser::$firstname

Definition at line 70 of file class.ilObjUser.php.

ilObjUser::$fullname

Definition at line 72 of file class.ilObjUser.php.

Referenced by setFullname().

ilObjUser::$gender

Definition at line 68 of file class.ilObjUser.php.

Referenced by getProfileAsString().

ilObjUser::$hobby

Definition at line 86 of file class.ilObjUser.php.

ilObjUser::$ilias
ilObjUser::$institution

Definition at line 75 of file class.ilObjUser.php.

ilObjUser::$lastname

Definition at line 71 of file class.ilObjUser.php.

ilObjUser::$login

all user related data in single vars public

Definition at line 48 of file class.ilObjUser.php.

ilObjUser::$matriculation

Definition at line 87 of file class.ilObjUser.php.

ilObjUser::$passwd

Definition at line 50 of file class.ilObjUser.php.

ilObjUser::$passwd_type

Definition at line 51 of file class.ilObjUser.php.

ilObjUser::$phone_home

Definition at line 82 of file class.ilObjUser.php.

ilObjUser::$phone_mobile

Definition at line 83 of file class.ilObjUser.php.

ilObjUser::$phone_office

Definition at line 81 of file class.ilObjUser.php.

ilObjUser::$prefs

Definition at line 102 of file class.ilObjUser.php.

ilObjUser::$referral_comment

Definition at line 88 of file class.ilObjUser.php.

ilObjUser::$skin

Definition at line 109 of file class.ilObjUser.php.

ilObjUser::$street

Definition at line 77 of file class.ilObjUser.php.

ilObjUser::$user_defined_data = array()

Definition at line 95 of file class.ilObjUser.php.

ilObjUser::$utitle

Definition at line 69 of file class.ilObjUser.php.

ilObjUser::$zipcode

Definition at line 79 of file class.ilObjUser.php.


The documentation for this class was generated from the following file: