mirror of
https://github.com/ACSPRI/queXS
synced 2024-04-02 12:12:16 +00:00
Merging the Limesurvey 1.91+ branch of queXS in to the trunk
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
<?php
|
||||
/*
|
||||
* LimeSurvey
|
||||
* Copyright (C) 2007 The LimeSurvey Project Team / Carsten Schmitz
|
||||
* All rights reserved.
|
||||
* License: GNU/GPL License v2 or later, see LICENSE.php
|
||||
* LimeSurvey is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses.
|
||||
* See COPYRIGHT.php for copyright notices and details.
|
||||
*
|
||||
* $Id: dumplabel.php 7382 2009-08-01 19:48:15Z c_schmitz $
|
||||
*/
|
||||
* LimeSurvey
|
||||
* Copyright (C) 2007 The LimeSurvey Project Team / Carsten Schmitz
|
||||
* All rights reserved.
|
||||
* License: GNU/GPL License v2 or later, see LICENSE.php
|
||||
* LimeSurvey is free software. This version may have been modified pursuant
|
||||
* to the GNU General Public License, and as distributed it includes or
|
||||
* is derivative of works licensed under the GNU General Public License or
|
||||
* other free or open source software licenses.
|
||||
* See COPYRIGHT.php for copyright notices and details.
|
||||
*
|
||||
* $Id: dumplabel.php 10925 2011-09-02 14:12:02Z c_schmitz $
|
||||
*/
|
||||
|
||||
|
||||
|
||||
@@ -22,46 +22,50 @@
|
||||
|
||||
//Ensure script is not run directly, avoid path disclosure
|
||||
include_once("login_check.php");
|
||||
require_once("export_data_functions.php");
|
||||
$lids=returnglobal('lids');
|
||||
$lid=returnglobal('lid');
|
||||
if (!$lid)
|
||||
if (!$lid && !$lids) die('No LID has been provided. Cannot dump label set.');
|
||||
|
||||
if ($lid)
|
||||
{
|
||||
echo "<br />\n";
|
||||
echo "<table width='350' align='center' style='border: 1px solid #555555' cellpadding='1' cellspacing='0'>\n";
|
||||
echo "\t<tr bgcolor='#555555'><td colspan='2' height='4'><font size='1' face='verdana' color='white'><strong>".$clang->gT("Export Label Set")."</strong></td></tr>\n";
|
||||
echo "\t<tr bgcolor='#CCCCCC'><td align='center'>\n";
|
||||
echo "<br /><strong><font color='red'>".$clang->gT("Error")."</font></strong><br />\n".$clang->gT("No LID has been provided. Cannot dump label set.")."<br />\n";
|
||||
echo "<br /><input type='submit' value='".$clang->gT("Main Admin Screen")."' onclick=\"window.open('$scriptname', '_self')\">\n";
|
||||
echo "\t</td></tr>\n";
|
||||
echo "</table>\n";
|
||||
echo "</body></html>\n";
|
||||
exit;
|
||||
$lids=array($lid);
|
||||
}
|
||||
$lids=array_map('sanitize_int',$lids);
|
||||
|
||||
$fn = "limesurvey_labelset_".implode('_',$lids).".lsl";
|
||||
$xml = getXMLWriter();
|
||||
|
||||
$dumphead = "# LimeSurvey Label Set Dump\n"
|
||||
. "# DBVersion $dbversionnumber\n"
|
||||
. "# This is a dumped label set from the LimeSurvey Script\n"
|
||||
. "# http://www.limesurvey.org/\n"
|
||||
. "# Do not change this header!\n";
|
||||
|
||||
//1: Questions Table
|
||||
$qquery = "SELECT * FROM {$dbprefix}labelsets WHERE lid=$lid";
|
||||
$qdump = BuildCSVFromQuery($qquery);
|
||||
|
||||
//2: Answers table
|
||||
$aquery = "SELECT lid, code, title, sortorder, language, assessment_value FROM {$dbprefix}labels WHERE lid=$lid";
|
||||
$adump = BuildCSVFromQuery($aquery);
|
||||
|
||||
$fn = "limesurvey_labelset_$lid.csv";
|
||||
|
||||
|
||||
header("Content-Type: application/download");
|
||||
header("Content-Type: text/html/force-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");
|
||||
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
|
||||
header("Pragma: cache"); // HTTP/1.0
|
||||
|
||||
echo $dumphead, $qdump, $adump;
|
||||
$xml->openURI('php://output');
|
||||
|
||||
$xml->setIndent(true);
|
||||
$xml->startDocument('1.0', 'UTF-8');
|
||||
$xml->startElement('document');
|
||||
$xml->writeElement('LimeSurveyDocType','Label set');
|
||||
$xml->writeElement('DBVersion',$dbversionnumber);
|
||||
getXMLStructure($xml,$lids);
|
||||
$xml->endElement(); // close columns
|
||||
$xml->endDocument();
|
||||
exit;
|
||||
|
||||
?>
|
||||
function getXMLStructure($xml,$lids)
|
||||
{
|
||||
global $dbprefix;
|
||||
|
||||
|
||||
// Label sets table
|
||||
$lsquery = "SELECT * FROM {$dbprefix}labelsets WHERE lid=".implode(' or lid=',$lids);
|
||||
BuildXMLFromQuery($xml,$lsquery,'labelsets');
|
||||
|
||||
// Labels
|
||||
$lquery = "SELECT lid, code, title, sortorder, language, assessment_value FROM {$dbprefix}labels WHERE lid=".implode(' or lid=',$lids);
|
||||
BuildXMLFromQuery($xml,$lquery,'labels');
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user