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


PHP question_possible_response类代码示例

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


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


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