45 private $resourceLink =
null;
52 private $resourceLinkId =
null;
66 private $dataConnector =
null;
82 $this->ltiResultSourcedId =
null;
83 $this->created =
null;
84 $this->updated =
null;
94 if (!is_null($this->resourceLinkId)) {
108 public function delete()
122 if (is_null($this->resourceLink) && !is_null($this->resourceLinkId)) {
126 return $this->resourceLink;
136 $this->resourceLink = $resourceLink;
166 $this->resourceLink =
null;
167 $this->resourceLinkId = $resourceLinkId;
177 return $this->dataConnector;
187 $this->dataConnector = $dataConnector;
198 public function getId($idScope =
null, $source =
null)
203 if ($source instanceof
Context) {
205 $platform = $context->getPlatform();
206 } elseif (!is_null($resourceLink)) {
207 $context = $resourceLink->getContext();
208 $platform = $resourceLink->getPlatform();
209 } elseif ($source instanceof
Platform) {
213 if (!is_null($platform)) {
214 $key = $platform->getId();
215 if (is_null($idScope)) {
216 $idScope = $platform->idScope;
219 if (is_null($idScope)) {
230 $ok = !is_null($context) && !empty($context->ltiContextId);
236 $ok = !is_null($resourceLink) && !empty($resourceLink->ltiResourceLinkId);
264 $userresult->dataConnector = $dataConnector;
265 $userresult->load($id);
281 $userresult->resourceLink = $resourceLink;
282 if (!is_null($resourceLink)) {
283 $userresult->resourceLinkId = $resourceLink->getRecordId();
284 $userresult->dataConnector = $resourceLink->getDataConnector();
305 private function load($id =
null)
310 if (!is_null($dataConnector)) {
311 return $dataConnector->loadUserResult($this);
Class to represent a platform context.
Class to provide a connection to a persistent store for LTI objects.
static fromRecordId($id, $dataConnector)
Load the resource link from the database.
Class to represent a platform user association with a resource link.
__construct()
Class constructor.
$updated
Date/time the record was last updated.
getId($idScope=null, $source=null)
Get the user ID (which may be a compound of the platform and resource link IDs).
setDataConnector($dataConnector)
Set the data connector.
getDataConnector()
Get the data connector.
getResourceLink()
Get resource link.
initialize()
Initialise the user.
$created
Date/time the record was created.
$ltiResultSourcedId
UserResult's result sourcedid.
setResourceLink($resourceLink)
Set resource link.
setResourceLinkId($resourceLinkId)
Set resource link ID of user.
getRecordId()
Get record ID of user.
setRecordId($id)
Set record ID of user.
static fromResourceLink($resourceLink, $ltiUserId)
Class constructor from resource link.
save()
Save the user to the database.
static fromRecordId($id, $dataConnector)
Load the user from the database.
Class to represent a platform user.
$ltiUserId
user ID as supplied in the last connection request.