Ejemplo n.º 1
0
    // Main parameters
    $sExpression = utils::ReadParam('expression', null, true, 'raw_data');
    $sQueryId = utils::ReadParam('query', null, true, 'raw_data');
    $sFormat = utils::ReadParam('format', null, true);
    $sFileName = utils::ReadParam('filename', '', true, 'string');
    $bInteractive = utils::ReadParam('interactive', false);
    $sMode = utils::ReadParam('mode', '');
    if ($bInteractive) {
        InteractiveShell($sExpression, $sQueryId, $sFormat, $sFileName, $sMode);
    } else {
        $oExporter = CheckParameters($sExpression, $sQueryId, $sFormat);
        $sMimeType = $oExporter->GetMimeType();
        if ($sMimeType == 'text/html') {
            $oP = new NiceWebPage('iTop export');
            $oP->add_style("body { overflow: auto; }");
            $oP->add_ready_script("\$('table.listResults').tablesorter({widgets: ['MyZebra']});");
        } else {
            $oP = new ajax_page('iTop export');
            $oP->SetContentType($oExporter->GetMimeType());
        }
        DoExport($oP, $oExporter, false);
        $oP->output();
    }
} catch (BulkExportMissingParameterException $e) {
    $oP = new ajax_page('iTop Export');
    $oP->add($e->getMessage());
    Usage($oP);
    $oP->output();
} catch (Exception $e) {
    $oP = new WebPage('iTop Export');
    $oP->add('Error: ' . $e->getMessage());