• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP question_possible_response类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: test_get_possible_responses

 public function test_get_possible_responses()
 {
     $q = new stdClass();
     $q->id = 1;
     $q->options->trueanswer = 1;
     $q->options->falseanswer = 2;
     $q->options->answers[1] = (object) array('fraction' => 1);
     $q->options->answers[2] = (object) array('fraction' => 0);
     $this->assertEqual(array($q->id => array(0 => new question_possible_response(get_string('false', 'qtype_truefalse'), 0), 1 => new question_possible_response(get_string('true', 'qtype_truefalse'), 1), null => question_possible_response::no_response())), $this->qtype->get_possible_responses($q));
 }
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:10,代码来源:testquestiontype.php


示例2: get_possible_responses

    public function get_possible_responses($questiondata) {
        $responses = array();

        $unit = $this->get_default_numerical_unit($questiondata);

        $starfound = false;
        foreach ($questiondata->options->answers as $aid => $answer) {
            $responseclass = $answer->answer;

            if ($responseclass === '*') {
                $starfound = true;
            } else {
                $responseclass = $this->add_unit($questiondata, $responseclass, $unit);

                $ans = new qtype_numerical_answer($answer->id, $answer->answer, $answer->fraction,
                        $answer->feedback, $answer->feedbackformat, $answer->tolerance);
                list($min, $max) = $ans->get_tolerance_interval();
                $responseclass .= " ($min..$max)";
            }

            $responses[$aid] = new question_possible_response($responseclass,
                    $answer->fraction);
        }

        if (!$starfound) {
            $responses[0] = new question_possible_response(
                    get_string('didnotmatchanyanswer', 'question'), 0);
        }

        $responses[null] = question_possible_response::no_response();

        return array($questiondata->id => $responses);
    }
开发者ID:JP-Git,项目名称:moodle,代码行数:33,代码来源:questiontype.php


示例3: test_get_possible_responses_no_star

    public function test_get_possible_responses_no_star() {
        $q = test_question_maker::get_question_data('calculated');
        unset($q->options->answers[17]);

        $this->assertEqual(array(
            $q->id => array(
                13 => new question_possible_response(
                        $this->get_possible_response('{a} + {b}', 0.001, 'nominal'), 1),
                14 => new question_possible_response(
                        $this->get_possible_response('{a} - {b}', 0.001, 'nominal'), 0),
                0  => new question_possible_response(
                        get_string('didnotmatchanyanswer', 'question'), 0),
                null => question_possible_response::no_response()
            ),
        ), $this->qtype->get_possible_responses($q));
    }
开发者ID:nutanrajmalanai,项目名称:moodle,代码行数:16,代码来源:testquestiontype.php


示例4: test_get_possible_responses_no_star

 public function test_get_possible_responses_no_star()
 {
     $q = test_question_maker::get_question_data('shortanswer', 'frogonly');
     $this->assertEquals(array($q->id => array(13 => new question_possible_response('frog', 1), 0 => new question_possible_response(get_string('didnotmatchanyanswer', 'question'), 0), null => question_possible_response::no_response())), $this->qtype->get_possible_responses($q));
 }
开发者ID:janaece,项目名称:globalclassroom4_clean,代码行数:5,代码来源:questiontype_test.php


示例5: get_possible_responses

    public function get_possible_responses($questiondata) {
        $responses = array();

        $unit = $this->get_default_numerical_unit($questiondata);

        foreach ($questiondata->options->answers as $aid => $answer) {
            $responseclass = $answer->answer;

            if ($responseclass != '*') {
                $responseclass = $this->add_unit($questiondata, $responseclass, $unit);

                $ans = new qtype_numerical_answer($answer->id, $answer->answer, $answer->fraction,
                        $answer->feedback, $answer->feedbackformat, $answer->tolerance);
                list($min, $max) = $ans->get_tolerance_interval();
                $responseclass .= " ($min..$max)";
            }

            $responses[$aid] = new question_possible_response($responseclass,
                    $answer->fraction);
        }
        $responses[null] = question_possible_response::no_response();

        return array($questiondata->id => $responses);
    }
开发者ID:nottmoo,项目名称:moodle,代码行数:24,代码来源:questiontype.php


示例6: get_possible_responses

 public function get_possible_responses($questiondata)
 {
     $responses = array();
     $starfound = false;
     foreach ($questiondata->options->answers as $aid => $answer) {
         $responses[$aid] = new question_possible_response($answer->answer, $answer->fraction);
         if ($answer->answer === '*') {
             $starfound = true;
         }
     }
     if (!$starfound) {
         $responses[0] = new question_possible_response(get_string('didnotmatchanyanswer', 'question'), 0);
     }
     $responses[null] = question_possible_response::no_response();
     return array($questiondata->id => $responses);
 }
开发者ID:evltuma,项目名称:moodle,代码行数:16,代码来源:questiontype.php


示例7: test_get_possible_responses

 public function test_get_possible_responses()
 {
     $q = $this->get_test_question_data();
     $this->assertEquals(array(14 => array(14 => new question_possible_response('frog: amphibian', 1 / 3), 15 => new question_possible_response('frog: mammal', 0), 17 => new question_possible_response('frog: insect', 0), null => question_possible_response::no_response()), 15 => array(14 => new question_possible_response('cat: amphibian', 0), 15 => new question_possible_response('cat: mammal', 1 / 3), 17 => new question_possible_response('cat: insect', 0), null => question_possible_response::no_response()), 16 => array(14 => new question_possible_response('newt: amphibian', 1 / 3), 15 => new question_possible_response('newt: mammal', 0), 17 => new question_possible_response('newt: insect', 0), null => question_possible_response::no_response())), $this->qtype->get_possible_responses($q));
 }
开发者ID:VERSION2-Inc,项目名称:moodle-qtype_ddmatch,代码行数:5,代码来源:questiontype_test.php


示例8: get_possible_responses

 public function get_possible_responses($questiondata)
 {
     $responses = array();
     $question = $this->make_question($questiondata);
     foreach ($question->correctresponse as $position => $answerid) {
         $responses[] = $position . ': ' . $question->answers[$answerid]->answer;
     }
     $responses = array(0 => question_possible_response::no_response(), 1 => implode(', ', $responses));
     return;
 }
开发者ID:Kathrin84,项目名称:moodle-qtype_ordering,代码行数:10,代码来源:questiontype.php


示例9: test_get_possible_responses_single

    public function test_get_possible_responses_single() {
        $q = $this->get_test_question_data();
        $responses = $this->qtype->get_possible_responses($q);

        $this->assertEquals(array(
            $q->id => array(
                1 => new question_possible_response('frog', 1),
                2 => new question_possible_response('toad', 0),
                null => question_possible_response::no_response(),
            )), $this->qtype->get_possible_responses($q));
    }
开发者ID:JP-Git,项目名称:moodle,代码行数:11,代码来源:questiontype_test.php


示例10: test_get_possible_responses

 public function test_get_possible_responses()
 {
     $q = $this->get_test_question_data();
     $this->assertEquals(array(1 => array(1 => new question_possible_response('quick', 1 / 3), 2 => new question_possible_response('slow', 0), null => question_possible_response::no_response()), 2 => array(1 => new question_possible_response('fox', 1 / 3), 2 => new question_possible_response('dog', 0), null => question_possible_response::no_response()), 3 => array(1 => new question_possible_response('lazy', 1 / 3), 2 => new question_possible_response('assiduous', 0), null => question_possible_response::no_response())), $this->qtype->get_possible_responses($q));
 }
开发者ID:antoniorodrigues,项目名称:redes-digitais,代码行数:5,代码来源:questiontype_test.php


示例11: get_possible_responses

 public function get_possible_responses($questiondata)
 {
     $question = $this->make_question($questiondata);
     $parts = array();
     foreach ($question->places as $place => $group) {
         $choices = array();
         foreach ($question->choices[$group] as $i => $choice) {
             $choices[$i] = new question_possible_response(html_to_text($choice->text, 0, false), ($question->rightchoices[$place] == $i) / count($question->places));
         }
         $choices[null] = question_possible_response::no_response();
         $parts[$place] = $choices;
     }
     return $parts;
 }
开发者ID:ndunand,项目名称:moodle-qtype_gapselect,代码行数:14,代码来源:questiontypebase.php


示例12: test_get_possible_responses_no_star

    public function test_get_possible_responses_no_star() {
        $q = $this->get_test_question_data();
        unset($q->options->answers[14]);

        $this->assertEqual(array(
            $q->id => array(
                13 => new question_possible_response('42 m (41.5..42.5)', 1),
                0 => new question_possible_response(
                        get_string('didnotmatchanyanswer', 'question'), 0),
                null => question_possible_response::no_response()
            ),
        ), $this->qtype->get_possible_responses($q));
    }
开发者ID:nutanrajmalanai,项目名称:moodle,代码行数:13,代码来源:testquestiontype.php


示例13: get_possible_responses

    public function get_possible_responses($questiondata) {
        if ($questiondata->options->single) {
            $responses = array();

            foreach ($questiondata->options->answers as $aid => $answer) {
                $responses[$aid] = new question_possible_response(html_to_text(format_text(
                        $answer->answer, $answer->answerformat, array('noclean' => true)),
                        0, false), $answer->fraction);
            }

            $responses[null] = question_possible_response::no_response();
            return array($questiondata->id => $responses);
        } else {
            $parts = array();

            foreach ($questiondata->options->answers as $aid => $answer) {
                $parts[$aid] = array($aid =>
                        new question_possible_response(html_to_text(format_text(
                        $answer->answer, $answer->answerformat, array('noclean' => true)),
                        0, false), $answer->fraction));
            }

            return $parts;
        }
    }
开发者ID:nigeldaley,项目名称:moodle,代码行数:25,代码来源:questiontype.php


示例14: test_get_possible_responses

 public function test_get_possible_responses()
 {
     $q = $this->get_test_question_data();
     $this->assertEqual(array($q->id => array(13 => new question_possible_response('42 m (41.5..42.5)', 1), 14 => new question_possible_response('*', 0.1), null => question_possible_response::no_response())), $this->qtype->get_possible_responses($q));
 }
开发者ID:sebastiansanio,项目名称:tallerdeprogramacion2fiuba,代码行数:5,代码来源:testquestiontype.php


示例15: get_possible_responses

 public function get_possible_responses($questiondata)
 {
     $parts = array();
     $q = $this->make_question($questiondata);
     foreach ($q->prts as $index => $prt) {
         foreach ($prt->get_nodes_summary() as $nodeid => $choices) {
             $parts[$index . '-' . $nodeid] = array($choices->falsenote => new question_possible_response($choices->falsenote, $choices->falsescore * $prt->get_value()), $choices->truenote => new question_possible_response($choices->truenote, $choices->truescore * $prt->get_value()), null => question_possible_response::no_response());
         }
     }
     return $parts;
 }
开发者ID:profcab,项目名称:moodle-qtype_stack,代码行数:11,代码来源:questiontype.php


示例16: get_possible_responses

 public function get_possible_responses($questiondata)
 {
     $question = $this->make_question($questiondata);
     $parts = array();
     foreach ($question->places as $placeno => $place) {
         $choices = array();
         foreach ($question->choices[$place->group] as $i => $choice) {
             $correct = $question->rightchoices[$placeno] == $i;
             $choices[$choice->no] = new question_possible_response($choice->summarise(), $correct ? 1 : 0);
         }
         $choices[null] = question_possible_response::no_response();
         $parts[$placeno] = $choices;
     }
     return $parts;
 }
开发者ID:evltuma,项目名称:moodle,代码行数:15,代码来源:questiontypebase.php


示例17: get_possible_responses

 public function get_possible_responses($questiondata)
 {
     $responses = array();
     $virtualqtype = $this->get_virtual_qtype();
     $unit = $virtualqtype->get_default_numerical_unit($questiondata);
     $tolerancetypes = $this->tolerance_types();
     $starfound = false;
     foreach ($questiondata->options->answers as $aid => $answer) {
         $responseclass = $answer->answer;
         if ($responseclass === '*') {
             $starfound = true;
         } else {
             $a = new stdClass();
             $a->answer = $virtualqtype->add_unit($questiondata, $responseclass, $unit);
             $a->tolerance = $answer->tolerance;
             $a->tolerancetype = $tolerancetypes[$answer->tolerancetype];
             $responseclass = get_string('answerwithtolerance', 'qtype_calculated', $a);
         }
         $responses[$aid] = new question_possible_response($responseclass, $answer->fraction);
     }
     if (!$starfound) {
         $responses[0] = new question_possible_response(get_string('didnotmatchanyanswer', 'question'), 0);
     }
     $responses[null] = question_possible_response::no_response();
     return array($questiondata->id => $responses);
 }
开发者ID:EmmanuelYupit,项目名称:educursos,代码行数:26,代码来源:questiontype.php


示例18: test_get_possible_responses_test3

 public function test_get_possible_responses_test3()
 {
     $qdata = test_question_maker::get_question_data('stack', 'test3');
     $expected = array('odd-0' => array('odd-0-0' => new question_possible_response('odd-0-0', 0), 'odd-0-1' => new question_possible_response('odd-0-1', 0.25), null => question_possible_response::no_response()), 'even-0' => array('even-0-0' => new question_possible_response('even-0-0', 0), 'even-0-1' => new question_possible_response('even-0-1', 0.25), null => question_possible_response::no_response()), 'oddeven-0' => array('oddeven-0-0' => new question_possible_response('oddeven-0-0', 0), 'oddeven-0-1' => new question_possible_response('oddeven-0-1', 0.125), null => question_possible_response::no_response()), 'oddeven-1' => array('oddeven-1-0' => new question_possible_response('oddeven-1-0', 0), 'oddeven-1-1' => new question_possible_response('oddeven-1-1', 0.125), null => question_possible_response::no_response()), 'unique-0' => array('unique-0-0' => new question_possible_response('unique-0-0', 0), 'unique-0-1' => new question_possible_response('unique-0-1', 0.25), null => question_possible_response::no_response()));
     $this->assertEquals($expected, $this->qtype->get_possible_responses($qdata));
 }
开发者ID:sowirepo,项目名称:moodle-qtype_stack,代码行数:6,代码来源:questiontype_test.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP question_state类代码示例发布时间:2022-05-23
下一篇:
PHP question_engine_data_mapper类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap