"
. "".$clang->gT("Your personal settings")."\n"
. "\n"
. "
\n"
. "
";
}
if (isset($surveyid) && $surveyid &&
$action!='dataentry' && $action!='browse' && $action!='exportspss' &&
$action!='statistics' && $action!='importoldresponses' && $action!='exportr' &&
$action!='vvimport' && $action!='vvexport' && $action!='exportresults')
{
if(bHasSurveyPermission($surveyid,'survey','read'))
{
$js_admin_includes[]='../scripts/jquery/jquery.coookie.js';
$js_admin_includes[]='../scripts/jquery/superfish.js';
$js_admin_includes[]='../scripts/jquery/hoverIntent.js';
$js_admin_includes[]='scripts/surveytoolbar.js';
$css_admin_includes[]= $homeurl."/styles/default/superfish.css";
$baselang = GetBaseLanguageFromSurveyID($surveyid);
$sumquery3 = "SELECT * FROM ".db_table_name('questions')." WHERE sid={$surveyid} AND parent_qid=0 AND language='".$baselang."'"; //Getting a count of questions for this survey
$sumresult3 = $connect->Execute($sumquery3); //Checked
$sumcount3 = $sumresult3->RecordCount();
$sumquery6 = "SELECT count(*) FROM ".db_table_name('conditions')." as c, ".db_table_name('questions')." as q WHERE c.qid = q.qid AND q.sid=$surveyid"; //Getting a count of conditions for this survey
$sumcount6 = $connect->GetOne($sumquery6); //Checked
$sumquery2 = "SELECT * FROM ".db_table_name('groups')." WHERE sid={$surveyid} AND language='".$baselang."'"; //Getting a count of groups for this survey
$sumresult2 = $connect->Execute($sumquery2); //Checked
$sumcount2 = $sumresult2->RecordCount();
$sumquery1 = "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"; //Getting data for this survey
$sumresult1 = db_select_limit_assoc($sumquery1, 1) ; //Checked
if ($sumresult1->RecordCount()==0){die('Invalid survey id');} // if surveyid is invalid then die to prevent errors at a later time
// Output starts here...
$surveysummary = "";
$surveyinfo = $sumresult1->FetchRow();
$surveyinfo = array_map('FlattenText', $surveyinfo);
//$surveyinfo = array_map('htmlspecialchars', $surveyinfo);
$activated = $surveyinfo['active'];
////////////////////////////////////////////////////////////////////////
// SURVEY MENU BAR
////////////////////////////////////////////////////////////////////////
$surveysummary .= "" //"
\n" ;
}
// Translate survey item
if (bHasSurveyPermission($surveyid,'translations','read'))
{
// Check if multiple languages have been activated
$supportedLanguages = getLanguageData(false);
if (count(GetAdditionalLanguagesFromSurveyID($surveyid)) > 0)
{
$surveysummary .= "
';
}
// SHOW PRINTABLE AND SCANNABLE VERSION OF SURVEY BUTTON
if(bHasSurveyPermission($surveyid,'surveycontent','export'))
{
if (count(GetAdditionalLanguagesFromSurveyID($surveyid)) == 0)
{
$surveysummary .= "
\n";
$surveysummary2 = "";
if ($surveyinfo['anonymized'] != "N") {$surveysummary2 .= $clang->gT("Answers to this survey are anonymized.")." \n";}
else {$surveysummary2 .= $clang->gT("This survey is NOT anonymous.")." \n";}
if ($surveyinfo['format'] == "S") {$surveysummary2 .= $clang->gT("It is presented question by question.")." \n";}
elseif ($surveyinfo['format'] == "G") {$surveysummary2 .= $clang->gT("It is presented group by group.")." \n";}
else {$surveysummary2 .= $clang->gT("It is presented on one single page.")." \n";}
if ($surveyinfo['allowjumps'] == "Y")
{
if ($surveyinfo['format'] == 'A') {$surveysummary2 .= $clang->gT("No question index will be shown with this format.")." \n";}
else {$surveysummary2 .= $clang->gT("A question index will be shown; participants will be able to jump between viewed questions.")." \n";}
}
if ($surveyinfo['datestamp'] == "Y") {$surveysummary2 .= $clang->gT("Responses will be date stamped.")." \n";}
if ($surveyinfo['ipaddr'] == "Y") {$surveysummary2 .= $clang->gT("IP Addresses will be logged")." \n";}
if ($surveyinfo['refurl'] == "Y") {$surveysummary2 .= $clang->gT("Referrer URL will be saved.")." \n";}
if ($surveyinfo['usecookie'] == "Y") {$surveysummary2 .= $clang->gT("It uses cookies for access control.")." \n";}
if ($surveyinfo['allowregister'] == "Y") {$surveysummary2 .= $clang->gT("If tokens are used, the public may register for this survey")." \n";}
if ($surveyinfo['allowsave'] == "Y" && $surveyinfo['tokenanswerspersistence'] == 'N') {$surveysummary2 .= $clang->gT("Participants can save partially finished surveys")." \n";}
if ($surveyinfo['emailnotificationto'] != '')
{
$surveysummary2 .= $clang->gT("Basic email notification is sent to:")." {$surveyinfo['emailnotificationto']} \n";
}
if ($surveyinfo['emailresponseto'] != '')
{
$surveysummary2 .= $clang->gT("Detailed email notification with response data is sent to:")." {$surveyinfo['emailresponseto']} \n";
}
if(bHasSurveyPermission($surveyid,'surveycontent','update'))
{
$surveysummary2 .= $clang->gT("Regenerate question codes:")
. " [gT("Are you sure you want regenerate the question codes?","js")."')) {".get2post("$scriptname?action=renumberquestions&sid=$surveyid&style=straight")."}\" "
. ">".$clang->gT("Straight")."] "
. " [gT("Are you sure you want regenerate the question codes?","js")."')) {".get2post("$scriptname?action=renumberquestions&sid=$surveyid&style=bygroup")."}\" "
. ">".$clang->gT("By Group")."]";
$surveysummary2 .= "\n";
}
$surveysummary .= "
\n";
if (!$surveyinfo['language']) {$language=getLanguageNameFromCode($currentadminlang,false);} else {$language=getLanguageNameFromCode($surveyinfo['language'],false);}
$surveysummary .= "
$language
\n";
// get the rowspan of the Additionnal languages row
// is at least 1 even if no additionnal language is present
$additionnalLanguagesCount = count($aAdditionalLanguages);
$surveysummary .= "
"
. $clang->gT("Additional Languages").":
\n";
$first=true;
if ($additionnalLanguagesCount == 0)
{
$surveysummary .= "
-
\n";
}
else
{
foreach ($aAdditionalLanguages as $langname)
{
if ($langname)
{
if (!$first) {$surveysummary .= "
";}
$first=false;
$surveysummary .= "
".getLanguageNameFromCode($langname,false)."
\n";
}
}
}
if ($first) $surveysummary .= "";
if ($surveyinfo['surveyls_urldescription']==""){$surveyinfo['surveyls_urldescription']=htmlspecialchars($surveyinfo['surveyls_url']);}
$surveysummary .= "
\n";
if ($activated == "N" && $sumcount3 == 0)
{
$surveysummary .= $clang->gT("Survey cannot be activated yet.")." \n";
if ($sumcount2 == 0 && bHasSurveyPermission($surveyid,'surveycontent','create'))
{
$surveysummary .= "[".$clang->gT("You need to add question groups")."] ";
}
if ($sumcount3 == 0 && bHasSurveyPermission($surveyid,'surveycontent','create'))
{
$surveysummary .= "[".$clang->gT("You need to add questions")."] ";
}
}
$surveysummary .= $surveysummary2
. "
\n";
}
else
{
include("access_denied.php");
}
}
if (isset($surveyid) && $surveyid && $gid ) // Show the group toolbar
{
// TODO: check that surveyid and thus baselang are always set here
$sumquery4 = "SELECT * FROM ".db_table_name('questions')." WHERE sid=$surveyid AND
gid=$gid AND language='".$baselang."'"; //Getting a count of questions for this survey
$sumresult4 = $connect->Execute($sumquery4); //Checked
$sumcount4 = $sumresult4->RecordCount();
$grpquery ="SELECT * FROM ".db_table_name('groups')." WHERE gid=$gid AND
language='".$baselang."' ORDER BY ".db_table_name('groups').".group_order";
$grpresult = db_execute_assoc($grpquery); //Checked
// Check if other questions/groups are dependent upon this group
$condarray=GetGroupDepsForConditions($surveyid,"all",$gid,"by-targgid");
$groupsummary = "
\n";
}
////////////////////////////////////////////////////////////////////////////////
// Question toolbar
////////////////////////////////////////////////////////////////////////////////
if (isset($surveyid) && $surveyid && $gid && $qid) // Show the question toolbar
{
// TODO: check that surveyid is set and that so is $baselang
//Show Question Details
//Count answer-options for this question
$qrq = "SELECT * FROM ".db_table_name('answers')." WHERE qid=$qid AND language='".$baselang."' ORDER BY sortorder, answer";
$qrr = $connect->Execute($qrq); //Checked
$qct = $qrr->RecordCount();
//Count sub-questions for this question
$sqrq= "SELECT * FROM ".db_table_name('questions')." WHERE parent_qid=$qid AND language='".$baselang."'";
$sqrr= $connect->Execute($sqrq); //Checked
$sqct = $sqrr->RecordCount();
$qrquery = "SELECT * FROM ".db_table_name('questions')." WHERE gid=$gid AND sid=$surveyid AND qid=$qid AND language='".$baselang."'";
$qrresult = db_execute_assoc($qrquery) or safe_die($qrquery." ".$connect->ErrorMsg()); //Checked
$questionsummary = "
\n";
// Check if other questions in the Survey are dependent upon this question
$condarray=GetQuestDepsForConditions($surveyid,"all","all",$qid,"by-targqid","outsidegroup");
// PREVIEW THIS QUESTION BUTTON
while ($qrrow = $qrresult->FetchRow())
{
$qrrow = array_map('FlattenText', $qrrow);
//$qrrow = array_map('htmlspecialchars', $qrrow);
$questionsummary .= "