本文整理汇总了PHP中test_question_maker::set_standard_combined_feedback_fields方法的典型用法代码示例。如果您正苦于以下问题:PHP test_question_maker::set_standard_combined_feedback_fields方法的具体用法?PHP test_question_maker::set_standard_combined_feedback_fields怎么用?PHP test_question_maker::set_standard_combined_feedback_fields使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类test_question_maker
的用法示例。
在下文中一共展示了test_question_maker::set_standard_combined_feedback_fields方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: get_test_question_data
protected function get_test_question_data()
{
global $USER;
$q = new stdClass();
$q->id = 0;
$q->name = 'Drag and drop matching question';
$q->category = 0;
$q->contextid = 0;
$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->stamp = make_unique_id_code();
$q->version = make_unique_id_code();
$q->hidden = 0;
$q->timecreated = time();
$q->timemodified = time();
$q->createdby = $USER->id;
$q->modifiedby = $USER->id;
$q->options = new stdClass();
$q->options->shuffleanswers = false;
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', 'answertextformat' => FORMAT_HTML), 15 => (object) array('id' => 15, 'questiontext' => 'cat', 'questiontextformat' => FORMAT_HTML, 'answertext' => 'mammal', 'answertextformat' => FORMAT_HTML), 16 => (object) array('id' => 16, 'questiontext' => 'newt', 'questiontextformat' => FORMAT_HTML, 'answertext' => 'amphibian', 'answertextformat' => FORMAT_HTML), 17 => (object) array('id' => 17, 'questiontext' => '', 'questiontextformat' => FORMAT_HTML, 'answertext' => 'insect', 'answertextformat' => FORMAT_HTML));
return $q;
}
示例2: get_test_question_data
/**
* @return object the data to construct a question like
* {@link qtype_ddwtos_test_helper::make_ddwtos_question_fox()}.
*/
protected function get_test_question_data()
{
global $USER;
$dd = new stdClass();
$dd->id = 0;
$dd->category = 0;
$dd->contextid = 0;
$dd->parent = 0;
$dd->questiontextformat = FORMAT_HTML;
$dd->generalfeedbackformat = FORMAT_HTML;
$dd->defaultmark = 1;
$dd->penalty = 0.3333333;
$dd->length = 1;
$dd->stamp = make_unique_id_code();
$dd->version = make_unique_id_code();
$dd->hidden = 0;
$dd->timecreated = time();
$dd->timemodified = time();
$dd->createdby = $USER->id;
$dd->modifiedby = $USER->id;
$dd->name = 'Drag-and-drop words into sentences question';
$dd->questiontext = 'The [[1]] brown [[2]] jumped over the [[3]] dog.';
$dd->generalfeedback = 'This sentence uses each letter of the alphabet.';
$dd->qtype = 'ddwtos';
$dd->options = new stdClass();
$dd->options->shuffleanswers = true;
test_question_maker::set_standard_combined_feedback_fields($dd->options);
$dd->options->answers = array((object) array('answer' => 'quick', 'feedback' => 'O:8:"stdClass":2:{s:9:"draggroup";s:1:"1";s:8:"infinite";i:0;}'), (object) array('answer' => 'fox', 'feedback' => 'O:8:"stdClass":2:{s:9:"draggroup";s:1:"2";s:8:"infinite";i:0;}'), (object) array('answer' => 'lazy', 'feedback' => 'O:8:"stdClass":2:{s:9:"draggroup";s:1:"3";s:8:"infinite";i:0;}'), (object) array('answer' => 'assiduous', 'feedback' => 'O:8:"stdClass":2:{s:9:"draggroup";s:1:"3";s:8:"infinite";i:0;}'), (object) array('answer' => 'dog', 'feedback' => 'O:8:"stdClass":2:{s:9:"draggroup";s:1:"2";s:8:"infinite";i:0;}'), (object) array('answer' => 'slow', 'feedback' => 'O:8:"stdClass":2:{s:9:"draggroup";s:1:"1";s:8:"infinite";i:0;}'));
return $dd;
}
示例3: get_test_question_data
protected function get_test_question_data()
{
global $USER;
$q = new stdClass();
$q->id = 0;
$q->name = 'Gapfill Question';
$q->category = 0;
$q->contextid = 0;
$q->parent = 0;
$q->questiontext = 'The [cat] sat on the [mat]';
$q->questiontextformat = FORMAT_HTML;
$q->generalfeedback = 'General feedback.';
$q->generalfeedbackformat = FORMAT_HTML;
$q->defaultmark = 1;
$q->penalty = 0.3333333;
$q->length = 1;
$q->stamp = make_unique_id_code();
$q->version = make_unique_id_code();
$q->hidden = 0;
$q->timecreated = time();
$q->timemodified = time();
$q->createdby = $USER->id;
$q->modifiedby = $USER->id;
$q->options = new stdClass();
test_question_maker::set_standard_combined_feedback_fields($q->options);
$q->options->displayanswers = 0;
$q->options->delimitchars = "[]";
return $q;
}
示例4: get_test_question_data
/**
* @return object the data to construct a question like
* {@link qtype_gapselect_test_helper::make_a_gapselect_question()}.
*/
protected function get_test_question_data()
{
global $USER;
$gapselect = new stdClass();
$gapselect->id = 0;
$gapselect->category = 0;
$gapselect->contextid = 0;
$gapselect->parent = 0;
$gapselect->questiontextformat = FORMAT_HTML;
$gapselect->generalfeedbackformat = FORMAT_HTML;
$gapselect->defaultmark = 1;
$gapselect->penalty = 0.3333333;
$gapselect->length = 1;
$gapselect->stamp = make_unique_id_code();
$gapselect->version = make_unique_id_code();
$gapselect->hidden = 0;
$gapselect->timecreated = time();
$gapselect->timemodified = time();
$gapselect->createdby = $USER->id;
$gapselect->modifiedby = $USER->id;
$gapselect->name = 'Selection from drop down list question';
$gapselect->questiontext = 'The [[1]] brown [[2]] jumped over the [[3]] dog.';
$gapselect->generalfeedback = 'This sentence uses each letter of the alphabet.';
$gapselect->qtype = 'gapselect';
$gapselect->options = new stdClass();
$gapselect->options->shuffleanswers = true;
test_question_maker::set_standard_combined_feedback_fields($gapselect->options);
$gapselect->options->answers = array((object) array('answer' => 'quick', 'feedback' => '1'), (object) array('answer' => 'fox', 'feedback' => '2'), (object) array('answer' => 'lazy', 'feedback' => '3'), (object) array('answer' => 'assiduous', 'feedback' => '3'), (object) array('answer' => 'dog', 'feedback' => '2'), (object) array('answer' => 'slow', 'feedback' => '1'));
return $gapselect;
}
示例5: make_a_multichoiceset_question
/**
* Makes a multichoice all or nothing question with choices 'A', 'B', 'C' and 'D' shuffled.
* 'A' and 'C' is correct, defaultmark 1.
* @return qtype_multichoiceset_question
*/
public static function make_a_multichoiceset_question()
{
question_bank::load_question_definition_classes('multichoiceset');
$mc = new qtype_multichoiceset_question();
test_question_maker::initialise_a_question($mc);
$mc->name = 'Multi-choice all or nothing question';
$mc->questiontext = 'The answer is A and C.';
$mc->generalfeedback = 'You should have selected A and C.';
$mc->qtype = question_bank::get_qtype('multichoiceset');
$mc->shuffleanswers = 1;
$mc->answernumbering = 'abc';
test_question_maker::set_standard_combined_feedback_fields($mc);
$mc->answers = array(13 => new question_answer(13, 'A', 0.5, 'A is part of the right answer', FORMAT_HTML), 14 => new question_answer(14, 'B', 0, 'B is wrong', FORMAT_HTML), 15 => new question_answer(15, 'C', 0.5, 'C is part of the right answer', FORMAT_HTML), 16 => new question_answer(16, 'D', 0, 'D is wrong', FORMAT_HTML));
return $mc;
}
示例6: test_grading_rounding_three_right
public function test_grading_rounding_three_right()
{
question_bank::load_question_definition_classes('multichoice');
$mc = new qtype_multichoice_multi_question();
test_question_maker::initialise_a_question($mc);
$mc->name = 'Odd numbers';
$mc->questiontext = 'Which are the odd numbers?';
$mc->generalfeedback = '1, 3 and 5 are the odd numbers.';
$mc->qtype = question_bank::get_qtype('multichoice');
$mc->answernumbering = 'abc';
test_question_maker::set_standard_combined_feedback_fields($mc);
$mc->answers = array(11 => new question_answer(11, '1', 0.3333333, '', FORMAT_HTML), 12 => new question_answer(12, '2', -1, '', FORMAT_HTML), 13 => new question_answer(13, '3', 0.3333333, '', FORMAT_HTML), 14 => new question_answer(14, '4', -1, '', FORMAT_HTML), 15 => new question_answer(15, '5', 0.3333333, '', FORMAT_HTML), 16 => new question_answer(16, '6', -1, '', FORMAT_HTML));
$mc->start_attempt(new question_attempt_step(), 1);
list($grade, $state) = $mc->grade_response($mc->prepare_simulated_post_data(array('1' => '1', '3' => '1', '5' => '1')));
$this->assertEquals(1, $grade, '', 1.0E-6);
$this->assertEquals(question_state::$gradedright, $state);
}
示例7: make_a_maths_gapselect_question
/**
* @return qtype_gapselect_question
*/
public static function make_a_maths_gapselect_question()
{
question_bank::load_question_definition_classes('gapselect');
$gapselect = new qtype_gapselect_question();
test_question_maker::initialise_a_question($gapselect);
$gapselect->name = 'Selection from drop down list question';
$gapselect->questiontext = 'Fill in the operators to make this equation work: ' . '7 [[1]] 11 [[2]] 13 [[1]] 17 [[2]] 19 = 3';
$gapselect->generalfeedback = 'This sentence uses each letter of the alphabet.';
$gapselect->qtype = question_bank::get_qtype('gapselect');
$gapselect->shufflechoices = true;
test_question_maker::set_standard_combined_feedback_fields($gapselect);
$gapselect->choices = array(1 => array(1 => new qtype_gapselect_choice('+', 1, true), 2 => new qtype_gapselect_choice('-', 1, true), 3 => new qtype_gapselect_choice('*', 1, true), 4 => new qtype_gapselect_choice('/', 1, true)));
$gapselect->places = array(1 => 1, 2 => 1, 3 => 1, 4 => 1);
$gapselect->rightchoices = array(1 => 1, 2 => 2, 3 => 1, 4 => 2);
$gapselect->textfragments = array('7 ', ' 11 ', ' 13 ', ' 17 ', ' 19 = 3');
return $gapselect;
}
示例8: make_randomsamatch_question_animals
/**
* Makes a randomsamatch question similar to the match question returned
* by {@link make_a_matching_question}, but with no 'insect' distractor.
* @return qtype_randomsamatch_question
*/
public function make_randomsamatch_question_animals()
{
question_bank::load_question_definition_classes('randomsamatch');
$q = new qtype_randomsamatch_question();
test_question_maker::initialise_a_question($q);
$q->name = 'Random shortanswer matching question';
$q->questiontext = 'Classify the animals.';
$q->generalfeedback = 'Frogs and toads are amphibians, the others are mammals.';
$q->qtype = question_bank::get_qtype('randomsamatch');
test_question_maker::set_standard_combined_feedback_fields($q);
$q->shufflestems = false;
$q->stems = array();
$q->choices = array();
$q->right = array();
// Now we create 4 shortanswers question,
// but we just fill the needed fields.
question_bank::load_question_definition_classes('shortanswer');
$sa1 = new qtype_shortanswer_question();
test_question_maker::initialise_a_question($sa1);
$sa1->id = 25;
$sa1->questiontext = 'Dog';
$sa1->answers = array(13 => new question_answer(13, 'Mammal', 1.0, 'Correct.', FORMAT_HTML), 14 => new question_answer(14, 'Animal', 0.5, 'There is a betterresponse.', FORMAT_HTML), 15 => new question_answer(15, '*', 0.0, 'That is a bad answer.', FORMAT_HTML));
$sa1->qtype = question_bank::get_qtype('shortanswer');
$sa2 = new qtype_shortanswer_question();
test_question_maker::initialise_a_question($sa2);
$sa2->id = 26;
$sa2->questiontext = 'Frog';
$sa2->answers = array(16 => new question_answer(16, 'Amphibian', 1.0, 'Correct.', FORMAT_HTML), 17 => new question_answer(17, 'A Prince', 1.0, 'Maybe.', FORMAT_HTML), 18 => new question_answer(18, '*', 0.0, 'That is a bad answer.', FORMAT_HTML));
$sa2->qtype = question_bank::get_qtype('shortanswer');
$sa3 = new qtype_shortanswer_question();
test_question_maker::initialise_a_question($sa3);
$sa3->id = 27;
$sa3->questiontext = 'Toad';
$sa3->answers = array(19 => new question_answer(19, 'Amphibian', 1.0, 'Correct.', FORMAT_HTML), 20 => new question_answer(20, '*', 0.0, 'That is a bad answer.', FORMAT_HTML));
$sa3->qtype = question_bank::get_qtype('shortanswer');
$sa4 = new qtype_shortanswer_question();
test_question_maker::initialise_a_question($sa4);
$sa4->id = 28;
$sa4->questiontext = 'Cat';
$sa4->answers = array(21 => new question_answer(21, 'Mammal', 1.0, 'Correct.', FORMAT_HTML));
$sa4->qtype = question_bank::get_qtype('shortanswer');
$q->questionsloader = new qtype_randomsamatch_test_question_loader(array(), 4, array($sa1, $sa2, $sa3, $sa4));
return $q;
}
示例9: make_a_ddmatching_question
/**
* Makes a matching question to classify 'Dog', 'Frog', 'Toad' and 'Cat' as
* 'Mammal', 'Amphibian' or 'Insect'.
* defaultmark 1. Stems are shuffled by default.
* @return qtype_match_question
*/
public static function make_a_ddmatching_question()
{
question_bank::load_question_definition_classes('ddmatch');
$ddmatch = new qtype_ddmatch_question();
test_question_maker::initialise_a_question($ddmatch);
$ddmatch->name = 'Drag and drop matching question';
$ddmatch->questiontext = 'Classify the animals.';
$ddmatch->generalfeedback = 'Frogs and toads are amphibians, the others are mammals.';
$ddmatch->qtype = question_bank::get_qtype('ddmatch');
$ddmatch->shufflestems = 1;
test_question_maker::set_standard_combined_feedback_fields($ddmatch);
// Using unset to get 1-based arrays.
$ddmatch->stems = array('', 'Dog', 'Frog', 'Toad', 'Cat');
$ddmatch->stemformat = array('', FORMAT_HTML, FORMAT_HTML, FORMAT_HTML, FORMAT_HTML);
$ddmatch->choices = array('', 'Mammal', 'Amphibian', 'Insect');
$ddmatch->choiceformat = array('', FORMAT_HTML, FORMAT_HTML, FORMAT_HTML);
$ddmatch->right = array('', 1, 2, 2, 1);
unset($ddmatch->stems[0]);
unset($ddmatch->stemformat[0]);
unset($ddmatch->choices[0]);
unset($ddmatch->right[0]);
return $ddmatch;
}
示例10: 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;
}
示例11: make_ddmarker_question_maths
/**
* @return qtype_ddmarker_question
*/
public function make_ddmarker_question_maths()
{
question_bank::load_question_definition_classes('ddmarker');
$dd = new qtype_ddmarker_question();
test_question_maker::initialise_a_question($dd);
$dd->name = 'Drag-and-drop markers question';
$dd->questiontext = 'Fill in the operators to make this equation work: ';
$dd->generalfeedback = 'Hmmmm...';
$dd->qtype = question_bank::get_qtype('ddmarker');
$dd->shufflechoices = true;
test_question_maker::set_standard_combined_feedback_fields($dd);
$dd->choices = $this->make_choice_structure(array(new qtype_ddmarker_drag_item('+', 1, 1), new qtype_ddmarker_drag_item('-', 2, 1), new qtype_ddmarker_drag_item('*', 3, 1), new qtype_ddmarker_drag_item('/', 4, 1)));
$dd->places = $this->make_place_structure(array(new qtype_ddmarker_drop_zone(1, 'circle', '50,50;50'), new qtype_ddmarker_drop_zone(2, 'rectangle', '100,0;100,100'), new qtype_ddmarker_drop_zone(3, 'polygon', '0,100;100,100;100,200;0,200')));
$dd->rightchoices = array(1 => 1, 2 => 1, 3 => 1);
return $dd;
}
示例12: make_ddimageortext_question_maths
/**
* Make a mathematical ddimageortext question.
*
* @return qtype_ddimageortext_question
*/
public function make_ddimageortext_question_maths()
{
question_bank::load_question_definition_classes('ddimageortext');
$dd = new qtype_ddimageortext_question();
test_question_maker::initialise_a_question($dd);
$dd->name = 'Drag-and-drop onto image question';
$dd->questiontext = 'Fill in the operators to make this equation work: ' . '7 [[1]] 11 [[2]] 13 [[1]] 17 [[2]] 19 = 3';
$dd->generalfeedback = 'This sentence uses each letter of the alphabet.';
$dd->qtype = question_bank::get_qtype('ddimageortext');
$dd->shufflechoices = true;
test_question_maker::set_standard_combined_feedback_fields($dd);
$dd->choices = $this->make_choice_structure(array(new qtype_ddimageortext_drag_item('+', 1, 1), new qtype_ddimageortext_drag_item('-', 2, 1)));
$dd->places = $this->make_place_structure(array(new qtype_ddimageortext_drop_zone('', 1, 1), new qtype_ddimageortext_drop_zone('', 2, 1), new qtype_ddimageortext_drop_zone('', 3, 1), new qtype_ddimageortext_drop_zone('', 4, 1)));
$dd->rightchoices = array(1 => 1, 2 => 2, 3 => 1, 4 => 2);
return $dd;
}