Ejemplo n.º 1
0
    ApplicationContext::SetUrlMakerClass('iTopStandardURLMaker');
    // 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');
Ejemplo n.º 2
0
 //
 $aArgs = array();
 foreach ($oFilter->GetQueryParams() as $sParam => $foo) {
     $value = utils::ReadParam('arg_' . $sParam, null, true, 'raw_data');
     if (!is_null($value)) {
         $aArgs[$sParam] = $value;
     }
 }
 $oFilter->SetInternalParams($aArgs);
 if ($oFilter) {
     $oSet = new CMDBObjectSet($oFilter, array(), $aArgs);
     $oSet->OptimizeColumnLoad($aAliasToFields);
     switch ($sFormat) {
         case 'html':
             $oP = new NiceWebPage("iTop - Export");
             $oP->add_style('body { overflow: auto; }');
             // Show scroll bars if needed
             // Integration within MS-Excel web queries + HTTPS + IIS:
             // MS-IIS set these header values with no-cache... while Excel fails to do the job if using HTTPS
             // Then the fix is to force the reset of header values Pragma and Cache-control
             header("Pragma:", true);
             header("Cache-control:", true);
             // The HTML output is made for pages located in the /pages/ folder
             // since this page is in a different folder, let's adjust the HTML 'base' attribute
             // to make the relative hyperlinks in the page work
             $sUrl = utils::GetAbsoluteUrlAppRoot();
             $oP->set_base($sUrl . 'pages/');
             if (count($aFields) > 0) {
                 $iSearch = array_search('id', $aFields);
                 if ($iSearch !== false) {
                     $bViewLink = true;