当前位置: 首页>>代码示例>>PHP>>正文


PHP LimeExpressionManager::GetQuestionStatus方法代码示例

本文整理汇总了PHP中LimeExpressionManager::GetQuestionStatus方法的典型用法代码示例。如果您正苦于以下问题:PHP LimeExpressionManager::GetQuestionStatus方法的具体用法?PHP LimeExpressionManager::GetQuestionStatus怎么用?PHP LimeExpressionManager::GetQuestionStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在LimeExpressionManager的用法示例。


在下文中一共展示了LimeExpressionManager::GetQuestionStatus方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: view

 /**
  * dataentry::view()
  * view a dataentry
  * @param mixed $surveyid
  * @param mixed $lang
  * @return
  */
 public function view($surveyid, $lang = NULL)
 {
     $surveyid = sanitize_int($surveyid);
     $lang = isset($_GET['lang']) ? $_GET['lang'] : NULL;
     if (isset($lang)) {
         $lang = sanitize_languagecode($lang);
     }
     $aViewUrls = array();
     if (hasSurveyPermission($surveyid, 'responses', 'read')) {
         $clang = Yii::app()->lang;
         $sDataEntryLanguage = Survey::model()->findByPk($surveyid)->language;
         $surveyinfo = getSurveyInfo($surveyid);
         $slangs = Survey::model()->findByPk($surveyid)->additionalLanguages;
         $baselang = Survey::model()->findByPk($surveyid)->language;
         array_unshift($slangs, $baselang);
         if (is_null($lang) || !in_array($lang, $slangs)) {
             $sDataEntryLanguage = $baselang;
             $blang = $clang;
         } else {
             Yii::app()->loadLibrary('Limesurvey_lang', array($lang));
             $blang = new Limesurvey_lang($lang);
             $sDataEntryLanguage = $lang;
         }
         $langlistbox = languageDropdown($surveyid, $sDataEntryLanguage);
         $thissurvey = getSurveyInfo($surveyid);
         //This is the default, presenting a blank dataentry form
         LimeExpressionManager::StartSurvey($surveyid, 'survey', NULL, false, LEM_PRETTY_PRINT_ALL_SYNTAX);
         $moveResult = LimeExpressionManager::NavigateForwards();
         $aData['thissurvey'] = $thissurvey;
         $aData['langlistbox'] = $langlistbox;
         $aData['surveyid'] = $surveyid;
         $aData['blang'] = $blang;
         $aData['site_url'] = Yii::app()->homeUrl;
         LimeExpressionManager::StartProcessingPage(true, Yii::app()->baseUrl);
         // means that all variables are on the same page
         $aViewUrls[] = 'caption_view';
         Yii::app()->loadHelper('database');
         // SURVEY NAME AND DESCRIPTION TO GO HERE
         $degquery = "SELECT * FROM {{groups}} WHERE sid={$surveyid} AND language='{$sDataEntryLanguage}' ORDER BY {{groups}}.group_order";
         $degresult = dbExecuteAssoc($degquery);
         // GROUP NAME
         $aDataentryoutput = '';
         foreach ($degresult->readAll() as $degrow) {
             LimeExpressionManager::StartProcessingGroup($degrow['gid'], $thissurvey['anonymized'] != "N", $surveyid);
             $deqquery = "SELECT * FROM {{questions}} WHERE sid={$surveyid} AND parent_qid=0 AND gid={$degrow['gid']} AND language='{$sDataEntryLanguage}'";
             $deqrows = (array) dbExecuteAssoc($deqquery)->readAll();
             $aDataentryoutput .= "\t<tr>\n" . "<td colspan='3' align='center'><strong>" . flattenText($degrow['group_name'], true) . "</strong></td>\n" . "\t</tr>\n";
             $gid = $degrow['gid'];
             $aDataentryoutput .= "\t<tr class='data-entry-separator'><td colspan='3'></td></tr>\n";
             // Perform a case insensitive natural sort on group name then question title of a multidimensional array
             usort($deqrows, 'groupOrderThenQuestionOrder');
             $bgc = 'odd';
             foreach ($deqrows as $deqrow) {
                 $qidattributes = getQuestionAttributeValues($deqrow['qid'], $deqrow['type']);
                 $cdata['qidattributes'] = $qidattributes;
                 $hidden = isset($qidattributes['hidden']) ? $qidattributes['hidden'] : 0;
                 // TODO - can questions be hidden?  Are JavaScript variables names used?  Consistently with everywhere else?
                 //                    LimeExpressionManager::ProcessRelevance($qidattributes['relevance'],$deqrow['qid'],NULL,$deqrow['type'],$hidden);
                 // TMSW Conditions->Relevance:  Show relevance equation instead of conditions here - better yet, have data entry use survey-at-a-time but with different view
                 $qinfo = LimeExpressionManager::GetQuestionStatus($deqrow['qid']);
                 $relevance = trim($qinfo['info']['relevance']);
                 $explanation = trim($qinfo['relEqn']);
                 $validation = trim($qinfo['prettyValidTip']);
                 $qidattributes = getQuestionAttributeValues($deqrow['qid']);
                 $array_filter_help = flattenText($this->_array_filter_help($qidattributes, $sDataEntryLanguage, $surveyid));
                 if ($relevance != '' && $relevance != '1' || $validation != '' || $array_filter_help != '') {
                     $showme = '';
                     if ($bgc == "even") {
                         $bgc = "odd";
                     } else {
                         $bgc = "even";
                     }
                     //Do no alternate on explanation row
                     if ($relevance != '' && $relevance != '1') {
                         $showme = "[" . $blang->gT("Only answer this if the following conditions are met:") . "]<br />{$explanation}\n";
                     }
                     if ($showme != '' && $validation != '') {
                         $showme .= '<br/>';
                     }
                     if ($validation != '') {
                         $showme .= "[" . $blang->gT("The answer(s) must meet these validation criteria:") . "]<br />{$validation}\n";
                     }
                     if ($showme != '' && $array_filter_help != '') {
                         $showme .= '<br/>';
                     }
                     if ($array_filter_help != '') {
                         $showme .= "[" . $blang->gT("The answer(s) must meet these array_filter criteria:") . "]<br />{$array_filter_help}\n";
                     }
                     $cdata['explanation'] = "<tr class ='data-entry-explanation'><td class='data-entry-small-text' colspan='3' align='left'>{$showme}</td></tr>\n";
                 }
                 //END OF GETTING CONDITIONS
                 //Alternate bgcolor for different groups
                 if (!isset($bgc)) {
//.........这里部分代码省略.........
开发者ID:rawaludin,项目名称:LimeSurvey,代码行数:101,代码来源:dataentry.php

示例2: getQuestionReplacement

 /**
  * Construction of replacement array, actually doing it with redata
  *
  * @param $aQuestionQanda : array from qanda helper
  * @return aray of replacement for question.psptl
  **/
 public static function getQuestionReplacement($aQuestionQanda)
 {
     // Get the default replacement and set empty value by default
     $aReplacement = array("QID" => "", "SGQ" => "", "AID" => "", "QUESTION_CODE" => "", "QUESTION_NUMBER" => "", "QUESTION" => "", "QUESTION_TEXT" => "", "QUESTIONHELP" => "", "QUESTIONHELPPLAINTEXT" => "", "QUESTION_CLASS" => "", "QUESTION_MAN_CLASS" => "", "QUESTION_INPUT_ERROR_CLASS" => "", "ANSWER" => "", "QUESTION_HELP" => "", "QUESTION_VALID_MESSAGE" => "", "QUESTION_FILE_VALID_MESSAGE" => "", "QUESTION_MAN_MESSAGE" => "", "QUESTION_MANDATORY" => "", "QUESTION_ESSENTIALS" => "");
     if (!is_array($aQuestionQanda) || empty($aQuestionQanda[0])) {
         return $aReplacement;
     }
     $iQid = $aQuestionQanda[4];
     $lemQuestionInfo = LimeExpressionManager::GetQuestionStatus($iQid);
     $iSurveyId = Yii::app()->getConfig('surveyID');
     // Or : by SGQA of question ? by Question::model($iQid)->sid;
     $oSurveyId = Survey::model()->findByPk($iSurveyId);
     $sType = $lemQuestionInfo['info']['type'];
     // Core value : not replaced
     $aReplacement['QID'] = $iQid;
     $aReplacement['GID'] = $aQuestionQanda[6];
     // Not sure for aleatory : it's the real gid or the updated gid ? We need original gid or updated gid ?
     $aReplacement['SGQ'] = $aQuestionQanda[7];
     $aReplacement['AID'] = isset($aQuestionQanda[0]['aid']) ? $aQuestionQanda[0]['aid'] : "";
     $aReplacement['QUESTION_CODE'] = $aReplacement['QUESTION_NUMBER'] = "";
     $sCode = $aQuestionQanda[5];
     $iNumber = $aQuestionQanda[0]['number'];
     switch (Yii::app()->getConfig('showqnumcode')) {
         case 'both':
             $aReplacement['QUESTION_CODE'] = $sCode;
             $aReplacement['QUESTION_NUMBER'] = $iNumber;
             break;
         case 'number':
             $aReplacement['QUESTION_NUMBER'] = $iNumber;
             break;
         case 'number':
             $aReplacement['QUESTION_CODE'] = $sCode;
             break;
         case 'choose':
         default:
             switch ($oSurveyId->showqnumcode) {
                 case 'B':
                     // Both
                     $aReplacement['QUESTION_CODE'] = $sCode;
                     $aReplacement['QUESTION_NUMBER'] = $iNumber;
                     break;
                 case 'N':
                     $aReplacement['QUESTION_NUMBER'] = $iNumber;
                     break;
                 case 'C':
                     $aReplacement['QUESTION_CODE'] = $sCode;
                     break;
                 case 'X':
                 default:
                     break;
             }
             break;
     }
     $aReplacement['QUESTION'] = $aQuestionQanda[0]['all'];
     // Deprecated : only used in old template (very old)
     // Core value : user text
     $aReplacement['QUESTION_TEXT'] = $aQuestionQanda[0]['text'];
     $aReplacement['QUESTIONHELP'] = $lemQuestionInfo['info']['help'];
     // User help
     // To be moved in a extra plugin : QUESTIONHELP img adding
     $sTemplateDir = Template::model()->getTemplatePath($oSurveyId->template);
     $sTemplateUrl = Template::model()->getTemplateURL($oSurveyId->template);
     if (flattenText($aReplacement['QUESTIONHELP'], true, true) != '') {
         $aReplacement['QUESTIONHELP'] = Yii::app()->getController()->renderPartial('/survey/system/questionhelp/questionhelp', array('questionHelp' => $aReplacement['QUESTIONHELP']), true);
     }
     // Core value :the classes
     $aReplacement['QUESTION_CLASS'] = Question::getQuestionClass($sType);
     //get additional question classes from question attribute
     $aQuestionAttributes = getQuestionAttributeValues($aQuestionQanda[4]);
     //add additional classes
     if (isset($aQuestionAttributes['cssclass'])) {
         $aReplacement['QUESTION_CLASS'] .= " " . $aQuestionAttributes['cssclass'];
     }
     $aMandatoryClass = array();
     if ($lemQuestionInfo['info']['mandatory'] == 'Y') {
         $aMandatoryClass[] = 'mandatory';
     }
     if ($lemQuestionInfo['anyUnanswered'] && $_SESSION['survey_' . $iSurveyId]['maxstep'] != $_SESSION['survey_' . $iSurveyId]['step']) {
         $aMandatoryClass[] = 'missing';
     }
     $aReplacement['QUESTION_MAN_CLASS'] = !empty($aMandatoryClass) ? " " . implode(" ", $aMandatoryClass) : "";
     $aReplacement['QUESTION_INPUT_ERROR_CLASS'] = $aQuestionQanda[0]['input_error_class'];
     // Core value : LS text : EM and not
     $aReplacement['ANSWER'] = $aQuestionQanda[1];
     $aReplacement['QUESTION_HELP'] = $aQuestionQanda[0]['help'];
     // Core help only, not EM
     $aReplacement['QUESTION_VALID_MESSAGE'] = $aQuestionQanda[0]['valid_message'];
     // $lemQuestionInfo['validTip']
     $aReplacement['QUESTION_FILE_VALID_MESSAGE'] = $aQuestionQanda[0]['file_valid_message'];
     // $lemQuestionInfo['??']
     $aReplacement['QUESTION_MAN_MESSAGE'] = $aQuestionQanda[0]['man_message'];
     $aReplacement['QUESTION_MANDATORY'] = $aQuestionQanda[0]['mandatory'];
     // For QUESTION_ESSENTIALS
     $aHtmlOptions = array();
//.........这里部分代码省略.........
开发者ID:BertHankes,项目名称:LimeSurvey,代码行数:101,代码来源:SurveyRuntimeHelper.php

示例3: do_multiplenumeric


//.........这里部分代码省略.........
        $slider_maxtext = $slider_max = is_numeric($slider_max) ? $slider_max : 100;
        $slider_default = trim(LimeExpressionManager::ProcessString("{{$aQuestionAttributes['slider_default']}}", $ia[0], array(), false, 1, 1, false, false, true));
        $slider_default = is_numeric($slider_default) ? $slider_default : "";
        if ($slider_default == '' && $aQuestionAttributes['slider_middlestart'] == 1) {
            $slider_middlestart = intval(($slider_max + $slider_min) / 2);
        } else {
            $slider_middlestart = '';
        }
        $slider_separator = trim($aQuestionAttributes['slider_separator']) != '' ? $aQuestionAttributes['slider_separator'] : "";
        $slider_reset = $aQuestionAttributes['slider_reset'] ? 1 : 0;
    } else {
        $slider_layout = false;
    }
    $hidetip = $aQuestionAttributes['hide_tip'];
    if ($aQuestionAttributes['random_order'] == 1) {
        $ansquery = "SELECT * FROM {{questions}} WHERE parent_qid={$ia['0']}  AND language='" . $_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang'] . "' ORDER BY " . dbRandom();
    } else {
        $ansquery = "SELECT * FROM {{questions}} WHERE parent_qid={$ia['0']}  AND language='" . $_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang'] . "' ORDER BY question_order";
    }
    $ansresult = dbExecuteAssoc($ansquery);
    //Checked
    $aSubquestions = $ansresult->readAll();
    $anscount = count($aSubquestions) * 2;
    $fn = 1;
    $answer_main = '';
    if ($anscount == 0) {
        $inputnames = array();
        $answer_main .= '    <li>' . gT('Error: This question has no answers.') . "</li>\n";
    } else {
        foreach ($aSubquestions as $ansrow) {
            $myfname = $ia[1] . $ansrow['title'];
            if ($ansrow['question'] == "") {
                $ansrow['question'] = "&nbsp;";
            }
            if ($slider_layout === false || $slider_separator == '') {
                $theanswer = $ansrow['question'];
                $sliderleft = '';
                $sliderright = '';
            } else {
                $aAnswer = explode($slider_separator, $ansrow['question']);
                $theanswer = isset($aAnswer[0]) ? $aAnswer[0] : "";
                $sliderleft = isset($aAnswer[1]) ? $aAnswer[1] : "";
                $sliderright = isset($aAnswer[2]) ? $aAnswer[2] : "";
                $sliderleft = "<div class=\"slider_lefttext\">{$sliderleft}</div>";
                $sliderright = "<div class=\"slider_righttext\">{$sliderright}</div>";
            }
            // color code missing mandatory questions red
            if ($ia[6] == 'Y' && $_SESSION['survey_' . Yii::app()->getConfig('surveyID')][$myfname] === '') {
                $theanswer = "<span class='errormandatory'>{$theanswer}</span>";
            }
            list($htmltbody2, $hiddenfield) = return_array_filter_strings($ia, $aQuestionAttributes, $thissurvey, $ansrow, $myfname, '', $myfname, "li", "question-item answer-item text-item numeric-item" . $extraclass);
            $answer_main .= "\t{$htmltbody2}\n";
            $answer_main .= "<label for=\"answer{$myfname}\" class=\"{$prefixclass}-label\">{$theanswer}</label>\n";
            $sSeparator = getRadixPointData($thissurvey['surveyls_numberformat']);
            $sSeparator = $sSeparator['separator'];
            $answer_main .= "{$sliderleft}<span class=\"input\">\n\t" . $prefix . "\n\t<input class=\"text {$kpclass}\" type=\"text\" size=\"" . $tiwidth . "\" name=\"" . $myfname . "\" id=\"answer" . $myfname . "\" title=\"" . gT('Only numbers may be entered in this field.') . "\" value=\"";
            if (isset($_SESSION['survey_' . Yii::app()->getConfig('surveyID')][$myfname])) {
                $dispVal = $_SESSION['survey_' . Yii::app()->getConfig('surveyID')][$myfname];
                if (strpos($dispVal, ".")) {
                    $dispVal = rtrim(rtrim($dispVal, "0"), ".");
                }
                $dispVal = str_replace('.', $sSeparator, $dispVal);
                $answer_main .= $dispVal;
            }
            $answer_main .= '" onkeyup="' . $checkconditionFunction . '(this.value, this.name, this.type);" ' . " {$maxlength} />\n\t" . $suffix . "\n</span>{$sliderright}\n\t</li>\n";
            $fn++;
            $inputnames[] = $myfname;
        }
        if (trim($aQuestionAttributes['equals_num_value']) != '' || trim($aQuestionAttributes['min_num_value']) != '' || trim($aQuestionAttributes['max_num_value']) != '') {
            $qinfo = LimeExpressionManager::GetQuestionStatus($ia[0]);
            if (trim($aQuestionAttributes['equals_num_value']) != '') {
                $answer_main .= "\t<li class='multiplenumerichelp help-item'>\n" . "<span class=\"label\">" . gT('Remaining: ') . "</span>\n" . "<span id=\"remainingvalue_{$ia[0]}\" class=\"dynamic_remaining\">{$prefix}\n" . "{" . $qinfo['sumRemainingEqn'] . "}\n" . "{$suffix}</span>\n" . "\t</li>\n";
            }
            $answer_main .= "\t<li class='multiplenumerichelp  help-item'>\n" . "<span class=\"label\">" . gT('Total: ') . "</span>\n" . "<span id=\"totalvalue_{$ia[0]}\" class=\"dynamic_sum\">{$prefix}\n" . "{" . $qinfo['sumEqn'] . "}\n" . "{$suffix}</span>\n" . "\t</li>\n";
        }
        $answer .= "<ul class=\"subquestions-list questions-list text-list {$prefixclass}-list\">\n" . $answer_main . "</ul>\n";
    }
    if ($aQuestionAttributes['slider_layout'] == 1) {
        Yii::app()->getClientScript()->registerScriptFile(Yii::app()->getConfig('generalscripts') . "numeric-slider.js");
        Yii::app()->getClientScript()->registerCssFile(Yii::app()->getConfig('publicstyleurl') . "numeric-slider.css");
        if ($slider_default != "") {
            $slider_startvalue = $slider_default;
            $slider_displaycallout = 1;
        } elseif ($slider_middlestart != '') {
            $slider_startvalue = $slider_middlestart;
            $slider_displaycallout = 0;
        } else {
            $slider_startvalue = 'NULL';
            $slider_displaycallout = 0;
        }
        $slider_showminmax = $aQuestionAttributes['slider_showminmax'] == 1 ? 1 : 0;
        //some var for slider
        $aJsLang = array('reset' => gT('Reset'), 'tip' => gT('Please click and drag the slider handles to enter your answer.'));
        $aJsVar = array('slider_showminmax' => $slider_showminmax, 'slider_min' => $slider_min, 'slider_mintext' => $slider_mintext, 'slider_max' => $slider_max, 'slider_maxtext' => $slider_maxtext, 'slider_step' => $slider_step, 'slider_startvalue' => $slider_startvalue, 'slider_displaycallout' => $slider_displaycallout, 'slider_prefix' => $prefix, 'slider_suffix' => $suffix, 'slider_reset' => $slider_reset, 'lang' => $aJsLang);
        $answer .= "<script type='text/javascript'><!--\n" . " doNumericSlider({$ia[0]}," . ls_json_encode($aJsVar) . ");\n" . " //--></script>";
    }
    $sSeparator = getRadixPointData($thissurvey['surveyls_numberformat']);
    $sSeparator = $sSeparator['separator'];
    return array($answer, $inputnames);
}
开发者ID:segfault,项目名称:LimeSurvey,代码行数:101,代码来源:qanda_helper.php

示例4: index


//.........这里部分代码省略.........
                                         }
                                         // while
                                     }
                                     break;
                                 case "R":
                                     // (Rank 1), (Rank 2)... TIBO
                                     $thiscquestion = $fieldmap[$conrow['cfieldname']];
                                     $rankid = $thiscquestion['aid'];
                                     $answer_section = " (" . gT("RANK") . " {$rankid})";
                                     break;
                                 default:
                                     // nothing to add
                                     break;
                             }
                         }
                         if (count($conditions) > 1) {
                             $sExplanation .= "'" . implode("' <em class='scenario-or-separator'>" . gT("or") . "</em> '", $conditions) . "'";
                         } elseif (count($conditions) == 1) {
                             $sExplanation .= "'" . $conditions[0] . "'";
                         }
                         unset($conditions);
                         // Following line commented out because answer_section  was lost, but is required for some question types
                         //$explanation .= " ".gT("to question")." '".$mapquestionsNumbers[$distinctrow['cqid']]."' $answer_section ";
                         if ($distinctrow['cqid']) {
                             $sExplanation .= " <span class='scenario-at-separator'>" . gT("at question") . "</span> '" . $mapquestionsNumbers[$distinctrow['cqid']] . " [" . $subresult['title'] . "]' (" . strip_tags($subresult['question']) . "{$answer_section})";
                         } else {
                             $sExplanation .= " " . $distinctrow['value'];
                         }
                         //$distinctrow
                         $x++;
                     }
                     $s++;
                 }
                 $qinfo = LimeExpressionManager::GetQuestionStatus($deqrow['qid']);
                 $relevance = trim($qinfo['info']['relevance']);
                 $sEquation = $qinfo['relEqn'];
                 if (trim($relevance) != '' && trim($relevance) != '1') {
                     if (isset($qidattributes['printable_help'][$sLanguageCode]) && $qidattributes['printable_help'][$sLanguageCode] != '') {
                         $sExplanation = $qidattributes['printable_help'][$sLanguageCode];
                     } elseif ($sExplanation == '') {
                         $sExplanation = $sEquation;
                         $sEquation = '&nbsp;';
                         // No need to show it twice
                     }
                     $sExplanation = "<b>" . gT('Only answer this question if the following conditions are met:') . "</b><br/> " . $sExplanation;
                     if (Yii::app()->getConfig('showrelevance')) {
                         $sExplanation .= "<span class='printable_equation'><br>" . $sEquation . "</span>";
                     }
                 } else {
                     $sExplanation = '';
                 }
                 ++$total_questions;
                 //TIBO map question qid to their q number
                 $mapquestionsNumbers[$deqrow['qid']] = $total_questions;
                 //END OF GETTING CONDITIONS
                 $qid = $deqrow['qid'];
                 $fieldname = "{$surveyid}" . "X" . "{$gid}" . "X" . "{$qid}";
                 if (isset($showsgqacode) && $showsgqacode == true) {
                     $deqrow['question'] = $deqrow['question'] . "<br />" . gT("ID:") . " {$fieldname} <br />" . gT("Question code:") . " " . $deqrow['title'];
                 }
                 $question = array('QUESTION_NUMBER' => $total_questions, 'QUESTION_CODE' => $deqrow['title'], 'QUESTION_TEXT' => preg_replace('/(?:<br ?\\/?>|<\\/(?:p|h[1-6])>)$/is', '', $deqrow['question']), 'QUESTION_SCENARIO' => $sExplanation, 'QUESTION_MANDATORY' => '', 'QUESTION_ID' => $deqrow['qid'], 'QUESTION_CLASS' => getQuestionClass($deqrow['type']), 'QUESTION_TYPE_HELP' => $qinfo['validTip'], 'QUESTION_MAN_MESSAGE' => '', 'QUESTION_VALID_MESSAGE' => '', 'QUESTION_FILE_VALID_MESSAGE' => '', 'QUESTIONHELP' => '', 'ANSWER' => '');
                 $showqnumcode = Yii::app()->getConfig('showqnumcode');
                 if ($showqnumcode == 'choose' && ($aSurveyInfo['showqnumcode'] == 'N' || $aSurveyInfo['showqnumcode'] == 'X') || $showqnumcode == 'number' || $showqnumcode == 'none') {
                     $question['QUESTION_CODE'] = '';
                 }
                 if ($showqnumcode == 'choose' && ($aSurveyInfo['showqnumcode'] == 'C' || $aSurveyInfo['showqnumcode'] == 'X') || $showqnumcode == 'code' || $showqnumcode == 'none') {
开发者ID:wrenchpilot,项目名称:LimeSurvey,代码行数:67,代码来源:printablesurvey.php

示例5: preview


//.........这里部分代码省略.........
                \$('#answer'+name).val(displayVal);

                if (typeof evt_type === 'undefined')
                {
                    evt_type = 'onchange';
                }
                checkconditions(newval, name, type, evt_type);
            }

            function checkconditions(value, name, type, evt_type)
            {
                if (typeof evt_type === 'undefined')
                {
                    evt_type = 'onchange';
                }
                if (type == 'radio' || type == 'select-one')
                {
                    var hiddenformname='java'+name;
                    document.getElementById(hiddenformname).value=value;
                }
                else if (type == 'checkbox')
                {
                    if (document.getElementById('answer'+name).checked)
                    {
                        \$('#java'+name).val('Y');
                    } else
                    {
                        \$('#java'+name).val('');
                    }
                }
                else if (type == 'text' && name.match(/other\$/) && typeof document.getElementById('java'+name) !== 'undefined' && document.getElementById('java'+name) != null)
                {
                    \$('#java'+name).val(value);
                }
                ExprMgr_process_relevance_and_tailoring(evt_type,name,type);
                {$showQuestion}
            }
            \$(document).ready(function() {
                {$showQuestion}
            });
            \$(document).change(function() {
                {$showQuestion}
            });
            \$(document).bind('keydown',function(e) {
                        if (e.keyCode == 9) {
                            {$showQuestion}
                            return true;
                        }
                        return true;
                    });
        // -->
        </script>
EOD;
        $answer = $answers[0][1];
        //        $help = $answers[0][2];
        $qinfo = LimeExpressionManager::GetQuestionStatus($qid);
        $help = $qinfo['info']['help'];
        $question = $answers[0][0];
        $question['code'] = $answers[0][5];
        $question['class'] = getQuestionClass($qrows['type']);
        $question['essentials'] = 'id="question' . $qrows['qid'] . '"';
        $question['sgq'] = $ia[1];
        $question['aid'] = 'unknown';
        $question['sqid'] = 'unknown';
        if ($qrows['mandatory'] == 'Y') {
            $question['man_class'] = ' mandatory';
        } else {
            $question['man_class'] = '';
        }
        $redata = compact(array_keys(get_defined_vars()));
        $content = templatereplace(file_get_contents("{$thistpl}/startpage.pstpl"), array(), $redata);
        $content .= CHtml::form('index.php', 'post', array('id' => "limesurvey", 'name' => "limesurvey", 'autocomplete' => 'off'));
        $content .= templatereplace(file_get_contents("{$thistpl}/startgroup.pstpl"), array(), $redata);
        $question_template = file_get_contents("{$thistpl}/question.pstpl");
        // the following has been added for backwards compatiblity.
        if (substr_count($question_template, '{QUESTION_ESSENTIALS}') > 0) {
            // LS 1.87 and newer templates
            $content .= "\n" . templatereplace($question_template, array(), $redata, 'Unspecified', false, $qid) . "\n";
        } else {
            // LS 1.86 and older templates
            $content .= '<div ' . $question['essentials'] . ' class="' . $question['class'] . $question['man_class'] . '">';
            $content .= "\n" . templatereplace($question_template, array(), $redata, 'Unspecified', false, $qid) . "\n";
            $content .= "\n\t</div>\n";
        }
        $content .= templatereplace(file_get_contents("{$thistpl}/endgroup.pstpl"), array(), $redata) . $dummy_js;
        LimeExpressionManager::FinishProcessingGroup();
        $content .= LimeExpressionManager::GetRelevanceAndTailoringJavaScript();
        $content .= '<p>&nbsp;</form>';
        $content .= templatereplace(file_get_contents("{$thistpl}/endpage.pstpl"), array(), $redata);
        LimeExpressionManager::FinishProcessingPage();
        echo $content;
        if ($LEMdebugLevel >= 1) {
            echo LimeExpressionManager::GetDebugTimingMessage();
        }
        if ($LEMdebugLevel >= 2) {
            echo "<table><tr><td align='left'><b>Group/Question Validation Results:</b>" . $moveResult['message'] . "</td></tr></table>\n";
        }
        echo "</html>\n";
        exit;
    }
开发者ID:ryu1inaba,项目名称:LimeSurvey,代码行数:101,代码来源:question.php

示例6: do_multiplenumeric


//.........这里部分代码省略.........
            $myfname = $ia[1] . $ansrow['title'];
            if ($ansrow['question'] == "") {
                $ansrow['question'] = "&nbsp;";
            }
            if ($slider_layout === false || $slider_separator == '') {
                $theanswer = $ansrow['question'];
                $sliders = false;
            } else {
                $aAnswer = explode($slider_separator, $ansrow['question']);
                $theanswer = isset($aAnswer[0]) ? $aAnswer[0] : "";
                $labelText = $theanswer;
                $sliderleft = isset($aAnswer[1]) ? $aAnswer[1] : "";
                $sliderright = isset($aAnswer[2]) ? $aAnswer[2] : "";
                $sliders = true;
            }
            $aAnswer = isset($aAnswer) ? $aAnswer : '';
            $sliderleft = isset($sliderleft) ? $sliderleft : "";
            $sliderright = isset($sliderright) ? $sliderright : "";
            // color code missing mandatory questions red
            $alert = '';
            if ($_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['step'] != $_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['maxstep'] || $_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['step'] == $_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['prevstep']) {
                if ($ia[6] == 'Y' && $_SESSION['survey_' . Yii::app()->getConfig('surveyID')][$myfname] === '') {
                    $alert = true;
                }
            }
            //list($htmltbody2, $hiddenfield)=return_array_filter_strings($ia, $aQuestionAttributes, $thissurvey, $ansrow, $myfname, '', $myfname, "div","form-group question-item answer-item text-item numeric-item".$extraclass);
            $sDisplayStyle = return_display_style($ia, $aQuestionAttributes, $thissurvey, $myfname);
            // TODO : check why it's done here a second time
            $sSeparator = getRadixPointData($thissurvey['surveyls_numberformat']);
            $sSeparator = $sSeparator['separator'];
            // The value of the slider depends on many possible different parameters, by order of priority :
            // 1. The value stored in the session
            // 2. Else the default Answer   (set by EM and stored in session, so same case than 1)
            // 3. Else the init value
            // 4. Else the middle start
            // 5. If no value at all, or if middle start, the "user no action" is recorded as null in the database
            // For bootstrap slider, the value can't be NULL so we set it by default to the slider minimum value.
            // The old behaviour of "null" value (corresponding to user no action) is implemented via $slider_user_no_action
            // It could be used to show a temporary "No Answer" checkbox (hidden when user touch the slider)
            // Most of this javascript is here to handle the fact that bootstrapSlider need numerical value in the input
            // It can't accept "NULL" nor anyother thousand separator than "." (else it become a string)
            // See : https://github.com/LimeSurvey/LimeSurvey/blob/master/scripts/bootstrap-slider.js#l1453-l1461
            // If the bootstrapSlider were updated, most of this javascript would not be necessary.
            $sValue = null;
            if (App()->request->getPost('slider_user_no_action_' . $myfname)) {
                $slider_user_no_action = App()->request->getPost('slider_user_no_action_' . $myfname);
            } else {
                $slider_user_no_action = 1;
                // value stored in _SESSION
                if (isset($_SESSION['survey_' . Yii::app()->getConfig('surveyID')][$myfname])) {
                    $sValue = $_SESSION['survey_' . Yii::app()->getConfig('surveyID')][$myfname];
                    $slider_user_no_action = 0;
                } elseif ($slider_default != "") {
                    $sValue = $slider_default;
                    $slider_user_no_action = 0;
                } elseif (isset($slider_middlestart) && $slider_middlestart != '') {
                    $sValue = $slider_middlestart;
                }
            }
            $sUnformatedValue = $sValue;
            if (strpos($sValue, ".")) {
                $sValue = rtrim(rtrim($sValue, "0"), ".");
                $sValue = str_replace('.', $sSeparator, $sValue);
            }
            if (trim($aQuestionAttributes['num_value_int_only']) == 1) {
                $extraclass .= " integeronly";
                $answertypeclass = " integeronly";
                $integeronly = 1;
            } else {
                $answertypeclass = "";
                $integeronly = 0;
            }
            if (!$sliders) {
                $sRows .= doRender('/survey/questions/multiplenumeric/rows/input/answer_row', array('qid' => $ia[0], 'extraclass' => $extraclass, 'answertypeclass' => $answertypeclass, 'sDisplayStyle' => $sDisplayStyle, 'kpclass' => $kpclass, 'alert' => $alert, 'theanswer' => $theanswer, 'labelname' => 'answer' . $myfname, 'prefixclass' => $prefixclass, 'prefix' => $prefix, 'suffix' => $suffix, 'tiwidth' => $tiwidth, 'myfname' => $myfname, 'dispVal' => $sValue, 'maxlength' => $maxlength, 'labelText' => $labelText, 'checkconditionFunction' => $checkconditionFunction . '(this.value, this.name, this.type, \'onchange\',' . $integeronly . ')', 'integeronly' => $integeronly), true);
            } else {
                $sRows .= doRender('/survey/questions/multiplenumeric/rows/sliders/answer_row', array('qid' => $ia[0], 'extraclass' => $extraclass, 'sDisplayStyle' => $sDisplayStyle, 'kpclass' => $kpclass, 'alert' => $alert, 'theanswer' => $theanswer, 'labelname' => 'answer' . $myfname, 'prefixclass' => $prefixclass, 'sliders' => $sliders, 'sliderleft' => $sliderleft, 'sliderright' => $sliderright, 'prefix' => $prefix, 'suffix' => $suffix, 'tiwidth' => $tiwidth, 'myfname' => $myfname, 'dispVal' => $sValue, 'maxlength' => $maxlength, 'labelText' => $labelText, 'checkconditionFunction' => $checkconditionFunction . '(this.value, this.name, this.type)', 'slider_orientation' => $slider_orientation, 'slider_step' => $slider_step, 'slider_min' => $slider_min, 'slider_mintext' => $slider_mintext, 'slider_max' => $slider_max, 'slider_maxtext' => $slider_maxtext, 'slider_default' => $slider_default, 'slider_handle' => isset($slider_handle) ? $slider_handle : '', 'slider_reset' => $slider_reset, 'slider_custom_handle' => $slider_custom_handle, 'slider_user_no_action' => $slider_user_no_action, 'slider_showminmax' => $aQuestionAttributes['slider_showminmax'], 'sSeparator' => $sSeparator, 'sUnformatedValue' => $sUnformatedValue), true);
            }
            $fn++;
            $inputnames[] = $myfname;
        }
        $displaytotal = false;
        $equals_num_value = false;
        if (trim($aQuestionAttributes['equals_num_value']) != '' || trim($aQuestionAttributes['min_num_value']) != '' || trim($aQuestionAttributes['max_num_value']) != '') {
            $qinfo = LimeExpressionManager::GetQuestionStatus($ia[0]);
            if (trim($aQuestionAttributes['equals_num_value']) != '') {
                $equals_num_value = true;
            }
            $displaytotal = true;
        }
        // TODO: Slider and multiple-numeric input should really be two different question types
        $templateFile = $sliders ? 'answer' : 'answer_input';
        $answer = doRender('/survey/questions/multiplenumeric/' . $templateFile, array('sRows' => $sRows, 'prefixclass' => $prefixclass, 'equals_num_value' => $equals_num_value, 'id' => $ia[0], 'prefix' => $prefix, 'suffix' => $suffix, 'sumRemainingEqn' => isset($qinfo) ? $qinfo['sumRemainingEqn'] : '', 'displaytotal' => $displaytotal, 'sumEqn' => isset($qinfo) ? $qinfo['sumEqn'] : '', 'prefix' => $prefix), true);
    }
    if ($aQuestionAttributes['slider_layout'] == 1) {
        Yii::app()->getClientScript()->registerScriptFile(App()->baseUrl . "/third_party/bootstrap-slider/bootstrap-slider.js");
    }
    $sSeparator = getRadixPointData($thissurvey['surveyls_numberformat']);
    $sSeparator = $sSeparator['separator'];
    return array($answer, $inputnames);
}
开发者ID:mfavetti,项目名称:LimeSurvey,代码行数:101,代码来源:qanda_helper.php

示例7: run


//.........这里部分代码省略.........
        //Display the "file validation" message on page if necessary
        if (isset($showpopups) && $showpopups == 0 && isset($filenotvalidated) && $filenotvalidated == true && $okToShowErrors) {
            echo "<p><span class='errormandatory'>" . $clang->gT("One or more uploaded files are not in proper format/size. You cannot proceed until these files are valid.") . "</span></p>";
        }
        $_gseq = -1;
        foreach ($_SESSION[$LEMsessid]['grouplist'] as $gl) {
            $gid = $gl[0];
            ++$_gseq;
            $groupname = $gl[1];
            $groupdescription = $gl[2];
            if ($surveyMode != 'survey' && $gid != $onlyThisGID) {
                continue;
            }
            $redata = compact(array_keys(get_defined_vars()));
            echo "\n\n<!-- START THE GROUP -->\n";
            echo "\n\n<div id='group-{$_gseq}'";
            $gnoshow = LimeExpressionManager::GroupIsIrrelevantOrHidden($_gseq);
            if ($gnoshow && !$previewgrp) {
                echo " style='display: none;'";
            }
            echo ">\n";
            echo templatereplace(file_get_contents($sTemplatePath . "startgroup.pstpl"), array(), $redata);
            echo "\n";
            if (!$previewquestion) {
                echo templatereplace(file_get_contents($sTemplatePath . "groupdescription.pstpl"), array(), $redata);
            }
            echo "\n";
            echo "\n\n<!-- PRESENT THE QUESTIONS -->\n";
            foreach ($qanda as $qa) {
                if ($gid != $qa[6]) {
                    continue;
                }
                $qid = $qa[4];
                $qinfo = LimeExpressionManager::GetQuestionStatus($qid);
                $lastgrouparray = explode("X", $qa[7]);
                $lastgroup = $lastgrouparray[0] . "X" . $lastgrouparray[1];
                // id of the last group, derived from question id
                $lastanswer = $qa[7];
                $q_class = getQuestionClass($qinfo['info']['type']);
                $man_class = '';
                if ($qinfo['info']['mandatory'] == 'Y') {
                    $man_class .= ' mandatory';
                }
                if ($qinfo['anyUnanswered'] && $_SESSION[$LEMsessid]['maxstep'] != $_SESSION[$LEMsessid]['step']) {
                    $man_class .= ' missing';
                }
                $n_q_display = '';
                if ($qinfo['hidden'] && $qinfo['info']['type'] != '*') {
                    continue;
                    // skip this one
                }
                if (!$qinfo['relevant'] || $qinfo['hidden'] && $qinfo['info']['type'] == '*') {
                    $n_q_display = ' style="display: none;"';
                }
                $question = $qa[0];
                //===================================================================
                // The following four variables offer the templating system the
                // capacity to fully control the HTML output for questions making the
                // above echo redundant if desired.
                $question['essentials'] = 'id="question' . $qa[4] . '"' . $n_q_display;
                $question['class'] = $q_class;
                $question['man_class'] = $man_class;
                $question['code'] = $qa[5];
                $question['sgq'] = $qa[7];
                $question['aid'] = !empty($qinfo['info']['aid']) ? $qinfo['info']['aid'] : 0;
                $question['sqid'] = !empty($qinfo['info']['sqid']) ? $qinfo['info']['sqid'] : 0;
开发者ID:ryu1inaba,项目名称:LimeSurvey,代码行数:67,代码来源:SurveyRuntimeHelper.php

示例8: run


//.........这里部分代码省略.........
     }
     $_gseq = -1;
     foreach ($_SESSION[$LEMsessid]['grouplist'] as $gl) {
         $gid = $gl['gid'];
         ++$_gseq;
         $groupname = $gl['group_name'];
         $groupdescription = $gl['description'];
         if ($surveyMode != 'survey' && $gid != $onlyThisGID) {
             continue;
         }
         $redata = compact(array_keys(get_defined_vars()));
         Yii::app()->setConfig('gid', $gid);
         // To be used in templaterplace in whole group. Attention : it's the actual GID (not the GID of the question)
         echo "\n\n<!-- START THE GROUP -->\n";
         echo "\n\n<div id='group-{$_gseq}'";
         $gnoshow = LimeExpressionManager::GroupIsIrrelevantOrHidden($_gseq);
         if ($gnoshow && !$previewgrp) {
             echo " style='display: none;'";
         }
         echo ">\n";
         echo templatereplace(file_get_contents($sTemplatePath . "startgroup.pstpl"), array(), $redata);
         echo "\n";
         if (!$previewquestion) {
             echo templatereplace(file_get_contents($sTemplatePath . "groupdescription.pstpl"), array(), $redata);
         }
         echo "\n";
         echo "\n\n<!-- PRESENT THE QUESTIONS -->\n";
         foreach ($qanda as $qa) {
             // Test if finalgroup is in this qid (for all in one survey, else we do only qanda for needed question (in one by one or group by goup)
             if ($gid != $qa['finalgroup']) {
                 continue;
             }
             $qid = $qa[4];
             $qinfo = LimeExpressionManager::GetQuestionStatus($qid);
             $lastgrouparray = explode("X", $qa[7]);
             $lastgroup = $lastgrouparray[0] . "X" . $lastgrouparray[1];
             // id of the last group, derived from question id
             $lastanswer = $qa[7];
             $q_class = getQuestionClass($qinfo['info']['type']);
             $man_class = '';
             if ($qinfo['info']['mandatory'] == 'Y') {
                 $man_class .= ' mandatory';
             }
             if ($qinfo['anyUnanswered'] && $_SESSION[$LEMsessid]['maxstep'] != $_SESSION[$LEMsessid]['step']) {
                 $man_class .= ' missing';
             }
             $n_q_display = '';
             if ($qinfo['hidden'] && $qinfo['info']['type'] != '*') {
                 continue;
                 // skip this one
             }
             if (!$qinfo['relevant'] || $qinfo['hidden'] && $qinfo['info']['type'] == '*') {
                 $n_q_display = ' style="display: none;"';
             }
             $question = $qa[0];
             //===================================================================
             // The following four variables offer the templating system the
             // capacity to fully control the HTML output for questions making the
             // above echo redundant if desired.
             $question['essentials'] = 'id="question' . $qa[4] . '"' . $n_q_display;
             $question['class'] = $q_class;
             $question['man_class'] = $man_class;
             $question['code'] = $qa[5];
             $question['sgq'] = $qa[7];
             $question['aid'] = !empty($qinfo['info']['aid']) ? $qinfo['info']['aid'] : 0;
             $question['sqid'] = !empty($qinfo['info']['sqid']) ? $qinfo['info']['sqid'] : 0;
开发者ID:rouben,项目名称:LimeSurvey,代码行数:67,代码来源:SurveyRuntimeHelper.php

示例9: do_multiplenumeric


//.........这里部分代码省略.........
    }
    $hidetip = $aQuestionAttributes['hide_tip'];
    if ($aQuestionAttributes['random_order'] == 1) {
        $ansquery = "SELECT * FROM {{questions}} WHERE parent_qid={$ia['0']}  AND language='" . $_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang'] . "' ORDER BY " . dbRandom();
    } else {
        $ansquery = "SELECT * FROM {{questions}} WHERE parent_qid={$ia['0']}  AND language='" . $_SESSION['survey_' . Yii::app()->getConfig('surveyID')]['s_lang'] . "' ORDER BY question_order";
    }
    $ansresult = dbExecuteAssoc($ansquery);
    //Checked
    $aSubquestions = $ansresult->readAll();
    $anscount = count($aSubquestions) * 2;
    $fn = 1;
    $answer = Yii::app()->getController()->renderPartial('/survey/questions/multiplenumeric/header', array('prefixclass' => $prefixclass), true);
    $answer_main = '';
    if ($anscount == 0) {
        $inputnames = array();
        $noanswer = true;
        $answer .= '    <p class="text-danger">' . gT('Error: This question has no answers.') . "</p>\n";
    } else {
        foreach ($aSubquestions as $ansrow) {
            $myfname = $ia[1] . $ansrow['title'];
            if ($ansrow['question'] == "") {
                $ansrow['question'] = "&nbsp;";
            }
            if ($slider_layout === false || $slider_separator == '') {
                $theanswer = $ansrow['question'];
                $sliders = false;
            } else {
                $aAnswer = explode($slider_separator, $ansrow['question']);
                $theanswer = isset($aAnswer[0]) ? $aAnswer[0] : "";
                $sliderleft = isset($aAnswer[1]) ? $aAnswer[1] : "";
                $sliderright = isset($aAnswer[2]) ? $aAnswer[2] : "";
                $sliders = true;
                $sliderright = "<div class=\"slider_righttext\">{$sliderright}</div>";
            }
            $aAnswer = isset($aAnswer) ? $aAnswer : '';
            $sliderleft = isset($sliderleft) ? $sliderleft : "";
            $sliderright = isset($sliderright) ? $sliderright : "";
            // color code missing mandatory questions red
            $alert = '';
            if ($ia[6] == 'Y' && $_SESSION['survey_' . Yii::app()->getConfig('surveyID')][$myfname] === '') {
                $alert = true;
            }
            //list($htmltbody2, $hiddenfield)=return_array_filter_strings($ia, $aQuestionAttributes, $thissurvey, $ansrow, $myfname, '', $myfname, "div","form-group question-item answer-item text-item numeric-item".$extraclass);
            $sDisplayStyle = return_display_style($ia, $aQuestionAttributes, $thissurvey, $myfname);
            $sSeparator = getRadixPointData($thissurvey['surveyls_numberformat']);
            $sSeparator = $sSeparator['separator'];
            $dispVal = '';
            if (isset($_SESSION['survey_' . Yii::app()->getConfig('surveyID')][$myfname])) {
                $dispVal = $_SESSION['survey_' . Yii::app()->getConfig('surveyID')][$myfname];
                if (strpos($dispVal, ".")) {
                    $dispVal = rtrim(rtrim($dispVal, "0"), ".");
                }
                $dispVal = str_replace('.', $sSeparator, $dispVal);
            }
            $itemDatas = array('extraclass' => $extraclass, 'sDisplayStyle' => $sDisplayStyle, 'kpclass' => $kpclass, 'alert' => $alert, 'theanswer' => $theanswer, 'labelname' => 'answer' . $myfname, 'prefixclass' => $prefixclass, 'sliders' => $sliders, 'sliderleft' => $sliderleft, 'sliderright' => $sliderright, 'prefix' => $prefix, 'suffix' => $suffix, 'tiwidth' => $tiwidth, 'myfname' => $myfname, 'dispVal' => $dispVal, 'maxlength' => $maxlength, 'labelText' => $ansrow['question'], 'checkconditionFunction' => $checkconditionFunction . '(this.value, this.name, this.type)', 'slider_orientation' => $slider_orientation, 'slider_step' => $slider_step, 'slider_min' => $slider_min, 'slider_mintext' => $slider_mintext, 'slider_max' => $slider_max, 'slider_maxtext' => $slider_maxtext, 'slider_default' => $slider_default, 'slider_handle' => $slider_handle, 'slider_custom_handle' => $slider_custom_handle);
            $answer .= Yii::app()->getController()->renderPartial('/survey/questions/multiplenumeric/item', $itemDatas, true);
            $fn++;
            $inputnames[] = $myfname;
        }
        $displaytotal = false;
        $equals_num_value = false;
        if (trim($aQuestionAttributes['equals_num_value']) != '' || trim($aQuestionAttributes['min_num_value']) != '' || trim($aQuestionAttributes['max_num_value']) != '') {
            $qinfo = LimeExpressionManager::GetQuestionStatus($ia[0]);
            if (trim($aQuestionAttributes['equals_num_value']) != '') {
                $equals_num_value = true;
            }
            $displaytotal = true;
        }
        $footerDatas = array('equals_num_value' => $equals_num_value, 'id' => $ia[0], 'prefix' => $prefix, 'suffix' => $suffix, 'sumRemainingEqn' => isset($qinfo) ? $qinfo['sumRemainingEqn'] : '', 'displaytotal' => $displaytotal, 'sumEqn' => isset($qinfo) ? $qinfo['sumEqn'] : '');
        $answer .= Yii::app()->getController()->renderPartial('/survey/questions/multiplenumeric/footer', $footerDatas, true);
    }
    if ($aQuestionAttributes['slider_layout'] == 1) {
        Yii::app()->getClientScript()->registerScriptFile(Yii::app()->getConfig('generalscripts') . "bootstrap-slider.js");
        Yii::app()->getClientScript()->registerScriptFile(Yii::app()->getConfig('generalscripts') . "numeric-slider.js");
        Yii::app()->getClientScript()->registerCssFile(Yii::app()->getConfig('publicstyleurl') . "numeric-slider.css");
        if ($slider_default != "") {
            $slider_startvalue = $slider_default;
            $slider_displaycallout = 1;
        } elseif ($slider_middlestart != '') {
            $slider_startvalue = $slider_middlestart;
            $slider_displaycallout = 0;
        } else {
            $slider_startvalue = 'NULL';
            $slider_displaycallout = 0;
        }
        $slider_showminmax = $aQuestionAttributes['slider_showminmax'] == 1 ? 1 : 0;
        //some var for slider
        $aJsLang = array('reset' => gT('Reset'), 'tip' => gT('Please click and drag the slider handles to enter your answer.'));
        $aJsVar = array('slider_showminmax' => $slider_showminmax, 'slider_min' => $slider_min, 'slider_mintext' => $slider_mintext, 'slider_max' => $slider_max, 'slider_maxtext' => $slider_maxtext, 'slider_step' => $slider_step, 'slider_startvalue' => $slider_startvalue, 'slider_displaycallout' => $slider_displaycallout, 'slider_prefix' => $prefix, 'slider_suffix' => $suffix, 'slider_reset' => $slider_reset, 'lang' => $aJsLang);
        /*
        $answer .= "<script type='text/javascript'><!--\n"
                    . " doNumericSlider({$ia[0]},".ls_json_encode($aJsVar).");\n"
                    . " //--></script>";
        */
    }
    $sSeparator = getRadixPointData($thissurvey['surveyls_numberformat']);
    $sSeparator = $sSeparator['separator'];
    return array($answer, $inputnames);
}
开发者ID:BertHankes,项目名称:LimeSurvey,代码行数:101,代码来源:qanda_helper.php

示例10: foreach

 }
 //Loop through questions
 foreach ($deqrows as $deqrow) {
     // - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     // START doing questions
     $qidattributes = getQuestionAttributes($deqrow['qid'], $deqrow['type']);
     if ($qidattributes['hidden'] == 1 && $deqrow['type'] != '*') {
         continue;
     }
     $bGroupHasVisibleQuestions = true;
     //GET ANY CONDITIONS THAT APPLY TO THIS QUESTION
     $printablesurveyoutput = '';
     $explanation = '';
     //reset conditions explanation
     $s = 0;
     $qinfo = LimeExpressionManager::GetQuestionStatus($deqrow['qid']);
     $relevance = trim($qinfo['info']['relevance']);
     $explanation = $qinfo['relEqn'];
     if (trim($relevance) != '' && trim($relevance) != '1') {
         $explanation = "<b>" . $clang->gT('Only answer this question if the following conditions are met:') . "</b>" . "<br/> ° " . $explanation;
     } else {
         $explanation = '';
     }
     ++$total_questions;
     //TIBO map question qid to their q number
     $mapquestionsNumbers[$deqrow['qid']] = $total_questions;
     //END OF GETTING CONDITIONS
     $qid = $deqrow['qid'];
     $fieldname = "{$surveyid}" . "X" . "{$gid}" . "X" . "{$qid}";
     if (isset($showsgqacode) && $showsgqacode == true) {
         $deqrow['question'] = $deqrow['question'] . "<br />" . $clang->gT("ID:") . " {$fieldname} <br />" . $clang->gT("Question code:") . " " . $deqrow['title'];
开发者ID:ddrmoscow,项目名称:queXS,代码行数:31,代码来源:printablesurvey.php

示例11: view

 /**
  * dataentry::view()
  * view a dataentry
  * @param mixed $surveyid
  * @param mixed $lang
  * @return
  */
 public function view($surveyid, $lang = NULL)
 {
     $surveyid = sanitize_int($surveyid);
     $lang = isset($_GET['lang']) ? $_GET['lang'] : NULL;
     if (isset($lang)) {
         $lang = sanitize_languagecode($lang);
     }
     $aViewUrls = array();
     if (Permission::model()->hasSurveyPermission($surveyid, 'responses', 'create')) {
         $sDataEntryLanguage = Survey::model()->findByPk($surveyid)->language;
         $surveyinfo = getSurveyInfo($surveyid);
         $slangs = Survey::model()->findByPk($surveyid)->additionalLanguages;
         $baselang = Survey::model()->findByPk($surveyid)->language;
         array_unshift($slangs, $baselang);
         if (is_null($lang) || !in_array($lang, $slangs)) {
             $sDataEntryLanguage = $baselang;
         } else {
             $sDataEntryLanguage = $lang;
         }
         $langlistbox = languageDropdown($surveyid, $sDataEntryLanguage);
         $thissurvey = getSurveyInfo($surveyid);
         //This is the default, presenting a blank dataentry form
         LimeExpressionManager::StartSurvey($surveyid, 'survey', NULL, false, LEM_PRETTY_PRINT_ALL_SYNTAX);
         $moveResult = LimeExpressionManager::NavigateForwards();
         $aData['thissurvey'] = $thissurvey;
         $aData['langlistbox'] = $langlistbox;
         $aData['surveyid'] = $surveyid;
         $aData['sDataEntryLanguage'] = $sDataEntryLanguage;
         $aData['site_url'] = Yii::app()->homeUrl;
         LimeExpressionManager::StartProcessingPage(true, Yii::app()->baseUrl);
         // means that all variables are on the same page
         $aViewUrls[] = 'caption_view';
         Yii::app()->loadHelper('database');
         // SURVEY NAME AND DESCRIPTION TO GO HERE
         $degquery = "SELECT * FROM {{groups}} WHERE sid={$surveyid} AND language='{$sDataEntryLanguage}' ORDER BY {{groups}}.group_order";
         $degresult = dbExecuteAssoc($degquery);
         // GROUP NAME
         $aDataentryoutput = '';
         foreach ($degresult->readAll() as $degrow) {
             LimeExpressionManager::StartProcessingGroup($degrow['gid'], $thissurvey['anonymized'] != "N", $surveyid);
             $deqquery = "SELECT * FROM {{questions}} WHERE sid={$surveyid} AND parent_qid=0 AND gid={$degrow['gid']} AND language='{$sDataEntryLanguage}'";
             $deqrows = (array) dbExecuteAssoc($deqquery)->readAll();
             $aDataentryoutput .= "\t<tr class='info'>\n" . "<!-- Inside controller dataentry.php -->" . "<td colspan='3'><h4>" . flattenText($degrow['group_name'], true) . "</h4></td>\n" . "\t</tr>\n";
             $gid = $degrow['gid'];
             $aDataentryoutput .= "\t<tr class='data-entry-separator'><td colspan='3'></td></tr>\n";
             // Perform a case insensitive natural sort on group name then question title of a multidimensional array
             usort($deqrows, 'groupOrderThenQuestionOrder');
             $bgc = 'odd';
             foreach ($deqrows as $deqrow) {
                 $cdata = array();
                 $qidattributes = getQuestionAttributeValues($deqrow['qid']);
                 $cdata['qidattributes'] = $qidattributes;
                 $hidden = isset($qidattributes['hidden']) ? $qidattributes['hidden'] : 0;
                 // TODO - can questions be hidden?  Are JavaScript variables names used?  Consistently with everywhere else?
                 //                    LimeExpressionManager::ProcessRelevance($qidattributes['relevance'],$deqrow['qid'],NULL,$deqrow['type'],$hidden);
                 // TMSW Condition->Relevance:  Show relevance equation instead of conditions here - better yet, have data entry use survey-at-a-time but with different view
                 $qinfo = LimeExpressionManager::GetQuestionStatus($deqrow['qid']);
                 $relevance = trim($qinfo['info']['relevance']);
                 $explanation = trim($qinfo['relEqn']);
                 $validation = trim($qinfo['prettyValidTip']);
                 $qidattributes = getQuestionAttributeValues($deqrow['qid']);
                 $array_filter_help = flattenText($this->_array_filter_help($qidattributes, $sDataEntryLanguage, $surveyid));
                 if ($relevance != '' && $relevance != '1' || $validation != '' || $array_filter_help != '') {
                     $showme = '<div class="alert alert-warning col-sm-8 col-sm-offset-2" role="alert">';
                     if ($bgc == "even") {
                         $bgc = "odd";
                     } else {
                         $bgc = "even";
                     }
                     //Do no alternate on explanation row
                     if ($relevance != '' && $relevance != '1') {
                         $showme = '<strong>' . gT("Only answer this if the following conditions are met:", 'html', $sDataEntryLanguage) . "</strong><br />{$explanation}\n";
                     }
                     if ($validation != '') {
                         $showme .= '<strong>' . gT("The answer(s) must meet these validation criteria:", 'html', $sDataEntryLanguage) . "</strong><br />{$validation}\n";
                     }
                     if ($showme != '' && $array_filter_help != '') {
                         $showme .= '<br/>';
                     }
                     if ($array_filter_help != '') {
                         $showme .= '<strong>' . gT("The answer(s) must meet these array_filter criteria:", 'html', $sDataEntryLanguage) . "</strong><br />{$array_filter_help}\n";
                     }
                     $showme .= '</div>';
                     $cdata['explanation'] = "<tr class ='data-entry-explanation'><td class='data-entry-small-text' colspan='3' align='left'>{$showme}</td></tr>\n";
                 }
                 //END OF GETTING CONDITIONS
                 //Alternate bgcolor for different groups
                 if (!isset($bgc)) {
                     $bgc = "even";
                 }
                 if ($bgc == "even") {
                     $bgc = "odd";
                 } else {
//.........这里部分代码省略.........
开发者ID:mfavetti,项目名称:LimeSurvey,代码行数:101,代码来源:dataentry.php

示例12: do_multiplenumeric


//.........这里部分代码省略.........
            //			$answer .= "\t</tr>\n";
            $fn++;
            $inputnames[] = $myfname;
        }
        $question_tip = '';
        if ($hidetip == 0) {
            $question_tip .= '<p class="tip">' . $clang->gT('Only numbers may be entered in these fields') . "</p>\n";
        }
        //        if ($max_num_value)
        //        {
        //            $question_tip .= '<p id="max_num_value_'.$ia[1].'" class="tip">'.sprintf($clang->gT('Total of all entries must not exceed %d'), $max_num_value)."</p>\n";
        //        }
        //        if ($equals_num_value)
        //        {
        //            $question_tip .= '<p id="equals_num_value_'.$ia[1].'" class="tip">'.sprintf($clang->gT('Total of all entries must equal %d'),$equals_num_value)."</p>\n";
        //        }
        //        if ($min_num_value)
        //        {
        //            $question_tip .= '<p id="min_num_value_'.$ia[1].'" class="tip">'.sprintf($clang->gT('Total of all entries must be at least %s'),$min_num_value)."</p>\n";
        //        }
        //
        //          // TMSW TODO
        //        if ($max_num_value || $equals_num_value || $min_num_value)
        //        {
        //            $answer_computed = '';
        //            if ($equals_num_value)
        //            {
        //                $answer_computed .= "\t<li class='multiplenumerichelp'>\n<label for=\"remainingvalue_{$ia[1]}\">\n\t".$clang->gT('Remaining: ')."\n</label>\n<span>\n\t$prefix\n\t<input size=10 type='text' id=\"remainingvalue_{$ia[1]}\" disabled=\"disabled\" />\n\t$suffix\n</span>\n\t</li>\n";
        //            }
        //            $answer_computed .= "\t<li class='multiplenumerichelp'>\n<label for=\"totalvalue_{$ia[1]}\">\n\t".$clang->gT('Total: ')."\n</label>\n<span>\n\t$prefix\n\t<input size=10  type=\"text\" id=\"totalvalue_{$ia[1]}\" disabled=\"disabled\" />\n\t$suffix\n</span>\n\t</li>\n";
        //            $answer_main .= $answer_computed;
        //        }
        if (trim($aQuestionAttributes['equals_num_value']) != '' || trim($aQuestionAttributes['min_num_value']) != '' || trim($aQuestionAttributes['max_num_value']) != '') {
            $qinfo = LimeExpressionManager::GetQuestionStatus($ia[0]);
            if (trim($aQuestionAttributes['equals_num_value']) != '') {
                $answer_main .= "\t<li class='multiplenumerichelp help-item'>\n" . "<span class=\"label\">" . $clang->gT('Remaining: ') . "</span>\n" . "<span id=\"remainingvalue_{$ia[0]}\" class=\"dynamic_remaining\">{$prefix}\n" . "{" . $qinfo['sumRemainingEqn'] . "}\n" . "{$suffix}</span>\n" . "\t</li>\n";
            }
            $answer_main .= "\t<li class='multiplenumerichelp  help-item'>\n" . "<span class=\"label\">" . $clang->gT('Total: ') . "</span>\n" . "<span id=\"totalvalue_{$ia[0]}\" class=\"dynamic_sum\">{$prefix}\n" . "{" . $qinfo['sumEqn'] . "}\n" . "{$suffix}</span>\n" . "\t</li>\n";
        }
        $answer .= $question_tip . "<ul class=\"subquestions-list questions-list text-list numeric-list\">\n" . $answer_main . "</ul>\n";
    }
    //just added these here so its easy to change in one place
    $errorClass = 'tip problem';
    $goodClass = 'tip good';
    /* ==================================
       Style to be applied to all templates.
       .numeric-multi p.tip.error
       {
       color: #f00;
       }
       .numeric-multi p.tip.good
       {
       color: #0f0;
       }
       */
    $sSeperator = getRadixPointData($thissurvey['surveyls_numberformat']);
    $sSeperator = $sSeperator['seperator'];
    //    if ($max_num_value || $equals_num_value || $min_num_value)
    //    { //Do value validation
    //        $answer .= '<input type="hidden" name="qattribute_answer[]" value="'.$ia[1]."\" />\n";
    //        $answer .= '<input type="hidden" name="qattribute_answer'.$ia[1]."\" />\n";
    //
    //        $answer .= "<script type='text/javascript'>\n";
    //        $answer .= "    function calculateValue".$ia[1]."(method) {\n";
    //        //Make all empty fields 0 (or else calculation won't work
    //        foreach ($inputnames as $inputname)
开发者ID:rawaludin,项目名称:LimeSurvey,代码行数:67,代码来源:qanda_helper.php

示例13: templatereplace

 }
 echo ">\n";
 echo templatereplace(file_get_contents("{$thistpl}/startgroup.pstpl"));
 echo "\n";
 if ($groupdescription) {
     echo templatereplace(file_get_contents("{$thistpl}/groupdescription.pstpl"));
 }
 echo "\n";
 echo "\n\n<!-- PRESENT THE QUESTIONS -->\n";
 $i = 0;
 foreach ($qanda as $qa) {
     if ($gid != $qa[6]) {
         continue;
     }
     $qid = $qa[4];
     $qinfo = LimeExpressionManager::GetQuestionStatus($qid);
     $lastgrouparray = explode("X", $qa[7]);
     $lastgroup = $lastgrouparray[0] . "X" . $lastgrouparray[1];
     // id of the last group, derived from question id
     $lastanswer = $qa[7];
     $q_class = question_class($qinfo['info']['type']);
     $man_class = '';
     if ($qinfo['info']['mandatory'] == 'Y') {
         $man_class .= ' mandatory';
     }
     if ($qinfo['anyUnanswered'] && $_SESSION['maxstep'] != $_SESSION['step']) {
         $man_class .= ' missing';
     }
     $n_q_display = '';
     if ($qinfo['hidden'] && $qinfo['info']['type'] != '*') {
         continue;
开发者ID:rkaldung,项目名称:LimeSurvey,代码行数:31,代码来源:group.php

示例14: do_multiplenumeric


//.........这里部分代码省略.........
                if (isset($answer_and_slider_array[2])) {
                    $sliderright = $answer_and_slider_array[2];
                } else {
                    $sliderright = "";
                }
                $sliderleft = "<div class=\"slider_lefttext\">{$sliderleft}</div>";
                $sliderright = "<div class=\"slider_righttext\">{$sliderright}</div>";
            }
            // color code missing mandatory questions red
            if ($ia[6] == 'Y' && ($_SESSION['step'] == $_SESSION['prevstep'] || $_SESSION['maxstep'] > $_SESSION['step']) && $_SESSION[$myfname] == '') {
                $theanswer = "<span class='errormandatory'>{$theanswer}</span>";
            }
            list($htmltbody2, $hiddenfield) = return_array_filter_strings($ia, $qidattributes, $thissurvey, $ansrow, $myfname, '', $myfname, "li");
            $answer_main .= "\t{$htmltbody2}\n";
            if ($slider_layout === false) {
                $answer_main .= "<label for=\"answer{$myfname}\">{$theanswer}</label>\n";
            } else {
                $answer_main .= "<label for=\"answer{$myfname}\" class=\"slider-label\">{$theanswer}</label>\n";
            }
            if ($label_width < strlen(trim(strip_tags($ansrow['question'])))) {
                $label_width = strlen(trim(strip_tags($ansrow['question'])));
            }
            if ($slider_layout === false) {
                $sSeperator = getRadixPointData($thissurvey['surveyls_numberformat']);
                $sSeperator = $sSeperator['seperator'];
                $answer_main .= "<span class=\"input\">\n\t" . $prefix . "\n\t<input class=\"text {$kpclass}\" type=\"text\" size=\"" . $tiwidth . '" name="' . $myfname . '" id="answer' . $myfname . '" value="';
                if (isset($_SESSION[$myfname])) {
                    $dispVal = str_replace('.', $sSeperator, $_SESSION[$myfname]);
                    $answer_main .= $dispVal;
                }
                $answer_main .= '" onkeyup="' . $checkconditionFunction . '(this.value, this.name, this.type);" ' . " {$numbersonly} {$maxlength} />\n\t" . $suffix . "\n</span>\n\t</li>\n";
            } else {
                if ($qidattributes['slider_showminmax'] == 1) {
                    //$slider_showmin=$slider_min;
                    $slider_showmin = "\t<div id=\"slider-left-{$myfname}\" class=\"slider_showmin\">{$slider_mintext}</div>\n";
                    $slider_showmax = "\t<div id=\"slider-right-{$myfname}\" class=\"slider_showmax\">{$slider_maxtext}</div>\n";
                } else {
                    $slider_showmin = '';
                    $slider_showmax = '';
                }
                $js_header_includes[] = '/scripts/jquery/lime-slider.js';
                if (isset($_SESSION[$myfname]) && $_SESSION[$myfname] != '') {
                    $slider_startvalue = $_SESSION[$myfname] * $slider_divisor;
                    $displaycallout_atstart = 1;
                } elseif ($slider_default != "") {
                    $slider_startvalue = $slider_default * $slider_divisor;
                    $displaycallout_atstart = 1;
                } elseif ($slider_middlestart != '') {
                    $slider_startvalue = $slider_middlestart;
                    $displaycallout_atstart = 0;
                } else {
                    $slider_startvalue = 'NULL';
                    $displaycallout_atstart = 0;
                }
                $answer_main .= "{$sliderleft}<div id='container-{$myfname}' class='multinum-slider'>\n" . "\t<input type=\"text\" id=\"slider-modifiedstate-{$myfname}\" value=\"{$displaycallout_atstart}\" style=\"display: none;\" />\n" . "\t<input type=\"text\" id=\"slider-param-min-{$myfname}\" value=\"{$slider_min}\" style=\"display: none;\" />\n" . "\t<input type=\"text\" id=\"slider-param-max-{$myfname}\" value=\"{$slider_max}\" style=\"display: none;\" />\n" . "\t<input type=\"text\" id=\"slider-param-stepping-{$myfname}\" value=\"{$slider_stepping}\" style=\"display: none;\" />\n" . "\t<input type=\"text\" id=\"slider-param-divisor-{$myfname}\" value=\"{$slider_divisor}\" style=\"display: none;\" />\n" . "\t<input type=\"text\" id=\"slider-param-startvalue-{$myfname}\" value='{$slider_startvalue}' style=\"display: none;\" />\n" . "\t<input type=\"text\" id=\"slider-onchange-js-{$myfname}\" value=\"{$numbersonly_slider}\" style=\"display: none;\" />\n" . "\t<input type=\"text\" id=\"slider-prefix-{$myfname}\" value=\"{$prefix}\" style=\"display: none;\" />\n" . "\t<input type=\"text\" id=\"slider-suffix-{$myfname}\" value=\"{$suffix}\" style=\"display: none;\" />\n" . "<div id=\"slider-{$myfname}\" class=\"ui-slider-1\">\n" . $slider_showmin . "<div class=\"slider_callout\" id=\"slider-callout-{$myfname}\"></div>\n" . "<div class=\"ui-slider-handle\" id=\"slider-handle-{$myfname}\"></div>\n";
                $answer_main .= "<input class=\"text\" type=\"text\" name=\"{$myfname}\" id=\"answer{$myfname}\" value=\"";
                if (isset($_SESSION[$myfname]) && $_SESSION[$myfname] != '') {
                    $answer_main .= $_SESSION[$myfname];
                } elseif ($slider_default != "") {
                    $answer_main .= $slider_default;
                }
                $answer_main .= "\"/>\n";
                $answer_main .= $slider_showmax . "\t</div>" . "</div>{$sliderright}\n";
                $answer_main .= "\t</li>\n";
            }
            //			$answer .= "\t</tr>\n";
            $fn++;
            $inputnames[] = $myfname;
        }
        $question_tip = '';
        if ($hidetip == 0) {
            $question_tip .= '<p class="tip">' . $clang->gT('Only numbers may be entered in these fields') . "</p>\n";
        }
        if (trim($qidattributes['equals_num_value']) != '' || trim($qidattributes['min_num_value']) != '' || trim($qidattributes['max_num_value']) != '') {
            $qinfo = LimeExpressionManager::GetQuestionStatus($ia[0]);
            if (trim($qidattributes['equals_num_value']) != '') {
                $answer_main .= "\t<li class='multiplenumerichelp'>\n" . "<label for=\"remainingvalue_{$ia[0]}\">" . $clang->gT('Remaining: ') . "</label>\n" . "<span id=\"remainingvalue_{$ia[0]}\" class=\"dynamic_remaining\">{$prefix}\n" . "{" . $qinfo['sumRemainingEqn'] . "}\n" . "{$suffix}</span>\n" . "\t</li>\n";
            }
            $answer_main .= "\t<li class='multiplenumerichelp'>\n" . "<label for=\"totalvalue_{$ia[0]}\">" . $clang->gT('Total: ') . "</label>\n" . "<span id=\"totalvalue_{$ia[0]}\" class=\"dynamic_sum\">{$prefix}\n" . "{" . $qinfo['sumEqn'] . "}\n" . "{$suffix}</span>\n" . "\t</li>\n";
        }
        $answer .= $question_tip . "<ul>\n" . $answer_main . "</ul>\n";
    }
    //just added these here so its easy to change in one place
    $errorClass = 'tip problem';
    $goodClass = 'tip good';
    /* ==================================
       Style to be applied to all templates.
       .numeric-multi p.tip.error
       {
       color: #f00;
       }
       .numeric-multi p.tip.good
       {
       color: #0f0;
       }
       */
    $sSeperator = getRadixPointData($thissurvey['surveyls_numberformat']);
    $sSeperator = $sSeperator['seperator'];
    return array($answer, $inputnames);
}
开发者ID:ddrmoscow,项目名称:queXS,代码行数:101,代码来源:qanda.php


注:本文中的LimeExpressionManager::GetQuestionStatus方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。