MDL-47494 ddwtos: Some minor coding style clean-up.
This commit is contained in:
@@ -22,13 +22,13 @@
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
$string['addingddwtos'] = 'Adding drag and drop into text';
|
||||
$string['addmorechoiceblanks'] = 'Blanks for {no} More Choices';
|
||||
$string['addingddwtos'] = 'Adding a drag and drop into text';
|
||||
$string['addmorechoiceblanks'] = 'Blanks for {no} more choices';
|
||||
$string['answer'] = 'Answer';
|
||||
$string['correctansweris'] = 'The correct answer is: {$a}';
|
||||
$string['ddwtos'] = 'Drag and drop into text';
|
||||
$string['ddwtos_help'] = 'Type in some question text like "The [[1]] jumped over the [[2]]", then enter the possible words to go in gaps 1 and 2 underneath.';
|
||||
$string['ddwtossummary'] = 'Missing words in some text are filled in using drag-and-drop.';
|
||||
$string['editingddwtos'] = 'Editing drag and drop into text';
|
||||
$string['editingddwtos'] = 'Editing a drag and drop into text';
|
||||
$string['infinite'] = 'Infinite';
|
||||
$string['pleaseputananswerineachbox'] = 'Please put an answer in each box.';
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 13 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 224 B |
@@ -44,19 +44,24 @@ class qtype_ddwtos_renderer extends qtype_elements_embedded_in_question_text_ren
|
||||
public function formulation_and_controls(question_attempt $qa,
|
||||
question_display_options $options) {
|
||||
global $PAGE;
|
||||
|
||||
$result = parent::formulation_and_controls($qa, $options);
|
||||
$topnode = 'div.que.ddwtos#q'.$qa->get_slot();
|
||||
|
||||
$inputids = array();
|
||||
$question = $qa->get_question();
|
||||
foreach ($question->places as $placeno => $place) {
|
||||
$inputids[$placeno] = $this->box_id($qa, $question->field($placeno));
|
||||
}
|
||||
$params = array('inputids' => $inputids,
|
||||
'topnode' => $topnode,
|
||||
'readonly' => $options->readonly);
|
||||
|
||||
$PAGE->requires->yui_module('moodle-qtype_ddwtos-dd', 'M.qtype_ddwtos.init_question',
|
||||
array($params));
|
||||
$params = array(
|
||||
'inputids' => $inputids,
|
||||
'topnode' => 'div.que.ddwtos#q' . $qa->get_slot(),
|
||||
'readonly' => $options->readonly
|
||||
);
|
||||
|
||||
$PAGE->requires->yui_module('moodle-qtype_ddwtos-dd',
|
||||
'M.qtype_ddwtos.init_question', array($params));
|
||||
|
||||
return $result;
|
||||
}
|
||||
|
||||
@@ -64,11 +69,13 @@ class qtype_ddwtos_renderer extends qtype_elements_embedded_in_question_text_ren
|
||||
question_display_options $options) {
|
||||
$result = '';
|
||||
$question = $qa->get_question();
|
||||
|
||||
$dragboxs = '';
|
||||
foreach ($question->choices as $group => $choices) {
|
||||
$dragboxs .= $this->drag_boxes($qa, $group,
|
||||
$question->get_ordered_choices($group), $options);
|
||||
}
|
||||
|
||||
$classes = array('answercontainer');
|
||||
if (!$options->readonly) {
|
||||
$classes[] = 'notreadonly';
|
||||
@@ -84,6 +91,7 @@ class qtype_ddwtos_renderer extends qtype_elements_embedded_in_question_text_ren
|
||||
$classes[] = 'readonly';
|
||||
}
|
||||
$result .= html_writer::tag('div', '', array('class' => implode(' ', $classes)));
|
||||
|
||||
// We abuse the clear_wrong method to output the hidden form fields we
|
||||
// want irrespective of whether we are actually clearing the wrong
|
||||
// bits of the response.
|
||||
@@ -102,7 +110,7 @@ class qtype_ddwtos_renderer extends qtype_elements_embedded_in_question_text_ren
|
||||
$value = $qa->get_last_qt_var($question->field($place));
|
||||
|
||||
$attributes = array(
|
||||
'class' => 'place'.$place.' drop group' . $group
|
||||
'class' => 'place' . $place . ' drop group' . $group
|
||||
);
|
||||
|
||||
if ($options->readonly) {
|
||||
@@ -138,11 +146,12 @@ class qtype_ddwtos_renderer extends qtype_elements_embedded_in_question_text_ren
|
||||
}
|
||||
|
||||
$boxes .= html_writer::tag('span', $content, array(
|
||||
'class' => 'draghome choice'.$key.' group' . $choice->draggroup . $infinite)) . ' ';
|
||||
'class' => 'draghome choice' . $key . ' group' .
|
||||
$choice->draggroup . $infinite)) . ' ';
|
||||
}
|
||||
|
||||
return html_writer::nonempty_tag('div', $boxes,
|
||||
array('class' => 'draggrouphomes'. $choice->draggroup));
|
||||
array('class' => 'draggrouphomes' . $choice->draggroup));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Vendored
+30
-6
@@ -1,3 +1,27 @@
|
||||
// This file is part of Moodle - http://moodle.org/
|
||||
//
|
||||
// Moodle is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// Moodle is distributed in the hope that it will be useful,
|
||||
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
// GNU General Public License for more details.
|
||||
//
|
||||
// You should have received a copy of the GNU General Public License
|
||||
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
/**
|
||||
* JavaScript code for the ddwtos question type.
|
||||
*
|
||||
* @package qtype
|
||||
* @subpackage ddwtos
|
||||
* @copyright 2011 The Open University
|
||||
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
||||
*/
|
||||
|
||||
YUI.add('moodle-qtype_ddwtos-dd', function(Y) {
|
||||
var DDWTOSDDNAME = 'ddwtos_dd';
|
||||
var DDWTOS_DD = function() {
|
||||
@@ -326,12 +350,12 @@ YUI.add('moodle-qtype_ddwtos-dd', function(Y) {
|
||||
_event: (Y.UA.webkit || Y.UA.ie) ? 'keydown' : 'keypress',
|
||||
|
||||
_keys: {
|
||||
'32': 'next',
|
||||
'37': 'previous',
|
||||
'38': 'previous',
|
||||
'39': 'next',
|
||||
'40': 'next',
|
||||
'27': 'remove'
|
||||
'32': 'next', // Space
|
||||
'37': 'previous', // Left arrow
|
||||
'38': 'previous', // Up arrow
|
||||
'39': 'next', // Right arrow
|
||||
'40': 'next', // Down arrow
|
||||
'27': 'remove' // Escape
|
||||
},
|
||||
|
||||
_keyHandler: function (e, notifier) {
|
||||
|
||||
Reference in New Issue
Block a user