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


PHP limesurvey_lang::gt方法代码示例

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


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

示例1: generate_statistics


//.........这里部分代码省略.........
                $qsid = $fielddata['sid'];
                $qgid = $fielddata['gid'];
                $qqid = $fielddata['qid'];
                list($qanswer, $qlid) = !empty($fielddata['aid']) ? explode("_", $fielddata['aid']) : array("", "");
                //get SGQ data
                //list($qsid, $qgid, $qqid) = explode("X", substr($rt, 1, strlen($rt)), 3);
                //get question data
                $nquery = "SELECT title, type, question, other, parent_qid FROM " . db_table_name("questions") . " WHERE parent_qid=0 AND qid='{$qqid}' AND language='{$language}'";
                $nresult = db_execute_num($nquery) or safe_die("Couldn't get text question<br />{$nquery}<br />" . $connect->ErrorMsg());
                //loop through question data
                while ($nrow = $nresult->FetchRow()) {
                    $qtitle = FlattenText($nrow[0]);
                    $qtype = $nrow[1];
                    $qquestion = FlattenText($nrow[2]);
                    $nlid = $nrow[4];
                }
                $mfield = substr($rt, 1, strlen($rt));
                //Text questions either have an answer, or they don't. There's no other way of quantising the results.
                // So, instead of building an array of predefined answers like we do with lists & other types,
                // we instead create two "types" of possible answer - either there is a response.. or there isn't.
                // This question type then can provide a % of the question answered in the summary.
                $alist[] = array("Answers", $statlang->gT("Answer"), $mfield);
                $alist[] = array("NoAnswer", $statlang->gT("No answer"), $mfield);
            } elseif ($firstletter == "Q") {
                //get SGQ data
                list($qsid, $qgid, $qqid) = explode("X", substr($rt, 1, strlen($rt)), 3);
                //separating another ID
                $tmpqid = substr($qqid, 0, strlen($qqid) - 1);
                //check if we have legid QIDs. if not create them by substringing
                while (!in_array($tmpqid, $legitqids)) {
                    $tmpqid = substr($tmpqid, 0, strlen($tmpqid) - 1);
                }
                //length of QID
                $qidlength = strlen($tmpqid);
                //we somehow get the answer code (see SQL later) from the $qqid
                $qaid = substr($qqid, $qidlength, strlen($qqid) - $qidlength);
                //get some question data
                $nquery = "SELECT title, type, question, other FROM " . db_table_name("questions") . " WHERE qid='" . substr($qqid, 0, $qidlength) . "' AND parent_qid=0 AND language='{$language}'";
                $nresult = db_execute_num($nquery) or safe_die("Couldn't get text question<br />{$nquery}<br />" . $connect->ErrorMsg());
                //more substrings
                $count = substr($qqid, strlen($qqid) - 1);
                //loop through question data
                while ($nrow = $nresult->FetchRow()) {
                    $qtitle = FlattenText($nrow[0]) . '-' . $count;
                    $qtype = $nrow[1];
                    $qquestion = FlattenText($nrow[2]);
                }
                //get answers
                $qquery = "SELECT title as code, question as answer FROM " . db_table_name("questions") . " WHERE parent_qid='" . substr($qqid, 0, $qidlength) . "' AND title='{$qaid}' AND language='{$language}' ORDER BY question_order";
                $qresult = db_execute_num($qquery) or safe_die("Couldn't get answer details (Array 5p Q)<br />{$qquery}<br />" . $connect->ErrorMsg());
                //loop through answer data
                while ($qrow = $qresult->FetchRow()) {
                    //store each answer here
                    $atext = FlattenText($qrow[1]);
                }
                //add this to the question title
                $qtitle .= " [{$atext}]";
                //even more substrings...
                $mfield = substr($rt, 1, strlen($rt));
                //Text questions either have an answer, or they don't. There's no other way of quantising the results.
                // So, instead of building an array of predefined answers like we do with lists & other types,
                // we instead create two "types" of possible answer - either there is a response.. or there isn't.
                // This question type then can provide a % of the question answered in the summary.
                $alist[] = array("Answers", $statlang->gT("Answer"), $mfield);
                $alist[] = array("NoAnswer", $statlang->gT("No answer"), $mfield);
            } elseif ($firstletter == "R") {
开发者ID:rkaldung,项目名称:LimeSurvey,代码行数:67,代码来源:statistics_function.php


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