Esempio n. 1
0
 function checkVariable($var, $all = false)
 {
     // get answer type
     $t = $var->getAnswerType();
     // general
     if ($_SESSION['VRFILTERMODE_VARIABLE'] == 0 || $all == true) {
         $text[] = $var->getQuestion();
         switch ($t) {
             case ANSWER_TYPE_ENUMERATED:
             case ANSWER_TYPE_DROPDOWN:
             case ANSWER_TYPE_SETOFENUMERATED:
             case ANSWER_TYPE_MULTIDROPDOWN:
                 $text[] = $var->getOptionsText();
                 break;
             case ANSWER_TYPE_CUSTOM:
                 $text[] = $var->getAnswerTypeCustom();
                 break;
         }
     }
     // verification
     if ($_SESSION['VRFILTERMODE_VARIABLE'] == 1 || $all == true) {
         switch ($t) {
             case ANSWER_TYPE_RANGE:
                 $text[] = $var->getMinimum();
                 $text[] = $var->getMaximum();
                 $text[] = $var->getOtherValues();
                 break;
             case ANSWER_TYPE_SLIDER:
                 $text[] = $var->getMinimum();
                 $text[] = $var->getMaximum();
                 break;
             case ANSWER_TYPE_SETOFENUMERATED:
             case ANSWER_TYPE_MULTIDROPDOWN:
                 $text[] = $var->getMinimumSelected();
                 $text[] = $var->getMaximumSelected();
                 $text[] = $var->getExactSelected();
                 break;
             case ANSWER_TYPE_STRING:
             case ANSWER_TYPE_OPEN:
                 $text[] = $var->getMinimumLength();
                 $text[] = $var->getMaximumLength();
                 $text[] = $var->getMinimumWords();
                 $text[] = $var->getMaximumWords();
                 break;
             case ANSWER_TYPE_CALENDAR:
                 $text[] = $var->getMaximumDatesSelected();
                 break;
         }
         if (inArray($t, array(ANSWER_TYPE_RANGE, ANSWER_TYPE_DOUBLE, ANSWER_TYPE_INTEGER, ANSWER_TYPE_ENUMERATED, ANSWER_TYPE_DROPDOWN, ANSWER_TYPE_DATE, ANSWER_TYPE_DATETIME, ANSWER_TYPE_TIME, ANSWER_TYPE_SLIDER))) {
             $text[] = $var->getComparisonEqualTo();
             $text[] = $var->getComparisonNotEqualTo();
             $text[] = $var->getComparisonGreaterEqualTo();
             $text[] = $var->getComparisonGreater();
             $text[] = $var->getComparisonSmallerEqualTo();
             $text[] = $var->getComparisonSmaller();
         }
     }
     // display
     if ($_SESSION['VRFILTERMODE_VARIABLE'] == 2 || $all == true) {
         $text[] = $var->getPageHeader();
         $text[] = $var->getPageFooter();
         $text[] = $var->getLabelBackButton();
         $text[] = $var->getLabelNextButton();
         $text[] = $var->getLabelDKButton();
         $text[] = $var->getLabelRFButton();
         $text[] = $var->getLabelNAButton();
         $text[] = $var->getLabelUpdateButton();
         $text[] = $var->getLabelRemarkButton();
         $text[] = $var->getLabelRemarkSaveButton();
         $text[] = $var->getLabelCloseButton();
         switch ($t) {
             case ANSWER_TYPE_ENUMERATED:
             case ANSWER_TYPE_DROPDOWN:
             case ANSWER_TYPE_SETOFENUMERATED:
             case ANSWER_TYPE_MULTIDROPDOWN:
                 $text[] = $var->getEnumeratedCustom();
                 $text[] = $var->getEnumeratedRandomizer();
                 break;
         }
     }
     // assistance
     if ($_SESSION['VRFILTERMODE_VARIABLE'] == 3 || $all == true) {
         $text[] = $var->getEmptyMessage();
         $text[] = $var->getPreText();
         $text[] = $var->getPostText();
         if (inArray($t, array(ANSWER_TYPE_RANGE, ANSWER_TYPE_DOUBLE, ANSWER_TYPE_INTEGER, ANSWER_TYPE_ENUMERATED, ANSWER_TYPE_DROPDOWN, ANSWER_TYPE_DATE, ANSWER_TYPE_DATETIME, ANSWER_TYPE_TIME, ANSWER_TYPE_SLIDER))) {
             $text[] = $var->getErrorMessageComparisonEqualTo();
             $text[] = $var->getErrorMessageComparisonNotEqualTo();
             $text[] = $var->getErrorMessageComparisonGreaterEqualTo();
             $text[] = $var->getErrorMessageComparisonGreater();
             $text[] = $var->getErrorMessageComparisonSmallerEqualTo();
             $text[] = $var->getErrorMessageComparisonSmaller();
         } else {
             if (inArray($t, array(ANSWER_TYPE_STRING, ANSWER_TYPE_OPEN))) {
                 $text[] = $var->getErrorMessageComparisonEqualToIgnoreCase();
                 $text[] = $var->getErrorMessageComparisonNotEqualToIgnoreCase();
             }
         }
         switch ($t) {
             case ANSWER_TYPE_DOUBLE:
                 $text[] = $var->getErrorMessageDouble();
                 break;
             case ANSWER_TYPE_INTEGER:
                 $text[] = $var->getErrorMessageInteger();
                 break;
             case ANSWER_TYPE_STRING:
                 /* fall through */
             /* fall through */
             case ANSWER_TYPE_OPEN:
                 $text[] = $var->getErrorMessagePattern();
                 $text[] = $var->getErrorMessageMinimumLength();
                 $text[] = $var->getErrorMessageMaximumLength();
                 $text[] = $var->getErrorMessageMinimumWords();
                 $text[] = $var->getErrorMessageMaximumWords();
                 break;
             case ANSWER_TYPE_RANGE:
                 /* fall through */
             /* fall through */
             case ANSWER_TYPE_SLIDER:
                 $text[] = $var->getErrorMessageRange();
                 break;
             case ANSWER_TYPE_SETOFENUMERATED:
                 /* fall through */
             /* fall through */
             case ANSWER_TYPE_MULTIDROPDOWN:
                 $text[] = $var->getErrorMessageSelectMinimum();
                 $text[] = $var->getErrorMessageSelectMaximum();
                 $text[] = $var->getErrorMessageSelectExact();
                 $text[] = $var->getErrorMessageSelectInvalidSubset();
                 $text[] = $var->getErrorMessageSelectInvalidSet();
                 break;
             case ANSWER_TYPE_CALENDAR:
                 $text[] = $var->getErrorMessageMaximumCalendar();
                 break;
         }
     }
     // fill
     if ($_SESSION['VRFILTERMODE_VARIABLE'] == 4 || $all == true) {
         $text[] = $var->getFillText();
         $text[] = $var->getFillCode();
     }
     // interactive
     if ($_SESSION['VRFILTERMODE_VARIABLE'] == 6 || $all == true) {
         $text[] = $var->getInlineStyle();
         $text[] = $var->getPageStyle();
         $text[] = $var->getPageJavascript();
         $text[] = $var->getInlineJavascript();
         $text[] = $var->getScripts();
         $text[] = $var->getOnBack();
         $text[] = $var->getOnNext();
         $text[] = $var->getOnDK();
         $text[] = $var->getOnRF();
         $text[] = $var->getOnNA();
         $text[] = $var->getOnUpdate();
         $text[] = $var->getOnLanguageChange();
         $text[] = $var->getOnModeChange();
         $text[] = $var->getOnVersionChange();
     }
     // navigation
     if ($_SESSION['VRFILTERMODE_VARIABLE'] == 7 || $all == true) {
         $text[] = $var->getKeyboardBindingBack();
         $text[] = $var->getKeyboardBindingNext();
         $text[] = $var->getKeyboardBindingUpdate();
         $text[] = $var->getKeyboardBindingClose();
         $text[] = $var->getKeyboardBindingDK();
         $text[] = $var->getKeyboardBindingRF();
         $text[] = $var->getKeyboardBindingNA();
         $text[] = $var->getKeyboardBindingRemark();
     }
     // check for references
     $fills = getReferences(implode(" ", $text), INDICATOR_FILL);
     $fills1 = getReferences(implode(" ", $text), INDICATOR_FILL_NOVALUE);
     $fills2 = getReferences(implode(" ", $text), INDICATOR_INLINEFIELD_ANSWER);
     $fills3 = getReferences(implode(" ", $text), INDICATOR_INLINEFIELD_TEXT);
     $fills = array_unique(array_merge($fills, $fills1, $fills2, $fills3));
     $messages = $this->checkReferences($fills);
     // options text format check
     if ($_SESSION['VRFILTERMODE_VARIABLE'] == 0 || $all == true) {
         if (inArray($t, array(ANSWER_TYPE_ENUMERATED, ANSWER_TYPE_DROPDOWN, ANSWER_TYPE_SETOFENUMERATED, ANSWER_TYPE_MULTIDROPDOWN))) {
             if ($var->getOptionsText() == "") {
                 $messages[] = Language::messageCheckerVariableNoOptionCodes();
             } else {
                 if ($var->getOptionsText() != SETTING_FOLLOW_TYPE) {
                     $options = explode("\r\n", $var->getOptionsText());
                     foreach ($options as $option) {
                         $t = splitString("/ /", $option, PREG_SPLIT_NO_EMPTY, 2);
                         $code = trim($t[0]);
                         if (!is_numeric($code)) {
                             $messages[] = Language::messageCheckerVariableNumericOptionCodes($option);
                             break;
                         }
                         $labeltext = trim($t[1]);
                     }
                 }
             }
         }
     }
     // function reference check
     if ($_SESSION['VRFILTERMODE_VARIABLE'] == 6 || $all == true) {
         $functions[] = $var->getOnBack();
         $functions[] = $var->getOnNext();
         $functions[] = $var->getOnDK();
         $functions[] = $var->getOnRF();
         $functions[] = $var->getOnNA();
         $functions[] = $var->getOnUpdate();
         $functions[] = $var->getOnLanguageChange();
         $functions[] = $var->getOnModeChange();
         $functions[] = $var->getOnVersionChange();
         foreach ($functions as $f) {
             if (stripos($f, '(') !== false) {
                 $f = substr($f, 0, stripos($f, '('));
             }
             if (!inArray(trim($f), array("", SETTING_FOLLOW_GENERIC, SETTING_FOLLOW_TYPE))) {
                 if (function_exists($f) == false) {
                     $messages[] = Language::messageCheckerFunctionNotExists($f);
                 }
             }
         }
     }
     if ($_SESSION['VRFILTERMODE_VARIABLE'] == 0 || $all == true) {
         if ($t == ANSWER_TYPE_CUSTOM) {
             $functions[] = $var->getAnswerTypeCustom();
             foreach ($functions as $f) {
                 if (stripos($f, '(') !== false) {
                     $f = substr($f, 0, stripos($f, '('));
                 }
                 if (!inArray(trim($f), array("", SETTING_FOLLOW_GENERIC, SETTING_FOLLOW_TYPE))) {
                     if (function_exists($f) == false) {
                         $messages[] = Language::messageCheckerFunctionNotExists($f);
                     }
                 }
             }
         }
     }
     if ($var->hasType()) {
         $tempsurv = new Survey($var->getSuid());
         $temptype = $tempsurv->getType($var->getTyd());
         if ($temptype->getTyd() == "") {
             $messages[] = Language::messageCheckerTypeNotExists($var->getName());
         }
     }
     return $messages;
 }
Esempio n. 2
0
 function showTranslateVariableAssistance($variable)
 {
     $returnStr = '<form id="editform" method="post">';
     $returnStr .= setSessionParamsPost(array('page' => 'translator.survey.translatevariableassistanceres', 'vsid' => $variable->getVsid()));
     $returnStr .= $this->getVariableTopTab(3);
     $helpstart = '<div class="input-group">';
     $helpstart2 = "";
     $helpend2 = "";
     $message = Language::helpFollowSurvey();
     $answertype = $variable->getAnswerType();
     if ($answertype == SETTING_FOLLOW_TYPE) {
         $survey = new Survey($_SESSION['SUID']);
         $type = $survey->getType($variable->getTyd());
         $answertype = $type->getAnswerType();
     } else {
         if ($variable->getTyd() > 0) {
             $survey = new Survey($_SESSION['SUID']);
             $type = $survey->getType($variable->getTyd());
             $message = Language::helpFollowType($type->getName());
             $helpstart2 = '<div class="input-group">';
             $message2 = Language::helpFollowTypeOnly($type->getName());
             $helpend2 = '<span class="input-group-addon"><i>' . $message2 . '</i></span></div>';
         }
     }
     $helpend = '<span class="input-group-addon"><i>' . $message . '</i></span></div>';
     $returnStr .= '<div class="well" style="background-color:white;">';
     $survey = new Survey($_SESSION['SUID']);
     $language = getSurveyLanguage();
     $returnStr .= "<div id='accordion' class='panel-group' role='tablist' aria-expanded='true'>";
     $l = $survey->getDefaultLanguage(getSurveyMode());
     $arr = Language::getLanguagesArray();
     $helpend = '<span class="input-group-addon"><i>' . $message . '</i></span></div>';
     if ($l != $language) {
         switchSurveyLanguageTranslator($l);
         $langlabel = $arr[str_replace("_", "", getSurveyLanguagePostFix($l))]['name'];
         $returnStr .= "<div class='panel panel-default'>";
         $returnStr .= "<div class='panel panel-heading' role='tab' id='headingOne'>";
         $returnStr .= '<a role="button" data-toggle="collapse" aria-expanded="true" aria-controls="collapseOne" href="#collapseOne">' . $langlabel . '</a>';
         $returnStr .= "</div>";
         $returnStr .= '<div class="panel-collapse collapse in" id="collapseOne" role="tabpanel" labelledby="headingOne">';
         $returnStr .= "<div class='panel-body'>";
         $returnStr .= '<table width=100%>';
         if (inArray($answertype, array(ANSWER_TYPE_STRING, ANSWER_TYPE_INTEGER, ANSWER_TYPE_RANGE, ANSWER_TYPE_DOUBLE, ANSWER_TYPE_DROPDOWN, ANSWER_TYPE_MULTIDROPDOWN))) {
             $returnStr .= '<tr><td>' . Language::labelTypeEditAssistancePreText() . '</td><td>' . $helpstart2 . '<input type="text" class="form-control" readonly value="' . $this->displayTextSettingValue(convertHTLMEntities($variable->getPreText(), ENT_QUOTES)) . '">' . $helpend2 . '</td></tr>';
             $returnStr .= '<tr><td>' . Language::labelTypeEditAssistancePostText() . '</td><td>' . $helpstart2 . '<input type="text" class="form-control" readonly value="' . $this->displayTextSettingValue(convertHTLMEntities($variable->getPostText(), ENT_QUOTES)) . '">' . $helpend2 . '</td></tr>';
         }
         $returnStr .= '<tr><td>' . Language::labelTypeEditAssistanceHoverText() . '</td><td>' . $helpstart2 . '<input type="text" class="form-control" readonly value="' . $this->displayTextSettingValue(convertHTLMEntities($variable->getHoverText(), ENT_QUOTES)) . '">' . $helpend2 . '</td></tr>';
         $returnStr .= '<tr><td valign=top style="width: 15%;">' . Language::labelTypeEditAssistanceEmptyMessage() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" rows=2 readonly class="form-control">' . $this->displayTextSettingValue(convertHTLMEntities($variable->getEmptyMessage()), ENT_QUOTES) . '</textarea>' . $helpend . '</td></tr>';
         switch ($answertype) {
             case ANSWER_TYPE_DOUBLE:
                 $returnStr .= '<tr><td valign=top style="width: 20%;">' . Language::labelTypeEditAssistanceErrorMessageDouble() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" readonly rows=2 class="form-control">' . $this->displayTextSettingValue(convertHTLMEntities($variable->getErrorMessageDouble(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
                 break;
             case ANSWER_TYPE_INTEGER:
                 $returnStr .= '<tr><td valign=top style="width: 20%;">' . Language::labelTypeEditAssistanceErrorMessageInteger() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" readonly rows=2 class="form-control">' . $this->displayTextSettingValue(convertHTLMEntities($variable->getErrorMessageInteger(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
                 break;
             case ANSWER_TYPE_STRING:
                 /* fall through */
             /* fall through */
             case ANSWER_TYPE_OPEN:
                 $returnStr .= '<tr><td valign=top style="width: 20%;">' . Language::labelTypeEditAssistanceErrorMessagePattern() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" readonly rows=2 class="form-control">' . $this->displayTextSettingValue(convertHTLMEntities($variable->getErrorMessagePattern(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
                 $returnStr .= '<tr><td valign=top style="width: 20%;">' . Language::labelTypeEditAssistanceErrorMessageMinLength() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" readonly rows=2 class="form-control">' . $this->displayTextSettingValue(convertHTLMEntities($variable->getErrorMessageMinimumLength(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
                 $returnStr .= '<tr><td valign=top style="width: 20%;">' . Language::labelTypeEditAssistanceErrorMessageMaxLength() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" readonly rows=2 class="form-control">' . $this->displayTextSettingValue(convertHTLMEntities($variable->getErrorMessageMaximumLength(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
                 $returnStr .= '<tr><td valign=top style="width: 20%;">' . Language::labelTypeEditAssistanceErrorMessageMinWords() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" readonly rows=2 class="form-control">' . $this->displayTextSettingValue(convertHTLMEntities($variable->getErrorMessageMinimumWords(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
                 $returnStr .= '<tr><td valign=top style="width: 20%;">' . Language::labelTypeEditAssistanceErrorMessageMaxWords() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" readonly rows=2 class="form-control">' . $this->displayTextSettingValue(convertHTLMEntities($variable->getErrorMessageMaximumWords(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
                 break;
             case ANSWER_TYPE_ENUMERATED:
                 $returnStr .= '<tr><td valign=top style="width: 20%;">' . Language::labelTypeEditAssistanceErrorMessageInlineAnswered() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" readonly rows=2 class="form-control">' . $this->displayTextSettingValue(convertHTLMEntities($variable->getErrorMessageInlineAnswered(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
                 $returnStr .= '<tr><td valign=top style="width: 20%;">' . Language::labelTypeEditAssistanceErrorMessageInlineExclusive() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" readonly rows=2 class="form-control">' . $this->displayTextSettingValue(convertHTLMEntities($variable->getErrorMessageInlineExclusive(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
                 $returnStr .= '<tr><td valign=top style="width: 20%;">' . Language::labelTypeEditAssistanceErrorMessageInlineInclusive() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" readonly rows=2 class="form-control">' . $this->displayTextSettingValue(convertHTLMEntities($variable->getErrorMessageInlineInclusive(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
                 $returnStr .= '<tr><td valign=top style="width: 20%;">' . Language::labelTypeEditAssistanceErrorMessageInlineMinRequired() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" readonly rows=2 class="form-control">' . $this->displayTextSettingValue(convertHTLMEntities($variable->getErrorMessageInlineMinimumRequired(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
                 $returnStr .= '<tr><td valign=top style="width: 20%;">' . Language::labelTypeEditAssistanceErrorMessageInlineMaxRequired() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" readonly rows=2 class="form-control">' . $this->displayTextSettingValue(convertHTLMEntities($variable->getErrorMessageInlineMaximumRequired(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
                 $returnStr .= '<tr><td valign=top style="width: 20%;">' . Language::labelTypeEditAssistanceErrorMessageInlineExactRequired() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" readonly rows=2 class="form-control">' . $this->displayTextSettingValue(convertHTLMEntities($variable->getErrorMessageInlineExactRequired(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
                 break;
             case ANSWER_TYPE_SETOFENUMERATED:
                 $returnStr .= '<tr><td valign=top style="width: 20%;">' . Language::labelTypeEditAssistanceErrorMessageInlineAnswered() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" readonly rows=2 class="form-control">' . $this->displayTextSettingValue(convertHTLMEntities($variable->getErrorMessageInlineAnswered(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
                 $returnStr .= '<tr><td valign=top style="width: 20%;">' . Language::labelTypeEditAssistanceErrorMessageInlineExclusive() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" readonly rows=2 class="form-control">' . $this->displayTextSettingValue(convertHTLMEntities($variable->getErrorMessageInlineExclusive(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
                 $returnStr .= '<tr><td valign=top style="width: 20%;">' . Language::labelTypeEditAssistanceErrorMessageInlineInclusive() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" readonly rows=2 class="form-control">' . $this->displayTextSettingValue(convertHTLMEntities($variable->getErrorMessageInlineInclusive(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
                 $returnStr .= '<tr><td valign=top style="width: 20%;">' . Language::labelTypeEditAssistanceErrorMessageInlineMinRequired() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" readonly rows=2 class="form-control">' . $this->displayTextSettingValue(convertHTLMEntities($variable->getErrorMessageInlineMinimumRequired(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
                 $returnStr .= '<tr><td valign=top style="width: 20%;">' . Language::labelTypeEditAssistanceErrorMessageInlineMaxRequired() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" readonly rows=2 class="form-control">' . $this->displayTextSettingValue(convertHTLMEntities($variable->getErrorMessageInlineMaximumRequired(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
                 $returnStr .= '<tr><td valign=top style="width: 20%;">' . Language::labelTypeEditAssistanceErrorMessageInlineExactRequired() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" readonly rows=2 class="form-control">' . $this->displayTextSettingValue(convertHTLMEntities($variable->getErrorMessageInlineExactRequired(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
                 /* fall through */
             /* fall through */
             case ANSWER_TYPE_MULTIDROPDOWN:
                 $returnStr .= '<tr><td valign=top style="width: 20%;">' . Language::labelTypeEditAssistanceErrorMessageMinSelect() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" readonly rows=2 class="form-control">' . $this->displayTextSettingValue(convertHTLMEntities($variable->getErrorMessageSelectMinimum(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
                 $returnStr .= '<tr><td valign=top style="width: 20%;">' . Language::labelTypeEditAssistanceErrorMessageMaxSelect() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" readonly rows=2 class="form-control">' . $this->displayTextSettingValue(convertHTLMEntities($variable->getErrorMessageSelectMaximum(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
                 $returnStr .= '<tr><td valign=top style="width: 20%;">' . Language::labelTypeEditAssistanceErrorMessageExactSelect() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" readonly rows=2 class="form-control">' . $this->displayTextSettingValue(convertHTLMEntities($variable->getErrorMessageSelectExact(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
                 $returnStr .= '<tr><td valign=top style="width: 20%;">' . Language::labelTypeEditAssistanceErrorMessageInvalidSubSelect() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" readonly rows=2 class="form-control">' . $this->displayTextSettingValue(convertHTLMEntities($variable->getErrorMessageSelectInvalidSubset(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
                 $returnStr .= '<tr><td valign=top style="width: 20%;">' . Language::labelTypeEditAssistanceErrorMessageInvalidSelect() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" readonly rows=2 class="form-control">' . $this->displayTextSettingValue(convertHTLMEntities($variable->getErrorMessageSelectInvalidSet(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
                 break;
             case ANSWER_TYPE_RANGE:
                 /* fall through */
             /* fall through */
             case ANSWER_TYPE_SLIDER:
                 $returnStr .= '<tr><td valign=top style="width: 20%;">' . Language::labelTypeEditAssistanceErrorMessageRange() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" readonly rows=2 class="form-control">' . $this->displayTextSettingValue(convertHTLMEntities($variable->getErrorMessageRange(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
                 break;
             case ANSWER_TYPE_CALENDAR:
                 $returnStr .= '<tr><td valign=top style="width: 20%;">' . Language::labelTypeEditAssistanceErrorMessageMaxCalendar() . '</td><td><textarea style="width: 100%;" readonly rows=2 class="form-control">' . convertHTLMEntities($variable->getErrorMessageMaximumCalendar(), ENT_QUOTES) . '</textarea></td></tr>';
                 break;
         }
         $returnStr .= '</table></div></div></div>';
         switchSurveyLanguageTranslator($language);
     }
     $langlabel = $arr[str_replace("_", "", getSurveyLanguagePostFix($language))]['name'];
     $returnStr .= "<div class='panel panel-default'>";
     $returnStr .= "<div class='panel panel-heading' role='tab' id='headingTwo'>";
     $returnStr .= '<a role="button" data-toggle="collapse" aria-expanded="true" aria-controls="collapseTwo" href="#collapseTwo">' . $langlabel . '</a>';
     $returnStr .= "</div>";
     $returnStr .= '<div class="panel-collapse collapse in" id="collapseTwo" role="tabpanel" labelledby="headingTwo">';
     $returnStr .= "<div class='panel-body'>";
     $returnStr .= '<table width=100%>';
     if (inArray($answertype, array(ANSWER_TYPE_STRING, ANSWER_TYPE_INTEGER, ANSWER_TYPE_RANGE, ANSWER_TYPE_DOUBLE, ANSWER_TYPE_DROPDOWN, ANSWER_TYPE_MULTIDROPDOWN))) {
         $returnStr .= '<tr><td>' . Language::labelTypeEditAssistancePreText() . '</td><td>' . $helpstart2 . '<input type="text" class="form-control" name="' . SETTING_PRETEXT . '" value="' . $this->displayTextSettingValue(convertHTLMEntities($variable->getPreText(), ENT_QUOTES)) . '">' . $helpend2 . '</td></tr>';
         $returnStr .= '<tr><td>' . Language::labelTypeEditAssistancePostText() . '</td><td>' . $helpstart2 . '<input type="text" class="form-control" name="' . SETTING_POSTTEXT . '" value="' . $this->displayTextSettingValue(convertHTLMEntities($variable->getPostText(), ENT_QUOTES)) . '">' . $helpend2 . '</td></tr>';
     }
     $returnStr .= '<tr><td>' . Language::labelTypeEditAssistanceHoverText() . '</td><td>' . $helpstart2 . '<input type="text" class="form-control" name="' . SETTING_HOVERTEXT . '" value="' . $this->displayTextSettingValue(convertHTLMEntities($variable->getHoverText(), ENT_QUOTES)) . '">' . $helpend2 . '</td></tr>';
     $returnStr .= '<tr><td valign=top style="width: 15%;">' . Language::labelTypeEditAssistanceEmptyMessage() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" rows=2 class="form-control" name="' . SETTING_EMPTY_MESSAGE . '">' . $this->displayTextSettingValue(convertHTLMEntities($variable->getEmptyMessage()), ENT_QUOTES) . '</textarea>' . $helpend . '</td></tr>';
     switch ($answertype) {
         case ANSWER_TYPE_DOUBLE:
             $returnStr .= '<tr><td valign=top style="width: 20%;">' . Language::labelTypeEditAssistanceErrorMessageDouble() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" rows=2 class="form-control" name="' . SETTING_ERROR_MESSAGE_DOUBLE . '">' . $this->displayTextSettingValue(convertHTLMEntities($variable->getErrorMessageDouble(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
             break;
         case ANSWER_TYPE_INTEGER:
             $returnStr .= '<tr><td valign=top style="width: 20%;">' . Language::labelTypeEditAssistanceErrorMessageInteger() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" rows=2 class="form-control" name="' . SETTING_ERROR_MESSAGE_INTEGER . '">' . $this->displayTextSettingValue(convertHTLMEntities($variable->getErrorMessageInteger(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
             break;
         case ANSWER_TYPE_STRING:
             /* fall through */
         /* fall through */
         case ANSWER_TYPE_OPEN:
             $returnStr .= '<tr><td valign=top style="width: 20%;">' . Language::labelTypeEditAssistanceErrorMessagePattern() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" rows=2 class="form-control" name="' . SETTING_ERROR_MESSAGE_PATTERN . '">' . $this->displayTextSettingValue(convertHTLMEntities($variable->getErrorMessagePattern(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
             $returnStr .= '<tr><td valign=top style="width: 20%;">' . Language::labelTypeEditAssistanceErrorMessageMinLength() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" rows=2 class="form-control" name="' . SETTING_ERROR_MESSAGE_MINIMUM_LENGTH . '">' . $this->displayTextSettingValue(convertHTLMEntities($variable->getErrorMessageMinimumLength(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
             $returnStr .= '<tr><td valign=top style="width: 20%;">' . Language::labelTypeEditAssistanceErrorMessageMaxLength() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" rows=2 class="form-control" name="' . SETTING_ERROR_MESSAGE_MAXIMUM_LENGTH . '">' . $this->displayTextSettingValue(convertHTLMEntities($variable->getErrorMessageMaximumLength(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
             $returnStr .= '<tr><td valign=top style="width: 20%;">' . Language::labelTypeEditAssistanceErrorMessageMinWords() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" rows=2 class="form-control" name="' . SETTING_ERROR_MESSAGE_MINIMUM_WORDS . '">' . $this->displayTextSettingValue(convertHTLMEntities($variable->getErrorMessageMinimumWords(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
             $returnStr .= '<tr><td valign=top style="width: 20%;">' . Language::labelTypeEditAssistanceErrorMessageMaxWords() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" rows=2 class="form-control" name="' . SETTING_ERROR_MESSAGE_MAXIMUM_WORDS . '">' . $this->displayTextSettingValue(convertHTLMEntities($variable->getErrorMessageMaximumWords(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
             break;
         case ANSWER_TYPE_ENUMERATED:
             $returnStr .= '<tr><td valign=top style="width: 20%;">' . Language::labelTypeEditAssistanceErrorMessageInlineAnswered() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" rows=2 class="form-control" name="' . SETTING_ERROR_MESSAGE_INLINE_ANSWERED . '">' . $this->displayTextSettingValue(convertHTLMEntities($variable->getErrorMessageInlineAnswered(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
             $returnStr .= '<tr><td valign=top style="width: 20%;">' . Language::labelTypeEditAssistanceErrorMessageInlineExclusive() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" rows=2 class="form-control" name="' . SETTING_ERROR_MESSAGE_INLINE_EXCLUSIVE . '">' . $this->displayTextSettingValue(convertHTLMEntities($variable->getErrorMessageInlineExclusive(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
             $returnStr .= '<tr><td valign=top style="width: 20%;">' . Language::labelTypeEditAssistanceErrorMessageInlineInclusive() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" rows=2 class="form-control" name="' . SETTING_ERROR_MESSAGE_INLINE_INCLUSIVE . '">' . $this->displayTextSettingValue(convertHTLMEntities($variable->getErrorMessageInlineInclusive(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
             $returnStr .= '<tr><td valign=top style="width: 20%;">' . Language::labelTypeEditAssistanceErrorMessageInlineMinRequired() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" rows=2 class="form-control" name="' . SETTING_ERROR_MESSAGE_INLINE_MINIMUM_REQUIRED . '">' . $this->displayTextSettingValue(convertHTLMEntities($variable->getErrorMessageInlineMinimumRequired(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
             $returnStr .= '<tr><td valign=top style="width: 20%;">' . Language::labelTypeEditAssistanceErrorMessageInlineMaxRequired() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" rows=2 class="form-control" name="' . SETTING_ERROR_MESSAGE_INLINE_MAXIMUM_REQUIRED . '">' . $this->displayTextSettingValue(convertHTLMEntities($variable->getErrorMessageInlineMaximumRequired(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
             $returnStr .= '<tr><td valign=top style="width: 20%;">' . Language::labelTypeEditAssistanceErrorMessageInlineExactRequired() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" rows=2 class="form-control" name="' . SETTING_ERROR_MESSAGE_INLINE_EXACT_REQUIRED . '">' . $this->displayTextSettingValue(convertHTLMEntities($variable->getErrorMessageInlineExactRequired(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
             break;
         case ANSWER_TYPE_SETOFENUMERATED:
             $returnStr .= '<tr><td valign=top style="width: 20%;">' . Language::labelTypeEditAssistanceErrorMessageInlineAnswered() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" rows=2 class="form-control" name="' . SETTING_ERROR_MESSAGE_INLINE_ANSWERED . '">' . $this->displayTextSettingValue(convertHTLMEntities($variable->getErrorMessageInlineAnswered(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
             $returnStr .= '<tr><td valign=top style="width: 20%;">' . Language::labelTypeEditAssistanceErrorMessageInlineExclusive() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" rows=2 class="form-control" name="' . SETTING_ERROR_MESSAGE_INLINE_EXCLUSIVE . '">' . $this->displayTextSettingValue(convertHTLMEntities($variable->getErrorMessageInlineExclusive(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
             $returnStr .= '<tr><td valign=top style="width: 20%;">' . Language::labelTypeEditAssistanceErrorMessageInlineInclusive() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" rows=2 class="form-control" name="' . SETTING_ERROR_MESSAGE_INLINE_INCLUSIVE . '">' . $this->displayTextSettingValue(convertHTLMEntities($variable->getErrorMessageInlineInclusive(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
             $returnStr .= '<tr><td valign=top style="width: 20%;">' . Language::labelTypeEditAssistanceErrorMessageInlineMinRequired() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" rows=2 class="form-control" name="' . SETTING_ERROR_MESSAGE_INLINE_MINIMUM_REQUIRED . '">' . $this->displayTextSettingValue(convertHTLMEntities($variable->getErrorMessageInlineMinimumRequired(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
             $returnStr .= '<tr><td valign=top style="width: 20%;">' . Language::labelTypeEditAssistanceErrorMessageInlineMaxRequired() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" rows=2 class="form-control" name="' . SETTING_ERROR_MESSAGE_INLINE_MAXIMUM_REQUIRED . '">' . $this->displayTextSettingValue(convertHTLMEntities($variable->getErrorMessageInlineMaximumRequired(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
             $returnStr .= '<tr><td valign=top style="width: 20%;">' . Language::labelTypeEditAssistanceErrorMessageInlineExactRequired() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" rows=2 class="form-control" name="' . SETTING_ERROR_MESSAGE_INLINE_EXACT_REQUIRED . '">' . $this->displayTextSettingValue(convertHTLMEntities($variable->getErrorMessageInlineExactRequired(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
             /* fall through */
         /* fall through */
         case ANSWER_TYPE_MULTIDROPDOWN:
             $returnStr .= '<tr><td valign=top style="width: 20%;">' . Language::labelTypeEditAssistanceErrorMessageMinSelect() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" rows=2 class="form-control" name="' . SETTING_ERROR_MESSAGE_MINIMUM_SELECT . '">' . $this->displayTextSettingValue(convertHTLMEntities($variable->getErrorMessageSelectMinimum(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
             $returnStr .= '<tr><td valign=top style="width: 20%;">' . Language::labelTypeEditAssistanceErrorMessageMaxSelect() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" rows=2 class="form-control" name="' . SETTING_ERROR_MESSAGE_MAXIMUM_SELECT . '">' . $this->displayTextSettingValue(convertHTLMEntities($variable->getErrorMessageSelectMaximum(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
             $returnStr .= '<tr><td valign=top style="width: 20%;">' . Language::labelTypeEditAssistanceErrorMessageExactSelect() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" rows=2 class="form-control" name="' . SETTING_ERROR_MESSAGE_EXACT_SELECT . '">' . $this->displayTextSettingValue(convertHTLMEntities($variable->getErrorMessageSelectExact(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
             $returnStr .= '<tr><td valign=top style="width: 20%;">' . Language::labelTypeEditAssistanceErrorMessageInvalidSubSelect() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" rows=2 class="form-control" name="' . SETTING_ERROR_MESSAGE_INVALID_SUB_SELECT . '">' . $this->displayTextSettingValue(convertHTLMEntities($variable->getErrorMessageSelectInvalidSubset(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
             $returnStr .= '<tr><td valign=top style="width: 20%;">' . Language::labelTypeEditAssistanceErrorMessageInvalidSelect() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" rows=2 class="form-control" name="' . SETTING_ERROR_MESSAGE_INVALID_SELECT . '">' . $this->displayTextSettingValue(convertHTLMEntities($variable->getErrorMessageSelectInvalidSet(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
             break;
         case ANSWER_TYPE_RANGE:
             /* fall through */
         /* fall through */
         case ANSWER_TYPE_SLIDER:
             $returnStr .= '<tr><td valign=top style="width: 20%;">' . Language::labelTypeEditAssistanceErrorMessageRange() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" rows=2 class="form-control" name="' . SETTING_ERROR_MESSAGE_RANGE . '">' . $this->displayTextSettingValue(convertHTLMEntities($variable->getErrorMessageRange(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
             break;
         case ANSWER_TYPE_CALENDAR:
             $returnStr .= '<tr><td valign=top style="width: 20%;">' . Language::labelTypeEditAssistanceErrorMessageMaxCalendar() . '</td><td><textarea style="width: 100%;" rows=2 class="form-control" name="' . SETTING_ERROR_MESSAGE_MAXIMUM_CALENDAR . '">' . convertHTLMEntities($variable->getErrorMessageMaximumCalendar(), ENT_QUOTES) . '</textarea></td></tr>';
             break;
     }
     $returnStr .= '</table></div></div></div></div></div>';
     $returnStr .= '<input type="submit" class="btn btn-default" value="' . Language::buttonTranslate() . '"/>';
     $returnStr .= '</form>';
     return $returnStr;
 }
Esempio n. 3
0
 function showOutputTranslation()
 {
     $_SESSION['PARAMETER_RETRIEVAL'] = PARAMETER_SURVEY_RETRIEVAL;
     $survey = new Survey($_SESSION['SUID']);
     $user = new User($_SESSION['URID']);
     $utype = $user->getUserType();
     $ut = "";
     switch ($utype) {
         case USER_SYSADMIN:
             $ut = "sysadmin";
             break;
         case USER_ADMIN:
             $ut = "admin";
             break;
         case USER_TRANSLATOR:
             $ut = "translator";
             break;
         case USER_INTERVIEWER:
             $ut = "interviewer";
             break;
     }
     $headers[] = array('link' => setSessionParamsHref(array('page' => $ut . '.output'), Language::headerOutput()), 'label' => Language::headerOutput());
     $headers[] = array('link' => setSessionParamsHref(array('page' => $ut . '.output.documentation'), Language::headerOutputDocumentation()), 'label' => Language::headerOutputDocumentation());
     $headers[] = array('link' => '', 'label' => Language::headerOutputDictionary());
     $returnStr = $this->showOutputHeader($headers, false);
     /* display survey texts */
     $returnStr .= "<div class='uscic-dictionary-messages'>Generic messages</div>";
     $returnStr .= "<table class='table table-bordered'";
     $returnStr .= "<tr><td width='200px'>" . Language::labelTypeEditAssistanceEmptyMessage() . "</td><td class='uscic-dictionary-message'>" . $survey->getEmptyMessage() . "</td></tr>";
     $returnStr .= "<tr><td width='200px'>" . Language::labelTypeEditAssistanceErrorMessageDouble() . "</td><td class='uscic-dictionary-message'>" . $survey->getErrorMessageDouble() . "</td></tr>";
     $returnStr .= "<tr><td width='200px'>" . Language::labelGroupEditAssistanceExactRequired() . "</td><td class='uscic-dictionary-message'>" . $survey->getErrorMessageExactRequired() . "</td></tr>";
     $returnStr .= "<tr><td width='200px'>" . Language::labelGroupEditAssistanceExclusive() . "</td><td class='uscic-dictionary-message'>" . $survey->getErrorMessageExclusive() . "</td></tr>";
     $returnStr .= "<tr><td width='200px'>" . Language::labelGroupEditAssistanceInclusive() . "</td><td class='uscic-dictionary-message'>" . $survey->getErrorMessageInclusive() . "</td></tr>";
     $returnStr .= "<tr><td width='200px'>" . Language::labelTypeEditAssistanceErrorMessageInlineAnswered() . "</td><td class='uscic-dictionary-message'>" . $survey->getErrorMessageInlineAnswered() . "</td></tr>";
     $returnStr .= "<tr><td width='200px'>" . Language::labelTypeEditAssistanceErrorMessageInlineExactRequired() . "</td><td class='uscic-dictionary-message'>" . $survey->getErrorMessageInlineExactRequired() . "</td></tr>";
     $returnStr .= "<tr><td width='200px'>" . Language::labelTypeEditAssistanceErrorMessageInlineExclusive() . "</td><td class='uscic-dictionary-message'>" . $survey->getErrorMessageInlineExclusive() . "</td></tr>";
     $returnStr .= "<tr><td width='200px'>" . Language::labelTypeEditAssistanceErrorMessageInlineInclusive() . "</td><td class='uscic-dictionary-message'>" . $survey->getErrorMessageInlineInclusive() . "</td></tr>";
     $returnStr .= "<tr><td width='200px'>" . Language::labelTypeEditAssistanceErrorMessageInlineMaxRequired() . "</td><td class='uscic-dictionary-message'>" . $survey->getErrorMessageInlineMaximumRequired() . "</td></tr>";
     $returnStr .= "<tr><td width='200px'>" . Language::labelTypeEditAssistanceErrorMessageInlineMinRequired() . "</td><td class='uscic-dictionary-message'>" . $survey->getErrorMessageInlineMinimumRequired() . "</td></tr>";
     $returnStr .= "<tr><td width='200px'>" . Language::labelTypeEditAssistanceErrorMessageInteger() . "</td><td class='uscic-dictionary-message'>" . $survey->getErrorMessageInteger() . "</td></tr>";
     $returnStr .= "<tr><td width='200px'>" . Language::labelTypeEditAssistanceErrorMessageMaxCalendar() . "</td><td class='uscic-dictionary-message'>" . $survey->getErrorMessageMaximumCalendar() . "</td></tr>";
     $returnStr .= "<tr><td width='200px'>" . Language::labelTypeEditAssistanceErrorMessageMaxLength() . "</td><td class='uscic-dictionary-message'>" . $survey->getErrorMessageMaximumLength() . "</td></tr>";
     $returnStr .= "<tr><td width='200px'>" . Language::labelGroupEditAssistanceMaximumRequired() . "</td><td class='uscic-dictionary-message'>" . $survey->getErrorMessageMaximumRequired() . "</td></tr>";
     $returnStr .= "<tr><td width='200px'>" . Language::labelTypeEditAssistanceErrorMessageMaxWords() . "</td><td class='uscic-dictionary-message'>" . $survey->getErrorMessageMaximumWords() . "</td></tr>";
     $returnStr .= "<tr><td width='200px'>" . Language::labelTypeEditAssistanceErrorMessageMinLength() . "</td><td class='uscic-dictionary-message'>" . $survey->getErrorMessageMinimumLength() . "</td></tr>";
     $returnStr .= "<tr><td width='200px'>" . Language::labelGroupEditAssistanceMinimumRequired() . "</td><td class='uscic-dictionary-message'>" . $survey->getErrorMessageMinimumRequired() . "</td></tr>";
     $returnStr .= "<tr><td width='200px'>" . Language::labelTypeEditAssistanceErrorMessageMinWords() . "</td><td class='uscic-dictionary-message'>" . $survey->getErrorMessageMinimumWords() . "</td></tr>";
     $returnStr .= "<tr><td width='200px'>" . Language::labelTypeEditAssistanceErrorMessagePattern() . "</td><td class='uscic-dictionary-message'>" . $survey->getErrorMessagePattern() . "</td></tr>";
     $returnStr .= "<tr><td width='200px'>" . Language::labelTypeEditAssistanceErrorMessageRange() . "</td><td class='uscic-dictionary-message'>" . $survey->getErrorMessageRange() . "</td></tr>";
     $returnStr .= "<tr><td width='200px'>" . Language::labelTypeEditAssistanceErrorMessageExactSelect() . "</td><td class='uscic-dictionary-message'>" . $survey->getErrorMessageSelectExact() . "</td></tr>";
     $returnStr .= "<tr><td width='200px'>" . Language::labelTypeEditAssistanceErrorMessageInvalidSelect() . "</td><td class='uscic-dictionary-message'>" . $survey->getErrorMessageSelectInvalidSet() . "</td></tr>";
     $returnStr .= "<tr><td width='200px'>" . Language::labelTypeEditAssistanceErrorMessageInvalidSubSelect() . "</td><td class='uscic-dictionary-message'>" . $survey->getErrorMessageSelectInvalidSubset() . "</td></tr>";
     $returnStr .= "<tr><td width='200px'>" . Language::labelTypeEditAssistanceErrorMessageMaxSelect() . "</td><td class='uscic-dictionary-message'>" . $survey->getErrorMessageSelectMaximum() . "</td></tr>";
     $returnStr .= "<tr><td width='200px'>" . Language::labelTypeEditAssistanceErrorMessageMinSelect() . "</td><td class='uscic-dictionary-message'>" . $survey->getErrorMessageSelectMinimum() . "</td></tr>";
     $returnStr .= "<tr><td width='200px'>" . Language::labelGroupEditAssistanceUniqueRequired() . "</td><td class='uscic-dictionary-message'>" . $survey->getErrorMessageUniqueRequired() . "</td></tr>";
     $returnStr .= "</table>";
     $backbutton = strtoupper($survey->getLabelBackButton());
     $nextbutton = strtoupper($survey->getLabelNextButton());
     $dkbutton = strtoupper($survey->getLabelDKButton());
     $rfbutton = strtoupper($survey->getLabelRFButton());
     $nabutton = strtoupper($survey->getLabelNAButton());
     $updatebutton = strtoupper($survey->getLabelUpdateButton());
     /* display survey texts */
     $returnStr .= "<div class='uscic-dictionary-messages'>Button labels</div>";
     $returnStr .= "<table class='table table-bordered'";
     $returnStr .= "<tr><td width='200px'>" . Language::labelTypeEditBackButton() . "</td><td class='uscic-dictionary-message'>" . $survey->getLabelBackButton() . "</td></tr>";
     $returnStr .= "<tr><td width='200px'>" . Language::labelTypeEditNextButton() . "</td><td class='uscic-dictionary-message'>" . $survey->getLabelNextButton() . "</td></tr>";
     $returnStr .= "<tr><td width='200px'>" . Language::labelTypeEditDKButton() . "</td><td class='uscic-dictionary-message'>" . $survey->getLabelDKButton() . "</td></tr>";
     $returnStr .= "<tr><td width='200px'>" . Language::labelTypeEditRFButton() . "</td><td class='uscic-dictionary-message'>" . $survey->getLabelRFButton() . "</td></tr>";
     $returnStr .= "<tr><td width='200px'>" . Language::labelTypeEditNAButton() . "</td><td class='uscic-dictionary-message'>" . $survey->getLabelNAButton() . "</td></tr>";
     $returnStr .= "<tr><td width='200px'>" . Language::labelTypeEditUpdateButton() . "</td><td class='uscic-dictionary-message'>" . $survey->getLabelUpdateButton() . "</td></tr>";
     $returnStr .= "<tr><td width='200px'>" . Language::labelTypeEditRemarkButton() . "</td><td class='uscic-dictionary-message'>" . $survey->getLabelRemarkButton() . "</td></tr>";
     $returnStr .= "<tr><td width='200px'>" . Language::labelTypeEditCloseButton() . "</td><td class='uscic-dictionary-message'>" . $survey->getLabelCloseButton() . "</td></tr>";
     $returnStr .= "</table>";
     $returnStr .= "<hr>";
     /* loop through sections */
     $sections = $survey->getSections();
     foreach ($sections as $section) {
         $returnStr .= "<div class='uscic-dictionary-section'>Section: " . $section->getName() . "</div>";
         $vars = $survey->getVariableDescriptives($section->getSeid());
         foreach ($vars as $var) {
             if ($var->isHiddenTranslation() == false) {
                 $answertype = $var->getAnswerType();
                 if ($answertype == SETTING_FOLLOW_TYPE) {
                     $type = $survey->getType($var->getTyd());
                     $answertype = $type->getAnswerType();
                 }
                 $table = "";
                 //if ($var->getDescription() != "") {
                 //    $table .= "<tr><td width='200px'>Description</td>";
                 //    $table .= "<td class='uscic-dictionary-description'>" . $var->getDescription() . "</td></tr>";
                 //}
                 if (trim($var->getQuestion()) != "") {
                     $table .= "<tr><td width='200px'>Text</td>";
                     $table .= "<td class='uscic-dictionary-text'>" . convertHTLMEntities($this->replaceFills($var->getQuestion())) . "</td></tr>";
                 }
                 if (inArray($answertype, array(ANSWER_TYPE_ENUMERATED, ANSWER_TYPE_SETOFENUMERATED, ANSWER_TYPE_DROPDOWN, ANSWER_TYPE_MULTIDROPDOWN))) {
                     $table .= "<tr><td width='200px'>Answer options</td>";
                     $table .= "<td class='uscic-dictionary-categories'>" . str_replace("\r\n", "<br/>", convertHTLMEntities($this->replaceFills($var->getOptionsText()))) . "</td></tr>";
                 }
                 if (trim($var->getPreText()) != "") {
                     $table .= "<tr><td width='200px'>Text before answer box</td>";
                     $table .= "<td class='uscic-dictionary-pretext'>" . str_replace("\r\n", "<br/>", convertHTLMEntities($this->replaceFills($var->getPreText()))) . "</td></tr>";
                 }
                 if (trim($var->getPostText()) != "") {
                     $table .= "<tr><td width='200px'>Text after answer box</td>";
                     $table .= "<td class='uscic-dictionary-posttext'>" . str_replace("\r\n", "<br/>", convertHTLMEntities($this->replaceFills($var->getPostText()))) . "</td></tr>";
                 }
                 if (trim($var->getFillText()) != "") {
                     $table .= "<tr><td width='200px'>Dynamic text</td>";
                     $table .= "<td class='uscic-dictionary-filltext'>" . str_replace("\r\n", "<br/>", convertHTLMEntities($this->replaceFills($var->getFillText()))) . "</td></tr>";
                 }
                 if (strtoupper($var->getLabelBackButton()) != $backbutton) {
                     $table .= "<tr><td width='200px'>Back button</td>";
                     $table .= "<td class='uscic-dictionary-button'>" . str_replace("\r\n", "<br/>", convertHTLMEntities($this->replaceFills($var->getLabelBackButton()))) . "</td></tr>";
                 }
                 if (strtoupper($var->getLabelNextButton()) != $nextbutton) {
                     $table .= "<tr><td width='200px'>Next button</td>";
                     $table .= "<td class='uscic-dictionary-button'>" . str_replace("\r\n", "<br/>", convertHTLMEntities($this->replaceFills($var->getLabelNextButton()))) . "</td></tr>";
                 }
                 if (strtoupper($var->getLabelDKButton()) != $dkbutton) {
                     $table .= "<tr><td width='200px'>Don't know button</td>";
                     $table .= "<td class='uscic-dictionary-button'>" . str_replace("\r\n", "<br/>", convertHTLMEntities($this->replaceFills($var->getLabelDKButton()))) . "</td></tr>";
                 }
                 if (strtoupper($var->getLabelRFButton()) != $rfbutton) {
                     $table .= "<tr><td width='200px'>Refuse button</td>";
                     $table .= "<td class='uscic-dictionary-button'>" . str_replace("\r\n", "<br/>", convertHTLMEntities($this->replaceFills($var->getLabelRFButton()))) . "</td></tr>";
                 }
                 if (strtoupper($var->getLabelNAButton()) != $nabutton) {
                     $table .= "<tr><td width='200px'>Not applicable button</td>";
                     $table .= "<td class='uscic-dictionary-button'>" . str_replace("\r\n", "<br/>", convertHTLMEntities($this->replaceFills($var->getLabelNAButton()))) . "</td></tr>";
                 }
                 if ($table != "") {
                     $returnStr .= "<div class='uscic-dictionary-question'>Question: " . $var->getName() . "</div>";
                     $returnStr .= "<table class='table table-bordered'>";
                     $returnStr .= $table;
                     $returnStr .= "</table>";
                 }
             }
         }
         $returnStr .= "<hr>";
         //break;
     }
     //$returnStr .= '</div>';
     //$returnStr .= '<script type="text/javascript">$( document ).ready(function() {$("#editor").wysiwyg();});</script>';
     $returnStr .= '</p></div>    </div>';
     //container and wrap
     //$returnStr .= $this->showBottomBar();
     $returnStr .= $this->showFooter(false);
     $_SESSION['PARAMETER_RETRIEVAL'] = PARAMETER_ADMIN_RETRIEVAL;
     return $returnStr;
 }
Esempio n. 4
0
 function handleTypeAction($selected, $action, &$typecookievalue)
 {
     $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])) {
                                 $type = $tosave[$sel];
                             } else {
                                 $type = $survey->getType($s[1]);
                                 $tosave[$sel] = $type;
                             }
                             if (isset($changed[$s[0]])) {
                                 $arr = $changed[$s[0]];
                                 if (isset($arr[$sel]) == false) {
                                     $arr[$sel] = $type;
                                     $changed[$s[0]] = $arr;
                                 }
                             } else {
                                 $arr = array();
                                 $arr[$sel] = $type;
                                 $changed[$s[0]] = $arr;
                             }
                             $type->setSettingValue($set, $val);
                             if ($set == SETTING_INPUT_MASK && $val == INPUTMASK_CUSTOM) {
                                 $type->setSettingValue(SETTING_INPUT_MASK_CUSTOM, loadvarAllowHTML(SETTING_INPUT_MASK_CUSTOM));
                             } else {
                                 if ($set == SETTING_ENUMERATED_TEXTBOX && $val == TEXTBOX_YES) {
                                     $type->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->generateTypes($changed[$comp]);
                 $newtypes = $changed[$comp];
                 foreach ($newtypes as $newtype) {
                     $newvars = $survey->getVariableDescriptivesOfType($newtype->getTyd());
                     $mess = $compiler->generateVariableDescriptives($newvars);
                     $mess = $compiler->generateGetFills($newvars);
                     $mess = $compiler->generateInlineFields($newvars);
                 }
             }
             if ($changed) {
                 $content = $displaySysAdmin->displaySuccess(Language::messageToolsBatchEditorEdited(Language::labelTypesLower()));
             } else {
                 $content = $displaySysAdmin->displayWarning(Language::messageToolsBatchEditorNotEdited());
             }
             break;
             break;
         case 'copy':
             // determine survey
             $suid = loadvar('suid');
             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;
                 }
                 $type = $survey->getType($s[1]);
                 $oldtype = $type;
                 $type->copy($suid);
                 $newtypes[] = $type;
             }
             /* compile new */
             $compiler = new Compiler($suid, getSurveyVersion($survey));
             $mess = $compiler->generateTypes($newtypes);
             foreach ($newtypes as $newtype) {
                 $newvars = $survey->getVariableDescriptivesOfType($newtype->getTyd());
                 $mess = $compiler->generateVariableDescriptives($newvars);
                 $mess = $compiler->generateGetFills($newvars);
                 $mess = $compiler->generateInlineFields($newvars);
             }
             $content = $displaySysAdmin->displaySuccess(Language::messageToolsBatchEditorCopied(Language::labelTypesLower()));
             break;
         case 'move':
             $tocompile = array();
             $moved = array();
             $newtypes = array();
             // determine survey
             $suid = loadvar('suid');
             $cookiearr = explode("-", $typecookievalue);
             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];
                 }
                 $type = $survey->getType($s[1]);
                 $oldtype = $type;
                 $type->move($suid);
                 if (isset($moved[$s[0]])) {
                     $arr = $moved[$s[0]];
                 } else {
                     $arr = array();
                 }
                 $arr[] = $oldtype;
                 $moved[$s[0]] = $arr;
                 $newtypes[] = $type;
                 /* update cookie */
                 $ind = array_search($sel, $cookiearr);
                 $cookiearr[$ind] = $type->getSuid() . '~' . $type->getTyd();
             }
             /* update cookie */
             setcookie('uscictypecookie', implode("-", $cookiearr));
             //implode("-", $arr));
             $typecookievalue = 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 types in this survey */
                 if ($suid != $comp) {
                     $compiler = new Compiler($comp, getSurveyVersion($surveys[$comp]));
                     $mess = $compiler->generateTypes($moved[$comp], true);
                 }
             }
             /* compile new */
             $compiler = new Compiler($suid, getSurveyVersion($survey));
             $mess = $compiler->generateTypes($newtypes);
             $newtypes = $changed[$comp];
             foreach ($newtypes as $newtype) {
                 $newvars = $survey->getVariableDescriptivesOfType($newtype->getTyd());
                 $mess = $compiler->generateVariableDescriptives($newvars);
                 $mess = $compiler->generateGetFills($newvars);
                 $mess = $compiler->generateInlineFields($newvars);
             }
             $content = $displaySysAdmin->displaySuccess(Language::messageToolsBatchEditorMoved(Language::labelTypesLower()));
             break;
         case 'remove':
             $removed = array();
             $cookiearr = explode("-", $typecookievalue);
             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;
                 }
                 $type = $survey->getType($s[1]);
                 $type->remove();
                 $removed[] = $type;
                 /* update cookie */
                 $ind = array_search($sel, $cookiearr);
                 unset($cookiearr[$ind]);
             }
             /* update cookie */
             setcookie('uscictypecookie', implode("-", $cookiearr));
             //implode("-", $arr));
             $typecookievalue = implode("-", $cookiearr);
             /* compile */
             foreach ($surveys as $survey) {
                 $compiler = new Compiler($survey->getSuid(), getSurveyVersion($survey));
                 $mess = $compiler->generateTypes($removed, true);
             }
             $content = $displaySysAdmin->displaySuccess(Language::messageToolsBatchEditorRemoved(Language::labelTypesLower()));
             break;
         default:
             $content = $displaySysAdmin->displayWarning(Language::messageToolsBatchEditorUnrecognizedAction());
             break;
     }
     return $content;
 }
Esempio n. 5
0
 function showToolsBatchEditorTypes($variablecookievalue, $sectioncookievalue, $groupcookievalue, $typecookievalue)
 {
     $returnStr = $this->getToolsBatchEditorTopTab(1, $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=1 />";
     $returnStr .= '<div class="well">';
     $types = explode("-", $typecookievalue);
     $returnStr1 = '';
     foreach ($types as $typ) {
         $varsplit = explode("~", $typ);
         $survey = new Survey($varsplit[0]);
         $v = $survey->getType($varsplit[1]);
         if ($v->getName() != "") {
             $returnStr1 .= '<tr>';
             $returnStr1 .= '<td>';
             $returnStr1 .= "<input class='selectedboxtype' name=selected[] type='checkbox' value='" . $typ . "'>";
             $returnStr1 .= '</td>';
             $returnStr1 .= '<td>' . $v->getName() . '</td>';
             $returnStr1 .= '<tr>';
         }
     }
     if ($returnStr1 == "") {
         $returnStr .= $this->displayInfo(Language::messageToolsBatchEditorNoTypesFound());
     } 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::labelToolsBatchEditorTypes() . '</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 .= '</tr>';
         $returnStr .= $returnStr1;
         $returnStr .= '</table>';
         $returnStr .= $this->displayCookieScripts();
         // TODO: ADD PAGE RELOAD HERE
         $returnStr .= "<script type=text/javascript>\n                           function selectAllTypes() {\n                            \$('.selectedboxtype').prop('checked', true);\n                           };\n                           function unselectAllTypes() {\n                            \$('.selectedboxtype').prop('checked', false);\n                           };\n                           </script>";
         $returnStr .= "<input class='btn btn-default' type=button onclick='selectAllTypes();' value='Select all'/>";
         $returnStr .= "<input class='btn btn-default' type=button onclick='unselectAllTypes();' value='Unselect all'/>";
         $returnStr .= "<input class='btn btn-default' type=button onclick='clearCookie(\"uscictypecookie\"); \$(\"#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(1);
         $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 .= '</table>';
         $returnStr .= '<input onclick="$(\'#batchaction\').val(\'copy\'); $(\'#actionform\').submit(); " type="button" class="btn btn-default" value="' . Language::buttonCopy() . '"/>';
         $returnStr .= '</div>';
         if ($surveys->getNumberOfSurveys() > 1) {
             $returnStr .= '<span class="label label-default">' . Language::labelMove() . '</span>';
             $returnStr .= '<div class="well">';
             $returnStr .= '<table width=100%>';
             $returnStr .= '<tr><td>' . Language::labelTypeMoveSurvey() . '</td><td>' . $this->displaySurveys("suid", "suid", $_SESSION['SUID']) . '</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;
 }
Esempio n. 6
0
 function showTranslateTypeAssistanceRes()
 {
     $displayTranslator = new DisplayTranslator();
     $survey = new Survey($_SESSION['SUID']);
     $tyd = getFromSessionParams('tyd');
     $type = $survey->getType($tyd);
     $_SESSION['TYD'] = $tyd;
     $type->setPreText(loadvarAllowHTML(SETTING_PRETEXT));
     $type->setPostText(loadvarAllowHTML(SETTING_POSTTEXT));
     $type->setHoverText(loadvarAllowHTML(SETTING_HOVERTEXT));
     if (loadvar(SETTING_EMPTY_MESSAGE) != "") {
         $type->setEmptyMessage(loadvarAllowHTML(SETTING_EMPTY_MESSAGE));
     }
     $t = $type->getAnswerType();
     switch ($t) {
         case ANSWER_TYPE_STRING:
             /* fall through */
         /* fall through */
         case ANSWER_TYPE_OPEN:
             $type->setErrorMessageMinimumLength(loadvarAllowHTML(SETTING_ERROR_MESSAGE_MINIMUM_LENGTH));
             $type->setErrorMessageMaximumLength(loadvarAllowHTML(SETTING_ERROR_MESSAGE_MAXIMUM_LENGTH));
             $type->setErrorMessageMinimumWords(loadvarAllowHTML(SETTING_ERROR_MESSAGE_MINIMUM_WORDS));
             $type->setErrorMessageMaximumWords(loadvarAllowHTML(SETTING_ERROR_MESSAGE_MAXIMUM_WORDS));
             $type->setErrorMessagePattern(loadvarAllowHTML(SETTING_ERROR_MESSAGE_PATTERN));
             break;
         case ANSWER_TYPE_DOUBLE:
             $type->setErrorMessageDouble(loadvarAllowHTML(SETTING_ERROR_MESSAGE_DOUBLE));
             break;
         case ANSWER_TYPE_INTEGER:
             $type->setErrorMessageInteger(loadvarAllowHTML(SETTING_ERROR_MESSAGE_INTEGER));
             break;
         case ANSWER_TYPE_ENUMERATED:
             $type->setErrorMessageInlineAnswered(loadvarAllowHTML(SETTING_ERROR_MESSAGE_INLINE_ANSWERED));
             $type->setErrorMessageInlineExactRequired(loadvarAllowHTML(SETTING_ERROR_MESSAGE_INLINE_EXACT_REQUIRED));
             $type->setErrorMessageInlineExclusive(loadvarAllowHTML(SETTING_ERROR_MESSAGE_INLINE_EXCLUSIVE));
             $type->setErrorMessageInlineInclusive(loadvarAllowHTML(SETTING_ERROR_MESSAGE_INLINE_INCLUSIVE));
             $type->setErrorMessageInlineMinimumRequired(loadvarAllowHTML(SETTING_ERROR_MESSAGE_INLINE_MINIMUM_REQUIRED));
             $type->setErrorMessageInlineMaximumRequired(loadvarAllowHTML(SETTING_ERROR_MESSAGE_INLINE_MAXIMUM_REQUIRED));
             break;
         case ANSWER_TYPE_SETOFENUMERATED:
             $type->setErrorMessageInlineAnswered(loadvarAllowHTML(SETTING_ERROR_MESSAGE_INLINE_ANSWERED));
             $type->setErrorMessageInlineExactRequired(loadvarAllowHTML(SETTING_ERROR_MESSAGE_INLINE_EXACT_REQUIRED));
             $type->setErrorMessageInlineExclusive(loadvarAllowHTML(SETTING_ERROR_MESSAGE_INLINE_EXCLUSIVE));
             $type->setErrorMessageInlineInclusive(loadvarAllowHTML(SETTING_ERROR_MESSAGE_INLINE_INCLUSIVE));
             $type->setErrorMessageInlineMinimumRequired(loadvarAllowHTML(SETTING_ERROR_MESSAGE_INLINE_MINIMUM_REQUIRED));
             $type->setErrorMessageInlineMaximumRequired(loadvarAllowHTML(SETTING_ERROR_MESSAGE_INLINE_MAXIMUM_REQUIRED));
             /* fall through */
         /* fall through */
         case ANSWER_TYPE_MULTIDROPDOWN:
             $type->setErrorMessageSelectMinimum(loadvarAllowHTML(SETTING_ERROR_MESSAGE_MINIMUM_SELECT));
             $type->setErrorMessageSelectMaximum(loadvarAllowHTML(SETTING_ERROR_MESSAGE_MAXIMUM_SELECT));
             $type->setErrorMessageSelectExact(loadvarAllowHTML(SETTING_ERROR_MESSAGE_EXACT_SELECT));
             $type->setErrorMessageSelectInvalidSubset(loadvarAllowHTML(SETTING_ERROR_MESSAGE_INVALID_SUB_SELECT));
             $type->setErrorMessageSelectInvalidSet(loadvarAllowHTML(SETTING_ERROR_MESSAGE_INVALID_SELECT));
             break;
         case ANSWER_TYPE_RANGE:
             /* fall through */
         /* fall through */
         case ANSWER_TYPE_SLIDER:
             $type->setErrorMessageRange(loadvarAllowHTML(SETTING_ERROR_MESSAGE_RANGE));
             break;
         case ANSWER_TYPE_CALENDAR:
             $type->setErrorMessageMaximumCalendar(loadvarAllowHTML(SETTING_ERROR_MESSAGE_MAXIMUM_CALENDAR));
             break;
     }
     $content = $displayTranslator->displaySuccess(Language::messageTypeChanged($type->getName()));
     $type->save();
     /* compile */
     $compiler = new Compiler($_SESSION['SUID'], getSurveyVersion($survey));
     $mess = $compiler->generateTypes(array($type));
     $vars = $survey->getVariableDescriptivesOfType($tyd);
     $mess = $compiler->generateVariableDescriptives($vars);
     $mess = $compiler->generateGetFills($vars);
     $mess = $compiler->generateInlineFields($vars);
     /* update last page */
     $_SESSION['LASTPAGE'] = substr($_SESSION['LASTPAGE'], 0, strripos($_SESSION['LASTPAGE'], "res"));
     /* return result */
     return $displayTranslator->showTranslateType($_SESSION['TYD'], $content);
 }