Пример #1
0
 /**
  * Get the grade
  *
  * @param $userId
  * @throws \Tk\Exception
  * @return float
  */
 public function getGrade($userId)
 {
     $consumer = new \LTI_Tool_Consumer($this->consumerKey, $this->getConfig()->getLtiDataConnector());
     $resource = new \LTI_Resource_Link($consumer, $this->resourceId);
     $user = new \LTI_User($resource, $userId);
     $ltiOutcome = new \LTI_Outcome();
     if (!$resource->doOutcomesService(\LTI_Resource_Link::EXT_READ, $ltiOutcome, $user)) {
         throw new \Tk\Exception('Error reading from grade-center.');
     }
     return $ltiOutcome->getValue();
 }