Class to represent a tool consumer user

author Stephen P Vickers
version 2.5.00
license GNU Lesser General Public License, version 3
package LTI

 Methods

Class constructor.

__construct(\LTI_Resource_Link $resource_link, string $id) 

Parameters

$resource_link

\LTI_Resource_Link

Resource_Link object

$id

string

User ID value

Delete the user from the database.

delete() : boolean

Returns

booleanTrue if the user object was successfully deleted

Get context.

getContext() : \LTI_Resource_Link
deprecated Use getResourceLink() instead
see

Returns

\LTI_Resource_LinkContext object

Get the user ID (which may be a compound of the tool consumer and resource link IDs).

getId(integer $id_scope = NULL) : string

Parameters

$id_scope

integer

Scope to use for user ID (optional, default is null for consumer default setting)

Returns

stringUser ID value

Initialise the user.

initialise() 

Check if the user is an administrator (at any of the system, institution or context levels).

isAdmin() : boolean

Returns

booleanTrue if the user has a role of administrator

Check if the user is a learner.

isLearner() : boolean

Returns

booleanTrue if the user has a role of learner

Check if the user is staff.

isStaff() : boolean

Returns

booleanTrue if the user has a role of instructor, contentdeveloper or teachingassistant

Load the user from the database.

load() : boolean

Returns

booleanTrue if the user object was successfully loaded

Save the user to the database.

save() : boolean

Returns

booleanTrue if the user object was successfully saved

Set the user's email address.

setEmail(string $email, string $defaultEmail = NULL

Parameters

$email

string

Email address value

$defaultEmail

string

Value to use if no email is provided (optional, default is none)

Set the user's name.

setNames(string $firstname, string $lastname, string $fullname) 

Parameters

$firstname

string

User's first name.

$lastname

string

User's last name.

$fullname

string

User's full name.

Check whether the user has a specified role name.

hasRole(string $role) : boolean

Parameters

$role

string

Name of role

Returns

booleanTrue if the user has the specified role

 Properties

 

Date/time the record was created.

$created : object

Default

NULL
 

User's email address.

$email : string

Default

''
 

User's first name.

$firstname : string

Default

''
 

User's fullname.

$fullname : string

Default

''
 

Groups for user.

$groups : array

Default

array()
 

User's last name (surname or family name).

$lastname : string

Default

''
 

User's result sourcedid.

$lti_result_sourcedid : string

Default

NULL
 

Roles for user.

$roles : array

Default

array()
 

Date/time the record was last updated.

$updated : object

Default

NULL
 

Resource link object.

$context : \LTI_Context

Default

NULL
 

User ID value.

$id : string

Default

NULL