function browsemenubar($title = '') { global $surveyid, $scriptname, $imagefiles, $homeurl, $clang, $sumrows5, $surrows; $thissurvey = getSurveyInfo($surveyid); //BROWSE MENU BAR $browsemenubar = "<div class='menubar'>\n" . "<div class='menubar-title'>\n" . "<strong>{$title}</strong>: ({$thissurvey['name']})" . "</div>" . "<div class='menubar-main'>\n" . "<div class='menubar-left'>\n" . "<a href='{$scriptname}?sid={$surveyid}' title=\"" . $clang->gTview("Return to survey administration") . "\" >" . "<img name='Administration' src='{$imagefiles}/home.png' title='' alt='" . $clang->gT("Return to survey administration") . "' /></a>\n" . "<img src='{$imagefiles}/blank.gif' alt='' width='11' />\n" . "<img src='{$imagefiles}/seperator.gif' alt='' />\n" . "<a href='{$scriptname}?action=browse&sid={$surveyid}' title=\"" . $clang->gTview("Show summary information") . "\" >" . "<img name='SurveySummary' src='{$imagefiles}/summary.png' title='' alt='" . $clang->gT("Show summary information") . "' /></a>\n"; //Display responses if (count(GetAdditionalLanguagesFromSurveyID($surveyid)) == 0) { $browsemenubar .= "<a href='{$scriptname}?action=browse&sid={$surveyid}&subaction=all' title=\"" . $clang->gTview("Display Responses") . "\" >" . "<img name='ViewAll' src='{$imagefiles}/document.png' title='' alt='" . $clang->gT("Display Responses") . "' /></a>\n"; } else { $browsemenubar .= "<a href=\"#\" accesskey='b' id='browseresponses'" . "title=\"" . $clang->gTview("Display Responses") . "\" >" . "<img src='{$imagefiles}/document.png' alt='" . $clang->gT("Display Responses") . "' name='ViewAll' /></a>"; $tmp_survlangs = GetAdditionalLanguagesFromSurveyID($surveyid); $baselang = GetBaseLanguageFromSurveyID($surveyid); $tmp_survlangs[] = $baselang; rsort($tmp_survlangs); $browsemenubar .= "<div class=\"langpopup\" id=\"browselangpopup\">" . $clang->gT("Please select a language:") . "<ul>"; foreach ($tmp_survlangs as $tmp_lang) { $browsemenubar .= "<li><a href=\"{$scriptname}?action=browse&sid={$surveyid}&subaction=all&browselang={$tmp_lang}\" accesskey='b'>" . getLanguageNameFromCode($tmp_lang, false) . "</a></li>"; } $browsemenubar .= "</ul></div>"; } // Display last 50 responses $browsemenubar .= "<a href='{$scriptname}?action=browse&sid={$surveyid}&subaction=all&limit=50&order=desc'" . " title=\"" . $clang->gTview("Display Last 50 Responses") . "\" >" . "<img name='ViewLast' src='{$imagefiles}/viewlast.png' alt='" . $clang->gT("Display Last 50 Responses") . "' /></a>\n"; // Data entry $browsemenubar .= "<a href='{$scriptname}?action=dataentry&sid={$surveyid}'" . " title=\"" . $clang->gTview("Dataentry Screen for Survey") . "\" >" . "<img name='DataEntry' src='{$imagefiles}/dataentry.png' alt='" . $clang->gT("Dataentry Screen for Survey") . "' /></a>\n"; // Statistics $browsemenubar .= "<a href='{$scriptname}?action=statistics&sid={$surveyid}' " . "title=\"" . $clang->gTview("Get statistics from these responses") . "\" >" . "<img name='Statistics' src='{$imagefiles}/statistics.png' alt='" . $clang->gT("Get statistics from these responses") . "' /></a>\n"; $browsemenubar .= "<img src='{$imagefiles}/seperator.gif' alt='' />\n"; if (bHasRight($surveyid, 'export')) { // Export to application $browsemenubar .= "<a href='{$scriptname}?action=exportresults&sid={$surveyid}' title=\"" . $clang->gTview("Export Results to Application") . "\" >" . "<img name='Export' src='{$imagefiles}/export.png' " . "alt='" . $clang->gT("Export Results to Application") . "' /></a>\n" . "<a href='{$scriptname}?action=exportspss&sid={$surveyid}' title=\"" . $clang->gTview("Export results to a SPSS/PASW command file") . "\" >" . "<img src='{$imagefiles}/exportspss.png' " . "alt='" . $clang->gT("Export results to a SPSS/PASW command file") . "' /></a>\n" . "<a href='{$scriptname}?action=exportr&sid={$surveyid}' title=\"" . $clang->gTview("Export results to a R data file") . "\" >" . "<img src='{$imagefiles}/exportr.png' " . "alt='" . $clang->gT("Export results to a R data file") . "' /></a>\n"; } //Import old response table $browsemenubar .= "<a href='{$scriptname}?action=importoldresponses&sid={$surveyid}' title=\"" . $clang->gTview("Import answers from a deactivated survey table") . "\" >" . "<img name='ImportOldResponses' src='{$imagefiles}/importold.png' alt='" . $clang->gT("Import answers from a deactivated survey table") . "' /></a>\n"; $browsemenubar .= "<img src='{$imagefiles}/seperator.gif' alt='' />\n"; //browse saved responses $browsemenubar .= "<a href='{$scriptname}?action=saved&sid={$surveyid}' title=\"" . $clang->gTview("View Saved but not submitted Responses") . "\" >" . "<img src='{$imagefiles}/saved.png' title='' alt='" . $clang->gT("View Saved but not submitted Responses") . "' name='BrowseSaved' /></a>\n" . "<a href='{$scriptname}?action=vvimport&sid={$surveyid}' title=\"" . $clang->gTview("Import a VV survey file") . "\" >" . "<img src='{$imagefiles}/importvv.png' alt='" . $clang->gT("Import a VV survey file") . "' /></a>\n"; //Export VV if (bHasRight($surveyid, 'export')) { $browsemenubar .= "<a href='{$scriptname}?action=vvexport&sid={$surveyid}' title=\"" . $clang->gTview("Export a VV survey file") . "\" >" . "<img src='{$imagefiles}/exportvv.png' title='' alt='" . $clang->gT("Export a VV survey file") . "' /></a>\n"; } //Iterate survey if (($surrows['browse_response'] && $surrows['activate_survey'] || $_SESSION['USER_RIGHT_SUPERADMIN'] == 1) && ($thissurvey['private'] == 'N' && $thissurvey['tokenanswerspersistence'] == 'Y')) { $browsemenubar .= "<a href='{$scriptname}?action=iteratesurvey&sid={$surveyid}' title=\"" . $clang->gTview("Iterate survey") . "\" >" . "<img src='{$imagefiles}/iterate.png' title='' alt='" . $clang->gT("Iterate survey") . "' /></a>\n"; } $browsemenubar .= "</div>\n" . "\t</div>\n" . "</div>\n"; return $browsemenubar; }
if (!isset($answers)) { $answers = returnglobal('answers'); } if (!isset($type)) { $type = returnglobal('type'); } if (!isset($convertyto1)) { $convertyto1 = returnglobal('convertyto1'); } if (!isset($convertnto2)) { $convertnto2 = returnglobal('convertnto2'); } if (!isset($convertspacetous)) { $convertspacetous = returnglobal('convertspacetous'); } if (!bHasRight($surveyid, 'export')) { exit; } include_once "login_check.php"; include_once dirname(__FILE__) . "/classes/pear/Spreadsheet/Excel/Writer.php"; include_once dirname(__FILE__) . "/classes/tcpdf/extensiontcpdf.php"; $surveybaselang = GetBaseLanguageFromSurveyID($surveyid); $exportoutput = ""; // Get info about the survey $thissurvey = getSurveyInfo($surveyid); if (!$exportstyle) { //FIND OUT HOW MANY FIELDS WILL BE NEEDED - FOR 255 COLUMN LIMIT $excesscols = createFieldMap($surveyid); $excesscols = array_keys($excesscols); $afieldcount = count($excesscols); $exportoutput .= browsemenubar($clang->gT("Export Results"));
if (!isset($surveyid)) { $surveyid = returnglobal('sid'); } if (!isset($action)) { $action = returnglobal('action'); } $surveyinfo = getSurveyInfo($surveyid); $js_admin_includes[] = $homeurl . '/scripts/assessments.js'; $js_admin_includes[] = '../scripts/jquery/jquery.tablesorter.min.js'; $js_admin_includes[] = $rooturl . '/scripts/jquery/jquery-ui.js'; // . "<link rel=\"stylesheet\" type=\"text/css\" media=\"all\" href=\"styles/default/jquery-ui.css\" />\n"; $assessmentlangs = GetAdditionalLanguagesFromSurveyID($surveyid); $baselang = GetBaseLanguageFromSurveyID($surveyid); array_unshift($assessmentlangs, $baselang); // makes an array with ALL the languages supported by the survey -> $assessmentlangs if (bHasRight($surveyid, 'edit_survey_property')) { if ($action == "assessmentadd") { $inserttable = $dbprefix . "assessments"; $first = true; foreach ($assessmentlangs as $assessmentlang) { if (!isset($_POST['gid'])) { $_POST['gid'] = 0; } $datarray = array('sid' => $surveyid, 'scope' => $_POST['scope'], 'gid' => $_POST['gid'], 'minimum' => $_POST['minimum'], 'maximum' => $_POST['maximum'], 'name' => $_POST['name_' . $assessmentlang], 'language' => $assessmentlang, 'message' => $_POST['assessmentmessage_' . $assessmentlang]); if ($first == false) { $datarray['id'] = $aid; } $query = $connect->GetInsertSQL($inserttable, $datarray, get_magic_quotes_gpc()); $result = $connect->Execute($query) or safe_die("Error inserting<br />{$query}<br />" . $connect->ErrorMsg()); if ($first == true) { $first = false;
} $browseoutput .= "</form></div>\n" . "\t</div><form action='{$scriptname}?action=browse' id='resulttableform' method='post'>\n"; $browseoutput .= $tableheader; $dateformatdetails = getDateFormatData($_SESSION['dateformat']); while ($dtrow = $dtresult->FetchRow()) { if (!isset($bgcc)) { $bgcc = "evenrow"; } else { if ($bgcc == "evenrow") { $bgcc = "oddrow"; } else { $bgcc = "evenrow"; } } $browseoutput .= "\t<tr class='{$bgcc}' valign='top'>\n" . "<td align='center'><input type='checkbox' class='cbResponseMarker' value='{$dtrow['id']}' name='markedresponses[]' /></td>\n" . "<td align='center'>\n <a href='{$scriptname}?action=browse&sid={$surveyid}&subaction=id&id={$dtrow['id']}'><img src='{$imagefiles}/token_viewanswer.png' alt='" . $clang->gT('View response details') . "'/></a>\n <a href='{$scriptname}?action=dataentry&sid={$surveyid}&subaction=edit&id={$dtrow['id']}&lang={$language}'><img src='{$imagefiles}/token_edit.png' alt='" . $clang->gT('Edit this response') . "'/></a>"; if (bHasRight($surveyid, 'delete_survey')) { $browseoutput .= "<a><img id='deleteresponse_{$dtrow['id']}' src='{$imagefiles}/token_delete.png' alt='" . $clang->gT('Delete this response') . "' class='deleteresponse'/></a>\n"; } $browseoutput .= "</td>"; $i = 0; //If not private, display the token info and link to the token screen if ($surveyinfo['private'] == "N" && $dtrow['token'] && db_tables_exist($tokentable)) { if (isset($dtrow['tid']) && !empty($dtrow['tid'])) { //If we have a token, create a link to edit it $browsedatafield = "<a href='{$scriptname}?action=tokens&sid={$surveyid}&subaction=edit&tid={$dtrow['tid']}' title='" . $clang->gT("Edit this token") . "'>"; $browsedatafield .= "{$dtrow['token']}"; $browsedatafield .= "</a>"; } else { //No corresponding token in the token tabel, just display the token $browsedatafield .= "{$dtrow['token']}"; }
$message .= '<li>' . sprintf($clang->gT("%s records with invalid email address removed"), count($invalidemaillist)); $message .= " [<a href='#' onclick='\$(\"#invalidemaillist\").toggle();'>" . $clang->gT("List") . "</a>]"; $message .= "<div class='badtokenlist' id='invalidemaillist' style='display: none;'><ul>"; foreach ($invalidemaillist as $data) { $message .= "<li>{$data}</li>\n"; } } $message .= "</ul>"; } $message .= "</div>"; $tokenoutput .= "{$message}<br />\n"; unlink($the_full_file_path); } $tokenoutput .= "</div>\n"; } if ($subaction == "uploadldap" && (bHasRight($surveyid, 'edit_survey_property') || bHasRight($surveyid, 'activate_survey'))) { $duplicatelist = array(); $invalidemaillist = array(); $tokenoutput .= "\t<tr><td colspan='2' height='4'><strong>" . $clang->gT("Uploading LDAP Query") . "</strong></td></tr>\n" . "\t<tr><td align='center'>\n"; $ldapq = $_POST['ldapQueries']; // the ldap query id $ldap_server_id = $ldap_queries[$ldapq]['ldapServerId']; $ldapserver = $ldap_server[$ldap_server_id]['server']; $ldapport = $ldap_server[$ldap_server_id]['port']; if (isset($ldap_server[$ldap_server_id]['encoding']) && $ldap_server[$ldap_server_id]['encoding'] != 'utf-8' && $ldap_server[$ldap_server_id]['encoding'] != 'UTF-8') { $ldapencoding = $ldap_server[$ldap_server_id]['encoding']; } else { $ldapencoding = ''; } // define $attrlist: list of attributes to read from users' entries $attrparams = array('firstname_attr', 'lastname_attr', 'email_attr', 'token_attr', 'language');
if ($usresult) { $surveyselect = getsurveylist(); } else { $databaseoutput .= "<script type=\"text/javascript\">\n<!--\n alert(\"" . $clang->gT("Survey could not be updated", "js") . "\n" . $connect->ErrorMsg() . " ({$usquery})\")\n //-->\n</script>\n"; } } elseif ($action == "delsurvey" && bHasRight($surveyid, 'delete_survey')) { $query = "DELETE FROM {$dbprefix}surveys WHERE sid={$surveyid}"; $result = $connect->Execute($query); // Checked if ($result) { $surveyid = ""; $surveyselect = getsurveylist(); } else { $databaseoutput .= "<script type=\"text/javascript\">\n<!--\n alert(\"" . $clang->gT("ERROR deleting Survey id", "js") . " ({$surveyid})!\n{$error}\")\n //-->\n</script>\n"; } } elseif ($action == "updatesurvey2" && bHasRight($surveyid, 'edit_survey_property')) { $languagelist = GetAdditionalLanguagesFromSurveyID($surveyid); $languagelist[] = GetBaseLanguageFromSurveyID($surveyid); require_once "../classes/inputfilter/class.inputfilter_clean.php"; $myFilter = new InputFilter('', '', 1, 1, 1); foreach ($languagelist as $langname) { if ($langname) { if ($_POST['url_' . $langname] == "http://") { $_POST['url_' . $langname] = ""; } // Clean XSS attacks if ($filterxsshtml) { $_POST['short_title_' . $langname] = $myFilter->process($_POST['short_title_' . $langname]); $_POST['description_' . $langname] = $myFilter->process($_POST['description_' . $langname]); $_POST['welcome_' . $langname] = $myFilter->process($_POST['welcome_' . $langname]); $_POST['endtext_' . $langname] = $myFilter->process($_POST['endtext_' . $langname]);
} } elseif ($action == 'vvexport') { if (bHasRight($surveyid, 'browse_response')) { include 'vvexport.php'; } else { include 'access_denied.php'; } } elseif ($action == 'vvimport') { if (bHasRight($surveyid, 'browse_response')) { include 'vvimport.php'; } else { include 'access_denied.php'; } } if ($action == 'addquestion' || $action == 'copyquestion' || $action == 'editquestion' || $action == 'editdefaultvalues' || $action == 'orderquestions' || $action == 'ajaxquestionattributes' || $action == 'ajaxlabelsetpicker' || $action == 'ajaxlabelsetdetails') { if (bHasRight($surveyid, 'define_questions')) { $_SESSION['FileManagerContext'] = "edit:question:{$surveyid}"; include 'questionhandling.php'; } else { include 'access_denied.php'; } } if ($action == 'adduser' || $action == 'deluser' || $action == 'moduser' || $action == 'setusertemplates' || $action == 'usertemplates' || $action == 'userrights' || $action == 'modifyuser' || $action == 'editusers' || $action == 'addusergroup' || $action == 'editusergroup' || $action == 'mailusergroup' || $action == 'delusergroup' || $action == 'usergroupindb' || $action == 'mailsendusergroup' || $action == 'editusergroupindb' || $action == 'editusergroups' || $action == 'deleteuserfromgroup' || $action == 'addusertogroup' || $action == 'setuserrights' || $action == 'setasadminchild') { include 'userrighthandling.php'; } // For some output we dont want to have the standard admin menu bar if (!isset($labelsoutput) && !isset($templatesoutput) && !isset($printablesurveyoutput) && !isset($assessmentsoutput) && !isset($tokenoutput) && !isset($browseoutput) && !isset($exportspssoutput) && !isset($exportroutput) && !isset($dataentryoutput) && !isset($statisticsoutput) && !isset($savedsurveyoutput) && !isset($exportoutput) && !isset($importoldresponsesoutput) && !isset($conditionsoutput) && !isset($vvoutput) && !isset($listcolumnoutput) && !isset($importlabelresources) && !isset($iteratesurveyoutput) && substr($action, 0, 4) != 'ajax' && $action != 'update' && $action != 'showphpinfo') { $adminoutput .= showadminmenu(); } if (isset($databaseoutput)) { $adminoutput .= $databaseoutput;