MDL-47494 ddimageortext: NOBUG started making this a mixed question type with draggable text as welll as
draggable images.
This commit is contained in:
@@ -276,6 +276,7 @@ class qtype_ddimagetoimage_edit_form extends question_edit_form {
|
||||
$PAGE->requires->yui_module('moodle-qtype_ddimagetoimage-form',
|
||||
'M.qtype_ddimagetoimage.init_form',
|
||||
array($params));
|
||||
//$PAGE->requires->css('/lib/yui/3.4.0/build/csscssfonts/fonts-context-min.css');
|
||||
|
||||
return $question;
|
||||
}
|
||||
@@ -316,12 +317,7 @@ class qtype_ddimagetoimage_edit_form extends question_edit_form {
|
||||
$errors["drops[$i]"] =
|
||||
get_string('formerror_noxleft', 'qtype_ddimagetoimage');
|
||||
}
|
||||
if (!self::file_uploaded($data['dragitem'][$choice - 1])) {
|
||||
$errors["drops[$i]"] =
|
||||
get_string('formerror_nofile', 'qtype_ddimagetoimage', $choice);
|
||||
$errors['dragitem['.($choice - 1).']'] =
|
||||
get_string('formerror_nofile2', 'qtype_ddimagetoimage', $i);
|
||||
}
|
||||
|
||||
if (isset($allchoices[$choice]) && !$data['drags'][$choice-1]['infinite']) {
|
||||
$errors["drops[$i]"] =
|
||||
get_string('formerror_multipledraginstance', 'qtype_ddimagetoimage', $choice);
|
||||
|
||||
@@ -37,7 +37,12 @@ require_once($CFG->dirroot . '/question/type/gapselect/rendererbase.php');
|
||||
*/
|
||||
class qtype_ddimagetoimage_renderer extends qtype_with_combined_feedback_renderer {
|
||||
|
||||
|
||||
public function head_code(question_attempt $qa) {
|
||||
$this->page->requires->css('/lib/yui/3.4.0/build/csscssfonts/fonts-context-min.css');
|
||||
$this->page->requires->yui2_lib('event');
|
||||
$this->page->requires->yui2_lib('dragdrop');
|
||||
return parent::head_code($qa);
|
||||
}
|
||||
public function clear_wrong(question_attempt $qa) {
|
||||
$question = $qa->get_question();
|
||||
$response = $qa->get_last_qt_data();
|
||||
@@ -84,9 +89,18 @@ class qtype_ddimagetoimage_renderer extends qtype_with_combined_feedback_rendere
|
||||
if ($dragimage->isinfinite) {
|
||||
$classes[] = 'infinite';
|
||||
}
|
||||
$dragimagehomesgroup .= html_writer::empty_tag('img',
|
||||
array('src'=>$dragimageurl,
|
||||
'class'=>join(' ', $classes)));
|
||||
if ($dragimageurl === null) {
|
||||
$classes[] = 'yui3-cssfonts';
|
||||
$dragimagehomesgroup .= html_writer::tag('div',
|
||||
$dragimage->text,
|
||||
array('src'=>$dragimageurl,
|
||||
'class'=>join(' ', $classes)));
|
||||
} else {
|
||||
$dragimagehomesgroup .= html_writer::empty_tag('img',
|
||||
array('src'=>$dragimageurl,
|
||||
'alt' => $dragimage->text,
|
||||
'class'=>join(' ', $classes)));
|
||||
}
|
||||
}
|
||||
$dragimagehomes .= html_writer::tag('div', $dragimagehomesgroup,
|
||||
array('class'=>'dragitemgroup'.$groupno));
|
||||
|
||||
+1
-1
@@ -87,7 +87,7 @@ YUI.add('moodle-qtype_ddimagetoimage-dd', function(Y) {
|
||||
var oldhome = this.drag_image_home(dragimageno);
|
||||
var classes = 'draghome dragimagehomes'+dragimageno+' group'+group;
|
||||
var imghtml = '<img class="'+classes+'" src="'+url+'" alt="'+alt+'" />';
|
||||
var divhtml = '<div class="'+classes+'">'+alt+'</div>';
|
||||
var divhtml = '<div class="yui3-cssfonts '+classes+'">'+alt+'</div>';
|
||||
if (oldhome === null) {
|
||||
if (url) {
|
||||
dragimagesarea.append(imghtml);
|
||||
|
||||
+2
-2
@@ -14,8 +14,8 @@ YUI.add('moodle-qtype_ddimagetoimage-form', function(Y) {
|
||||
Y.one(this.get('topnode')).append('<div class="ddarea"><div class="droparea"></div>'+
|
||||
'<div class="dragitems"></div>'+
|
||||
'<div class="dropzones"></div></div>');
|
||||
this.doc = this.doc_structure(this);
|
||||
this.draw_dd_area();
|
||||
//this.doc = this.doc_structure(this);
|
||||
//this.draw_dd_area();
|
||||
},
|
||||
|
||||
draw_dd_area : function() {
|
||||
|
||||
Reference in New Issue
Block a user