Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

MDL-6297 shuffleanswers option not imported correctly for MC question…

…s. Backported from HEAD.
  • Loading branch information...
commit 8419513e13e50f967cfa68c5afa29ad774cf30ea 1 parent f990f10
tjhunt authored
Showing with 12 additions and 12 deletions.
  1. +12 −12 question/format/xml/format.php
View
24 question/format/xml/format.php
@@ -57,18 +57,12 @@ function trans_format( $name ) {
* @RETURN int internal code number
*/
function trans_single( $name ) {
- $name = trim($name);
-
- if ($name=="true") {
- $id = 1;
- }
- elseif ($name=="false") {
- $id = 0;
- }
- else {
- $id = 0; // or maybe warning required
- }
- return $id;
+ $name = trim($name);
+ if ($name == "false" || !$name) {
+ return 0;
+ } else {
+ return 1;
+ }
}
/*
@@ -143,6 +137,12 @@ function import_multichoice( $question ) {
$qo->qtype = MULTICHOICE;
$single = $question['#']['single'][0]['#'];
$qo->single = $this->trans_single( $single );
+ if (array_key_exists('shuffleanswers', $question['#'])) {
+ $shuffleanswers = $question['#']['shuffleanswers'][0]['#'];
+ } else {
+ $shuffleanswers = 'false';
+ }
+ $qo->shuffleanswers = $this->trans_single($shuffleanswers);
// run through the answers
$answers = $question['#']['answer'];
Please sign in to comment.
Something went wrong with that request. Please try again.