mirror of
https://github.com/ACSPRI/queXS
synced 2024-04-02 12:12:16 +00:00
Added icon for scanner
Updated queXMLPDF class to point to TCPDF isntallation Added icon to limesurvey page Modified export_structure_quexml to be able to export a string of noheader specified
This commit is contained in:
@@ -308,6 +308,10 @@ elseif ($action == 'iteratesurvey')
|
|||||||
if( ($surrows['browse_response'] && $surrows['activate_survey']) || $_SESSION['USER_RIGHT_SUPERADMIN'] == 1) {include('iterate_survey.php');}
|
if( ($surrows['browse_response'] && $surrows['activate_survey']) || $_SESSION['USER_RIGHT_SUPERADMIN'] == 1) {include('iterate_survey.php');}
|
||||||
else { include('access_denied.php');}
|
else { include('access_denied.php');}
|
||||||
}
|
}
|
||||||
|
elseif ($action=='showquexmlsurvey')
|
||||||
|
{
|
||||||
|
include('quexmlsurvey.php'); //No special right needed to show the printable survey
|
||||||
|
}
|
||||||
elseif ($action=='showprintablesurvey')
|
elseif ($action=='showprintablesurvey')
|
||||||
{
|
{
|
||||||
include('printablesurvey.php'); //No special right needed to show the printable survey
|
include('printablesurvey.php'); //No special right needed to show the printable survey
|
||||||
|
|||||||
@@ -4,8 +4,8 @@
|
|||||||
* Modify these two lines to point to your TCPDF installation
|
* Modify these two lines to point to your TCPDF installation
|
||||||
* Tested with TCPDF 5.8.008 - see http://www.tcpdf.org/
|
* Tested with TCPDF 5.8.008 - see http://www.tcpdf.org/
|
||||||
*/
|
*/
|
||||||
require_once('/var/lib/tcpdf/config/lang/eng.php');
|
require_once(dirname(__FILE__) . '/../tcpdf/config/lang/eng.php');
|
||||||
require_once('/var/lib/tcpdf/tcpdf.php');
|
require_once(dirname(__FILE__) . '/../tcpdf/tcpdf.php');
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -525,15 +525,19 @@ while ($Row = $QueryResult->FetchRow())
|
|||||||
|
|
||||||
$dom->append_child($questionnaire);
|
$dom->append_child($questionnaire);
|
||||||
|
|
||||||
|
$quexml = $dom->dump_mem(true,'UTF-8');
|
||||||
|
|
||||||
$fn = "survey_$surveyid.xml";
|
if (!(isset($noheader) && $noheader == true))
|
||||||
header("Content-Type: application/download");
|
{
|
||||||
header("Content-Disposition: attachment; filename=$fn");
|
$fn = "survey_$surveyid.xml";
|
||||||
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
|
header("Content-Type: application/download");
|
||||||
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
header("Content-Disposition: attachment; filename=$fn");
|
||||||
Header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
|
header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); // Date in the past
|
||||||
header("Pragma: no-cache"); // HTTP/1.0
|
header("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
|
||||||
|
Header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
|
||||||
echo $dom->dump_mem(true,'UTF-8');
|
header("Pragma: no-cache"); // HTTP/1.0
|
||||||
exit;
|
|
||||||
|
echo $quexml;
|
||||||
|
exit();
|
||||||
|
}
|
||||||
?>
|
?>
|
||||||
|
|||||||
@@ -592,6 +592,38 @@ if ($surveyid)
|
|||||||
. "<img src='$imagefiles/dataentry_disabled.png' title='' alt='".$clang->gT("Dataentry Screen for Survey")."'"
|
. "<img src='$imagefiles/dataentry_disabled.png' title='' alt='".$clang->gT("Dataentry Screen for Survey")."'"
|
||||||
. "name='DoDataentry' /></a>\n";
|
. "name='DoDataentry' /></a>\n";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (count(GetAdditionalLanguagesFromSurveyID($surveyid)) == 0)
|
||||||
|
{
|
||||||
|
|
||||||
|
$surveysummary .= "<a href=\"#\" onclick=\"window.open('$scriptname?action=showquexmlsurvey&sid=$surveyid', '_top')\""
|
||||||
|
. " title=\"".$clang->gTview("Printable and scanable Version of Survey")."\" >"
|
||||||
|
. "<img src='$imagefiles/scanner-3.png' name='ShowPrintableScanableSurvey' alt='".$clang->gT("Printable and scanable Version of Survey")."' />";
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
$surveysummary .= "<a href=\"#\" onclick=\"document.getElementById('printpopupquexml').style.visibility='visible'; "
|
||||||
|
. "document.getElementById('langpopup2').style.visibility='hidden';\""
|
||||||
|
. " title=\"".$clang->gTview("Printable and scanable Version of Survey")."\" >"
|
||||||
|
. "<img src='$imagefiles/scanner-3.png' name='ShowPrintableScanableSurvey' alt='".$clang->gT("Printable and scanable Version of Survey")."' />\n";
|
||||||
|
|
||||||
|
$tmp_survlangs = GetAdditionalLanguagesFromSurveyID($surveyid);
|
||||||
|
$baselang = GetBaseLanguageFromSurveyID($surveyid);
|
||||||
|
$tmp_survlangs[] = $baselang;
|
||||||
|
rsort($tmp_survlangs);
|
||||||
|
|
||||||
|
// Test Survey Language Selection Popup
|
||||||
|
$surveysummary .="<div class=\"langpopup2\" id=\"printpopupquexml\"><table width=\"100%\"><tr><td>".$clang->gT("Please select a language:")."</td></tr>";
|
||||||
|
foreach ($tmp_survlangs as $tmp_lang)
|
||||||
|
{
|
||||||
|
$surveysummary .= "<tr><td><a href=\"#\" accesskey='d' onclick=\"document.getElementById('printpopupquexml').style.visibility='hidden'; window.open('$scriptname?action=showquexmlsurvey&sid=$surveyid&lang=".$tmp_lang."', '_blank')\"><font color=\"#097300\"><b>".getLanguageNameFromCode($tmp_lang,false)."</b></font></a></td></tr>";
|
||||||
|
}
|
||||||
|
$surveysummary .= "<tr><td align=\"center\"><a href=\"#\" accesskey='d' onclick=\"document.getElementById('printpopupquexml').style.visibility='hidden';\"><font color=\"#DF3030\">".$clang->gT("Cancel")."</font></a></td></tr></table></div>";
|
||||||
|
|
||||||
|
$surveysummary .= "<script type='text/javascript'>document.getElementById('printpopupquexml').style.left='152px';</script>\n";
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (count(GetAdditionalLanguagesFromSurveyID($surveyid)) == 0)
|
if (count(GetAdditionalLanguagesFromSurveyID($surveyid)) == 0)
|
||||||
{
|
{
|
||||||
|
|||||||
94
include/limesurvey/admin/quexmlsurvey.php
Normal file
94
include/limesurvey/admin/quexmlsurvey.php
Normal file
@@ -0,0 +1,94 @@
|
|||||||
|
<?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: quexmlsurvey.php 9149 2010-09-28 03:07:52Z azammitdcarf $
|
||||||
|
*/
|
||||||
|
|
||||||
|
//Ensure script is not run directly, avoid path disclosure
|
||||||
|
include_once("login_check.php");
|
||||||
|
include_once(dirname(__FILE__)."/classes/quexml/quexmlpdf.php");
|
||||||
|
|
||||||
|
//---------------------
|
||||||
|
// Comes from http://fr2.php.net/tempnam
|
||||||
|
function tempdir($dir, $prefix='', $mode=0700)
|
||||||
|
{
|
||||||
|
if (substr($dir, -1) != '/') $dir .= '/';
|
||||||
|
|
||||||
|
do
|
||||||
|
{
|
||||||
|
$path = $dir.$prefix.mt_rand(0, 9999999);
|
||||||
|
} while (!mkdir($path, $mode));
|
||||||
|
|
||||||
|
return $path;
|
||||||
|
}
|
||||||
|
|
||||||
|
global $tempdir;
|
||||||
|
|
||||||
|
$surveyid = $_GET['sid'];
|
||||||
|
|
||||||
|
// Set the language of the survey, either from GET parameter of session var
|
||||||
|
if (isset($_GET['lang']))
|
||||||
|
{
|
||||||
|
$_GET['lang'] = preg_replace("/[^a-zA-Z0-9-]/", "", $_GET['lang']);
|
||||||
|
if ($_GET['lang']) $surveyprintlang = $_GET['lang'];
|
||||||
|
} else
|
||||||
|
{
|
||||||
|
$surveyprintlang=GetbaseLanguageFromSurveyid($surveyid);
|
||||||
|
}
|
||||||
|
|
||||||
|
// Setting the selected language for printout
|
||||||
|
$clang = new limesurvey_lang($surveyprintlang);
|
||||||
|
|
||||||
|
$quexmlpdf = new queXMLPDF(PDF_PAGE_ORIENTATION, 'mm', PDF_PAGE_FORMAT, true, 'UTF-8', false);
|
||||||
|
|
||||||
|
set_time_limit(120);
|
||||||
|
|
||||||
|
$noheader = true;
|
||||||
|
|
||||||
|
include_once("export_structure_quexml.php");
|
||||||
|
|
||||||
|
$quexmlpdf->create($quexmlpdf->createqueXML($quexml));
|
||||||
|
|
||||||
|
//NEED TO GET QID from $quexmlpdf
|
||||||
|
$qid = intval($quexmlpdf->getQuestionnaireId());
|
||||||
|
|
||||||
|
$zipdir=tempdir($tempdir);
|
||||||
|
|
||||||
|
$f1 = "$zipdir/quexf_banding_{$qid}_{$surveyprintlang}.xml";
|
||||||
|
$f2 = "$zipdir/quexmlpdf_{$qid}_{$surveyprintlang}.pdf";
|
||||||
|
$f3 = "$zipdir/quexml_{$qid}_{$surveyprintlang}.xml";
|
||||||
|
$f4 = "$zipdir/readme.txt";
|
||||||
|
|
||||||
|
file_put_contents($f1, $quexmlpdf->getLayout());
|
||||||
|
file_put_contents($f2, $quexmlpdf->Output("quexml_$qid.pdf", 'S'));
|
||||||
|
file_put_contents($f3, $quexml);
|
||||||
|
file_put_contents($f4, $clang->gT('This archive contains a PDF file of the survey, the queXML file of the survey and a queXF banding XML file which can be used with queXF: http://quexf.sourceforge.net/ for processing scanned surveys.'));
|
||||||
|
|
||||||
|
require_once("classes/phpzip/phpzip.inc.php");
|
||||||
|
$z = new PHPZip();
|
||||||
|
$zipfile="$tempdir/quexmlpdf_{$qid}_{$surveyprintlang}.zip";
|
||||||
|
$z->Zip($zipdir, $zipfile);
|
||||||
|
|
||||||
|
unlink($f1);
|
||||||
|
unlink($f2);
|
||||||
|
unlink($f3);
|
||||||
|
unlink($f4);
|
||||||
|
rmdir($zipdir);
|
||||||
|
|
||||||
|
header('Content-Type: application/octet-stream');
|
||||||
|
header('Content-Disposition: attachment; filename="quexmlpdf_' . $qid . '_' . $surveyprintlang . '.zip"');
|
||||||
|
header('Content-Transfer-Encoding: binary');
|
||||||
|
// load the file to send:
|
||||||
|
readfile($zipfile);
|
||||||
|
unlink($zipfile);
|
||||||
|
|
||||||
|
exit();
|
||||||
BIN
include/limesurvey/images/scanner-3.png
Normal file
BIN
include/limesurvey/images/scanner-3.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 4.0 KiB |
Reference in New Issue
Block a user