/**
 * Polls for the specified report handle
 *
 * @param string $handle the report handle to poll for
 * @return olsasoapresponse olsasoapresponse->result is a NULL object
 */
function UTIL_PollForReport($handle)
{
    global $CFG;
    if (!isolsaconfigurationset()) {
        $response = new olsaresponse(false, get_string('skillsoft_olsasettingsmissing', 'skillsoft'), NULL);
    } else {
        //Set local OLSA Variables
        $endpoint = $CFG->skillsoft_olsaendpoint;
        $customerId = $CFG->skillsoft_olsacustomerid;
        $sharedsecret = $CFG->skillsoft_olsasharedsecret;
        //Specify the WSDL using the EndPoint
        $wsdlurl = $endpoint . '?WSDL';
        //Specify the SOAP Client Options
        $options = array("trace" => 0, "exceptions" => 0, "soap_version" => SOAP_1_2, "cache_wsdl" => WSDL_CACHE_BOTH, "encoding" => "UTF-8");
        //Create a new instance of the OLSA Soap Client
        $client = new olsa_soapclient($wsdlurl, $options);
        //Create the USERNAMETOKEN
        $client->__setUsernameToken($customerId, $sharedsecret);
        //Create the Request
        $PollForReportRequest = array("customerId" => $customerId, "reportId" => $handle);
        //Call the WebService and stored result in $result
        $result = $client->__soapCall('UTIL_PollForReport', array('parameters' => $PollForReportRequest));
        if (is_soap_fault($result)) {
            if (!stripos($result->getmessage(), 'security token could not be authenticated or authorized') == false) {
                //Authentication Failure
                $response = new olsaresponse(false, get_string('skillsoft_olsassoapauthentication', 'skillsoft'), NULL);
            } elseif (!stripos($result->detail->exceptionName, 'DataNotReadyYetFault') == false) {
                //Report not ready yet
                $response = new olsaresponse(false, get_string('skillsoft_olsassoapreportnotready', 'skillsoft'), NULL);
            } elseif (!stripos($result->detail->exceptionName, 'ReportDoesNotExistFault') == false) {
                //Report not ready yet
                $response = new olsaresponse(false, get_string('skillsoft_olsassoapreportnotvalid', 'skillsoft', $handle), NULL);
            } else {
                //General SOAP Fault
                //print_error('olsassoapfault','skillsoft','',$result->getmessage());
                $response = new olsaresponse(false, get_string('skillsoft_olsassoapfault', 'skillsoft', $result->getmessage()), NULL);
            }
        } else {
            $response = new olsaresponse(true, '', $result);
        }
    }
    return $response;
}
        $html .= $br;
        $html .= 'DIAGNOSTICS HALTED';
        $html .= $br;
        $html .= $fontend;
    } else {
        $html .= $pass;
        $html .= 'cURL Extension is loaded.';
        $html .= $br;
        $html .= $fontend;
    }
    echo $OUTPUT->box(testheader($currenttest, 'Checking cURL Extension is loaded') . $html, 'generalbox boxaligncenter boxwidthwide', 'summary');
}
$currenttest++;
if ($continue) {
    $html = '';
    if (!isolsaconfigurationset()) {
        $continue = false;
        $html .= $fail;
        $html .= 'OLSA Settings are Not Configured. Please ensure you enter the OLSA settings in the module configuration settings';
        $html .= $br;
        $html .= 'DIAGNOSTICS HALTED';
        $html .= $br;
        $html .= $fontend;
    } else {
        $html .= $pass;
        $html .= 'OLSA Settings Configured.';
        $html .= $br;
        $html .= $fontend;
        //Set local OLSA Variables used for subsequent tests
        $endpoint = $CFG->skillsoft_olsaendpoint;
        $customerId = $CFG->skillsoft_olsacustomerid;