Пример #1
0
function skillsoft_poll_customreport($handle, $trace = false, $prefix = '    ')
{
    global $CFG;
    $starttime = microtime(true);
    $reporturl = '';
    if ($trace) {
        mtrace($prefix . get_string('skillsoft_customreport_poll_start', 'skillsoft'));
        mtrace($prefix . $prefix . get_string('skillsoft_customreport_poll_polling', 'skillsoft', $handle));
    }
    $pollresponse = UTIL_PollForReport($handle);
    if ($pollresponse->success) {
        if ($trace) {
            mtrace($prefix . $prefix . get_string('skillsoft_customreport_poll_ready', 'skillsoft'));
        }
        $reporturl = $pollresponse->result->olsaURL;
        //Update skillsoft_report_track table
        skillsoft_update_customreport_polled($handle, $reporturl);
    } else {
        if ($pollresponse->errormessage == get_string('skillsoft_olsassoapreportnotready', 'skillsoft')) {
            //The report is not ready
            if ($trace) {
                mtrace($prefix . $prefix . get_string('skillsoft_customreport_poll_notready', 'skillsoft'));
            }
        } else {
            if ($pollresponse->errormessage == get_string('skillsoft_olsassoapreportnotvalid', 'skillsoft', $report->handle)) {
                //The report does not exist so we need to delete this row in report track table
                if ($trace) {
                    mtrace($prefix . $prefix . get_string('skillsoft_customreport_poll_doesnotexist', 'skillsoft'));
                }
                $id = skillsoft_delete_report($report->handle);
            }
        }
    }
    $endtime = microtime(true);
    $duration = $endtime - $starttime;
    if ($trace) {
        mtrace($prefix . get_string('skillsoft_customreport_poll_end', 'skillsoft') . ' (took ' . $duration . ' seconds)');
    }
    return $reporturl;
}
Пример #2
0
        $html .= $fail;
        $html .= 'Exception while creating OLSA SOAP Client';
        $html .= $br;
        $html .= 'Exception Details';
        $html .= $br;
        $html .= $e->getMessage();
        $html .= $br;
        $html .= 'DIAGNOSTICS HALTED';
        $html .= $fontend;
    }
    echo $OUTPUT->box(testheader($currenttest, 'Create OLSA SOAP Client') . $html, 'generalbox boxaligncenter boxwidthwide', 'summary');
}
$currenttest++;
if ($continue) {
    $html = '';
    $pollresponse = UTIL_PollForReport('0');
    if ($pollresponse->errormessage == get_string('skillsoft_olsassoapauthentication', 'skillsoft')) {
        $continue = false;
        $html .= $fail;
        $html .= 'OLSA Credentials are incorrect, or Moodle Server time is incorrect. Please ensure you entered the correct values.';
        $html .= $br;
        $html .= 'DIAGNOSTICS HALTED';
        $html .= $br;
        $html .= $fontend;
    } else {
        $html .= $pass;
        $html .= 'OLSA Credentials are correct.';
        $html .= $br;
        $html .= $fontend;
        //Set local OLSA Variables used for subsequent tests
        $endpoint = $CFG->skillsoft_olsaendpoint;