Skip to content

Commit

Permalink
Added langauge popup for pritable survey button.
Browse files Browse the repository at this point in the history
git-svn-id: file:///Users/Shitiz/Downloads/lssvn/source/phpsurveyor@2233 b72ed6b6-b9f8-46b5-92b4-906544132732
  • Loading branch information
David Olivier committed Feb 3, 2007
1 parent bfae735 commit 2f3d7bd
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 11 deletions.
47 changes: 40 additions & 7 deletions admin/html.php
Expand Up @@ -383,7 +383,7 @@
. "name='DoSurvey' align='left' alt='"._("Do Survey")."' /></a>";

} else {
$surveysummary .= "<a href=\"#\" accesskey='d' onclick=\"document.getElementById('testsurvpopup').style.visibility='visible';\""
$surveysummary .= "<a href=\"#\" accesskey='d' onclick=\"hideTooltip(); document.getElementById('testsurvpopup').style.visibility='visible';\""
. "onmouseout=\"hideTooltip()\""
. "onmouseover=\"showTooltip(event,'"._("Do Survey")."');return false\">"
."<img src='$imagefiles/do.png' title='' "
Expand Down Expand Up @@ -420,12 +420,45 @@
{
$surveysummary .= "\t\t\t\t\t<img src='$imagefiles/blank.gif' alt='' width='40' align='left' border='0' hspace='0' />\n";
}
$surveysummary .= "<a href=\"#\" onclick=\"window.open('$scriptname?action=showprintablesurvey&amp;sid=$surveyid', '_blank')\""
. "onmouseout=\"hideTooltip()\""
. "onmouseover=\"showTooltip(event,'"._("Printable Version of Survey")."');return false\">\n"
. "<img src='$imagefiles/print.png' title='' name='ShowPrintableSurvey' align='left' alt='"._("Printable Version of Survey")."' />"
."</a>"
. "\t\t\t\t\t<img src='$imagefiles/seperator.gif' alt='' align='left' border='0' hspace='0' />\n";

if (count(GetAdditionalLanguagesFromSurveyID($surveyid)) == 0)
{

$surveysummary .= "<a href=\"#\" onclick=\"window.open('$scriptname?action=showprintablesurvey&amp;sid=$surveyid', '_blank')\""
. "onmouseout=\"hideTooltip()\""
. "onmouseover=\"showTooltip(event,'"._("Printable Version of Survey")."');return false\">\n"
. "<img src='$imagefiles/print.png' title='' name='ShowPrintableSurvey' align='left' alt='"._("Printable Version of Survey")."' />"
."</a>"
. "\t\t\t\t\t<img src='$imagefiles/seperator.gif' alt='' align='left' border='0' hspace='0' />\n";

} else {

$surveysummary .= "<a href=\"#\" onclick=\"hideTooltip(); document.getElementById('printpopup').style.visibility='visible';\""
. "onmouseout=\"hideTooltip()\""
. "onmouseover=\"showTooltip(event,'"._("Printable Version of Survey")."');return false\">\n"
. "<img src='$imagefiles/print.png' title='' name='ShowPrintableSurvey' align='left' alt='"._("Printable Version of Survey")."' />"
."</a>"
. "\t\t\t\t\t<img src='$imagefiles/seperator.gif' alt='' align='left' border='0' hspace='0' />\n";

$tmp_survlangs = GetAdditionalLanguagesFromSurveyID($surveyid);
$baselang = GetBaseLanguageFromSurveyID($surveyid);
$tmp_survlangs[] = $baselang;

// Test Survey Language Selection Popup
$surveysummary .="<DIV class=\"testsurvpopup\" id=\"printpopup\"><table width=\"100%\"><tr><td>"._("Please select a language:")."</td></tr>";
foreach ($tmp_survlangs as $tmp_lang)
{
$surveysummary .= "<tr><td><a href=\"#\" accesskey='d' onclick=\"document.getElementById('printpopup').style.visibility='hidden'; window.open('$scriptname?action=showprintablesurvey&amp;sid=$surveyid&amp;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('printpopup').style.visibility='hidden';\" /><font color=\"#DF3030\">"._("Cancel")."</font></a></td><tr></table></DIV>";

$surveysummary .= "<script type='text/javascript'>document.getElementById('printpopup').style.left='152px';</script>";
if (count($tmp_survlangs) > 2)
{
$tmp_pheight = 100 + ((count($tmp_survlangs)-2) * 20);
$surveysummary .= "<script type='text/javascript'>document.getElementById('printpopup').style.height='".$tmp_pheight."px';</script>";
}
}

if($sumrows5['edit_survey_property'])
{
Expand Down
17 changes: 13 additions & 4 deletions admin/printablesurvey.php
Expand Up @@ -47,11 +47,20 @@


// PRESENT SURVEY DATAENTRY SCREEN
//ToDo: Show a language selection box
$surveyprintlang=GetbaseLanguageFromSurveyid($surveyid);
$desquery = "SELECT * FROM ".db_table_name('surveys')." inner join ".db_table_name('surveys_languagesettings')." on (surveyls_survey_id=sid and surveyls_language=language) WHERE sid=$surveyid and language=".$connect->qstr($surveyprintlang); //Getting data for this survey
$desresult = db_execute_assoc($desquery);

// 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);
}

$desquery = "SELECT * FROM ".db_table_name('surveys')." inner join ".db_table_name('surveys_languagesettings')." on (surveyls_survey_id=sid) WHERE sid=$surveyid and phpsv_surveys_languagesettings.surveyls_language=".$connect->qstr($surveyprintlang); //Getting data for this survey

$desresult = db_execute_assoc($desquery);
while ($desrow = $desresult->FetchRow())
{
$surveyname = $desrow['surveyls_title'];
Expand Down

0 comments on commit 2f3d7bd

Please sign in to comment.