Exemplo n.º 1
0
 function showContacts($respondentOrHousehold)
 {
     $content = '';
     $refpage = 'interviewer.household';
     if ($respondentOrHousehold instanceof Respondent) {
         $refpage = 'interviewer.respondent';
     }
     $refpage = $this->setPrefix($refpage);
     $contacts = $respondentOrHousehold->getContacts();
     if (sizeof($contacts) > 0) {
         $content .= '<div class="span12" style="!important;overflow-y: auto;" id="contactdiv">';
         $content .= '<table class="table table-striped table-bordered pre-scrollable">';
         // style="overflow: auto;"
         $content .= '<thead><tr><th>' . Language::labelRespondentContactsContact() . '</th><th>' . Language::labelRespondentContactsInterviewer() . '</th><th>' . Language::labelRespondentContactsDateTime() . '</th><th>' . Language::labelRespondentContactsProxy() . '</td><th>' . Language::labelRespondentContactsRemark() . '</th><th>' . Language::labelRespondentContactsAppointment() . '</th></tr></thead><tbody>';
         //$dispositionCodes = Language::optionsDispositionContactCode();
         foreach ($contacts as $contact) {
             $content .= '<tr><td>' . $contact->getCode() . ': ' . $contact->getText($respondentOrHousehold) . '</td><td>' . $contact->getUsername() . '</td>';
             $content .= '<td><nobr>' . $contact->getContactTs() . '</td><td>';
             if ($contact->isProxy()) {
                 $content .= '<div rel="tooltip" title="' . convertHTLMEntities($contact->getProxyName(), ENT_QUOTES) . '" data-placement="top">' . Language::labelYesCap() . '</div>';
             } else {
                 $content .= Language::labelNoCap();
             }
             $content .= '</td><td>' . $contact->getRemark() . '</td><td>' . $contact->getEvent() . '</td></tr>';
         }
         $content .= '</tbody></table></div>';
         $content .= '<script>$( "#contactdiv" ).height(Math.round($(window).height() - 60 - 51 - 36 - 150));  </script>';
     } else {
         $content .= $this->displayInfo(Language::messageSMSNoContactsYet());
         //'<div class="alert alert-info">' . Language::messageSMSNoContactsYet() . '</div>';
     }
     $content .= '<hr>';
     $content .= $this->getRespondentContactButton($respondentOrHousehold, $refpage);
     return $this->showRespondentPageWithSideBar($respondentOrHousehold, $content, Language::labelContacts());
 }
Exemplo n.º 2
0
 function showTranslateGroupAssistance($group)
 {
     $returnStr = '<form id="editform" method="post">';
     $returnStr .= setSessionParamsPost(array('page' => 'translator.survey.translategroupassistanceres', 'gid' => $group->getGid()));
     $returnStr .= $this->getGroupTopTab(3);
     $returnStr .= '<div class="well" style="background-color:white;">';
     $helpstart = '<div class="input-group">';
     $message = Language::helpFollowSurvey();
     $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%>';
         $returnStr .= '<tr><td valign=top style="width: 15%;">' . Language::labelGroupEditAssistanceExclusive() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" readonly rows=2 class="form-control">' . $this->displayTextSettingValue(convertHTLMEntities($group->getErrorMessageExclusive(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
         $returnStr .= '<tr><td valign=top style="width: 15%;">' . Language::labelGroupEditAssistanceInclusive() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" readonly rows=2 class="form-control">' . $this->displayTextSettingValue(convertHTLMEntities($group->getErrorMessageInclusive(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
         $returnStr .= '<tr><td valign=top style="width: 15%;">' . Language::labelGroupEditAssistanceMinimumRequired() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" readonly rows=2 class="form-control">' . $this->displayTextSettingValue(convertHTLMEntities($group->getErrorMessageMinimumRequired(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
         $returnStr .= '<tr><td valign=top style="width: 15%;">' . Language::labelGroupEditAssistanceMaximumRequired() . '</td><td>' . $helpstart . '<textarea style="width: 100%;;" readonly rows=2 class="form-control">' . $this->displayTextSettingValue(convertHTLMEntities($group->getErrorMessageMaximumRequired(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
         $returnStr .= '<tr><td valign=top style="width: 15%;">' . Language::labelGroupEditAssistanceExactRequired() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" readonly rows=2 class="form-control">' . $this->displayTextSettingValue(convertHTLMEntities($group->getErrorMessageExactRequired(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
         $returnStr .= '<tr><td valign=top style="width: 15%;">' . Language::labelGroupEditAssistanceUniqueRequired() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" readonly rows=2 class="form-control">' . $this->displayTextSettingValue(convertHTLMEntities($group->getErrorMessageUniqueRequired(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
         $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%>';
     $returnStr .= '<tr><td valign=top style="width: 15%;">' . Language::labelGroupEditAssistanceExclusive() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" rows=2 class="form-control" name="' . SETTING_ERROR_MESSAGE_EXCLUSIVE . '">' . $this->displayTextSettingValue(convertHTLMEntities($group->getErrorMessageExclusive(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
     $returnStr .= '<tr><td valign=top style="width: 15%;">' . Language::labelGroupEditAssistanceInclusive() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" rows=2 class="form-control" name="' . SETTING_ERROR_MESSAGE_INCLUSIVE . '">' . $this->displayTextSettingValue(convertHTLMEntities($group->getErrorMessageInclusive(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
     $returnStr .= '<tr><td valign=top style="width: 15%;">' . Language::labelGroupEditAssistanceMinimumRequired() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" rows=2 class="form-control" name="' . SETTING_ERROR_MESSAGE_MINIMUM_REQUIRED . '">' . $this->displayTextSettingValue(convertHTLMEntities($group->getErrorMessageMinimumRequired(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
     $returnStr .= '<tr><td valign=top style="width: 15%;">' . Language::labelGroupEditAssistanceMaximumRequired() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" rows=2 class="form-control" name="' . SETTING_ERROR_MESSAGE_MAXIMUM_REQUIRED . '">' . $this->displayTextSettingValue(convertHTLMEntities($group->getErrorMessageMaximumRequired(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
     $returnStr .= '<tr><td valign=top style="width: 15%;">' . Language::labelGroupEditAssistanceExactRequired() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" rows=2 class="form-control" name="' . SETTING_ERROR_MESSAGE_EXACT_REQUIRED . '">' . $this->displayTextSettingValue(convertHTLMEntities($group->getErrorMessageExactRequired(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
     $returnStr .= '<tr><td valign=top style="width: 15%;">' . Language::labelGroupEditAssistanceUniqueRequired() . '</td><td>' . $helpstart . '<textarea style="width: 100%;" rows=2 class="form-control" name="' . SETTING_ERROR_MESSAGE_UNIQUE_REQUIRED . '">' . $this->displayTextSettingValue(convertHTLMEntities($group->getErrorMessageUniqueRequired(), ENT_QUOTES)) . '</textarea>' . $helpend . '</td></tr>';
     $returnStr .= '</table></div></div></div></div></div>';
     $survey = new Survey($_SESSION['SUID']);
     $user = new User($_SESSION['URID']);
     $langs = explode("~", $user->getLanguages(getSurvey(), getSurveyMode()));
     if (getSurveyLanguage() != $survey->getDefaultLanguage(getSurveyMode())) {
         $returnStr .= '<input type="submit" class="btn btn-default" value="' . Language::buttonTranslate() . '"/>';
     } else {
         if (inArray(getSurveyLanguage(), $langs)) {
             $returnStr .= '<input type="submit" class="btn btn-default" value="' . Language::buttonEdit() . '"/>';
         }
     }
     $returnStr .= '</form>';
     return $returnStr;
 }
Exemplo 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;
 }
Exemplo n.º 4
0
 function showAnswer($number, $variable, $var, $previousdata, $inline = false, $enumid = "")
 {
     //echo '<br/>showing: ' . $variable;
     /* if inline field, then don't show it UNLESS it is inline display */
     if ($this->engine->isInlineField($variable) && $inline == false) {
         return "";
     }
     $inlineclass = "";
     $hovertext = $this->engine->getFill($variable, $var, SETTING_HOVERTEXT);
     if ($hovertext != "") {
         $returnStr = "<div title='" . str_replace("'", "", $hovertext) . "' class='uscic-answer'>";
     } else {
         $returnStr = "<div class='uscic-answer'>";
     }
     if ($inline) {
         $inlineclass = "-inline";
         $returnStr = "";
     }
     $language = getSurveyLanguage();
     $varname = SESSION_PARAMS_ANSWER . $number;
     $id = $this->engine->getFill($variable, $var, SETTING_ID);
     if (trim($id) == "") {
         $id = $varname;
     }
     $answertype = $var->getAnswerType();
     if (inArray($answertype, array(ANSWER_TYPE_SETOFENUMERATED, ANSWER_TYPE_MULTIDROPDOWN))) {
         $varname .= "[]";
     }
     /* add required error check */
     if ($var->getIfEmpty() != IF_EMPTY_ALLOW) {
         /* if not inline OR inline but not in enumerated/set of enumerated */
         if ($inline == false || $inline == true && trim($enumid) == "") {
             if (inArray($var->getAnswerType(), array(ANSWER_TYPE_SETOFENUMERATED))) {
                 // custom name for set of enumerated question, since we use a hidden field/textbox to track the real answer(s); we just use this custom name for referencing in the error checking
                 $this->addErrorCheck(SESSION_PARAMS_ANSWER . $number . "_name[]", new ErrorCheck(ERROR_CHECK_REQUIRED, "true"), $this->engine->getFill($variable, $var, SETTING_EMPTY_MESSAGE));
             } else {
                 $this->addErrorCheck($varname, new ErrorCheck(ERROR_CHECK_REQUIRED, "true"), $this->engine->getFill($variable, $var, SETTING_EMPTY_MESSAGE));
             }
         }
     }
     $align = $var->getAnswerAlignment();
     $qa = "";
     switch ($align) {
         case ALIGN_LEFT:
             $qa = "text-left";
             break;
         case ALIGN_RIGHT:
             $qa = "text-right";
             break;
         case ALIGN_JUSTIFIED:
             $qa = "text-justify";
             break;
         case ALIGN_CENTER:
             $qa = "text-center";
             break;
         default:
             break;
     }
     /* hide dk/rf/na */
     if (inArray($previousdata, array(ANSWER_DK, ANSWER_RF, ANSWER_NA))) {
         $previousdata = "";
     }
     $pretext = "";
     $posttext = "";
     $inputgroupstart = '';
     $inputgroupend = "";
     if (inArray($answertype, array(ANSWER_TYPE_STRING, ANSWER_TYPE_INTEGER, ANSWER_TYPE_RANGE, ANSWER_TYPE_DOUBLE))) {
         $pretext = $this->engine->getFill($variable, $var, SETTING_PRETEXT);
         $posttext = $this->engine->getFill($variable, $var, SETTING_POSTTEXT);
         $answerformat = "";
         if ($pretext != "") {
             $answerformat = $var->getAnswerFormatting();
             $pretext = '<span id="vsid_' . $var->getVsid() . '" uscic-texttype="' . SETTING_PRETEXT . '" class="input-group-addon uscic-inputaddon-pretext' . $this->inlineeditable . '">' . $this->applyFormatting($pretext, $answerformat) . '</span>';
             $inputgroupstart = '<div class="input-group uscic-inputgroup-pretext">';
             $inputgroupend = "</div>";
         }
         if ($posttext != "") {
             if ($answerformat == "") {
                 $answerformat = $var->getAnswerFormatting();
             }
             $posttext = '<div id="vsid_' . $var->getVsid() . '" uscic-texttype="' . SETTING_POSTTEXT . '" class="input-group-addon uscic-inputaddon-posttext' . $this->inlineeditable . '">' . $this->applyFormatting($posttext, $answerformat) . '</div>';
             $inputgroupstart = '<div class="input-group uscic-inputgroup-posttext">';
             $inputgroupend = "</div>";
         }
     }
     $inlinejavascript = $this->engine->getFill($variable, $var, SETTING_JAVASCRIPT_WITHIN_ELEMENT);
     $inlinestyle = $this->engine->getFill($variable, $var, SETTING_STYLE_WITHIN_ELEMENT);
     $placeholder = $this->engine->getFill($variable, $var, SETTING_PLACEHOLDER);
     if (trim($placeholder) != "") {
         $placeholder = " placeholder='" . $placeholder . "' ";
     }
     $linkedto = "";
     if ($inline == true && trim($enumid) != "") {
         $linkedto = ' linkedto="' . $enumid . '" ';
     }
     /* add any comparison checks */
     $this->addComparisonChecks($var, $variable, $varname);
     /* any individual dk/rf/na */
     $dkrfna = $this->addDKRFNAButton($varname, $var, $variable, $inline, $enumid);
     $dkrfnaclass = "";
     if ($dkrfna != "") {
         if ($this->engine->isDKAnswer($variable)) {
             $dkrfnaclass = "dkrfna";
         } else {
             if ($this->engine->isRFAnswer($variable)) {
                 $dkrfnaclass = "dkrfna";
             } else {
                 if ($this->engine->isNAAnswer($variable)) {
                     $dkrfnaclass = "dkrfna";
                 }
             }
         }
     }
     /* add answer display */
     switch ($answertype) {
         case ANSWER_TYPE_STRING:
             //string
             $minimumlength = $this->engine->getFill($variable, $var, SETTING_MINIMUM_LENGTH);
             $maximumlength = $this->engine->getFill($variable, $var, SETTING_MAXIMUM_LENGTH);
             if ($minimumlength > 0) {
                 $this->addErrorCheck($varname, new ErrorCheck(ERROR_CHECK_MINLENGTH, $minimumlength), replacePlaceHolders(array(PLACEHOLDER_MINIMUM_LENGTH => $minimumlength), $this->engine->getFill($variable, $var, SETTING_ERROR_MESSAGE_MINIMUM_LENGTH)));
             }
             $this->addErrorCheck($varname, new ErrorCheck(ERROR_CHECK_MAXLENGTH, $maximumlength), replacePlaceHolders(array(PLACEHOLDER_MAXIMUM_LENGTH => $maximumlength), $this->engine->getFill($variable, $var, SETTING_ERROR_MESSAGE_MAXIMUM_LENGTH)));
             $minwords = $this->engine->getFill($variable, $var, SETTING_MINIMUM_WORDS);
             $maxwords = $this->engine->getFill($variable, $var, SETTING_MAXIMUM_WORDS);
             if ($minwords > 0) {
                 $this->addErrorCheck($varname, new ErrorCheck(ERROR_CHECK_MINWORDS, $minwords), replacePlaceHolders(array(PLACEHOLDER_MINIMUM_WORDS => $minwords), $this->engine->getFill($variable, $var, SETTING_ERROR_MESSAGE_MINIMUM_WORDS)));
             }
             $this->addErrorCheck($varname, new ErrorCheck(ERROR_CHECK_MAXWORDS, $maxwords), replacePlaceHolders(array(PLACEHOLDER_MAXIMUM_WORDS => $maxwords), $this->engine->getFill($variable, $var, SETTING_ERROR_MESSAGE_MAXIMUM_WORDS)));
             /* input masking */
             $textmask = $this->addInputMasking($varname, $variable, $var);
             // placeholder: , "placeholder": "*"
             $pattern = $this->engine->getFill($variable, $var, SETTING_PATTERN);
             if (trim($pattern) != "") {
                 $this->addErrorCheck($varname, new ErrorCheck(ERROR_CHECK_PATTERN, $pattern), replacePlaceHolders(array(PLACEHOLDER_PATTERN => $pattern), $this->engine->getFill($variable, $var, SETTING_ERROR_MESSAGE_PATTERN)));
             }
             if ($inline) {
                 $returnStr .= '<label>
                             <div class="uscic-string ' . $qa . '">' . $inputgroupstart . $pretext . '
                             <input class="form-control uscic-form-control-inline ' . $dkrfnaclass . '" spellcheck="false" autocorrect="off" autocapitalize="off" autocomplete="off" ' . $placeholder . $linkedto . $textmask . ' ' . $inlinestyle . ' ' . $inlinejavascript . ' ' . $this->getErrorTextString($varname) . ' class="uscic-string' . $inlineclass . '" type=text id=' . $id . ' name=' . $varname . ' value="' . convertHTLMEntities($previousdata, ENT_QUOTES) . '">
                                 ' . $posttext . $inputgroupend . $dkrfna . '
                             </div>
                             </label>';
             } else {
                 $returnStr .= $this->displayZipScripts();
                 $returnStr .= '<div class="form-group uscic-formgroup' . $inlineclass . '">
                             <label>
                                 <div class="uscic-string ' . $qa . '">' . $inputgroupstart . $pretext . '                                    
                                 <input spellcheck="false" autocorrect="off" autocapitalize="off" autocomplete="off" ' . $placeholder . $textmask . ' ' . $inlinestyle . ' ' . $inlinejavascript . ' ' . $this->getErrorTextString($varname) . ' class="form-control uscic-form-control ' . $dkrfnaclass . '" type=text id=' . $id . ' name=' . $varname . ' value="' . convertHTLMEntities($previousdata, ENT_QUOTES) . '">
                                     ' . $posttext . $inputgroupend . $dkrfna . '
                                 </div>    
                             </label>                                
                             </div>
                             ';
             }
             break;
         case ANSWER_TYPE_ENUMERATED:
             //enumerated
             $dis = $var->getEnumeratedDisplay();
             if ($dis == ORIENTATION_HORIZONTAL) {
                 $returnStr .= $this->showEnumeratedHorizontal($id, $varname, $variable, $var, $previousdata, $inlineclass, $inlinestyle, $inlinejavascript);
             } else {
                 if ($dis == ORIENTATION_VERTICAL) {
                     $returnStr .= $this->showEnumeratedVertical($id, $varname, $variable, $var, $previousdata, $inlineclass, $inlinestyle, $inlinejavascript);
                 } else {
                     $returnStr .= $this->showEnumeratedCustom($id, $varname, $variable, $var, $previousdata, $inlineclass, $inlinestyle, $inlinejavascript);
                 }
             }
             break;
         case ANSWER_TYPE_SETOFENUMERATED:
             //set of enumerated
             $dis = $var->getEnumeratedDisplay();
             if ($dis == ORIENTATION_HORIZONTAL) {
                 $returnStr .= $this->showsetOfEnumeratedHorizontal($id, $varname, $variable, $var, $previousdata, $inlineclass, $inlinestyle, $inlinejavascript);
             } else {
                 if ($dis == ORIENTATION_VERTICAL) {
                     $returnStr .= $this->showSetOfEnumeratedVertical($id, $varname, $variable, $var, $previousdata, $inlineclass, $inlinestyle, $inlinejavascript);
                 } else {
                     $returnStr .= $this->showSetOfEnumeratedCustom($id, $varname, $variable, $var, $previousdata, $inlineclass, $inlinestyle, $inlinejavascript);
                 }
             }
             break;
         case ANSWER_TYPE_DROPDOWN:
             //drop down
             $options = $this->engine->getFill($variable, $var, SETTING_OPTIONS);
             $returnStr .= $this->showComboBox($variable, $var, $varname, $id, $options, $previousdata, $inline, "", $linkedto);
             break;
         case ANSWER_TYPE_MULTIDROPDOWN:
             //multiple selection dropdown
             $this->addSetOfEnumeratedChecks($varname, $variable, $var, ANSWER_TYPE_MULTIDROPDOWN);
             $options = $this->engine->getFill($variable, $var, SETTING_OPTIONS);
             $returnStr .= $this->showComboBox($variable, $var, $varname, $id, $options, $previousdata, $inline, "multiple", $linkedto);
             break;
         case ANSWER_TYPE_INTEGER:
             //integer
             /* input masking */
             $textmask = $this->addInputMasking($varname, $variable, $var);
             $this->addErrorCheck($varname, new ErrorCheck(ERROR_CHECK_INTEGER, "true"), $this->engine->getFill($variable, $var, SETTING_ERROR_MESSAGE_INTEGER));
             if ($inline) {
                 $returnStr .= '<div class="form-group uscic-formgroup-inline"><label>
                             <div class="uscic-integer ' . $qa . '">' . $inputgroupstart . $pretext . '
                             <input class="form-control uscic-form-control-inline ' . $dkrfnaclass . '" spellcheck="false" autocorrect="off" autocapitalize="off" autocomplete="off" ' . $placeholder . $linkedto . $textmask . ' ' . $inlinestyle . ' ' . $inlinejavascript . ' ' . $this->getErrorTextString($varname) . ' class="uscic-integer' . $inlineclass . '" type=text id=' . $id . ' name=' . $varname . ' value="' . convertHTLMEntities($previousdata, ENT_QUOTES) . '">
                                 ' . $posttext . $inputgroupend . $dkrfna . '
                             </div>
                             </label></div>';
             } else {
                 $returnStr .= '<div class="form-group uscic-formgroup">
                             <label>
                             <div class="uscic-integer ' . $qa . '">' . $inputgroupstart . $pretext . '
                             <input spellcheck="false" autocorrect="off" autocapitalize="off" autocomplete="off" ' . $placeholder . $textmask . ' ' . $inlinestyle . ' ' . $inlinejavascript . ' ' . $this->getErrorTextString($varname) . ' class="form-control uscic-form-control ' . $dkrfnaclass . '" type=text id=' . $id . ' name=' . $varname . ' value="' . convertHTLMEntities($previousdata, ENT_QUOTES) . '">
                                 ' . $posttext . $inputgroupend . $dkrfna . '
                             </div>
                             </label>
                             </div>';
             }
             break;
         case ANSWER_TYPE_DOUBLE:
             //double
             /* input masking */
             $textmask = $this->addInputMasking($varname, $variable, $var);
             $this->addErrorCheck($varname, new ErrorCheck(ERROR_CHECK_NUMBER, "true"), $this->engine->getFill($variable, $var, SETTING_ERROR_MESSAGE_DOUBLE));
             if ($inline) {
                 $returnStr .= '<div class="form-group uscic-formgroup-inline"><label>
                             <div class="uscic-double ' . $qa . '">' . $inputgroupstart . $pretext . '
                             <input class="form-control uscic-form-control-inline ' . $dkrfnaclass . '" spellcheck="false" autocorrect="off" autocapitalize="off" autocomplete="off" ' . $placeholder . $linkedto . $textmask . ' ' . $inlinestyle . ' ' . $inlinejavascript . ' ' . $this->getErrorTextString($varname) . ' class="uscic-double' . $inlineclass . '" type=text id=' . $id . ' name=' . $varname . ' value="' . convertHTLMEntities($previousdata, ENT_QUOTES) . '">
                                 ' . $posttext . $inputgroupend . $dkrfna . '
                             </div>
                             </label></div>';
             } else {
                 $returnStr .= '<div class="form-group uscic-formgroup' . $inlineclass . '">
                             <label>
                             <div class="uscic-double ' . $qa . '">' . $inputgroupstart . $pretext . '
                             <input spellcheck="false" autocorrect="off" autocapitalize="off" autocomplete="off" ' . $placeholder . $textmask . ' ' . $inlinestyle . ' ' . $inlinejavascript . ' ' . $this->getErrorTextString($varname) . ' class="form-control uscic-form-control ' . $dkrfnaclass . '" type=text id=' . $id . ' name=' . $varname . ' value="' . convertHTLMEntities($previousdata, ENT_QUOTES) . '">
                             ' . $posttext . $inputgroupend . $dkrfna . '</div>
                             </label>
                             </div>';
             }
             break;
         case ANSWER_TYPE_RANGE:
             //range
             /* input masking */
             $textmask = $this->addInputMasking($varname, $variable, $var);
             $minimum = $this->engine->getFill($variable, $var, SETTING_MINIMUM_RANGE);
             if ($minimum == "" || !is_numeric($minimum)) {
                 $minimum = ANSWER_RANGE_MINIMUM;
             }
             $maximum = $this->engine->getFill($variable, $var, SETTING_MAXIMUM_RANGE);
             if ($maximum == "" || !is_numeric($maximum)) {
                 $maximum = ANSWER_RANGE_MAXIMUM;
             }
             $others = $this->engine->getFill($variable, $var, SETTING_OTHER_RANGE);
             if (trim($others) == "") {
                 $this->addErrorCheck($varname, new ErrorCheck(ERROR_CHECK_RANGE, "[" . $minimum . "," . $maximum . "]"), replacePlaceHolders(array(PLACEHOLDER_MINIMUM => $minimum, PLACEHOLDER_MAXIMUM => $maximum), $this->engine->getFill($variable, $var, SETTING_ERROR_MESSAGE_RANGE)));
             } else {
                 $this->addErrorCheck($varname, new ErrorCheck(ERROR_CHECK_RANGE_CUSTOM, "'" . $minimum . "," . $maximum . ";" . $others . "'"), replacePlaceHolders(array(PLACEHOLDER_MINIMUM => $minimum, PLACEHOLDER_MAXIMUM => $maximum), $this->engine->getFill($variable, $var, SETTING_ERROR_MESSAGE_RANGE)));
             }
             if (!(contains($minimum, ".") || contains($maximum, "."))) {
                 $this->addErrorCheck($varname, new ErrorCheck(ERROR_CHECK_INTEGER, "true"), $this->engine->getFill($variable, $var, SETTING_ERROR_MESSAGE_INTEGER));
             }
             if ($inline) {
                 $returnStr .= '<div class="form-group uscic-formgroup-inline"><label>
                             <div class="uscic-range ' . $qa . '">' . $inputgroupstart . $pretext . '
                             <input class="form-control uscic-form-control-inline ' . $dkrfnaclass . '" spellcheck="false" autocorrect="off" autocapitalize="off" autocomplete="off" ' . $placeholder . $linkedto . $textmask . ' ' . $inlinestyle . ' ' . $inlinejavascript . ' ' . $this->getErrorTextString($varname) . ' class="uscic-range' . $inlineclass . '" type=text id=' . $id . ' name=' . $varname . ' value="' . convertHTLMEntities($previousdata, ENT_QUOTES) . '">
                                 ' . $posttext . $inputgroupend . $dkrfna . '
                             </div>
                             </label></div>';
             } else {
                 $returnStr .= '<div class="form-group uscic-formgroup' . $inlineclass . '">                                
                             <label>
                             <div class="uscic-range ' . $qa . '">' . $inputgroupstart . $pretext . '
                             <input spellcheck="false" autocorrect="off" autocapitalize="off" autocomplete="off" ' . $placeholder . $textmask . ' ' . $inlinestyle . ' ' . $inlinejavascript . ' ' . $this->getErrorTextString($varname) . ' class="form-control uscic-form-control ' . $dkrfnaclass . '" type=text id=' . $id . ' name=' . $varname . ' value="' . convertHTLMEntities($previousdata, ENT_QUOTES) . '">
                                 ' . $posttext . $inputgroupend . $dkrfna . '</div>
                             </label>
                             </div>';
             }
             break;
         case ANSWER_TYPE_SLIDER:
             //slider
             $minimum = $this->engine->getFill($variable, $var, SETTING_MINIMUM_RANGE);
             $maximum = $this->engine->getFill($variable, $var, SETTING_MAXIMUM_RANGE);
             if ($minimum == "" || !is_numeric($minimum)) {
                 $minimum = ANSWER_RANGE_MINIMUM;
             }
             $maximum = $this->engine->getFill($variable, $var, SETTING_MAXIMUM_RANGE);
             if ($maximum == "" || !is_numeric($maximum)) {
                 $maximum = ANSWER_RANGE_MAXIMUM;
             }
             $orientation = "horizontal";
             if ($var->getSliderOrientation() == ORIENTATION_VERTICAL) {
                 $orientation = "vertical";
             }
             $step = $this->engine->replaceFills($var->getIncrement());
             $tooltip = "show";
             if ($var->getTooltip() == TOOLTIP_NO) {
                 $tooltip = "hide";
             }
             $returnStr .= $this->displaySlider($variable, $var, $varname, $id, $previousdata, $minimum, $maximum, $this->getErrorTextString($varname), $qa, $inlineclass, $step, $tooltip, $orientation, $dkrfna, $linkedto);
             break;
         case ANSWER_TYPE_DATE:
             //date
             $returnStr .= '<div class="form-group uscic-formgroup' . $inlineclass . '">
                           <div class="uscic-date' . $inlineclass . ' ' . $qa . '">
                             <label>
                             ' . $this->displayDateTimePicker($varname, $id, $previousdata, getSurveyLanguagePostFix(getSurveyLanguage()), "true", "false", Config::usFormatSurvey(), Config::secondsSurvey(), Config::minutesSurvey(), $inlineclass, $inlinestyle, $inlinejavascript, $this->engine->replaceFills($var->getDateFormat()), $this->getErrorTextString($varname), $dkrfna, $variable, $linkedto) . '
                             </label>
                             </div>
                             </div>';
             break;
         case ANSWER_TYPE_TIME:
             //time
             $returnStr .= '<div class="form-group uscic-formgroup' . $inlineclass . '">
                             <div class="uscic-time' . $inlineclass . ' ' . $qa . '">
                             <label>
                             ' . $this->displayDateTimePicker($varname, $id, $previousdata, getSurveyLanguagePostFix(getSurveyLanguage()), "false", "true", Config::usFormatSurvey(), Config::secondsSurvey(), Config::minutesSurvey(), $inlineclass, $inlinestyle, $inlinejavascript, $this->engine->replaceFills($var->getTimeFormat()), $this->getErrorTextString($varname), $dkrfna, $variable, $linkedto) . '
                             </label>
                             </div>
                             </div>';
             break;
         case ANSWER_TYPE_DATETIME:
             //date/time
             $returnStr .= '<div class="form-group uscic-formgroup' . $inlineclass . '">
                             <div class="uscic-datetime' . $inlineclass . ' ' . $qa . '">
                             <label>
                             ' . $this->displayDateTimePicker($varname, $id, $previousdata, getSurveyLanguagePostFix(getSurveyLanguage()), "true", "true", Config::usFormatSurvey(), Config::secondsSurvey(), Config::minutesSurvey(), $inlineclass, $inlinestyle, $inlinejavascript, $this->engine->replaceFills($var->getDateTimeFormat()), $this->getErrorTextString($varname), $dkrfna, $variable, $linkedto) . '
                             </label>
                             </div>
                             </div>';
             break;
         case ANSWER_TYPE_OPEN:
             //open
             $minimumlength = $this->engine->getFill($variable, $var, SETTING_MINIMUM_LENGTH);
             $maximumlength = $this->engine->getFill($variable, $var, SETTING_MAXIMUM_LENGTH);
             if ($minimumlength > 0) {
                 $this->addErrorCheck($varname, new ErrorCheck(ERROR_CHECK_MINLENGTH, $minimumlength), replacePlaceHolders(array(PLACEHOLDER_MINIMUM_LENGTH => $minimumlength), $this->engine->getFill($variable, $var, SETTING_ERROR_MESSAGE_MINIMUM_LENGTH)));
             }
             $this->addErrorCheck($varname, new ErrorCheck(ERROR_CHECK_MAXLENGTH, $maximumlength), replacePlaceHolders(array(PLACEHOLDER_MAXIMUM_LENGTH => $maximumlength), $this->engine->getFill($variable, $var, SETTING_ERROR_MESSAGE_MAXIMUM_LENGTH)));
             $minwords = $this->engine->getFill($variable, $var, SETTING_MINIMUM_WORDS);
             $maxwords = $this->engine->getFill($variable, $var, SETTING_MAXIMUM_WORDS);
             if ($minwords > 0) {
                 $this->addErrorCheck($varname, new ErrorCheck(ERROR_CHECK_MINWORDS, $minwords), replacePlaceHolders(array(PLACEHOLDER_MINIMUM_WORDS => $minimumwords), $this->engine->getFill($variable, $var, SETTING_ERROR_MESSAGE_MINIMUM_WORDS)));
             }
             $this->addErrorCheck($varname, new ErrorCheck(ERROR_CHECK_MAXWORDS, $maxwords), replacePlaceHolders(array(PLACEHOLDER_MAXIMUM_WORDS => $maximumwords), $this->engine->getFill($variable, $var, SETTING_ERROR_MESSAGE_MAXIMUM_WORDS)));
             $pattern = $this->engine->getFill($variable, $var, SETTING_PATTERN);
             if (trim($pattern) != "") {
                 $this->addErrorCheck($varname, new ErrorCheck(ERROR_CHECK_PATTERN, $pattern), replacePlaceHolders(array(PLACEHOLDER_PATTERN => $pattern), $this->engine->getFill($variable, $var, SETTING_ERROR_MESSAGE_PATTERN)));
             }
             if ($inline) {
                 $returnStr .= '<div class="form-group uscic-formgroup-inline"><label>
                             <textarea spellcheck="false" autocorrect="off" autocapitalize="off" ' . $placeholder . $linkedto . $inlinestyle . ' ' . $inlinejavascript . ' ' . $qa . ' ' . $this->getErrorTextString($varname) . ' id=' . $id . ' class="uscic-open-inline' . $inlineclass . ' ' . $dkrfnaclass . '" name=' . $varname . '>' . convertHTLMEntities($previousdata, ENT_QUOTES) . '</textarea>' . $dkrfna . '
                             </label></div>';
             } else {
                 $returnStr .= '<div class="form-group uscic-formgroup' . $inlineclass . '">
                             <label>
                             <div class="uscic-open">
                             <textarea spellcheck="false" autocorrect="off" autocapitalize="off" autocomplete="off" ' . $placeholder . $inlinestyle . ' ' . $inlinejavascript . ' ' . $qa . ' ' . $this->getErrorTextString($varname) . ' id=' . $id . ' class="form-control uscic-form-control ' . $dkrfnaclass . '" name=' . $varname . '>' . convertHTLMEntities($previousdata, ENT_QUOTES) . '</textarea>
                                 </div>' . $dkrfna . '
                             </label>                                
                             </div>';
             }
             break;
         case ANSWER_TYPE_CALENDAR:
             //calendar
             $maximum = $this->engine->getFill($variable, $var, SETTING_MAXIMUM_CALENDAR);
             $returnStr .= '<div class="form-group uscic-formgroup' . $inlineclass . '">
                         <div class="uscic-calendar' . $inlineclass . '">' . $this->showCalendar($varname, $id, $previousdata, $maximum, "en", true) . '
                         <p style="display:none" id="' . $id . '_help" class="help-block">You can only select a maximum of ' . $maximum . ' days.</p>
                          </div>
                          </div>';
             break;
         case ANSWER_TYPE_CUSTOM:
             //custom
             /* input masking */
             $textmask = $this->addInputMasking($varname, $variable, $var);
             $minimum = $this->engine->getFill($variable, $var, SETTING_MINIMUM_RANGE);
             if ($minimum == "" || !is_numeric($minimum)) {
                 $minimum = ANSWER_RANGE_MINIMUM;
             }
             $maximum = $this->engine->getFill($variable, $var, SETTING_MAXIMUM_RANGE);
             if ($maximum == "" || !is_numeric($maximum)) {
                 $maximum = ANSWER_RANGE_MAXIMUM;
             }
             $others = $this->engine->getFill($variable, $var, SETTING_OTHER_RANGE);
             if (trim($others) == "") {
                 $this->addErrorCheck($varname, new ErrorCheck(ERROR_CHECK_RANGE, "[" . $minimum . "," . $maximum . "]"), replacePlaceHolders(array(PLACEHOLDER_MINIMUM => $minimum, PLACEHOLDER_MAXIMUM => $maximum), $this->engine->getFill($variable, $var, SETTING_ERROR_MESSAGE_RANGE)));
             } else {
                 $this->addErrorCheck($varname, new ErrorCheck(ERROR_CHECK_RANGE_CUSTOM, "'" . $minimum . "," . $maximum . ";" . $others . "'"), replacePlaceHolders(array(PLACEHOLDER_MINIMUM => $minimum, PLACEHOLDER_MAXIMUM => $maximum), $this->engine->getFill($variable, $var, SETTING_ERROR_MESSAGE_RANGE)));
             }
             if (!(contains($minimum, ".") || contains($maximum, "."))) {
                 $this->addErrorCheck($varname, new ErrorCheck(ERROR_CHECK_INTEGER, "true"), $this->engine->getFill($variable, $var, SETTING_ERROR_MESSAGE_INTEGER));
             }
             $tocall = $this->engine->getFill($variable, $var, SETTING_ANSWERTYPE_CUSTOM);
             $parameters = array();
             if (stripos($tocall, '(') !== false) {
                 $parameters = rtrim(substr($tocall, stripos($tocall, '(') + 1), ')');
                 $parameters = preg_split("/[\\s,]+/", $parameters);
                 $tocall = substr($tocall, 0, stripos($tocall, '('));
             }
             // add error string as parameter if we need it
             $parameters[] = $this->getErrorTextString($varname);
             //echo $tocall . '----';
             if (function_exists($tocall)) {
                 try {
                     $f = new ReflectionFunction($tocall);
                     $returnStr .= $f->invoke($variable, $parameters);
                 } catch (Exception $e) {
                 }
             }
     }
     if (!$inline) {
         $returnStr .= "</div>";
     }
     return $returnStr;
 }
Exemplo n.º 5
0
 function showEditSettingsLayout($message = "")
 {
     $survey = new Survey($_SESSION['SUID']);
     $returnStr = $this->showSettingsHeader($survey, Language::headerEditSettingsLayout());
     $returnStr .= $this->getSurveyTopTab($_SESSION['VRFILTERMODE_SURVEY']);
     $returnStr .= '<div class="well" style="background-color:white;">';
     $returnStr .= $message;
     $returnStr .= '<form id="editform" method="post">';
     $returnStr .= setSessionParamsPost(array('page' => 'sysadmin.survey.editsettingslayoutres'));
     /* header/footer setting */
     $returnStr .= '<span class="label label-default">' . Language::labelSettingsPage() . '</span>';
     $returnStr .= '<div class="well">';
     $returnStr .= '<table width=100%>';
     $returnStr .= '<tr><td>' . Language::labelTypeEditLayoutTemplate() . '</td><td>';
     $templateoptions = array();
     if ($dh = opendir("display/templates")) {
         while (($file = readdir($dh)) !== false) {
             if (startsWith(strtolower($file), TEMPLATE_NAME) && contains($file, "_")) {
                 $templateoptions[] = $file;
             }
         }
         closedir($dh);
     }
     $returnStr .= "<select class='selectpicker show-tick' name='" . SETTING_SURVEY_TEMPLATE . "'>";
     $templatenames = Common::surveyOverallTemplates();
     $custom = 1;
     foreach ($templateoptions as $t) {
         $end = substr($t, strpos($t, "_") + 1, 1);
         $selected = '';
         if ($survey->getTemplate() == $end) {
             $selected = "SELECTED";
         }
         if (isset($templatenames[$end])) {
             $name = $templatenames[$end];
         } else {
             $name = "Custom" . $custom;
             $custom++;
         }
         $returnStr .= "<option " . $selected . " value=" . $end . ">" . $name . "</option>";
     }
     $returnStr .= "</select></td></tr>";
     //<input type="text" class="form-control" name="' . SETTING_SURVEY_TEMPLATE . '" value="' . convertHTLMEntities($survey->getTemplate(), ENT_QUOTES) . '"></td></tr>';
     $user = new User($_SESSION['URID']);
     $tinymce = '';
     if ($user->hasHTMLEditor()) {
         $returnStr .= $this->getTinyMCE();
         $tinymce = ' tinymce';
     }
     $returnStr .= '<tr><td valign=top style="width: 15%;">' . Language::labelSettingsHeader() . '</td><td><textarea style="width: 100%;" rows=6 class="form-control autocompletebasic' . $tinymce . '" id="' . SETTING_PAGE_HEADER . '" name="' . SETTING_PAGE_HEADER . '">' . convertHTLMEntities($survey->getPageHeader(), ENT_QUOTES) . '</textarea></td></tr>';
     $returnStr .= '<tr><td valign=top style="width: 15%;">' . Language::labelSettingsFooter() . '</td><td><textarea style="width: 100%;" rows=6 class="form-control autocompletebasic' . $tinymce . '" id="' . SETTING_PAGE_FOOTER . '" name="' . SETTING_PAGE_FOOTER . '">' . convertHTLMEntities($survey->getPageFooter(), ENT_QUOTES) . '</textarea></td></tr>';
     $returnStr .= "</table>";
     $returnStr .= '</div>';
     $returnStr .= '<span class="label label-default">' . Language::labelTypeEditLayoutOverall() . '</span>';
     $returnStr .= "<div class='well'>";
     $returnStr .= "<table>";
     $returnStr .= "<tr><td>" . Language::labelTypeEditQuestionAlignment() . "</td>";
     $returnStr .= "<td>" . $this->displayAlignment(SETTING_QUESTION_ALIGNMENT, $survey->getQuestionAlignment()) . "</td><td width=25><nobr/></td>            \n                      <td>" . Language::labelTypeEditQuestionFormatting() . "</td>";
     $returnStr .= "<td>" . $this->displayFormatting(SETTING_QUESTION_FORMATTING, $survey->getQuestionFormatting()) . "</td></tr>";
     $returnStr .= "<tr><td>" . Language::labelTypeEditAnswerAlignment() . "</td>";
     $returnStr .= "<td>" . $this->displayAlignment(SETTING_ANSWER_ALIGNMENT, $survey->getAnswerAlignment()) . "</td><td width=25><nobr/></td>\n                        <td>" . Language::labelTypeEditAnswerFormatting() . "</td>";
     $returnStr .= "<td>" . $this->displayFormatting(SETTING_ANSWER_FORMATTING, $survey->getAnswerFormatting()) . "</td></tr>";
     $returnStr .= "<tr><td>" . Language::labelTypeEditButtonAlignment() . "</td>";
     $returnStr .= "<td>" . $this->displayAlignment(SETTING_BUTTON_ALIGNMENT, $survey->getButtonAlignment()) . "</td><td width=25><nobr/></td>            \n                      <td>" . Language::labelTypeEditButtonFormatting() . "</td>";
     $returnStr .= "<td>" . $this->displayFormatting(SETTING_BUTTON_FORMATTING, $survey->getButtonFormatting()) . "</td></tr>";
     $returnStr .= '</table></div>';
     $returnStr .= '<span class="label label-default">' . Language::labelTypeEditLayoutError() . '</span>';
     $returnStr .= "<div class='well'>";
     $returnStr .= "<table>";
     $returnStr .= "<tr><td>" . Language::labelTypeEditLayoutErrorPlacement() . "</td>";
     $returnStr .= "<td>" . $this->displayErrorPlacement(SETTING_ERROR_PLACEMENT, $survey->getErrorPlacement()) . "</td><td width=25><nobr/></td>";
     $returnStr .= "</tr>";
     $returnStr .= '</table>';
     $returnStr .= '</div>';
     $returnStr .= '<span class="label label-default">' . Language::labelTypeEditLayoutButtons() . '</span>';
     $returnStr .= "<div class='well'>";
     $returnStr .= $this->displayColorPicker();
     $returnStr .= "<table>";
     $returnStr .= "<tr><td>" . Language::labelTypeEditBackButton() . "</td>";
     $returnStr .= "<td>" . $this->displayButton(SETTING_BACK_BUTTON, $survey->getShowBackButton()) . "</td>\n                      <td width=25><nobr/></td>            \n                      <td>" . Language::labelTypeEditButtonLabel() . "</td>";
     $returnStr .= "<td>" . $this->displayButtonLabel(SETTING_BACK_BUTTON_LABEL, $survey->getLabelBackButton()) . "</td></tr>";
     $returnStr .= "<tr><td>" . Language::labelTypeEditNextButton() . "</td>";
     $returnStr .= "<td>" . $this->displayButton(SETTING_NEXT_BUTTON, $survey->getShowNextButton()) . "</td><td width=25><nobr/></td>            \n                      <td>" . Language::labelTypeEditButtonLabel() . "</td>";
     $returnStr .= "<td>" . $this->displayButtonLabel(SETTING_NEXT_BUTTON_LABEL, $survey->getLabelNextButton()) . "</td></tr>";
     $returnStr .= "<tr><td>" . Language::labelTypeEditDKButton() . "</td>";
     $returnStr .= "<td>" . $this->displayButton(SETTING_DK_BUTTON, $survey->getShowDKButton()) . "</td><td width=25><nobr/></td>            \n                      <td>" . Language::labelTypeEditButtonLabel() . "</td>";
     $returnStr .= "<td>" . $this->displayButtonLabel(SETTING_DK_BUTTON_LABEL, $survey->getLabelDKButton()) . "</td></tr>";
     $returnStr .= "<tr><td>" . Language::labelTypeEditRFButton() . "</td>";
     $returnStr .= "<td>" . $this->displayButton(SETTING_RF_BUTTON, $survey->getShowRFButton()) . "</td><td width=25><nobr/></td>            \n                      <td>" . Language::labelTypeEditButtonLabel() . "</td>";
     $returnStr .= "<td>" . $this->displayButtonLabel(SETTING_RF_BUTTON_LABEL, $survey->getLabelRFButton()) . "</td></tr>";
     $returnStr .= "<tr><td>" . Language::labelTypeEditNAButton() . "</td>";
     $returnStr .= "<td>" . $this->displayButton(SETTING_NA_BUTTON, $survey->getShowNAButton()) . "</td><td width=25><nobr/></td>            \n                      <td>" . Language::labelTypeEditButtonLabel() . "</td>";
     $returnStr .= "<td>" . $this->displayButtonLabel(SETTING_NA_BUTTON_LABEL, $survey->getLabelNAButton()) . "</td></tr>";
     $returnStr .= "<tr><td>" . Language::labelTypeEditUpdateButton() . "</td>";
     $returnStr .= "<td>" . $this->displayButton(SETTING_UPDATE_BUTTON, $survey->getShowUpdateButton()) . "</td><td width=25><nobr/></td>            \n                      <td>" . Language::labelTypeEditButtonLabel() . "</td>";
     $returnStr .= "<td>" . $this->displayButtonLabel(SETTING_UPDATE_BUTTON_LABEL, $survey->getLabelUpdateButton()) . "</td></tr>";
     $returnStr .= "<tr><td>" . Language::labelTypeEditRemarkButton() . "</td>";
     $returnStr .= "<td>" . $this->displayButton(SETTING_REMARK_BUTTON, $survey->getShowRemarkButton()) . "</td><td width=25><nobr/></td>            \n                      <td>" . Language::labelTypeEditButtonLabel() . "</td>";
     $returnStr .= "<td>" . $this->displayButtonLabel(SETTING_REMARK_BUTTON_LABEL, $survey->getLabelRemarkButton()) . "</td></tr>";
     $returnStr .= "<tr><td>" . Language::labelTypeEditRemarkSaveButton() . "</td>";
     $returnStr .= "<td>" . $this->displayButton(SETTING_REMARK_SAVE_BUTTON, $survey->getShowRemarkSaveButton()) . "</td><td width=25><nobr/></td>            \n                      <td>" . Language::labelTypeEditButtonLabel() . "</td>";
     $returnStr .= "<td>" . $this->displayButtonLabel(SETTING_REMARK_SAVE_BUTTON_LABEL, $survey->getLabelRemarkSaveButton()) . "</td></tr>";
     $returnStr .= "<tr><td>" . Language::labelTypeEditCloseButton() . "</td>";
     $returnStr .= "<td>" . $this->displayButton(SETTING_CLOSE_BUTTON, $survey->getShowCloseButton()) . "</td><td width=25><nobr/></td>            \n                      <td>" . Language::labelTypeEditButtonLabel() . "</td>";
     $returnStr .= "<td>" . $this->displayButtonLabel(SETTING_CLOSE_BUTTON_LABEL, $survey->getLabelCloseButton()) . "</td></tr>";
     $returnStr .= '</table></div>';
     $returnStr .= '<span class="label label-default">' . Language::labelTypeEditLayoutSection() . '</span>';
     $returnStr .= "<div class='well'>";
     $returnStr .= "<table>";
     $returnStr .= "<tr><td>" . Language::labelTypeEditSectionHeader() . "</td>";
     $returnStr .= "<td>" . $this->displaySectionHeader(SETTING_SHOW_SECTION_HEADER, $survey->getShowSectionHeader()) . "</td><td width=25><nobr/></td>            \n                      <td>" . Language::labelTypeEditSectionFooter() . "</td>";
     $returnStr .= "<td>" . $this->displaySectionFooter(SETTING_SHOW_SECTION_FOOTER, $survey->getShowSectionFooter()) . "</td></tr>";
     $returnStr .= '</table></div>';
     $returnStr .= '<span class="label label-default">' . Language::labelTypeEditLayoutProgressBar() . '</span>';
     $returnStr .= "<div class='well'>";
     $returnStr .= "<table>";
     $returnStr .= "<tr><td>" . Language::labelTypeEditLayoutProgressBarShow() . "</td>";
     $returnStr .= "<td>" . $this->displayProgressbar(SETTING_PROGRESSBAR_SHOW, $survey->getShowProgressBar()) . "</td></tr>";
     $returnStr .= "<tr><td>" . Language::labelTypeEditLayoutProgressBarType() . "</td>";
     $returnStr .= "<td>" . $this->displayProgressbarType(SETTING_PROGRESSBAR_TYPE, $survey->getProgressBarType()) . "</td></tr>";
     $returnStr .= "<tr><td>" . Language::labelTypeEditLayoutProgressBarFillColor() . "</td>";
     $returnStr .= '<td><div class="input-group colorpicker">
       <input name=' . SETTING_PROGRESSBAR_FILLED_COLOR . ' type="text" value="' . $survey->getProgressBarFillColor() . '" class="form-control autocompletebasic" />
       <span class="input-group-addon"><i></i></span>
       </div></td></tr>';
     $returnStr .= '<tr><td>' . Language::labelTypeEditLayoutProgressBarWidth() . '</td><td><input type="text" class="form-control autocompletebasic" name="' . SETTING_PROGRESSBAR_WIDTH . '" value="' . convertHTLMEntities($survey->getProgressBarWidth(), ENT_QUOTES) . '"></td></tr>';
     $returnStr .= '</table>';
     $returnStr .= '</div>';
     $returnStr .= '<span class="label label-default">' . Language::labelSettingsTable() . '</span>';
     $returnStr .= "<div class='well'>";
     $returnStr .= "<table>";
     $returnStr .= "<tr><td>" . Language::labelTypeEditHeaderAlignment() . "</td>";
     $returnStr .= "<td>" . $this->displayAlignment(SETTING_HEADER_ALIGNMENT, $survey->getHeaderAlignment()) . "</td><td width=25><nobr/></td>            \n                      <td>" . Language::labelTypeEditHeaderFormatting() . "</td>";
     $returnStr .= "<td>" . $this->displayFormatting(SETTING_HEADER_FORMATTING, $survey->getHeaderFormatting()) . "</td></tr>";
     $returnStr .= "<tr><td>" . Language::labelTypeEditHeaderFixed() . "</td>";
     $returnStr .= "<td>" . $this->displayHeaderFixed($survey->getHeaderFixed()) . "</td><td width=25><nobr/></td>            \n                               <td>" . Language::labelTypeEditHeaderScrollDisplay() . "</td>";
     $returnStr .= '<td><input type="text" class="form-control" name="' . SETTING_HEADER_SCROLL_DISPLAY . '" value="' . convertHTLMEntities($survey->getHeaderScrollDisplay(), ENT_QUOTES) . '"></td></tr>';
     $returnStr .= "<tr><td>" . Language::labelGroupEditBordered() . "</td>";
     $returnStr .= "<td>" . $this->displayStriped(SETTING_GROUP_TABLE_BORDERED, $survey->getTableBordered()) . "</td><td width=25><nobr/></td>";
     $returnStr .= "<td>" . Language::labelGroupEditCondensed() . "</td>";
     $returnStr .= "<td>" . $this->displayStriped(SETTING_GROUP_TABLE_CONDENSED, $survey->getTableCondensed()) . "</td></tr>";
     $returnStr .= "<tr><td>" . Language::labelGroupEditHovered() . "</td>";
     $returnStr .= "<td>" . $this->displayStriped(SETTING_GROUP_TABLE_HOVERED, $survey->getTableHovered()) . "</td><td width=25><nobr/></td>";
     $returnStr .= "<td>" . Language::labelGroupEditStriped() . "</td>";
     $returnStr .= "<td>" . $this->displayStriped(SETTING_GROUP_TABLE_STRIPED, $survey->getTableStriped()) . "</td></tr>";
     $returnStr .= "<tr><td>" . Language::labelTypeEditTableWidth() . "</td>";
     $returnStr .= '<td><input type="text" class="form-control autocompletebasic" name="' . SETTING_TABLE_WIDTH . '" value="' . convertHTLMEntities($survey->getTableWidth(), ENT_QUOTES) . '"></td><td width=25><nobr/></td>';
     $returnStr .= "<td>" . Language::labelTypeEditQuestionColumnWidth() . "</td>";
     $returnStr .= '<td><input type="text" class="form-control autocompletebasic" name="' . SETTING_QUESTION_COLUMN_WIDTH . '" value="' . convertHTLMEntities($survey->getQuestionColumnWidth(), ENT_QUOTES) . '"></td><td width=25><nobr/></td></tr>';
     $returnStr .= "<tr><td>" . Language::labelTypeEditMobile() . "</td>";
     $returnStr .= '<td>' . $this->displayMobileLabels(SETTING_TABLE_MOBILE, $survey->getTableMobile()) . '</td><td width=25><nobr/></td>';
     $returnStr .= '<td>' . Language::labelTypeEditMobileLabels() . '</td><td>' . $this->displayMobileLabels(SETTING_TABLE_MOBILE_LABELS, $survey->getTableMobileLabels()) . '</td>';
     $returnStr .= "</tr>";
     $returnStr .= '</table>';
     $returnStr .= '</div>';
     $returnStr .= '<span class="label label-default">' . Language::labelTypeEditLayoutEnumerated() . '</span>';
     $returnStr .= "<div class='well'>";
     $returnStr .= "<table>";
     $returnStr .= "<tr><td>" . Language::labelTypeEditLayoutEnumeratedTemplate() . "</td>";
     $returnStr .= "<td>" . $this->displayEnumeratedTemplate(SETTING_ENUMERATED_ORIENTATION, $survey->getEnumeratedDisplay()) . "</td><td width=25><nobr/>";
     $returnStr .= "<td>" . Language::labelTypeEditEnumeratedOrder() . "</td>";
     $returnStr .= "<td>" . $this->displayEnumeratedOrder(SETTING_ENUMERATED_ORDER, $survey->getEnumeratedOrder()) . "</td></tr>";
     $returnStr .= "<tr><td>" . Language::labelTypeEditEnumeratedSplit() . "</td>";
     $returnStr .= "<td>" . $this->displayEnumeratedSplit(SETTING_ENUMERATED_SPLIT, $survey->getEnumeratedSplit()) . "</td><td width=25><nobr/></td>\n                            <td>" . Language::labelTypeEditHeaderAlignment() . "</td>";
     $returnStr .= "<td>" . $this->displayAlignment(SETTING_HEADER_ALIGNMENT, $survey->getHeaderAlignment()) . "</td></tr>";
     $returnStr .= "<tr><td>" . Language::labelTypeEditEnumeratedFormatting() . "</td>";
     $returnStr .= "<td>" . $this->displayFormatting(SETTING_HEADER_FORMATTING, $survey->getHeaderFormatting()) . "</td><td width=25><nobr/></td>";
     $returnStr .= "<td>" . Language::labelGroupEditBordered() . "</td>";
     $returnStr .= "<td>" . $this->displayEnumeratedSplit(SETTING_ENUMERATED_BORDERED, $survey->getEnumeratedBordered()) . "</td></tr>";
     $returnStr .= '<tr><td>' . Language::labelTypeEditLayoutTextBox() . '</td>';
     $returnStr .= "<td>" . $this->displayEnumeratedTextBox(SETTING_ENUMERATED_TEXTBOX, $survey->getEnumeratedTextBox()) . "</td><td width=25><nobr/></td>";
     $returnStr .= "<td>" . Language::labelTypeEditLayoutEnumeratedLabel() . "</td><td>" . $this->displayEnumeratedLabel(SETTING_ENUMERATED_LABEL, $survey->getEnumeratedLabel()) . "</td></tr>";
     $returnStr .= "<tr><td>" . Language::labelSliderTextBoxBefore() . '</td><td><input type="text" class="form-control autocompletebasic" name="' . SETTING_ENUMERATED_TEXTBOX_LABEL . '" value="' . $this->displayTextSettingValue(convertHTLMEntities($survey->getEnumeratedTextBoxLabel(), ENT_QUOTES)) . '"></td></tr>';
     $returnStr .= '</table>';
     $returnStr .= '</div>';
     $returnStr .= '<span class="label label-default">' . Language::labelTypeEditLayoutDateTimePicker() . '</span>';
     $returnStr .= "<div class='well'>";
     $returnStr .= "<table>";
     $returnStr .= '<tr><td>' . Language::labelTypeEditLayoutTimeFormat() . '</td>';
     $returnStr .= '<td><input style="width: 350px;" type="text" class="form-control autocompletebasic" name="' . SETTING_TIME_FORMAT . '" value="' . $this->displayTextSettingValue(convertHTLMEntities($survey->getTimeFormat(), ENT_QUOTES)) . '"></td></tr>';
     $returnStr .= '<tr><td>' . Language::labelTypeEditLayoutDateFormat() . '</td>';
     $returnStr .= '<td><input style="width: 350px;"  type="text" class="form-control autocompletebasic" name="' . SETTING_DATE_FORMAT . '" value="' . $this->displayTextSettingValue(convertHTLMEntities($survey->getDateFormat(), ENT_QUOTES)) . '"></td></tr>';
     $returnStr .= '<tr><td>' . Language::labelTypeEditLayoutDateTimeFormat() . '</td>';
     $returnStr .= '<td><input style="width: 350px;"  type="text" class="form-control autocompletebasic" name="' . SETTING_DATETIME_FORMAT . '" value="' . $this->displayTextSettingValue(convertHTLMEntities($survey->getDateTimeFormat(), ENT_QUOTES)) . '"></td></tr>';
     $returnStr .= '</table>';
     $returnStr .= '</div>';
     $returnStr .= '<span class="label label-default">' . Language::labelTypeEditLayoutSlider() . '</span>';
     $returnStr .= "<div class='well'>";
     $returnStr .= "<table>";
     $returnStr .= "<tr><td>" . Language::labelTypeEditLayoutOrientation() . "</td>";
     $returnStr .= "<td>" . $this->displayOrientation(SETTING_SLIDER_ORIENTATION, $survey->getSliderOrientation()) . "</td><td width=25><nobr/></td>";
     $returnStr .= "<td>" . Language::labelTypeEditLayoutTooltip() . "</td>";
     $returnStr .= "<td>" . $this->displayTooltip(SETTING_SLIDER_TOOLTIP, $survey->getTooltip()) . "</td></tr>";
     $returnStr .= '<tr><td>' . Language::labelTypeEditLayoutTextBox() . '</td>';
     $returnStr .= "<td>" . $this->displayTextBox(SETTING_SLIDER_TEXTBOX, $survey->getTextBox()) . "</td><td width=25><nobr/></td>\n                        <td>" . Language::labelTypeEditLayoutStep() . '</td><td><input type="text" class="form-control autocompletebasic" name="' . SETTING_SLIDER_INCREMENT . '" value="' . $this->displayTextSettingValue(convertHTLMEntities($survey->getIncrement(), ENT_QUOTES)) . '"></td></tr>';
     $returnStr .= '<tr><td>' . Language::labelTypeEditLayoutSliderLabelPlacement() . '</td>';
     $returnStr .= "<td>" . $this->displaySliderPlacement(SETTING_SLIDER_LABEL_PLACEMENT, $survey->getSliderLabelPlacement()) . "</td><td width=25><nobr/></td>";
     $returnStr .= "<td>" . Language::labelSliderTextBoxBefore() . '</td><td><input type="text" class="form-control autocompletebasic" name="' . SETTING_SLIDER_TEXTBOX_LABEL . '" value="' . $this->displayTextSettingValue(convertHTLMEntities($survey->getTextBoxLabel(), ENT_QUOTES)) . '"></td></tr>';
     $returnStr .= '</table>';
     $returnStr .= '</div>';
     $returnStr .= '<input type="submit" class="btn btn-default" value="' . Language::buttonSave() . '"/>';
     $returnStr .= "</form></div>";
     $returnStr .= $this->showSettingsFooter($survey);
     return $returnStr;
 }
Exemplo n.º 6
0
 function showEditUser($urid, $message = "")
 {
     $user = new User($urid);
     $returnStr = $this->showSysAdminHeader(Language::messageSMSTitle());
     $returnStr .= '<div id="wrap">';
     $returnStr .= $this->showNavBar();
     $returnStr .= '<div class="container"><p>';
     $returnStr .= '<ol class="breadcrumb">';
     $returnStr .= '<li>' . setSessionParamsHref(array('page' => 'sysadmin.users'), Language::headerUsers()) . '</li>';
     if ($user->getUsername() == '') {
         $returnStr .= '<li>' . Language::labelUserAddUser() . '</li>';
     } else {
         $returnStr .= '<li>' . Language::labelEdit() . ' ' . $user->getUsername() . '</li>';
     }
     $returnStr .= '</ol>';
     $returnStr .= $message;
     $returnStr .= $this->displayComboBox();
     $returnStr .= '<form id="editform" method="post">';
     $returnStr .= '<span class="label label-default">' . Language::labelUserGeneral() . '</span>';
     $returnStr .= '<div class="well">';
     $returnStr .= setSessionParamsPost(array('page' => 'sysadmin.users.edituserres', 'urid' => $urid));
     $returnStr .= '<div class="row">';
     $returnStr .= '<div class="col-md-6">';
     $returnStr .= '<table>';
     $returnStr .= '<tr><td>' . Language::labelUserUserName() . '</td><td><input type="text" class="form-control" name="username" value="' . convertHTLMEntities($user->getUsername(), ENT_QUOTES) . '"></td></tr>';
     $returnStr .= '<tr><td>' . Language::labelUserUserNameName() . '</td><td><input type="text" class="form-control" name="name" value="' . convertHTLMEntities($user->getName(), ENT_QUOTES) . '"></td></tr>';
     $returnStr .= '<tr><td align=top>' . Language::labelUserActive() . '</td><td>';
     $returnStr .= $this->showDropDown(array(VARIABLE_ENABLED => Language::labelEnabled(), VARIABLE_DISABLED => Language::labelDisabled()), $user->getStatus(), 'status');
     $returnStr .= '</td></tr>';
     $returnStr .= '<tr><td align=top>' . Language::labelUserUserType() . '</td><td>';
     $returnStr .= $this->showDropDown(array(USER_INTERVIEWER => Language::labelInterviewer(), USER_NURSE => Language::labelNurse(), USER_SUPERVISOR => Language::labelSupervisor(), USER_TRANSLATOR => Language::labelTranslator(), USER_RESEARCHER => Language::labelResearcher(), USER_SYSADMIN => Language::labelSysadmin(), USER_TESTER => Language::labelTester()), $user->getUserType(), 'usertype', 'usertype');
     $returnStr .= '</td></tr>';
     $returnStr .= "<script type='text/javascript'>";
     $returnStr .= '$( document ).ready(function() {
                                             $("#usertype").change(function (e) {
                                                 if (this.value == ' . USER_NURSE . ') {
                                                     $("#subtype").show(); 
                                                     $("#subtype2").hide();                                                         
                                                 }   
                                                 else if (this.value == ' . USER_SYSADMIN . ') {
                                                     $("#subtype2").show(); 
                                                     $("#subtype").hide(); 
                                                 }
                                                 else {
                                                     $("#subtype").hide();                                                       
                                                     $("#subtype2").hide();
                                                 }
                                                 
                                                 if (this.value == ' . USER_INTERVIEWER . ' || this.value == ' . USER_CATIINTERVIEWER . ' || this.value == ' . USER_NURSE . ' || this.value == ' . USER_SUPERVISOR . ') {
                                                     $("#super").show();
                                                     $("#accessdiv").hide();
                                                     $("#surveyaccess").hide();
                                                 }
                                                 else {
                                                     $("#super").hide();
                                                     $("#accessdiv").show();
                                                     $("#surveyaccess").show();
                                                 }
                                             });
                                             })';
     $returnStr .= "</script>";
     if (inArray($user->getUserType(), array(USER_NURSE))) {
         $returnStr .= '<tr id=subtype><td align=top>' . Language::labelUserUserSubType() . '</td><td>';
         $returnStr .= $this->showDropDown(array(USER_NURSE_MAIN => Language::labelNurseMain(), USER_NURSE_LAB => Language::labelNurseLab(), USER_NURSE_FIELD => Language::labelNurseField(), USER_NURSE_VISION => Language::labelNurseVision()), $user->getUserSubType(), 'usersubtype');
         $returnStr .= '</td></tr>';
     } else {
         if (inArray($user->getUserType(), array(USER_SYSADMIN))) {
             $returnStr .= '<tr id=subtype2><td align=top>' . Language::labelUserUserSubType() . '</td><td>';
             $returnStr .= $this->showDropDown(array(USER_SYSADMIN_MAIN => Language::labelSysadminMain(), USER_SYSADMIN => Language::labelSysadminAdmin()), $user->getUserSubType(), 'usersubtype');
             $returnStr .= '</td></tr>';
         } else {
             $returnStr .= '<tr id=subtype style="display: none;"><td align=top>' . Language::labelUserUserSubType() . '</td><td>';
             $returnStr .= $this->showDropDown(array(USER_NURSE_MAIN => Language::labelNurseMain(), USER_NURSE_LAB => Language::labelNurseLab(), USER_NURSE_FIELD => Language::labelNurseField(), USER_NURSE_VISION => Language::labelNurseVision()), $user->getUserSubType(), 'usersubtype');
             $returnStr .= '</td></tr>';
             $returnStr .= '<tr id=subtype2 style="display: none;"><td align=top>' . Language::labelUserUserSubType() . '</td><td>';
             $returnStr .= $this->showDropDown(array(USER_SYSADMIN_MAIN => Language::labelSysadminMain(), USER_SYSADMIN => Language::labelSysadminAdmin()), $user->getUserSubType(), 'usersubtype');
             $returnStr .= '</td></tr>';
         }
     }
     if (inArray($user->getUserType(), array(USER_INTERVIEWER, USER_CATIINTERVIEWER, USER_NURSE, USER_SUPERVISOR))) {
         $returnStr .= '<tr id=super><td>' . Language::labelUserSupervisor() . '</td><td>';
         $users = new Users();
         $users = $users->getUsersByType(USER_SUPERVISOR);
         $returnStr .= $this->displayUsers($users, $user->getSupervisor(), 'uridsel', true);
         $returnStr .= '</td></tr>';
     }
     $extra = '';
     if (inArray($user->getUserType(), array(USER_NURSE, USER_INTERVIEWER, USER_SUPERVISOR, USER_CATIINTERVIEWER))) {
         $extra = "style='display: none;'";
     }
     $returnStr .= '<tr id="surveyaccess"' . $extra . '><td>' . Language::labelUserSurveyAllowed() . '</td><td>' . $this->displaySurveys(SETTING_USER_SURVEYS . "[]", SETTING_USER_SURVEYS, implode("~", $user->getSurveysAccess()), '', "multiple") . '</td></tr>';
     $returnStr .= '</table></div>';
     $returnStr .= '<div class="col-md-6">';
     $returnStr .= '<table>';
     $returnStr .= '<tr><td align=top>' . Language::labelUserPassword() . '</td><td><input type="text" class="form-control" name="pwd1"></td></tr>';
     $returnStr .= '<tr><td align=top>' . Language::labelUserPassword2() . '</td><td><input type="text" class="form-control" name="pwd2"></td></tr>';
     $returnStr .= '</table></div></div>';
     if ($urid != "") {
         $returnStr .= '<br/><input type="submit" class="btn btn-default" value="' . Language::buttonEdit() . '"/>';
     } else {
         $returnStr .= '<br/><input type="submit" class="btn btn-default" value="' . Language::buttonAdd() . '"/>';
     }
     $returnStr .= '</div></form>';
     $suid = $_SESSION['SUID'];
     /* available surveys */
     if ($urid != "") {
         $extra = '';
         if (inArray($user->getUserType(), array(USER_NURSE, USER_INTERVIEWER, USER_SUPERVISOR, USER_CATIINTERVIEWER))) {
             $extra = "style='display: none;'";
         }
         $returnStr .= "<div " . $extra . " id='accessdiv'>";
         $returnStr .= "<form id=refreshform method=post>";
         $returnStr .= '<input type=hidden name=page value="sysadmin.users.edituser">';
         $returnStr .= '<input type=hidden name="' . SMS_POST_SURVEY . '" id="' . SMS_POST_SURVEY . '_hidden" value="' . getSurvey() . '">';
         $returnStr .= "</form>";
         $returnStr .= '<form id="editform1" method="post">';
         $returnStr .= setSessionParamsPost(array('page' => 'sysadmin.users.edituseraccessres', 'urid' => $urid));
         $returnStr .= '<span class="label label-default">' . Language::labelUserAccess() . '</span>';
         $returnStr .= '<div class="well">';
         $returnStr .= "<table>";
         $allsurveys = $user->getSurveysAccess();
         if (!inArray($suid, $allsurveys)) {
             $suid = $allsurveys[0];
         }
         $survey = new Survey($suid);
         $u = $_SESSION['URID'];
         $_SESSION['URID'] = $urid;
         // pretend to be edited user for a moment to get surveys to display
         $returnStr .= '<tr><td>' . Language::labelUserSurveyAccess() . '</td><td>' . $this->displaySurveys(SMS_POST_SURVEY, SMS_POST_SURVEY, $suid, '', "") . '</td></tr>';
         $_SESSION['URID'] = $u;
         $returnStr .= "<script type='text/javascript'>";
         $returnStr .= '$( document ).ready(function() {
                                             $("#' . SMS_POST_SURVEY . '").change(function (e) {
                                                 $("#' . SMS_POST_SURVEY . '_hidden").val(this.value);                                                     
                                                 $("#refreshform").submit();
                                             });
                                             })';
         $returnStr .= "</script>";
         /* available modes */
         $modes = Common::surveyModes();
         $allowedmodes = explode("~", $survey->getAllowedModes());
         $usermodes = $user->getModes($suid);
         foreach ($allowedmodes as $mode) {
             $returnStr .= "<tr class='modesrow'><td>" . $modes[$mode] . "</td><td>";
             $returnStr .= $this->displayUserMode(SETTING_USER_MODE . $mode, inArray($mode, $usermodes));
             $userlanguages = $user->getLanguages($suid, $mode);
             $returnStr .= "<td>" . Language::labelUserLanguageAllowed() . "</td>";
             $returnStr .= "<td>" . $this->displayLanguagesAdmin(SETTING_USER_LANGUAGES . $mode, SETTING_USER_LANGUAGES . $mode, $userlanguages, true, false, false, "multiple", $survey->getAllowedLanguages($mode)) . "</td>";
             $returnStr .= "</tr>";
         }
         $returnStr .= '</table>';
         $returnStr .= '<br/><input type="submit" class="btn btn-default" value="' . Language::buttonEdit() . '"/>';
         $returnStr .= '</div></form></div>';
     }
     $returnStr .= '</p></div>    </div>';
     //container and wrap
     $returnStr .= $this->showBottomBar();
     $returnStr .= $this->showFooter(false);
     return $returnStr;
 }
Exemplo n.º 7
0
 function showInputBox($name, $value, $edit)
 {
     if ($edit) {
         return '<input type="text" name="' . $name . '" class="form-control" value="' . convertHTLMEntities($value, ENT_QUOTES) . '" />';
     } else {
         return $value;
     }
 }