LTI Tool Provider Library  3.0.2
PHP class library for building LTI Tool Providers
User Class Reference

Class to represent a tool consumer user. More...

Public Member Functions

 __construct ()
 Class constructor. More...
 
 initialize ()
 Initialise the user. More...
 
 initialise ()
 Initialise the user. More...
 
 save ()
 Save the user to the database. More...
 
 delete ()
 Delete the user from the database. More...
 
 getResourceLink ()
 Get resource link. More...
 
 getRecordId ()
 Get record ID of user. More...
 
 setRecordId ($id)
 Set record ID of user. More...
 
 setResourceLinkId ($resourceLinkId)
 Set resource link ID of user. More...
 
 getDataConnector ()
 Get the data connector. More...
 
 getId ($idScope=null)
 Get the user ID (which may be a compound of the tool consumer and resource link IDs). More...
 
 setNames ($firstname, $lastname, $fullname)
 Set the user's name. More...
 
 setEmail ($email, $defaultEmail=null)
 Set the user's email address. More...
 
 isAdmin ()
 Check if the user is an administrator (at any of the system, institution or context levels). More...
 
 isStaff ()
 Check if the user is staff. More...
 
 isLearner ()
 Check if the user is a learner. More...
 

Static Public Member Functions

static fromRecordId ($id, $dataConnector)
 Load the user from the database. More...
 
static fromResourceLink ($resourceLink, $ltiUserId)
 Class constructor from resource link. More...
 

Data Fields

 $firstname = ''
 User's first name. More...
 
 $lastname = ''
 User's last name (surname or family name). More...
 
 $fullname = ''
 User's fullname. More...
 
 $email = ''
 User's email address. More...
 
 $image = ''
 User's image URI. More...
 
 $roles = array()
 Roles for user. More...
 
 $groups = array()
 Groups for user. More...
 
 $ltiResultSourcedId = null
 User's result sourcedid. More...
 
 $created = null
 Date/time the record was created. More...
 
 $updated = null
 Date/time the record was last updated. More...
 
 $ltiUserId = null
 user ID as supplied in the last connection request. More...
 

Detailed Description

Class to represent a tool consumer user.

Author
Stephen P Vickers svick.nosp@m.ers@.nosp@m.imsgl.nosp@m.obal.nosp@m..org
Date
2016
Version
3.0.2
Licence:
http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0

Definition at line 15 of file User.php.

Constructor & Destructor Documentation

__construct ( )

Class constructor.

Definition at line 113 of file User.php.

References User\initialize().

Member Function Documentation

delete ( )

Delete the user from the database.

Returns
boolean True if the user object was successfully deleted

Definition at line 174 of file User.php.

References User\getDataConnector().

static fromRecordId (   $id,
  $dataConnector 
)
static

Load the user from the database.

Parameters
int$idRecord ID of user
DataConnector$dataConnectorDatabase connection object
Returns
User User object

Definition at line 395 of file User.php.

Referenced by DataConnector_pdo\getUserResultSourcedIDsResourceLink().

static fromResourceLink (   $resourceLink,
  $ltiUserId 
)
static

Class constructor from resource link.

Parameters
ResourceLink$resourceLinkResource_Link object
string$ltiUserIdUser ID value
Returns
User

Definition at line 413 of file User.php.

References User\$ltiUserId, User\getDataConnector(), and User\initialize().

Referenced by ResourceLink\doMembershipsService(), Membership\get(), DataConnector_mysql\getUserResultSourcedIDsResourceLink(), and ToolProvider\onError().

getDataConnector ( )

Get the data connector.

Returns
mixed Data connector object or string

Definition at line 240 of file User.php.

Referenced by User\delete(), User\fromResourceLink(), User\getResourceLink(), and User\save().

getId (   $idScope = null)

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

Parameters
int$idScopeScope to use for user ID (optional, default is null for consumer default setting)
Returns
string User ID value

Definition at line 254 of file User.php.

References User\$ltiUserId, User\getResourceLink(), ToolProvider\ID_SCOPE_CONTEXT, ToolProvider\ID_SCOPE_GLOBAL, ToolProvider\ID_SCOPE_ID_ONLY, ToolProvider\ID_SCOPE_RESOURCE, and ToolProvider\ID_SCOPE_SEPARATOR.

Referenced by User\setEmail().

getRecordId ( )

Get record ID of user.

Returns
int Record ID of user

Definition at line 204 of file User.php.

getResourceLink ( )

Get resource link.

Returns
ResourceLink Resource link object

Definition at line 188 of file User.php.

References ResourceLink\fromRecordId(), and User\getDataConnector().

Referenced by User\getId().

initialise ( )

Initialise the user.

Pseudonym for initialize().

Definition at line 144 of file User.php.

References User\initialize().

initialize ( )

Initialise the user.

Definition at line 123 of file User.php.

Referenced by User\__construct(), User\fromResourceLink(), and User\initialise().

isAdmin ( )

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

Returns
boolean True if the user has a role of administrator

Definition at line 355 of file User.php.

isLearner ( )

Check if the user is a learner.

Returns
boolean True if the user has a role of learner

Definition at line 380 of file User.php.

isStaff ( )

Check if the user is staff.

Returns
boolean True if the user has a role of instructor, contentdeveloper or teachingassistant

Definition at line 368 of file User.php.

save ( )

Save the user to the database.

Returns
boolean True if the user object was successfully saved

Definition at line 156 of file User.php.

References User\getDataConnector().

setEmail (   $email,
  $defaultEmail = null 
)

Set the user's email address.

Parameters
string$emailEmail address value
string$defaultEmailValue to use if no email is provided (optional, default is none)

Definition at line 334 of file User.php.

References User\$email, and User\getId().

setNames (   $firstname,
  $lastname,
  $fullname 
)

Set the user's name.

Parameters
string$firstnameUser's first name.
string$lastnameUser's last name.
string$fullnameUser's full name.

Definition at line 298 of file User.php.

References User\$firstname, User\$fullname, User\$lastname, and User\$ltiUserId.

setRecordId (   $id)

Set record ID of user.

Parameters
int$idRecord ID of user

Definition at line 216 of file User.php.

setResourceLinkId (   $resourceLinkId)

Set resource link ID of user.

Parameters
int$resourceLinkIdResource link ID of user

Definition at line 228 of file User.php.

Field Documentation

object $created = null

Date/time the record was created.

Definition at line 71 of file User.php.

string $email = ''

User's email address.

Definition at line 41 of file User.php.

Referenced by User\setEmail().

string $firstname = ''

User's first name.

Definition at line 23 of file User.php.

Referenced by User\setNames().

string $fullname = ''

User's fullname.

Definition at line 35 of file User.php.

Referenced by User\setNames().

array $groups = array()

Groups for user.

Definition at line 59 of file User.php.

string $image = ''

User's image URI.

Definition at line 47 of file User.php.

string $lastname = ''

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

Definition at line 29 of file User.php.

Referenced by User\setNames().

string $ltiResultSourcedId = null

User's result sourcedid.

Definition at line 65 of file User.php.

string $ltiUserId = null

user ID as supplied in the last connection request.

Definition at line 102 of file User.php.

Referenced by User\fromResourceLink(), User\getId(), and User\setNames().

array $roles = array()

Roles for user.

Definition at line 53 of file User.php.

object $updated = null

Date/time the record was last updated.

Definition at line 77 of file User.php.


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