Moodle  2.2.1
http://www.collinsharper.com
C:/xampp/htdocs/moodle/question/type/truefalse/simpletest/helper.php
Go to the documentation of this file.
00001 <?php
00002 // This file is part of Moodle - http://moodle.org/
00003 //
00004 // Moodle is free software: you can redistribute it and/or modify
00005 // it under the terms of the GNU General Public License as published by
00006 // the Free Software Foundation, either version 3 of the License, or
00007 // (at your option) any later version.
00008 //
00009 // Moodle is distributed in the hope that it will be useful,
00010 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00011 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00012 // GNU General Public License for more details.
00013 //
00014 // You should have received a copy of the GNU General Public License
00015 // along with Moodle.  If not, see <http://www.gnu.org/licenses/>.
00016 
00027 defined('MOODLE_INTERNAL') || die();
00028 
00029 
00036 class qtype_truefalse_test_helper extends question_test_helper {
00037     public function get_test_questions() {
00038         return array('true', 'false');
00039     }
00040 
00045     public function make_truefalse_question_true() {
00046         question_bank::load_question_definition_classes('truefalse');
00047         $tf = new qtype_truefalse_question();
00048         test_question_maker::initialise_a_question($tf);
00049         $tf->name = 'True/false question';
00050         $tf->questiontext = 'The answer is true.';
00051         $tf->generalfeedback = 'You should have selected true.';
00052         $tf->penalty = 1;
00053         $tf->qtype = question_bank::get_qtype('truefalse');
00054 
00055         $tf->rightanswer = true;
00056         $tf->truefeedback = 'This is the right answer.';
00057         $tf->falsefeedback = 'This is the wrong answer.';
00058         $tf->truefeedbackformat = FORMAT_HTML;
00059         $tf->falsefeedbackformat = FORMAT_HTML;
00060         $tf->trueanswerid = 13;
00061         $tf->falseanswerid = 14;
00062 
00063         return $tf;
00064     }
00065 
00070     public function make_truefalse_question_false() {
00071         question_bank::load_question_definition_classes('truefalse');
00072         $tf = new qtype_truefalse_question();
00073         test_question_maker::initialise_a_question($tf);
00074         $tf->name = 'True/false question';
00075         $tf->questiontext = 'The answer is false.';
00076         $tf->generalfeedback = 'You should have selected false.';
00077         $tf->penalty = 1;
00078         $tf->qtype = question_bank::get_qtype('truefalse');
00079 
00080         $tf->rightanswer = false;
00081         $tf->truefeedback = 'This is the wrong answer.';
00082         $tf->falsefeedback = 'This is the right answer.';
00083         $tf->truefeedbackformat = FORMAT_HTML;
00084         $tf->falsefeedbackformat = FORMAT_HTML;
00085         $tf->trueanswerid = 13;
00086         $tf->falseanswerid = 14;
00087 
00088         return $tf;
00089     }
00090 }
 All Data Structures Namespaces Files Functions Variables Enumerations