function showTranslateVariable($vsid, $message = "") { $survey = new Survey($_SESSION['SUID']); $section = $survey->getSection($_SESSION['SEID']); $var = $survey->getVariableDescriptive($vsid); $returnStr = $this->showVariableHeader($survey, $section, $var, Language::headerTranslateVariable(), $message); if ($_SESSION['VRFILTERMODE_VARIABLE'] == 0) { $returnStr .= $this->showTranslateVariableGeneral($var); } elseif ($_SESSION['VRFILTERMODE_VARIABLE'] == 2) { $returnStr .= $this->showTranslateVariableLayout($var); } elseif ($_SESSION['VRFILTERMODE_VARIABLE'] == 3) { $returnStr .= $this->showTranslateVariableAssistance($var); } elseif ($_SESSION['VRFILTERMODE_VARIABLE'] == 4) { $returnStr .= $this->showTranslateVariableFill($var); } $returnStr .= '<div style="min-height: 100px; max-height: 100%;"></div>'; $returnStr .= $this->showVariableFooter($survey); return $returnStr; }
function showAuxDataRes() { /* update last page */ $_SESSION['LASTPAGE'] = substr($_SESSION['LASTPAGE'], 0, strripos($_SESSION['LASTPAGE'], "res")); $displayOutput = new DisplayOutput(); $de = new DataExport(loadvar('survey')); $de->setProperty(DATA_OUTPUT_CLEAN, loadvar(DATA_OUTPUT_CLEAN)); $de->setProperty(DATA_OUTPUT_HIDDEN, loadvar(DATA_OUTPUT_HIDDEN)); $de->setProperty(DATA_OUTPUT_COMPLETED, loadvar(DATA_OUTPUT_COMPLETED)); $de->setProperty(DATA_OUTPUT_FIELDNAME_CASE, loadvar(DATA_OUTPUT_FIELDNAME_CASE)); if (loadvar(DATA_OUTPUT_FILENAME) != "") { $de->setProperty(DATA_OUTPUT_FILENAME, loadvar(DATA_OUTPUT_FILENAME)); } $cookievars = ""; if (isset($_COOKIE['uscicvariablecookie'])) { if (loadvar(DATA_OUTPUT_SUBDATA) == SUBDATA_YES) { $vars = explode("-", $_COOKIE['uscicvariablecookie']); $arr = array(); foreach ($vars as $var) { $varsplit = explode("~", $var); if (loadvar('survey') == $varsplit[0]) { // only consider variables from survey we are downloading for $survey = new Survey($varsplit[0]); $v = $survey->getVariableDescriptive($varsplit[1]); if ($v->getName() != "") { $arr[] = strtoupper($v->getName()); } } } if (sizeof($arr) > 0) { $cookievars = implode("~", $arr); } } } $de->setProperty(DATA_OUTPUT_VARLIST, $cookievars); $de->setProperty(DATA_OUTPUT_FILETYPE, loadvar(DATA_OUTPUT_FILETYPE)); $de->setProperty(DATA_OUTPUT_INCLUDE_VALUE_LABELS, loadvar(DATA_OUTPUT_INCLUDE_VALUE_LABELS)); $de->setProperty(DATA_OUTPUT_INCLUDE_VALUE_LABEL_NUMBERS, loadvar(DATA_OUTPUT_INCLUDE_VALUE_LABEL_NUMBERS)); $de->setProperty(DATA_OUTPUT_LANGUAGES, implode("~", loadvar(DATA_OUTPUT_LANGUAGES))); $de->setProperty(DATA_OUTPUT_MARK_EMPTY, loadvar(DATA_OUTPUT_MARK_EMPTY)); $de->setProperty(DATA_OUTPUT_MODES, implode("~", loadvar(DATA_OUTPUT_MODES))); $de->setProperty(DATA_OUTPUT_PRIMARY_KEY_ENCRYPTION, loadvar(DATA_OUTPUT_PRIMARY_KEY_ENCRYPTION)); $de->setProperty(DATA_OUTPUT_PRIMARY_KEY_IN_DATA, loadvar(DATA_OUTPUT_PRIMARY_KEY_IN_DATA)); $de->setProperty(DATA_OUTPUT_SURVEY, loadvar(DATA_OUTPUT_SURVEY)); $de->setProperty(DATA_OUTPUT_TYPEDATA, loadvar(DATA_OUTPUT_TYPEDATA)); $de->setProperty(DATA_OUTPUT_VARIABLES_WITHOUT_DATA, loadvar(DATA_OUTPUT_VARIABLES_WITHOUT_DATA)); $de->setProperty(DATA_OUTPUT_KEEP_ONLY, loadvar(DATA_OUTPUT_KEEP_ONLY)); $de->setProperty(DATA_OUTPUT_TYPE, loadvar(DATA_OUTPUT_TYPE)); $de->setProperty(DATA_OUTPUT_ENCODING, "UTF-8"); $de->setProperty(DATA_OUTPUT_FROM, loadvar(DATA_OUTPUT_FROM)); $de->setProperty(DATA_OUTPUT_TO, loadvar(DATA_OUTPUT_TO)); //$de->displayProperties(); $de->generateAuxiliary(); $de->download(); //$de->displayProperties(); //$de->writeCSVFile(); //$de->displayLog(); return $displayOutput->showOutputAddOnData(); }
function showEditVariableRes($suid, $vsid) { $survey = new Survey($suid); $var = $survey->getVariableDescriptive($vsid); $texttype = loadvar("texttype"); $value = loadvarAllowHTML("text"); switch ($texttype) { case SETTING_QUESTION: $var->setQuestion($value); break; case SETTING_PRETEXT: $var->setPretext($value); break; case SETTING_POSTTEXT: $var->setPostText($value); break; case SETTING_OPTIONS: $code = loadvar("answercode"); $current = explode("\r\n", $var->getOptionsText()); foreach ($current as $k => $c) { if (startsWith($c, $code . " ")) { $current[$k] = $code . ' ' . $value; break; } } $var->setOptionsText(implode("\r\n", $current)); default: break; } $var->save(); $compiler = new Compiler($suid, getSurveyVersion($survey)); $mess = $compiler->generateVariableDescriptives(array($var)); $mess = $compiler->generateGetFills(array($var)); $mess = $compiler->generateInlineFields(array($var)); }
function showOutputStatisticsParadataVariable($seid, $vsid) { if (loadvar(DATA_OUTPUT_TYPEDATA) != "") { if (loadvar(DATA_OUTPUT_TYPEDATA) == DATA_TEST) { $_SESSION[SURVEY_EXECUTION_MODE] = SURVEY_EXECUTION_MODE_TEST; } else { $_SESSION[SURVEY_EXECUTION_MODE] = SURVEY_EXECUTION_MODE_NORMAL; } } else { $_SESSION[SURVEY_EXECUTION_MODE] = SURVEY_EXECUTION_MODE_NORMAL; } $survey = new Survey($_SESSION['SUID']); $section = $survey->getSection($seid); $variable = $survey->getVariableDescriptive($vsid); $headers[] = array('link' => setSessionParamsHref(array('page' => 'sysadmin.output'), Language::headerOutput()), 'label' => Language::headerOutputData()); $headers[] = array('link' => setSessionParamsHref(array('page' => 'sysadmin.output.statistics'), Language::headerOutputStatistics()), 'label' => Language::headerOutputStatistics()); $headers[] = array('link' => setSessionParamsHref(array('page' => 'sysadmin.output.statistics.paradata'), Language::headerOutputStatisticsParadata()), 'label' => Language::headerOutputStatisticsParadata()); $headers[] = array('link' => setSessionParamsHref(array('page' => 'sysadmin.output.statistics.paradata', 'suid' => $suid), $survey->getName()), 'label' => $survey->getName()); $headers[] = array('link' => setSessionParamsHref(array('page' => 'sysadmin.output.statistics.paradata.section', 'seid' => $seid), $section->getName()), 'label' => $section->getName()); $headers[] = array('link' => '', 'label' => $variable->getName()); $returnStr = $this->showOutputHeader($headers); $returnStr .= '<form id=surveyform method="post">'; $returnStr .= '<span class="label label-default">' . Language::labelAggregateDetails() . '</span>'; $returnStr .= '<div class="well well-sm">'; $returnStr .= '<table>'; $returnStr .= $this->displayComboBox(); $returnStr .= '<tr><td>' . Language::labelOutputDataType() . '</td><td>'; $returnStr .= "<select id='typedata' class='selectpicker show-tick' name=" . DATA_OUTPUT_TYPEDATA . ">"; $selected = array('', ''); if (loadvar(DATA_OUTPUT_TYPEDATA) != "") { $selected[loadvar(DATA_OUTPUT_TYPEDATA)] = "selected"; } //print_r($selected); $returnStr .= "<option " . $selected[0] . " value=" . DATA_REAL . ">" . Language::optionsDataReal() . "</option>"; $returnStr .= "<option " . $selected[1] . " value=" . DATA_TEST . ">" . Language::optionsDataTest() . "</option>"; $returnStr .= "</select>"; $returnStr .= "</td></tr>"; $returnStr .= '<script type=text/javascript> $(document).ready(function(){ $("#typedata").on("change", function(event) { document.getElementById("surveyform").submit(); }); }); </script>'; $returnStr .= "</form>"; $returnStr .= '</table>'; $returnStr .= '<br/><table>'; $returnStr .= '<tr><td valign=top style="min-width: 100px;">' . Language::labelTypeEditGeneralQuestion() . ": </td><td valign=top>"; $returnStr .= $variable->getQuestion() . "</td></tr>"; $returnStr .= '<tr><td valign=top>' . Language::labelTypeEditGeneralAnswerType() . ": </td><td valign=top>"; $answertype = $variable->getAnswerType(); $arr = Language::getAnswerTypes(); $returnStr .= $arr[$answertype] . "</td></tr>"; if (inArray($answertype, array(ANSWER_TYPE_ENUMERATED, ANSWER_TYPE_SETOFENUMERATED, ANSWER_TYPE_DROPDOWN, ANSWER_TYPE_MULTIDROPDOWN))) { $returnStr .= '<tr><td valign=top>' . Language::labelTypeEditGeneralCategories() . ": </td><td valign=top>"; $returnStr .= str_replace("\r\n", "<br/>", $variable->getOptionsText()) . "</td></tr>"; } else { if (inArray($answertype, array(ANSWER_TYPE_RANGE, ANSWER_TYPE_SLIDER))) { $returnStr .= '<tr><td valign=top>' . Language::labelTypeEditRangeMinimum() . ": </td><td valign=top>"; $returnStr .= $variable->getMinimum() . "</td></tr>"; $returnStr .= '<tr><td valign=top>' . Language::labelTypeEditRangeMaximum() . ": </td><td valign=top>"; $returnStr .= $variable->getMaximum() . "</td></tr>"; } } if ($variable->isArray()) { $returnStr .= $this->displayComboBox(); $returnStr .= '<tr><td valign=top>' . Language::labelTypeEditGeneralArrayInstance() . ": </td><td valign=top>"; $options = $this->getArrayData($_SESSION['SUID'], $variable->getName()); $returnStr .= "<form id=instanceform method=post>"; $returnStr .= "<select class='selectpicker show-tick' id='arrayinstance' name='arrayinstance'>"; foreach ($options as $op) { $returnStr .= "<option value='" . $op . "'>" . $op . "</option>"; } $returnStr .= "</select>"; $returnStr .= "</td></tr>"; $params = getSessionParams(); $params['vsid'] = $variable->getVsid(); $returnStr .= setSessionParamsPost($params); $returnStr .= "</form>"; $returnStr .= "<script type='text/javascript'>"; $returnStr .= "\$('#arrayinstance').change(function () {\n \$('#instanceform').submit();\n });"; $returnStr .= "</script>"; } $returnStr .= "</table></div>"; $returnStr .= '<span class="label label-default">' . Language::labelAggregateData() . '</span>'; $returnStr .= '<div class="well well-sm">'; $data = new Data(); $brackets = array(); $varname = $variable->getName(); if ($variable->isArray()) { if (loadvar("arrayinstance") != "") { $varname = loadvar("arrayinstance"); } else { $varname = $varname . "[1]"; } } $paradata = $data->getParaData($variable, $varname); //$aggdata = array(2,5); if (sizeof($paradata) == 0) { $returnStr .= "<br>" . $this->displayWarning(Language::messageNoData()); } else { $returnStr .= '<script src="js/highcharts.js"></script>'; $returnStr .= '<script src="js/modules/exporting.js"></script>'; $returnStr .= '<script src="js/export-csv.js"></script>'; $returnStr .= '<div id="chart1" style="min-width: 310px; height: 400px; margin: 0 auto"></div>'; $errorlabels = Language::errorCodeLabels(); $brackets = array(); foreach ($paradata as $k => $p) { if (isset($errorlabels[$k])) { $brackets[] = $errorlabels[$k]; } } $returnStr .= $this->createParadataChart($variable->getName(), implode(",", array_values($paradata)), $brackets); } $returnStr .= "</div>"; $returnStr .= '</p></div> </div>'; //container and wrap $returnStr .= $this->showBottomBar(); $returnStr .= $this->showFooter(false); return $returnStr; }
function handleVariableAction($selected, $action, &$variablecookievalue) { $surveys = array(); $displaySysAdmin = new DisplaySysAdmin(); switch ($action) { case 'edit': $settings = $this->getBatchEditorVariableProperties(); $tosave = array(); $tocompile = array(); $changed = array(); foreach ($settings as $set) { if (loadvar($set . "_checkbox") == 1) { $val = loadvarAllowHTML($set); if ($val != "") { foreach ($selected as $sel) { $s = explode("~", $sel); if (isset($surveys[$s[0]])) { $survey = $surveys[$s[0]]; } else { $survey = new Survey($s[0]); $surveys[$s[0]] = $survey; $tocompile[] = $s[0]; } if (isset($tosave[$sel])) { $var = $tosave[$sel]; } else { $var = $survey->getVariableDescriptive($s[1]); $tosave[$sel] = $var; } if (isset($changed[$s[0]])) { $arr = $changed[$s[0]]; if (isset($arr[$sel]) == false) { $arr[$sel] = $var; $changed[$s[0]] = $arr; } } else { $arr = array(); $arr[$sel] = $var; $changed[$s[0]] = $arr; } $var->setSettingValue($set, $val); if ($set == SETTING_INPUT_MASK && $val == INPUTMASK_CUSTOM) { $var->setSettingValue(SETTING_INPUT_MASK_CUSTOM, loadvarAllowHTML(SETTING_INPUT_MASK_CUSTOM)); } else { if ($set == SETTING_ENUMERATED_TEXTBOX && $val == TEXTBOX_YES) { $var->setSettingValue(SETTING_ENUMERATED_TEXTBOX_LABEL, loadvarAllowHTML(SETTING_ENUMERATED_TEXTBOX_LABEL)); } } } } } } /* save */ foreach ($tosave as $to) { $to->save(); } /* compile */ foreach ($tocompile as $comp) { if (isset($surveys[$comp])) { $survey = $surveys[$comp]; } else { $survey = new Survey($comp); $surveys[$comp] = $survey; } $compiler = new Compiler($comp, getSurveyVersion($surveys[$comp])); $mess = $compiler->generateVariableDescriptives($changed[$comp]); $mess = $compiler->generateGetFills($changed[$comp]); $mess = $compiler->generateSetFills($changed[$comp]); $mess = $compiler->generateInlineFields($changed[$comp]); } if ($changed) { $content = $displaySysAdmin->displaySuccess(Language::messageToolsBatchEditorEdited(Language::labelVariablesLower())); } else { $content = $displaySysAdmin->displayWarning(Language::messageToolsBatchEditorNotEdited()); } break; break; case 'copy': // determine survey $suid = loadvar('suid'); if ($suid == "") { $suid = $_SESSION['SUID']; } $section = loadvar("copysection"); foreach ($selected as $sel) { $s = explode("~", $sel); if (isset($surveys[$s[0]])) { $survey = $surveys[$s[0]]; } else { $survey = new Survey($s[0]); $surveys[$s[0]] = $survey; } $var = $survey->getVariableDescriptive($s[1]); $oldvar = $var; $var->copy($var->getName() . "_cl", $suid, $section); $newvars[] = $var; } /* compile new */ $compiler = new Compiler($suid, getSurveyVersion($survey)); $mess = $compiler->generateVariableDescriptives($newvars); $mess = $compiler->generateSetFills($newvars); $mess = $compiler->generateGetFills($newvars); $mess = $compiler->generateInlineFields($newvars); $content = $displaySysAdmin->displaySuccess(Language::messageToolsBatchEditorCopied(Language::labelVariablesLower())); break; case 'move': $tocompile = array(); $moved = array(); $newvars = array(); // determine survey $suid = loadvar('suid'); if ($suid == "") { $suid = $_SESSION['SUID']; } $section = loadvar("movesection"); $cookiearr = explode("-", $variablecookievalue); foreach ($selected as $sel) { $s = explode("~", $sel); if (isset($surveys[$s[0]])) { $survey = $surveys[$s[0]]; } else { $survey = new Survey($s[0]); $surveys[$s[0]] = $survey; $tocompile[] = $s[0]; } $var = $survey->getVariableDescriptive($s[1]); $oldvar = $var; $var->move($suid, $section); if (isset($moved[$s[0]])) { $arr = $moved[$s[0]]; } else { $arr = array(); } $arr[] = $oldvar; $moved[$s[0]] = $arr; $newvars[] = $var; /* update cookie */ $ind = array_search($sel, $cookiearr); $cookiearr[$ind] = $var->getSuid() . '~' . $var->getVsid(); } /* update cookie */ setcookie('uscicvariablecookie', implode("-", $cookiearr)); //implode("-", $arr)); $variablecookievalue = implode("-", $cookiearr); /* compile old */ foreach ($tocompile as $comp) { if (isset($surveys[$comp])) { $survey = $surveys[$comp]; } else { $survey = new Survey($comp); $surveys[$comp] = $survey; } /* we moved across survey for one or more variables in this survey */ if ($suid != $comp) { $compiler = new Compiler($comp, getSurveyVersion($surveys[$comp])); $mess = $compiler->generateVariableDescriptives($moved[$comp], true); $mess = $compiler->generateSetFills($moved[$comp], true); } } /* compile new */ $compiler = new Compiler($suid, getSurveyVersion($survey)); $mess = $compiler->generateVariableDescriptives($newvars); $mess = $compiler->generateSetFills($newvars); $mess = $compiler->generateGetFills($newvars); $mess = $compiler->generateInlineFields($newvars); $content = $displaySysAdmin->displaySuccess(Language::messageToolsBatchEditorMoved(Language::labelVariablesLower())); break; case 'remove': $removed = array(); $cookiearr = explode("-", $variablecookievalue); foreach ($selected as $sel) { $s = explode("~", $sel); if (isset($surveys[$s[0]])) { $survey = $surveys[$s[0]]; } else { $survey = new Survey($s[0]); $surveys[$s[0]] = $survey; } $var = $survey->getVariableDescriptive($s[1]); $var->remove(); $removed[] = $var; /* update cookie */ $ind = array_search($sel, $cookiearr); unset($cookiearr[$ind]); } /* update cookie */ setcookie('uscicvariablecookie', implode("-", $cookiearr)); //implode("-", $arr)); $variablecookievalue = implode("-", $cookiearr); /* compile */ foreach ($surveys as $survey) { $compiler = new Compiler($survey->getSuid(), getSurveyVersion($survey)); $mess = $compiler->generateVariableDescriptives($removed, true); $mess = $compiler->generateSetFills($removed, true); //$mess = $compiler->generateGetFills(); } $content = $displaySysAdmin->displaySuccess(Language::messageToolsBatchEditorRemoved(Language::labelVariablesLower())); break; default: $content = $displaySysAdmin->displayWarning(Language::messageToolsBatchEditorUnrecognizedAction()); break; } return $content; }
function showToolsBatchEditorVariables($variablecookievalue, $sectioncookievalue, $groupcookievalue, $typecookievalue) { $returnStr = $this->getToolsBatchEditorTopTab(0, $variablecookievalue != "", $sectioncookievalue != "", $groupcookievalue != "", $typecookievalue != ""); $returnStr .= "<form method='post' id='reload' name='reload'>"; $returnStr .= setSessionParamsPost(array('page' => 'sysadmin.tools.batcheditor')); $returnStr .= "</form>"; $returnStr .= '<form id=actionform name=actionform method="post">'; $returnStr .= setSessionParamsPost(array('page' => 'sysadmin.tools.batcheditorres')); $returnStr .= "<input type=hidden name=batchaction id=batchaction />"; $returnStr .= "<input type=hidden name=vrfiltermode_batch id=vrfiltermode_batch value=0 />"; $returnStr .= '<div class="well">'; $vars = explode("-", $variablecookievalue); $returnStr1 = ''; foreach ($vars as $var) { $varsplit = explode("~", $var); $survey = new Survey($varsplit[0]); $v = $survey->getVariableDescriptive($varsplit[1]); if ($v->getName() != "") { $returnStr1 .= '<tr>'; $returnStr1 .= '<td>'; $returnStr1 .= "<input class='selectedbox' name=selected[] type='checkbox' value='" . $var . "'>"; $returnStr1 .= '</td>'; $returnStr1 .= '<td>' . $v->getName() . '</td>'; // $returnStr1 .= '<td>' . $v->getDescription() . '</td>'; $returnStr1 .= '<tr>'; } } if ($returnStr1 == "") { $returnStr .= $this->displayInfo(Language::messageToolsBatchEditorNoVariablesFound()); } else { $returnStr .= $this->displayComboBox(); $returnStr .= '<div class="row row-offcanvas row-offcanvas-right"> <div class="col-xs-6 col-md-3">'; $returnStr .= '<span class="label label-default">' . Language::labelToolsBatchEditorVariables() . '</span>'; $returnStr .= '<div style="background-color: white;" class="well">'; $returnStr .= '<table class="table table-bordered table-striped">'; $returnStr .= '<tr>'; $returnStr .= "<th><nobr/></th>"; $returnStr .= "<th>" . Language::labelTypeEditGeneralName() . "</th>"; //$returnStr .= "<th>" . Language::labelTypeEditGeneralDescription() . "</th>"; $returnStr .= '</tr>'; $returnStr .= $returnStr1; $returnStr .= '</table>'; $returnStr .= $this->displayCookieScripts(); // TODO: ADD PAGE RELOAD HERE $returnStr .= "<script type=text/javascript>\n function selectAll() {\n \$('.selectedbox').prop('checked', true);\n };\n function unselectAll() {\n \$('.selectedbox').prop('checked', false);\n };\n </script>"; $returnStr .= "<input class='btn btn-default' type=button onclick='selectAll();' value='Select all'/>"; $returnStr .= "<input class='btn btn-default' type=button onclick='unselectAll();' value='Unselect all'/>"; $returnStr .= "<input class='btn btn-default' type=button onclick='clearCookie(\"uscicvariablecookie\"); \$(\"#reload\").submit();' value='" . Language::buttonClear() . "'/>"; $returnStr .= "</div>"; $returnStr .= '</div>'; // actions $returnStr .= '<div class="col-xs-12 col-md-9">'; $returnStr .= '<span class="label label-default">' . Language::labelToolsBatchEditorActions() . '</span>'; $returnStr .= '<div style="background-color: white;" class="well">'; $returnStr .= '<span class="label label-default">' . Language::labelEdit() . '</span>'; $returnStr .= '<div class="well">'; $returnStr .= '<ul class="nav nav-pills nav-justified" role="tablist">'; $returnStr .= '<li class="active"><a href="#general" role="tab" data-toggle="tab">' . Language::labelGeneral() . '</a></li>'; $returnStr .= '<li><a href="#access" role="tab" data-toggle="tab">' . Language::labelAccess() . '</a></li>'; $returnStr .= '<li><a href="#verification" role="tab" data-toggle="tab">' . Language::labelVerification() . '</a></li>'; $returnStr .= '<li><a href="#display" role="tab" data-toggle="tab">' . Language::labelLayout() . '</a></li>'; $returnStr .= '<li><a href="#assistance" role="tab" data-toggle="tab">' . Language::labelAssistance() . '</a></li>'; $returnStr .= '<li><a href="#interactive" role="tab" data-toggle="tab">' . Language::labelInteractive() . '</a></li>'; $returnStr .= '<li><a href="#output" role="tab" data-toggle="tab">' . Language::labelOutput() . '</a></li>'; $returnStr .= '<li><a href="#navigation" role="tab" data-toggle="tab">' . Language::labelNavigation() . '</a></li>'; $returnStr .= '</ul>'; $returnStr .= $this->showToolsBatchEditorVariableTabs(); $returnStr .= '</div>'; $returnStr .= '<span class="label label-default">' . Language::labelCopy() . '</span>'; $returnStr .= '<div class="well">'; $returnStr .= '<table width=100%>'; $surveys = new Surveys(); $suid = loadvar("suid"); if ($suid == "") { $suid = $_SESSION['SUID']; if ($suid == "") { $suid = $surveys->getFirstSurvey(false); } } if ($surveys->getNumberOfSurveys() > 1) { $returnStr .= '<tr><td>' . Language::labelTypeCopySurvey() . '</td><td>' . $this->displaySurveys("suid", "suid", $suid) . '</tr>'; } $returnStr .= '<tr><td>' . Language::labelTypeCopySection() . '</td>'; $returnStr .= "<td>" . $this->displaySections('copysection', '', $_SESSION['SUID'], "") . "</td></tr>"; $returnStr .= '</table>'; $returnStr .= '<input onclick="$(\'#batchaction\').val(\'copy\'); $(\'#actionform\').submit(); " type="button" class="btn btn-default" value="' . Language::buttonCopy() . '"/>'; $returnStr .= '</div>'; $returnStr .= '<span class="label label-default">' . Language::labelMove() . '</span>'; $returnStr .= '<div class="well">'; $returnStr .= '<table width=100%>'; $surveys = new Surveys(); if ($surveys->getNumberOfSurveys() > 1) { $returnStr .= '<tr><td>' . Language::labelTypeMoveSurvey() . '</td><td>' . $this->displaySurveys("suid", "suid", $_SESSION['SUID']) . '</tr>'; } $returnStr .= '<tr><td>' . Language::labelTypeMoveSection() . '</td>'; $returnStr .= "<td>" . $this->displaySections('movesection', '', $suid, "") . "</td></tr>"; $returnStr .= '</table>'; $returnStr .= '<input onclick="$(\'#batchaction\').val(\'move\'); $(\'#actionform\').submit(); " type="button" class="btn btn-default" value="' . Language::buttonMove() . '"/>'; $returnStr .= '</div>'; $returnStr .= '<span class="label label-default">' . Language::labelRemove() . '</span>'; $returnStr .= '<div class="well">'; $returnStr .= '<input onclick="$(\'#batchaction\').val(\'remove\'); $(\'#actionform\').submit(); " type="button" class="btn btn-default" value="' . Language::buttonRemove() . '"/>'; $returnStr .= '</div>'; $returnStr .= '</div>'; // close $returnStr .= '</div>'; $returnStr .= '</div>'; } $returnStr .= '</div>'; $returnStr .= '</form>'; return $returnStr; }
function showTranslateVariableFillRes() { $displayTranslator = new DisplayTranslator(); $survey = new Survey($_SESSION['SUID']); $vsid = getFromSessionParams('vsid'); $var = $survey->getVariableDescriptive($vsid); $_SESSION['VSID'] = $vsid; $var->setFillText(loadvarAllowHTML(SETTING_FILLTEXT)); $content = $displayTranslator->displaySuccess(Language::messageVariableChanged($var->getName())); $var->save(); /* compile */ $compiler = new Compiler($_SESSION['SUID'], getSurveyVersion($survey)); $mess = $compiler->generateVariableDescriptives(array($var)); $mess = $compiler->generateGetFills(array($var)); $mess = $compiler->generateInlineFields(array($var)); /* update last page */ $_SESSION['LASTPAGE'] = substr($_SESSION['LASTPAGE'], 0, strripos($_SESSION['LASTPAGE'], "res")); /* return result */ return $displayTranslator->showTranslateVariable($_SESSION['VSID'], $content); }