\n"; echo "\n"; echo "\t\n"; echo "\t\n"; echo "
".$clang->gT("Export Question")."
$setfont\n"; echo "$setfont
".$clang->gT("Error")."
\n"._EQ_NOGID."
\n"; echo "
\n"; echo "\t
\n"; echo "\n"; exit; } $fn = "limesurvey_group_$gid.csv"; $dumphead = "# LimeSurvey Group Dump\n" . "# DBVersion $dbversionnumber\n" . "# This is a dumped group from the LimeSurvey Script\n" . "# http://www.limesurvey.org/\n" . "# Do not change this header!\n"; header("Content-Type: application/download"); 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"); // always modified header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); header("Pragma: cache"); //0: Groups Table $gquery = "SELECT * FROM {$dbprefix}groups WHERE gid=$gid"; $gdump = BuildCSVFromQuery($gquery); //1: Questions Table $qquery = "SELECT * FROM {$dbprefix}questions WHERE gid=$gid"; $qdump = BuildCSVFromQuery($qquery); //2: Answers table $aquery = "SELECT DISTINCT {$dbprefix}answers.* FROM {$dbprefix}answers, {$dbprefix}questions WHERE ({$dbprefix}answers.qid={$dbprefix}questions.qid) AND ({$dbprefix}questions.gid=$gid)"; $adump = BuildCSVFromQuery($aquery); //3: Conditions table - THIS CAN ONLY EXPORT CONDITIONS THAT RELATE TO THE SAME GROUP $cquery = "SELECT DISTINCT {$dbprefix}conditions.* FROM {$dbprefix}conditions, {$dbprefix}questions, {$dbprefix}questions b WHERE ({$dbprefix}conditions.cqid={$dbprefix}questions.qid) AND ({$dbprefix}conditions.qid=b.qid) AND ({$dbprefix}questions.gid=$gid) AND (b.gid=$gid)"; $cdump = BuildCSVFromQuery($cquery); //4: Labelsets Table $lsquery = "SELECT DISTINCT {$dbprefix}labelsets.* FROM {$dbprefix}labelsets, {$dbprefix}questions WHERE ({$dbprefix}labelsets.lid={$dbprefix}questions.lid) AND (type in ('F', 'H', 'Z', 'W')) AND (gid=$gid)"; $lsdump = BuildCSVFromQuery($lsquery); //5: Labels Table $lquery = "SELECT {$dbprefix}labels.* FROM {$dbprefix}labels, {$dbprefix}questions WHERE ({$dbprefix}labels.lid={$dbprefix}questions.lid) AND (type in ('F', 'H', 'Z', 'W')) AND (gid=$gid)"; $ldump = BuildCSVFromQuery($lquery); //8: Question Attributes $query = "SELECT DISTINCT {$dbprefix}question_attributes.* FROM {$dbprefix}question_attributes, {$dbprefix}questions WHERE ({$dbprefix}question_attributes.qid={$dbprefix}questions.qid) AND ({$dbprefix}questions.gid=$gid)"; $qadump = BuildCSVFromQuery($query); // HTTP/1.0 echo $dumphead, $gdump, $qdump, $adump, $cdump, $lsdump, $ldump, $qadump; exit; ?>