/**
  * @return stdClass date to create a ddwtos question.
  */
 public function get_ddwtos_question_form_data_fox()
 {
     $fromform = new stdClass();
     $fromform->name = 'Drag-and-drop words into sentences question';
     $fromform->questiontext = array('text' => 'The [[1]] brown [[2]] jumped over the [[3]] dog.', 'format' => FORMAT_HTML);
     $fromform->defaultmark = 1.0;
     $fromform->generalfeedback = array('text' => 'This sentence uses each letter of the alphabet.', 'format' => FORMAT_HTML);
     $fromform->choices = array(array('answer' => 'quick', 'choicegroup' => '1'), array('answer' => 'fox', 'choicegroup' => '2'), array('answer' => 'lazy', 'choicegroup' => '3'), array('answer' => 'slow', 'choicegroup' => '1'), array('answer' => 'dog', 'choicegroup' => '2'), array('answer' => 'assiduous', 'choicegroup' => '3'));
     test_question_maker::set_standard_combined_feedback_form_data($fromform);
     $fromform->shownumcorrect = 0;
     $fromform->penalty = 0.3333333;
     return $fromform;
 }
示例#2
0
文件: helper.php 项目: evltuma/moodle
 /**
  * Makes a match question about completing two blanks in some text.
  * @return object the question definition data, as it might be returned from
  *      the question editing form.
  */
 public function get_match_question_form_data_foursubq()
 {
     $q = new stdClass();
     $q->name = 'Matching question';
     $q->questiontext = array('text' => 'Classify the animals.', 'format' => FORMAT_HTML);
     $q->generalfeedback = array('text' => 'General feedback.', 'format' => FORMAT_HTML);
     $q->defaultmark = 1;
     $q->penalty = 0.3333333;
     $q->shuffleanswers = 1;
     test_question_maker::set_standard_combined_feedback_form_data($q);
     $q->subquestions = array(0 => array('text' => 'frog', 'format' => FORMAT_HTML), 1 => array('text' => 'cat', 'format' => FORMAT_HTML), 2 => array('text' => 'newt', 'format' => FORMAT_HTML), 3 => array('text' => '', 'format' => FORMAT_HTML));
     $q->subanswers = array(0 => 'amphibian', 1 => 'mammal', 2 => 'amphibian', 3 => 'insect');
     $q->noanswers = 4;
     return $q;
 }
示例#3
0
文件: helper.php 项目: evltuma/moodle
 /**
  * @return stdClass date to create a ddimageortext question.
  */
 public function get_ddimageortext_question_form_data_xsection()
 {
     global $CFG, $USER;
     $fromform = new stdClass();
     $bgdraftitemid = 0;
     file_prepare_draft_area($bgdraftitemid, null, null, null, null);
     $fs = get_file_storage();
     $filerecord = new stdClass();
     $filerecord->contextid = context_user::instance($USER->id)->id;
     $filerecord->component = 'user';
     $filerecord->filearea = 'draft';
     $filerecord->itemid = $bgdraftitemid;
     $filerecord->filepath = '/';
     $filerecord->filename = 'oceanfloorbase.jpg';
     $fs->create_file_from_pathname($filerecord, $CFG->dirroot . '/question/type/ddimageortext/tests/fixtures/oceanfloorbase.jpg');
     $fromform->name = 'Geography cross-section';
     $fromform->questiontext = array('text' => '<p>Identify the features in this cross-section by dragging the labels into the boxes.</p>
                    <p><em>Use the mouse to drag the boxed words into the empty boxes. ' . 'Alternatively, use the tab key to select an empty box, ' . 'then use the space key to cycle through the options.</em></p>', 'format' => FORMAT_HTML);
     $fromform->defaultmark = 1;
     $fromform->generalfeedback = array('text' => '<p>More information about the major features of the Earth\'s surface ' . 'can be found in Block 3, Section 6.2.</p>', 'format' => FORMAT_HTML);
     $fromform->bgimage = $bgdraftitemid;
     $fromform->shuffleanswers = 0;
     $fromform->drags = array(array('dragitemtype' => 'word', 'draggroup' => '1', 'infinite' => '0'), array('dragitemtype' => 'word', 'draggroup' => '1', 'infinite' => '0'), array('dragitemtype' => 'word', 'draggroup' => '1', 'infinite' => '0'), array('dragitemtype' => 'word', 'draggroup' => '1', 'infinite' => '0'), array('dragitemtype' => 'word', 'draggroup' => '1', 'infinite' => '0'), array('dragitemtype' => 'word', 'draggroup' => '1', 'infinite' => '0'), array('dragitemtype' => 'word', 'draggroup' => '1', 'infinite' => '0'), array('dragitemtype' => 'word', 'draggroup' => '1', 'infinite' => '0'));
     $fromform->dragitem = array(0, 0, 0, 0, 0, 0, 0, 0);
     $fromform->draglabel = array('island<br/>arc', 'mid-ocean<br/>ridge', 'abyssal<br/>plain', 'continental<br/>rise', 'ocean<br/>trench', 'continental<br/>slope', 'mountain<br/>belt', 'continental<br/>shelf');
     $fromform->drops = array(array('xleft' => '53', 'ytop' => '17', 'choice' => '7', 'droplabel' => ''), array('xleft' => '172', 'ytop' => '2', 'choice' => '8', 'droplabel' => ''), array('xleft' => '363', 'ytop' => '31', 'choice' => '5', 'droplabel' => ''), array('xleft' => '440', 'ytop' => '13', 'choice' => '3', 'droplabel' => ''), array('xleft' => '115', 'ytop' => '74', 'choice' => '6', 'droplabel' => ''), array('xleft' => '210', 'ytop' => '94', 'choice' => '4', 'droplabel' => ''), array('xleft' => '310', 'ytop' => '87', 'choice' => '1', 'droplabel' => ''), array('xleft' => '479', 'ytop' => '84', 'choice' => '2', 'droplabel' => ''));
     test_question_maker::set_standard_combined_feedback_form_data($fromform);
     $fromform->penalty = '0.3333333';
     $fromform->hint = array(array('text' => '<p>Incorrect placements will be removed.</p>', 'format' => FORMAT_HTML), array('text' => '<ul>
                        <li>The abyssal plain is a flat almost featureless expanse of ocean ' . 'floor 4km to 6km below sea-level.</li>
                        <li>The continental rise is the gently sloping part of the ocean floor beyond the continental slope.</li>
                        <li>The continental shelf is the gently sloping ocean floor just offshore from the land.</li>
                        <li>The continental slope is the relatively steep part of the ocean floor ' . 'beyond the continental shelf.</li>
                        <li>A mid-ocean ridge is a broad submarine ridge several kilometres high.</li>
                        <li>A mountain belt is a long range of mountains.</li>
                        <li>An island arc is a chain of volcanic islands.</li>
                        <li>An oceanic trench is a deep trough in the ocean floor.</li>
                        </ul>', 'format' => FORMAT_HTML), array('text' => '<p>Incorrect placements will be removed.</p>', 'format' => FORMAT_HTML), array('text' => '<ul>
                        <li>The abyssal plain is a flat almost featureless expanse of ocean ' . 'floor 4km to 6km below sea-level.</li>
                        <li>The continental rise is the gently sloping part of the ocean floor beyond the continental slope.</li>
                        <li>The continental shelf is the gently sloping ocean floor just offshore from the land.</li>
                        <li>The continental slope is the relatively steep part of the ocean floor ' . 'beyond the continental shelf.</li>
                        <li>A mid-ocean ridge is a broad submarine ridge several kilometres high.</li>
                        <li>A mountain belt is a long range of mountains.</li>
                        <li>An island arc is a chain of volcanic islands.</li>
                        <li>An oceanic trench is a deep trough in the ocean floor.</li>
                        </ul>', 'format' => FORMAT_HTML));
     $fromform->hintclearwrong = array(1, 0, 1, 0);
     $fromform->hintshownumcorrect = array(1, 1, 1, 1);
     return $fromform;
 }
示例#4
0
文件: helper.php 项目: rezaies/moodle
    /**
     * Return the test data needed by the question generator (the data that
     * would come from saving the editing form).
     * @return stdClass date to create a ddmarkers question where one of the drag items has text '0'.
     */
    public function get_ddmarker_question_form_data_zerodrag() {
        global $CFG, $USER;
        $fromform = new stdClass();

        $bgdraftitemid = 0;
        file_prepare_draft_area($bgdraftitemid, null, null, null, null);
        $fs = get_file_storage();
        $filerecord = new stdClass();
        $filerecord->contextid = context_user::instance($USER->id)->id;
        $filerecord->component = 'user';
        $filerecord->filearea = 'draft';
        $filerecord->itemid = $bgdraftitemid;
        $filerecord->filepath = '/';
        $filerecord->filename = 'mkmap.png';
        $fs->create_file_from_pathname($filerecord, $CFG->dirroot .
                '/question/type/ddmarker/tests/fixtures/mkmap.png');

        $fromform->name = 'Drag digits';
        $fromform->questiontext = array(
            'text' => 'Put 0 in the left of the image, and 1 in the right.',
            'format' => FORMAT_HTML,
        );
        $fromform->defaultmark = 2;
        $fromform->generalfeedback = array(
            'text' => '',
            'format' => FORMAT_HTML,
        );
        $fromform->bgimage = $bgdraftitemid;
        $fromform->shuffleanswers = 0;

        $fromform->drags = array(
            array('label' => '0', 'noofdrags' => 1),
            array('label' => '1', 'noofdrags' => 1),
        );

        $fromform->drops = array(
            array('shape' => 'Rectangle', 'coords' => '0,0;272,389', 'choice' => 1),
            array('shape' => 'Rectangle', 'coords' => '272,0;272,389', 'choice' => 2),
        );

        test_question_maker::set_standard_combined_feedback_form_data($fromform);

        $fromform->penalty = '0.3333333';
        $fromform->hint = array(
            array(
                'text' => 'Hint 1.',
                'format' => FORMAT_HTML,
            ),
            array(
                'text' => 'Hint 2.',
                'format' => FORMAT_HTML,
            ),
        );
        $fromform->hintshownumcorrect = array(1, 1);
        $fromform->hintclearwrong = array(0, 1);
        $fromform->hintoptions = array(0, 1);

        return $fromform;
    }
 /**
  * @return stdClass date to create a ddmarkers question.
  */
 public function get_ddmarker_question_form_data_mkmap()
 {
     global $CFG, $USER;
     $fromform = new stdClass();
     $bgdraftitemid = 0;
     file_prepare_draft_area($bgdraftitemid, null, null, null, null);
     $fs = get_file_storage();
     $filerecord = new stdClass();
     $filerecord->contextid = context_user::instance($USER->id)->id;
     $filerecord->component = 'user';
     $filerecord->filearea = 'draft';
     $filerecord->itemid = $bgdraftitemid;
     $filerecord->filepath = '/';
     $filerecord->filename = 'mkmap.png';
     $fs->create_file_from_pathname($filerecord, $CFG->dirroot . '/question/type/ddmarker/tests/fixtures/mkmap.png');
     $fromform->name = 'Milton Keynes landmarks';
     $fromform->questiontext = array('text' => 'Please place the markers on the map of Milton Keynes and be aware that there is more than one railway station.', 'format' => FORMAT_HTML);
     $fromform->defaultmark = 1;
     $fromform->generalfeedback = array('text' => 'The Open University is at the junction of Brickhill Street and Groveway. There are three railway stations, Wolverton, Milton Keynes Central and Bletchley.', 'format' => FORMAT_HTML);
     $fromform->bgimage = $bgdraftitemid;
     $fromform->shuffleanswers = 0;
     $fromform->drags = array(array('label' => 'OU', 'noofdrags' => 1), array('label' => 'Railway station', 'noofdrags' => 3));
     $fromform->drops = array(array('shape' => 'Circle', 'coords' => '322,213;10', 'choice' => 1), array('shape' => 'Circle', 'coords' => '144,84;10', 'choice' => 2), array('shape' => 'Circle', 'coords' => '195,180;10', 'choice' => 2), array('shape' => 'Circle', 'coords' => '267,302;10', 'choice' => 2));
     test_question_maker::set_standard_combined_feedback_form_data($fromform);
     $fromform->penalty = '0.3333333';
     $fromform->hint = array(array('text' => 'You are trying to place four markers on the map.', 'format' => FORMAT_HTML), array('text' => 'You are trying to mark three railway stations.', 'format' => FORMAT_HTML));
     $fromform->hintshownumcorrect = array(1, 1);
     $fromform->hintclearwrong = array(0, 1);
     $fromform->hintoptions = array(0, 1);
     return $fromform;
 }