126 $this->firstname =
'';
127 $this->lastname =
'';
128 $this->fullname =
'';
131 $this->roles = array();
132 $this->groups = array();
133 $this->ltiResultSourcedId = null;
134 $this->created = null;
135 $this->updated = null;
159 if (!empty($this->ltiResultSourcedId) && !is_null($this->resourceLinkId)) {
174 public function delete()
191 if (is_null($this->resourceLink) && !is_null($this->resourceLinkId)) {
254 public function getId($idScope = null)
257 if (empty($idScope)) {
258 if (!is_null($this->resourceLink)) {
259 $idScope = $this->resourceLink->getConsumer()->idScope;
270 if ($this->resourceLink->ltiContextId) {
277 if ($this->resourceLink->ltiResourceLinkId) {
301 $names = array(0 =>
'', 1 =>
'');
304 $names = preg_split(
"/[\s]+/", $this->fullname, 2);
309 }
else if (!empty($names[0])) {
310 $this->firstname = $names[0];
312 $this->firstname =
'User';
317 }
else if (!empty($names[1])) {
318 $this->lastname = $names[1];
322 if (empty($this->fullname)) {
323 $this->fullname =
"{$this->firstname} {$this->lastname}";
339 }
else if (!empty($defaultEmail)) {
340 $this->email = $defaultEmail;
341 if (substr($this->email, 0, 1) ===
'@') {
358 return $this->
hasRole(
'Administrator') || $this->
hasRole(
'urn:lti:sysrole:ims/lis/SysAdmin') ||
359 $this->
hasRole(
'urn:lti:sysrole:ims/lis/Administrator') || $this->
hasRole(
'urn:lti:instrole:ims/lis/Administrator');
371 return ($this->
hasRole(
'Instructor') || $this->
hasRole(
'ContentDeveloper') || $this->
hasRole(
'TeachingAssistant'));
383 return $this->
hasRole(
'Learner');
444 if (substr($role, 0, 4) !==
'urn:')
446 $role =
'urn:lti:role:ims/lis/' . $role;
449 return in_array($role, $this->roles);