From a23e4984e30e6e99aafe8be973e1f334727b54c7 Mon Sep 17 00:00:00 2001 From: azammitdcarf Date: Thu, 30 Sep 2010 00:17:59 +0000 Subject: [PATCH] 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 --- include/limesurvey/admin/admin.php | 4 + .../admin/classes/quexml/quexmlpdf.php | 4 +- .../admin/export_structure_quexml.php | 24 +++-- include/limesurvey/admin/html.php | 32 ++++++ include/limesurvey/admin/quexmlsurvey.php | 94 ++++++++++++++++++ include/limesurvey/images/scanner-3.png | Bin 0 -> 4140 bytes 6 files changed, 146 insertions(+), 12 deletions(-) create mode 100644 include/limesurvey/admin/quexmlsurvey.php create mode 100644 include/limesurvey/images/scanner-3.png diff --git a/include/limesurvey/admin/admin.php b/include/limesurvey/admin/admin.php index 6d3d2d86..62e822a3 100644 --- a/include/limesurvey/admin/admin.php +++ b/include/limesurvey/admin/admin.php @@ -308,6 +308,10 @@ elseif ($action == 'iteratesurvey') if( ($surrows['browse_response'] && $surrows['activate_survey']) || $_SESSION['USER_RIGHT_SUPERADMIN'] == 1) {include('iterate_survey.php');} else { include('access_denied.php');} } +elseif ($action=='showquexmlsurvey') + { + include('quexmlsurvey.php'); //No special right needed to show the printable survey + } elseif ($action=='showprintablesurvey') { include('printablesurvey.php'); //No special right needed to show the printable survey diff --git a/include/limesurvey/admin/classes/quexml/quexmlpdf.php b/include/limesurvey/admin/classes/quexml/quexmlpdf.php index 6f18733a..db8a458d 100644 --- a/include/limesurvey/admin/classes/quexml/quexmlpdf.php +++ b/include/limesurvey/admin/classes/quexml/quexmlpdf.php @@ -4,8 +4,8 @@ * Modify these two lines to point to your TCPDF installation * Tested with TCPDF 5.8.008 - see http://www.tcpdf.org/ */ -require_once('/var/lib/tcpdf/config/lang/eng.php'); -require_once('/var/lib/tcpdf/tcpdf.php'); +require_once(dirname(__FILE__) . '/../tcpdf/config/lang/eng.php'); +require_once(dirname(__FILE__) . '/../tcpdf/tcpdf.php'); /** diff --git a/include/limesurvey/admin/export_structure_quexml.php b/include/limesurvey/admin/export_structure_quexml.php index 178ebec1..23b87a89 100644 --- a/include/limesurvey/admin/export_structure_quexml.php +++ b/include/limesurvey/admin/export_structure_quexml.php @@ -525,15 +525,19 @@ while ($Row = $QueryResult->FetchRow()) $dom->append_child($questionnaire); +$quexml = $dom->dump_mem(true,'UTF-8'); -$fn = "survey_$surveyid.xml"; -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"); -Header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); -header("Pragma: no-cache"); // HTTP/1.0 - -echo $dom->dump_mem(true,'UTF-8'); -exit; +if (!(isset($noheader) && $noheader == true)) +{ + $fn = "survey_$surveyid.xml"; + 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"); + Header("Cache-Control: must-revalidate, post-check=0, pre-check=0"); + header("Pragma: no-cache"); // HTTP/1.0 + + echo $quexml; + exit(); +} ?> diff --git a/include/limesurvey/admin/html.php b/include/limesurvey/admin/html.php index 77a6fb6b..94aa6b2c 100644 --- a/include/limesurvey/admin/html.php +++ b/include/limesurvey/admin/html.php @@ -592,6 +592,38 @@ if ($surveyid) . "".$clang->gT("Dataentry Screen for Survey")."\n"; } + + + if (count(GetAdditionalLanguagesFromSurveyID($surveyid)) == 0) + { + + $surveysummary .= "gTview("Printable and scanable Version of Survey")."\" >" + . "".$clang->gT("Printable and scanable Version of Survey").""; + + } else { + + $surveysummary .= "gTview("Printable and scanable Version of Survey")."\" >" + . "".$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 .="
"; + foreach ($tmp_survlangs as $tmp_lang) + { + $surveysummary .= ""; + } + $surveysummary .= "
".$clang->gT("Please select a language:")."
".getLanguageNameFromCode($tmp_lang,false)."
".$clang->gT("Cancel")."
"; + + $surveysummary .= "\n"; + } + if (count(GetAdditionalLanguagesFromSurveyID($surveyid)) == 0) { diff --git a/include/limesurvey/admin/quexmlsurvey.php b/include/limesurvey/admin/quexmlsurvey.php new file mode 100644 index 00000000..d292a3a2 --- /dev/null +++ b/include/limesurvey/admin/quexmlsurvey.php @@ -0,0 +1,94 @@ +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(); diff --git a/include/limesurvey/images/scanner-3.png b/include/limesurvey/images/scanner-3.png new file mode 100644 index 0000000000000000000000000000000000000000..cec53cdc18421b11636e163e341e456581c28b28 GIT binary patch literal 4140 zcmai2XH*kPw++S6xkwWMrCeI1B*f4{Km_SMgepZ!=%EEdFQJOks{w%zq*sw1s-hqu zARxs{6%nLJ3r%Sc@BQw2>-~DOW@fLMIs5E0^JCVWi8s(wXQ1Vz1pojHni>y~R|xst zsDW3#Df!R1E1-0`uX`T=sCzGS?aBJp7-*-h{@@C)%1@Q{@GGG4(lEzfp~l}$ZNN?O z_ax5izS9-{?GG@ronQ(8FbZfsxQ}vPm?Q+c8&4B@!q?`0V2*m}q^%`Kfm~5|F(I1h zV%Wpnl1wOJq}Y|yPn#88mh-@n6;#eLtRsJJUz}Q`aaRjDp27-s5mC{g7%;#!#0eG} z%yE2u8xR~8w%NJ1ARpf0WY0vI8=*$hEC>l*Xg?0^-U(UsAN`rM8(MHV%70nMa6&9f zwx;G2^6h2O??Ab7tadx+Oyv)k>X%IrYAq$Et1>2pqr)vgEu$oqr*!VdkOMM4k!w+x z!qh$IaA0AHxbVm9?8C5Mc{?Fdc)YBN3eED~b>{f1${PP*TwBO!q+v656Yy$ts&kJAxsjNv@m>9R-e0t9=WE~% z+}zDYYM5?WYwKf>QPDM#IV<)d(J7y%OePi-le@Yu+V%1_=E9cWmUUn2a)>PS1pxqBpvea8THKJ9*5DNT z4fRU9dQKm?xOjE`6Gi77H7u6J%1U8seIisJ=U*`6Iol=xfu=e+gS$@n0Yll~0O|xt?nC3yA=1uE+5oQ}2>fmBpHTU!XCz1QwR(4&;P_i;mH zOJo$YE#W810?ZikJ5N5ixWu!i{pHm7+**gbUwwi;C)a6wTE^hhwEx!$F6pyr$^D(! zt(fgoA|Gt^t%Hv&L9gscWhtq$aFr%e59E6qwPaead8`wkC`ifZ<@T-e#} z?R}cOj&Xn@qyzVZ>(YV4#9n}zh&|dOhAx4&Y(>2{Ka*e~*?A-B5$)1-G`!?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