本文整理汇总了PHP中test_question_maker::initialise_question_data方法的典型用法代码示例。如果您正苦于以下问题:PHP test_question_maker::initialise_question_data方法的具体用法?PHP test_question_maker::initialise_question_data怎么用?PHP test_question_maker::initialise_question_data使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类test_question_maker
的用法示例。
在下文中一共展示了test_question_maker::initialise_question_data方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_calculated_question_data_sum
/**
* Makes a calculated question about summing two numbers.
* @return qtype_calculated_question
*/
public function get_calculated_question_data_sum()
{
question_bank::load_question_definition_classes('calculated');
$qdata = new stdClass();
test_question_maker::initialise_question_data($qdata);
$qdata->qtype = 'calculated';
$qdata->name = 'Simple sum';
$qdata->questiontext = 'What is {a} + {b}?';
$qdata->generalfeedback = 'Generalfeedback: {={a} + {b}} is the right answer.';
$qdata->options = new stdClass();
$qdata->options->unitgradingtype = 0;
$qdata->options->unitpenalty = 0.0;
$qdata->options->showunits = qtype_numerical::UNITNONE;
$qdata->options->unitsleft = 0;
$qdata->options->synchronize = 0;
$qdata->options->answers = array(13 => new qtype_numerical_answer(13, '{a} + {b}', 1.0, 'Very good.', FORMAT_HTML, 0.001), 14 => new qtype_numerical_answer(14, '{a} - {b}', 0.0, 'Add. not subtract!.', FORMAT_HTML, 0.001), 17 => new qtype_numerical_answer(17, '*', 0.0, 'Completely wrong.', FORMAT_HTML, 0));
foreach ($qdata->options->answers as $answer) {
$answer->correctanswerlength = 2;
$answer->correctanswerformat = 1;
}
$qdata->options->units = array();
return $qdata;
}
示例2: get_match_question_data_foursubq
/**
* Makes a match question about completing two blanks in some text.
* @return object the question definition data, as it might be returned from
* get_question_options.
*/
public function get_match_question_data_foursubq()
{
global $USER;
$q = new stdClass();
test_question_maker::initialise_question_data($q);
$q->name = 'Matching question';
$q->qtype = 'match';
$q->parent = 0;
$q->questiontext = 'Classify the animals.';
$q->questiontextformat = FORMAT_HTML;
$q->generalfeedback = 'General feedback.';
$q->generalfeedbackformat = FORMAT_HTML;
$q->defaultmark = 1;
$q->penalty = 0.3333333;
$q->length = 1;
$q->hidden = 0;
$q->createdby = $USER->id;
$q->modifiedby = $USER->id;
$q->options = new stdClass();
$q->options->shuffleanswers = 1;
test_question_maker::set_standard_combined_feedback_fields($q->options);
$q->options->subquestions = array(14 => (object) array('id' => 14, 'questiontext' => 'frog', 'questiontextformat' => FORMAT_HTML, 'answertext' => 'amphibian'), 15 => (object) array('id' => 15, 'questiontext' => 'cat', 'questiontextformat' => FORMAT_HTML, 'answertext' => 'mammal'), 16 => (object) array('id' => 16, 'questiontext' => 'newt', 'questiontextformat' => FORMAT_HTML, 'answertext' => 'amphibian'), 17 => (object) array('id' => 17, 'questiontext' => '', 'questiontextformat' => FORMAT_HTML, 'answertext' => 'insect'));
return $q;
}
示例3: get_multianswer_question_data_twosubq
/**
* Makes a multianswer question about completing two blanks in some text.
* @return object the question definition data, as it might be returned from
* get_question_options.
*/
public function get_multianswer_question_data_twosubq() {
$qdata = new stdClass();
test_question_maker::initialise_question_data($qdata);
$qdata->name = 'Simple multianswer';
$qdata->questiontext =
'Complete this opening line of verse: "The {#1} and the {#2} went to sea".';
$qdata->generalfeedback = 'General feedback: It\'s from "The Owl and the Pussy-cat" by Lear: ' .
'"The owl and the pussycat went to sea';
$qdata->defaultmark = 2.0;
$qdata->qtype = 'multianswer';
$sa = new stdClass();
test_question_maker::initialise_question_data($sa);
$sa->name = 'Simple multianswer';
$sa->questiontext = '{1:SHORTANSWER:Dog#Wrong, silly!~=Owl#Well done!~*#Wrong answer}';
$sa->generalfeedback = '';
$sa->penalty = 0.0;
$sa->qtype = 'shortanswer';
$sa->options = new stdClass();
$sa->options->usecase = 0;
$sa->options->answers = array(
13 => new question_answer(13, 'Dog', 0, 'Wrong, silly!', FORMAT_HTML),
14 => new question_answer(14, 'Owl', 1, 'Well done!', FORMAT_HTML),
15 => new question_answer(15, '*', 0, 'Wrong answer', FORMAT_HTML),
);
$mc = new stdClass();
test_question_maker::initialise_question_data($mc);
$mc->name = 'Simple multianswer';
$mc->questiontext = '{1:MULTICHOICE:Bow-wow#You seem to have a dog obsessions!~' .
'Wiggly worm#Now you are just being ridiculous!~=Pussy-cat#Well done!}';
$mc->generalfeedback = '';
$mc->penalty = 0.0;
$mc->qtype = 'multichoice';
$mc->options = new stdClass();
$mc->options->layout = 0;
$mc->options->single = 1;
$mc->options->shuffleanswers = 1;
$mc->options->correctfeedback = '';
$mc->options->correctfeedbackformat = 1;
$mc->options->partiallycorrectfeedback = '';
$mc->options->partiallycorrectfeedbackformat = 1;
$mc->options->incorrectfeedback = '';
$mc->options->incorrectfeedbackformat = 1;
$mc->options->answernumbering = '';
$mc->options->shownumcorrect = 0;
$mc->options->answers = array(
23 => new question_answer(23, 'Bow-wow', 0,
'You seem to have a dog obsessions!', FORMAT_HTML),
24 => new question_answer(24, 'Wiggly worm', 0,
'Now you are just being ridiculous!', FORMAT_HTML),
25 => new question_answer(25, 'Pussy-cat', 1,
'Well done!', FORMAT_HTML),
);
$qdata->options = new stdClass();
$qdata->options->questions = array(
1 => $sa,
2 => $mc,
);
$qdata->hints = array(
new question_hint(0, 'Hint 1', FORMAT_HTML),
new question_hint(0, 'Hint 2', FORMAT_HTML),
);
return $qdata;
}
示例4: get_transcription_question_data_frogonly
/**
* Gets the question data for a transcription questionwith just the correct
* ansewer 'frog', and no other answer matching.
* @return stdClass
*/
public function get_transcription_question_data_frogonly()
{
$qdata = new stdClass();
test_question_maker::initialise_question_data($qdata);
$qdata->qtype = 'transcription';
$qdata->name = 'Transcription question';
$qdata->questiontext = 'Name the best amphibian: __________';
$qdata->generalfeedback = 'Generalfeedback: you should have said frog.';
$qdata->options = new stdClass();
$qdata->options->usecase = false;
$qdata->options->answers = array(13 => new question_answer(13, 'frog', 1.0, 'Frog is right.', FORMAT_HTML));
return $qdata;
}
示例5: get_gapfill_question_data_catmat
/**
* Gets the question data for a shortanswer questionwith just the correct
* ansewer 'frog', and no other answer matching.
* @return stdClass
*/
public function get_gapfill_question_data_catmat()
{
$qdata = new stdClass();
test_question_maker::initialise_question_data($qdata);
$qdata->qtype = 'gapfill';
$qdata->name = 'catmat';
$qdata->questiontext = 'The [cat] sat on the [mat]';
$qdata->generalfeedback = 'someanswer';
$qdata->options = new stdClass();
$qdata->options->casesensitive = false;
return $qdata;
}
示例6: get_multianswer_question_data_dollarsigns
/**
* Makes a multianswer question onetaining one blank in some text.
* This question has no hints.
*
* @return object the question definition data, as it might be returned from
* get_question_options.
*/
public function get_multianswer_question_data_dollarsigns()
{
$qdata = new stdClass();
test_question_maker::initialise_question_data($qdata);
$qdata->name = 'Multianswer with $s';
$qdata->questiontext = 'Which is the right order? {#1}';
$qdata->generalfeedback = '';
$qdata->defaultmark = 1.0;
$qdata->qtype = 'multianswer';
$mc = new stdClass();
test_question_maker::initialise_question_data($mc);
$mc->name = 'Multianswer with $s';
$mc->questiontext = '{1:MULTICHOICE:=y,y,$3~$3,y,y}';
$mc->generalfeedback = '';
$mc->penalty = 0.0;
$mc->qtype = 'multichoice';
$mc->options = new stdClass();
$mc->options->layout = 0;
$mc->options->single = 1;
$mc->options->shuffleanswers = 0;
$mc->options->correctfeedback = '';
$mc->options->correctfeedbackformat = 1;
$mc->options->partiallycorrectfeedback = '';
$mc->options->partiallycorrectfeedbackformat = 1;
$mc->options->incorrectfeedback = '';
$mc->options->incorrectfeedbackformat = 1;
$mc->options->answernumbering = 0;
$mc->options->shownumcorrect = 0;
$mc->options->answers = array(23 => new question_answer(23, 'y,y,$3', 0, '', FORMAT_HTML), 24 => new question_answer(24, '$3,y,y', 0, '', FORMAT_HTML));
$qdata->options = new stdClass();
$qdata->options->questions = array(1 => $mc);
$qdata->hints = array();
return $qdata;
}
示例7: get_stack_question_data_test3
/**
* @return qtype_stack_question the question from the test3.xml file.
*/
public static function get_stack_question_data_test3()
{
question_bank::load_question_definition_classes('stack');
$qdata = new stdClass();
test_question_maker::initialise_question_data($qdata);
$qdata->contextid = context_system::instance()->id;
$qdata->qtype = 'stack';
$qdata->name = 'test-3';
$qdata->questiontext = '<p>1. Give an example of an odd function by typing
an expression which represents it.
$f_1(x)=$ [[input:ans1]].
[[validation:ans1]]
[[feedback:odd]]</p>
<p>2. Give an example of an even function.
$f_2(x)=$ [[input:ans2]].
[[validation:ans2]]
[[feedback:even]]</p>
<p>3. Give an example of a function which is odd and even.
$f_3(x)=$ [[input:ans3]].
[[validation:ans3]]
[[feedback:oddeven]]</p>
<p>4. Is the answer to 3. unique? [[input:ans4]]
(Or are there many different possibilities.)
[[validation:ans4]]
[[feedback:unique]]</p>';
$qdata->generalfeedback = '';
$qdata->penalty = 0.4;
$qdata->options = new stdClass();
$qdata->options->id = 0;
$qdata->options->questionvariables = '';
$qdata->options->specificfeedback = '';
$qdata->options->specificfeedbackformat = FORMAT_HTML;
$qdata->options->questionnote = '';
$qdata->options->questionsimplify = 1;
$qdata->options->assumepositive = 0;
$qdata->options->markmode = 'penalty';
$qdata->options->prtcorrect = self::DEFAULT_CORRECT_FEEDBACK;
$qdata->options->prtcorrectformat = FORMAT_HTML;
$qdata->options->prtpartiallycorrect = self::DEFAULT_PARTIALLYCORRECT_FEEDBACK;
$qdata->options->prtpartiallycorrectformat = FORMAT_HTML;
$qdata->options->prtincorrect = self::DEFAULT_INCORRECT_FEEDBACK;
$qdata->options->prtincorrectformat = FORMAT_HTML;
$qdata->options->multiplicationsign = 'dot';
$qdata->options->sqrtsign = 1;
$qdata->options->complexno = 'i';
$qdata->options->inversetrig = 'cos-1';
$qdata->options->matrixparens = '[';
$qdata->options->variantsselectionseed = '';
$input = new stdClass();
$input->name = 'ans1';
$input->id = 0;
$input->questionid = 0;
$input->type = 'algebraic';
$input->tans = 'x^3';
$input->boxsize = 15;
$input->strictsyntax = 1;
$input->insertstars = 0;
$input->syntaxhint = '';
$input->forbidwords = '';
$input->allowwords = '';
$input->forbidfloat = 1;
$input->requirelowestterms = 0;
$input->checkanswertype = 0;
$input->mustverify = 1;
$input->showvalidation = 1;
$input->options = '';
$qdata->inputs['ans1'] = $input;
$input = new stdClass();
$input->name = 'ans2';
$input->id = 0;
$input->questionid = 0;
$input->type = 'algebraic';
$input->tans = 'x^4';
$input->boxsize = 15;
$input->strictsyntax = 1;
$input->insertstars = 0;
$input->syntaxhint = '';
$input->forbidwords = '';
$input->allowwords = '';
$input->forbidfloat = 1;
$input->requirelowestterms = 0;
$input->checkanswertype = 0;
$input->mustverify = 1;
$input->showvalidation = 1;
$input->options = '';
$qdata->inputs['ans2'] = $input;
$input = new stdClass();
$input->name = 'ans3';
$input->id = 0;
$input->questionid = 0;
$input->type = 'algebraic';
$input->tans = '0';
$input->boxsize = 15;
$input->strictsyntax = 1;
$input->insertstars = 0;
$input->syntaxhint = '';
$input->forbidwords = '';
//.........这里部分代码省略.........