Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 1441
Línea 32... Línea 32...
32
 * @copyright  2010 The Open University
32
 * @copyright  2010 The Open University
33
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
33
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
34
 */
34
 */
35
class qtype_ddimageortext_test_helper extends question_test_helper {
35
class qtype_ddimageortext_test_helper extends question_test_helper {
36
    public function get_test_questions() {
36
    public function get_test_questions() {
37
        return array('fox', 'maths', 'xsection', 'mixedlang');
37
        return ['fox', 'maths', 'xsection', 'mixedlang', 'mathjax'];
38
    }
38
    }
Línea 39... Línea 39...
39
 
39
 
40
    /**
40
    /**
41
     * @return qtype_ddimageortext_question
41
     * @return qtype_ddimageortext_question
Línea 165... Línea 165...
165
                      'can be found in Block 3, Section 6.2.</p>',
165
                      'can be found in Block 3, Section 6.2.</p>',
166
            'format' => FORMAT_HTML,
166
            'format' => FORMAT_HTML,
167
        );
167
        );
168
        $fromform->bgimage = $bgdraftitemid;
168
        $fromform->bgimage = $bgdraftitemid;
169
        $fromform->shuffleanswers = 0;
169
        $fromform->shuffleanswers = 0;
-
 
170
        $fromform->dropzonevisibility = 0;
170
        $fromform->drags = array(
171
        $fromform->drags = array(
171
            array('dragitemtype' => 'word', 'draggroup' => '1', 'infinite' => '0'),
172
            array('dragitemtype' => 'word', 'draggroup' => '1', 'infinite' => '0'),
172
            array('dragitemtype' => 'word', 'draggroup' => '1', 'infinite' => '0'),
173
            array('dragitemtype' => 'word', 'draggroup' => '1', 'infinite' => '0'),
173
            array('dragitemtype' => 'word', 'draggroup' => '1', 'infinite' => '0'),
174
            array('dragitemtype' => 'word', 'draggroup' => '1', 'infinite' => '0'),
174
            array('dragitemtype' => 'word', 'draggroup' => '1', 'infinite' => '0'),
175
            array('dragitemtype' => 'word', 'draggroup' => '1', 'infinite' => '0'),
Línea 203... Línea 204...
203
        test_question_maker::set_standard_combined_feedback_form_data($fromform);
204
        test_question_maker::set_standard_combined_feedback_form_data($fromform);
Línea 204... Línea 205...
204
 
205
 
205
        $fromform->penalty = '0.3333333';
206
        $fromform->penalty = '0.3333333';
206
        $fromform->hint = array(
207
        $fromform->hint = array(
207
            array(
208
            array(
208
                'text' => '<p>Incorrect placements will be removed.</p>',
209
                'text' => '<p>1. Incorrect placements will be removed.</p>',
209
                'format' => FORMAT_HTML,
210
                'format' => FORMAT_HTML,
210
            ),
211
            ),
211
            array(
212
            array(
212
                'text' => '<ul>
213
                'text' => '<ul>
213
                           <li>The abyssal plain is a flat almost featureless expanse of ocean '.
214
                           <li>2. The abyssal plain is a flat almost featureless expanse of ocean '.
214
                           'floor 4km to 6km below sea-level.</li>
215
                           'floor 4km to 6km below sea-level.</li>
215
                           <li>The continental rise is the gently sloping part of the ocean floor beyond the continental slope.</li>
216
                           <li>The continental rise is the gently sloping part of the ocean floor beyond the continental slope.</li>
216
                           <li>The continental shelf is the gently sloping ocean floor just offshore from the land.</li>
217
                           <li>The continental shelf is the gently sloping ocean floor just offshore from the land.</li>
217
                           <li>The continental slope is the relatively steep part of the ocean floor '.
218
                           <li>The continental slope is the relatively steep part of the ocean floor '.
Línea 222... Línea 223...
222
                           <li>An oceanic trench is a deep trough in the ocean floor.</li>
223
                           <li>An oceanic trench is a deep trough in the ocean floor.</li>
223
                           </ul>',
224
                           </ul>',
224
                'format' => FORMAT_HTML,
225
                'format' => FORMAT_HTML,
225
            ),
226
            ),
226
            array(
227
            array(
227
                'text' => '<p>Incorrect placements will be removed.</p>',
228
                'text' => '<p>3. Incorrect placements will be removed.</p>',
228
                'format' => FORMAT_HTML,
229
                'format' => FORMAT_HTML,
229
            ),
230
            ),
230
            array(
231
            array(
231
                'text' => '<ul>
232
                'text' => '<ul>
232
                           <li>The abyssal plain is a flat almost featureless expanse of ocean '.
233
                           <li>4. The abyssal plain is a flat almost featureless expanse of ocean '.
233
                           'floor 4km to 6km below sea-level.</li>
234
                           'floor 4km to 6km below sea-level.</li>
234
                           <li>The continental rise is the gently sloping part of the ocean floor beyond the continental slope.</li>
235
                           <li>The continental rise is the gently sloping part of the ocean floor beyond the continental slope.</li>
235
                           <li>The continental shelf is the gently sloping ocean floor just offshore from the land.</li>
236
                           <li>The continental shelf is the gently sloping ocean floor just offshore from the land.</li>
236
                           <li>The continental slope is the relatively steep part of the ocean floor '.
237
                           <li>The continental slope is the relatively steep part of the ocean floor '.
237
                           'beyond the continental shelf.</li>
238
                           'beyond the continental shelf.</li>
Línea 250... Línea 251...
250
 
251
 
251
        return $fromform;
252
        return $fromform;
Línea 252... Línea 253...
252
    }
253
    }
-
 
254
 
-
 
255
    /**
-
 
256
     * Get data required to save a drag-drop into text question where the the answer contain equation
-
 
257
     *
-
 
258
     *
-
 
259
     * @return stdClass data to create a ddwtos question.
-
 
260
     */
-
 
261
    public function get_ddimageortext_question_form_data_mathjax() {
-
 
262
        global $CFG, $USER;
-
 
263
        $fromform = new stdClass();
-
 
264
 
-
 
265
        $bgdraftitemid = 0;
-
 
266
        file_prepare_draft_area($bgdraftitemid, null, null, null, null);
-
 
267
        $fs = get_file_storage();
-
 
268
        $filerecord = new stdClass();
-
 
269
        $filerecord->contextid = context_user::instance($USER->id)->id;
-
 
270
        $filerecord->component = 'user';
-
 
271
        $filerecord->filearea = 'draft';
-
 
272
        $filerecord->itemid = $bgdraftitemid;
-
 
273
        $filerecord->filepath = '/';
-
 
274
        $filerecord->filename = 'oceanfloorbase.jpg';
-
 
275
        $fs->create_file_from_pathname($filerecord, $CFG->dirroot .
-
 
276
            '/question/type/ddimageortext/tests/fixtures/oceanfloorbase.jpg');
-
 
277
        $fromform->name = 'Drag-and-drop words into image question with equation';
-
 
278
        $fromform->questiontext = ['text' => 'Fill in the correct mathjax equation: y = 2, x =4', 'format' => FORMAT_HTML];
-
 
279
        $fromform->defaultmark = 1.0;
-
 
280
        $fromform->generalfeedback = ['text' => 'The right answer is: "y = x^2"', 'format' => FORMAT_HTML];
-
 
281
        $fromform->drags = [
-
 
282
            ['dragitemtype' => 'word', 'draggroup' => '1', 'infinite' => '0'],
-
 
283
            ['dragitemtype' => 'word', 'draggroup' => '1', 'infinite' => '0'],
-
 
284
        ];
-
 
285
        $fromform->bgimage = $bgdraftitemid;
-
 
286
        $fromform->dragitem = [0, 0];
-
 
287
        $fromform->draglabel =
-
 
288
            [
-
 
289
                '$$ y = x^2 $$',
-
 
290
                '$$ y = x^5 $$',
-
 
291
            ];
-
 
292
        $fromform->drops = [
-
 
293
            ['xleft' => '53', 'ytop' => '17', 'choice' => '1', 'droplabel' => ''],
-
 
294
            ['xleft' => '172', 'ytop' => '2', 'choice' => '2', 'droplabel' => ''],
-
 
295
        ];
-
 
296
        test_question_maker::set_standard_combined_feedback_form_data($fromform);
-
 
297
        $fromform->shownumcorrect = 0;
-
 
298
        $fromform->penalty = 0.3333333;
-
 
299
        $fromform->status = \core_question\local\bank\question_version_status::QUESTION_STATUS_READY;
-
 
300
        return $fromform;
-
 
301
    }
253
 
302
 
254
    /**
303
    /**
255
     * Make a test question where the drag items are a different language than the main question text.
304
     * Make a test question where the drag items are a different language than the main question text.
256
     *
305
     *
257
     * @return qtype_ddimageortext_question
306
     * @return qtype_ddimageortext_question