Exemple #1
0
 /**
  * Generate an TSV (tab-separated value) file for the survey structure
  * @param type $surveyid
  */
 private function _exporttsv($surveyid)
 {
     $fn = "limesurvey_survey_{$surveyid}.txt";
     header("Content-Type: text/tab-separated-values charset=UTF-8");
     header("Content-Disposition: attachment; filename={$fn}");
     header("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
     // Date in the past
     header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
     header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
     header("Pragma: public");
     // HTTP/1.0
     $data =& LimeExpressionManager::TSVSurveyExport($surveyid);
     $lines = array();
     foreach ($data as $row) {
         $lines[] = implode("\t", str_replace(array("\t", "\n", "\r"), array(" ", " ", " "), $row));
     }
     $output = implode("\n", $lines);
     //        echo "\xEF\xBB\xBF"; // UTF-8 BOM
     echo $output;
     return;
 }