24 public static $SCOPE =
'https://purl.imsglobal.org/spec/lti-ags/scope/result.readonly';
61 parent::__construct($platform,
$endpoint,
'/results');
62 $this->limit = $limit;
63 $this->pagingMode = $pagingMode;
65 $this->mediaType =
'application/vnd.ims.lis.v2.resultcontainer+json';
75 public function getAll($limit =
null)
78 if (is_null($limit)) {
79 $limit = $this->limit;
81 if (is_null($limit)) {
85 $params[
'limit'] = $limit;
90 $http = $this->
send(
'GET', $params);
93 if (!empty($http->responseJson)) {
94 foreach ($http->responseJson as $outcome) {
95 $outcomes[] = self::getOutcome($outcome);
98 if (!$this->pagingMode && $http->hasRelativeLink(
'next')) {
99 $url = $http->getRelativeLink(
'next');
100 $this->endpoint = $url;
119 public function get($user)
121 $params = array(
'user_id' => $user->ltiUserId);
122 $http = $this->
send(
'GET', $params);
124 if (!empty($http->responseJson)) {
125 $outcome = self::getOutcome(reset($http->responseJson));
146 private static function getOutcome($json)
149 $outcome->ltiUserId = $json->userId;
150 if (isset($json->resultScore)) {
151 $outcome->setValue($json->resultScore);
153 if (isset($json->resultMaximum)) {
154 $outcome->setPointsPossible($json->resultMaximum);
156 if (isset($json->comment)) {
157 $outcome->comment = $json->comment;
Class to represent an outcome.
Class to implement the Assignment and Grade services.
Class to implement the Result service.
static $SCOPE
Access scope.
getAll($limit=null)
Retrieve all outcomes for a line-item.
__construct($platform, $endpoint, $limit=null, $pagingMode=false)
Class constructor.
static $defaultLimit
Default limit on size of container to be returned from requests.
Class to implement a service.
send($method, $parameters=array(), $body=null)
Send a service request.
$endpoint
Service endpoint.
Class to represent a platform user.