Exemplo n.º 1
0
 */
if (isset($_POST['export_report']) && $_POST['export_report']) {
    switch ($_POST['export_format']) {
        case 'xls':
            $filename = 'survey_results_'.$survey_id.'.xls';
            $data = SurveyUtil::export_complete_report_xls(
                $survey_data,
                $filename,
                $_GET['user_id']
            );
            exit;
            break;
        case 'csv':
        default:
            $data = SurveyUtil::export_complete_report(
                $survey_data,
                $_GET['user_id']
            );
            $filename = 'survey_results_'.$survey_id.'.csv';

            header('Content-type: application/octet-stream');
            header('Content-Type: application/force-download');

            if (preg_match("/MSIE 5.5/", $_SERVER['HTTP_USER_AGENT'])) {
                header('Content-Disposition: filename= '.$filename);
            } else {
                header('Content-Disposition: attachment; filename= '.$filename);
            }
            if (strpos($_SERVER['HTTP_USER_AGENT'], 'MSIE')) {
                header('Pragma: ');
                header('Cache-Control: ');
                header('Cache-Control: public'); // IE cannot download from sessions without a cache