mirror of
https://github.com/moodle/moodle.git
synced 2025-08-11 03:46:42 +02:00
MDL-79863 qtype_ordering: qtype_ordering make default selection type 'random'
This commit is contained in:
parent
ff17a02bb7
commit
fc9263f9fe
3 changed files with 22 additions and 16 deletions
|
@ -71,7 +71,7 @@ class qtype_ordering_edit_form extends question_edit_form {
|
||||||
$options = qtype_ordering_question::get_layout_types();
|
$options = qtype_ordering_question::get_layout_types();
|
||||||
$mform->addElement('select', $name, $label, $options);
|
$mform->addElement('select', $name, $label, $options);
|
||||||
$mform->addHelpButton($name, $name, $plugin);
|
$mform->addHelpButton($name, $name, $plugin);
|
||||||
$mform->setDefault($name, 0);
|
$mform->setDefault($name, qtype_ordering_question::LAYOUT_VERTICAL);
|
||||||
|
|
||||||
// selecttype
|
// selecttype
|
||||||
$name = 'selecttype';
|
$name = 'selecttype';
|
||||||
|
@ -79,7 +79,7 @@ class qtype_ordering_edit_form extends question_edit_form {
|
||||||
$options = qtype_ordering_question::get_select_types();
|
$options = qtype_ordering_question::get_select_types();
|
||||||
$mform->addElement('select', $name, $label, $options);
|
$mform->addElement('select', $name, $label, $options);
|
||||||
$mform->addHelpButton($name, $name, $plugin);
|
$mform->addHelpButton($name, $name, $plugin);
|
||||||
$mform->setDefault($name, 0);
|
$mform->setDefault($name, qtype_ordering_question::SELECT_RANDOM);
|
||||||
|
|
||||||
// selectcount
|
// selectcount
|
||||||
$name = 'selectcount';
|
$name = 'selectcount';
|
||||||
|
@ -91,7 +91,7 @@ class qtype_ordering_edit_form extends question_edit_form {
|
||||||
$mform->addElement('select', $name, $label, $options);
|
$mform->addElement('select', $name, $label, $options);
|
||||||
$mform->disabledIf($name, 'selecttype', 'eq', 0);
|
$mform->disabledIf($name, 'selecttype', 'eq', 0);
|
||||||
$mform->addHelpButton($name, $name, $plugin);
|
$mform->addHelpButton($name, $name, $plugin);
|
||||||
$mform->setDefault($name, 0);
|
$mform->setDefault($name, 6);
|
||||||
|
|
||||||
// gradingtype
|
// gradingtype
|
||||||
$name = 'gradingtype';
|
$name = 'gradingtype';
|
||||||
|
@ -99,7 +99,7 @@ class qtype_ordering_edit_form extends question_edit_form {
|
||||||
$options = qtype_ordering_question::get_grading_types();
|
$options = qtype_ordering_question::get_grading_types();
|
||||||
$mform->addElement('select', $name, $label, $options);
|
$mform->addElement('select', $name, $label, $options);
|
||||||
$mform->addHelpButton($name, $name, $plugin);
|
$mform->addHelpButton($name, $name, $plugin);
|
||||||
$mform->setDefault($name, 0);
|
$mform->setDefault($name, qtype_ordering_question::GRADING_ABSOLUTE_POSITION);
|
||||||
|
|
||||||
// answers (=items)
|
// answers (=items)
|
||||||
// get_per_answer_fields()
|
// get_per_answer_fields()
|
||||||
|
@ -303,7 +303,7 @@ class qtype_ordering_edit_form extends question_edit_form {
|
||||||
if (isset($question->options->selecttype)) {
|
if (isset($question->options->selecttype)) {
|
||||||
$question->selecttype = $question->options->selecttype;
|
$question->selecttype = $question->options->selecttype;
|
||||||
} else {
|
} else {
|
||||||
$question->selecttype = qtype_ordering_question::SELECT_ALL;
|
$question->selecttype = qtype_ordering_question::SELECT_RANDOM;
|
||||||
}
|
}
|
||||||
|
|
||||||
// selectcount
|
// selectcount
|
||||||
|
|
|
@ -204,17 +204,23 @@ class qtype_ordering_renderer extends qtype_with_combined_feedback_renderer {
|
||||||
|
|
||||||
// format scoredetails, e.g. 1 /2 = 50%, for each item
|
// format scoredetails, e.g. 1 /2 = 50%, for each item
|
||||||
foreach ($currentresponse as $position => $answerid) {
|
foreach ($currentresponse as $position => $answerid) {
|
||||||
$answer = $question->answers[$answerid];
|
if (array_key_exists($answerid, $question->answers)) {
|
||||||
$score = $this->get_ordering_item_score($question, $position, $answerid);
|
$answer = $question->answers[$answerid];
|
||||||
list($score, $maxscore, $fraction, $percent, $class, $img) = $score;
|
$score = $this->get_ordering_item_score($question, $position, $answerid);
|
||||||
if ($maxscore===null) {
|
list($score, $maxscore, $fraction, $percent, $class, $img) = $score;
|
||||||
$score = get_string('noscore', $plugin);
|
if ($maxscore===null) {
|
||||||
|
$score = get_string('noscore', $plugin);
|
||||||
|
} else {
|
||||||
|
$totalscore += $score;
|
||||||
|
$totalmaxscore += $maxscore;
|
||||||
|
$score = "$score / $maxscore = $percent%";
|
||||||
|
}
|
||||||
|
$scoredetails .= html_writer::tag('li', $score, $params);
|
||||||
} else {
|
} else {
|
||||||
$totalscore += $score;
|
// Oops, the md5 key is not recognized !!
|
||||||
$totalmaxscore += $maxscore;
|
// Maybe the password salt has changed
|
||||||
$score = "$score / $maxscore = $percent%";
|
// because we restored to a new server?
|
||||||
}
|
}
|
||||||
$scoredetails .= html_writer::tag('li', $score, $params);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
$scoredetails .= html_writer::end_tag('ol');
|
$scoredetails .= html_writer::end_tag('ol');
|
||||||
|
|
|
@ -31,5 +31,5 @@ $plugin->cron = 0;
|
||||||
$plugin->component = 'qtype_ordering';
|
$plugin->component = 'qtype_ordering';
|
||||||
$plugin->maturity = MATURITY_STABLE;
|
$plugin->maturity = MATURITY_STABLE;
|
||||||
$plugin->requires = 2010112400; // Moodle 2.0
|
$plugin->requires = 2010112400; // Moodle 2.0
|
||||||
$plugin->version = 2016022445;
|
$plugin->version = 2016032846;
|
||||||
$plugin->release = '2016-02-24 (45)';
|
$plugin->release = '2016-03-28 (46)';
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue