Exemplo n.º 1
0
        //Check if we failed because no groupcode and resubmit
        if (!stripos($response->errormessage, "the property '_pathid_' or '_orgcode_' must be specified") == false) {
            $response = SO_GetMultiActionSignOnUrl($CFG->skillsoft_accountprefix . $USER->{$CFG->skillsoft_useridentifier}, $USER->firstname, $USER->lastname, $USER->email, "", $CFG->skillsoft_defaultssogroup, $lcl_actiontype, $lcl_assetid, $userx508);
        }
    }
} else {
    $response = new olsaresponse(false, get_string('skillsoft_ssomodeerror', 'skillsoft'), NULL);
}
//Log minimal data if success
//Disabled for anything other than SSO
// issues when importing the resulting OLSA data for assets as timestamps differ for firstaccess,
//resulting in incorrect recording of attempts
if (!$skillsoft->completable) {
    if ($response->success) {
        $now = time();
        $id = skillsoft_setFirstAccessDate($USER->id, $skillsoft->id, 1, $now);
        $id = skillsoft_setLastAccessDate($USER->id, $skillsoft->id, 1, $now);
        $id = skillsoft_setAccessCount($USER->id, $skillsoft->id, 1);
    }
}
$waitimage = '<p><img src="' . $OUTPUT->pix_url('wait', 'skillsoft') . '" class="icon" alt="' . get_string('skillsoft_waitingalt', 'skillsoft') . '" /><br/></p>';
?>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title><?php 
echo get_string('skillsoft_ssotitle', 'skillsoft');
?>
</title>
<script type="text/javascript">
 /**
  * Process the ReportResults
  *
  * @param object $reportresults The ReportResults
  * @return null
  */
 public function processreportresults($reportresults, $attempt = 1)
 {
     //Lets parse the response
     $this->cleardata();
     $this->attempt = $attempt;
     $this->getdata();
     $this->cmi->core->lesson_status = strtolower($reportresults->lessonstatus);
     if ($reportresults->currentscore != 0) {
         $this->cmi->core->score->raw = $reportresults->currentscore;
     }
     //Now we do the EXITAU part
     //Duration
     $value = $this->Sec2Time($reportresults->duration);
     $id = skillsoft_insert_track($this->user->id, $this->skillsoft->id, $this->attempt, '[CORE]time', $value);
     $id = skillsoft_setFirstAccessDate($this->user->id, $this->skillsoft->id, $this->attempt, $reportresults->firstaccessdate);
     $id = skillsoft_setLastAccessDate($this->user->id, $this->skillsoft->id, $this->attempt, $reportresults->lastaccessdate);
     if (substr($this->cmi->core->lesson_status, 0, 1) == 'c' || substr($this->cmi->core->lesson_status, 0, 1) == 'p') {
         $id = skillsoft_setCompletedDate($this->user->id, $this->skillsoft->id, $this->attempt, $reportresults->completeddate);
     }
     $id = skillsoft_setAccessCount($this->user->id, $this->skillsoft->id, $this->attempt, $reportresults->accesscount);
     $id = skillsoft_setFirstScore($this->user->id, $this->skillsoft->id, $this->attempt, $reportresults->firstscore);
     $id = skillsoft_setCurrentScore($this->user->id, $this->skillsoft->id, $this->attempt, $reportresults->currentscore);
     $id = skillsoft_setBestScore($this->user->id, $this->skillsoft->id, $this->attempt, $reportresults->bestscore);
     //Need to do these last to ensure grades correctly entered
     //Persist the data
     $id = skillsoft_insert_track($this->user->id, $this->skillsoft->id, $this->attempt, '[CORE]lesson_status', $this->cmi->core->lesson_status);
     $id = skillsoft_insert_track($this->user->id, $this->skillsoft->id, $this->attempt, '[CORE]score', $this->cmi->core->score->raw);
 }