SloodleUserA class to represent a single user, including Moodle and Sloodle data.
Located in /lib/sl_userlib.php (line 29)
bool
create_sloodle_user
([string $uuid = ''], [string $avname = ''], [int $userid = 0], [string $loginposition = ''], [string $loginpositionexpires = ''], [string $loginpositionregion = ''], [string $loginsecuritytoken = ''])
array
$enrolled_courses_cache
= NULL (line 99)
Cache of courses which the Moodle user is enrolled in Used by some functions fetching database data about a Moodle user's courses.
It is an array which caches the list of courses the Moodle user is enrolled in Note that update is *not* automatic, but you can manually call {@link: update_enrolled_courses_cache_from_db()}. After construction, it will always be a numeric array of integers (but may be empty) Each element will be a course ID (integer).
object
$moodle_user_cache
= NULL (line 86)
Moodle user data cache.
Used by various functions fetching database data about a Moodle user. Contents can also be used in subsequent function calls to prevent the need for an additional database query (typically by specifying a $use_cache parameter). Update is *not* automatic. It can be updated manually by calling {@link: update_moodle_user_cache_from_db()}. Unlike the Sloodle equivalent, this cannot be used to update the database After construction, it will always be an object.
int
$moodle_user_id
= 0 (line 52)
Integer ID of a Moodle user entry in the database.
Value 0 represents no user.
object
$sloodle_user_cache
= NULL (line 70)
Sloodle user data cache.
Used by various functions fetching database data about a Sloodle user. Contents can also be used in subsequent function calls to prevent the need for an additional database query (typically by specifying a $use_cache parameter). Update is *not* automatic. It can be updated manually by calling {@link: update_sloodle_user_cache_from_db()}. Data placed here can also be used to edit the database using {@link: insert_sloodle_user_cache_to_db()} or {@link: update_sloodle_user_cache_to_db()}. After construction, it will always be an object.
int
$sloodle_user_id
= 0 (line 42)
Integer ID of a Sloodle user entry in the database.
Value 0 represents no user.
Create a Moodle user account with the specified first name, last name and email address.
Create a new Sloodle user.
All parameters are optional. To enable loginzone authentication, you *must* specify position and expiry time. Note that, if no login security token is specified, it is generated automatically. If successful, the new ID is stored and the user data is cached.
Clears the login position from the currently selected Sloodle user.
This function will user the user identified by {@link:$sloodle_user_id}, retrieve all the user data, remove the login position values, and update the database.
Deletes the Sloodle user identified by {@link:$sloodle_user_id}.
Find the Moodle user linked to the current Sloodle user.
Stores the Moodle user ID in {@link:$moodle_user_id}.
Find the Sloodle user linked to the current Moodle user.
Stores the Sloodle user ID in {@link:$sloodle_user_id}.
Attempts to find a Sloodle user by their UUID and/or avatar nam.
Note: the UUID takes precedence, but the name can be used as a fall-back. The ID of the user is stored in {@link:$sloodle_user_id}.
Attempt to find a Sloodle user by their loginzone position If successful, the user ID is stored in {@link:$sloodle_user_id} and the function returns true.
If no user was found for the given position, false is returned (this may occur if the LoginZone position has expired). If an error occurs, then a string containing an error message is returned.
Generates a new login position for the current Sloodle user.
Stores the new login position in the database, and refreshes the user cache
Accessor: gets the Moodle user ID member, {@link: $moodle_user_id}.
Accessor: gets the Sloodle user ID member, {@link: $sloodle_user_id}.
Checks if the current Sloodle user has a login security token
Use the Sloodle user cache to insert a new entry in the Sloodle user database table.
Uses the object entirely as-is, except that the 'id' field is ignored. The ID of the new entry is stored in {@link:$sloodle_user_id}.
Checks if the current Moodle user is already enrolled in the specified course.
Links the current Sloodle and Moodle accounts together.
NOTE: does not remove any other links to the Moodle account.
Performs an internal login of the current Moodle user.
Stores all the user data in the global $USER variable. Note: if login fails, $USER is unchanged. Additionally, note that this function will not perform automatic registration.
Generates a new login security token for the current Sloodle user
Accessor: sets the Moodle user ID member, {@link: $moodle_user_id}.
Accessor: sets the Sloodle user ID member, {@link: $sloodle_user_id}.
Completely unlinks the Sloodle user from any Moodle account.
Use the database to update the cache of courses which the current Moodle user is enrolled in.
Note that admins are considered by this function to be enrolled in all courses.
Update the Moodle user cache ({@link:$moodle_user_cache}) from the database
Updates the Sloodle user cache ({@link:$sloodle_user_cache}) from the database
Use the Sloodle user cache to update an entry in the Sloodle users database table.
Uses the object-entirely as-is, so the 'id' field must be accurate. Ignores anu unset fields.
Determines whether or not the current Sloodle and Moodle users are linked.
Documentation generated on Tue, 04 Mar 2008 15:08:56 +0000 by phpDocumentor 1.4.0