]> _ Git - fluidbook-toolbox.git/commitdiff
wip #3924 @1
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 13 Oct 2020 09:31:35 +0000 (11:31 +0200)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Tue, 13 Oct 2020 09:31:35 +0000 (11:31 +0200)
app/Models/Quiz.php

index 50641defb0f4c82a1a3e80f82589d05e6b41b75e..045d18db9fe6b5cfa2351dd871da50df99fc587e 100644 (file)
@@ -212,17 +212,19 @@ class Quiz extends CubistMagicAbstractModel
             }
         }
 
+        $data = $this->getPageData();
+
         // Create data.xml
         $xml = simplexml_load_string('<?xml version="1.0" encoding="UTF-8" ?><quiz />');
-        $xml->addAttribute('id', $this->getAttribute('id'));
-        $xml->addChild('title', $this->getAttribute('title'));
-        $xml->addChild('threshold', $this->getAttribute('threshold') ?: '0');
-        $xml->addChild('instantReview', $this->getAttribute('instantReview') ? '1' : '0');
-        $xml->addChild('review', $this->getAttribute('review') ? '1' : '0');
-        $xml->addChild('logattempts', $this->getAttribute('logattempts') ? '1' : '0');
+        $xml->addAttribute('id', $data->get('id'));
+        $xml->addChild('title', $data->get('title'));
+        $xml->addChild('threshold', $data->get('threshold', '0') ?: '0');
+        $xml->addChild('instantReview', $data->get('instantReview', true) ? '1' : '0');
+        $xml->addChild('review', $data->get('review', true) ? '1' : '0');
+        $xml->addChild('logattempts', $data->get('logattempts', false) ? '1' : '0');
         $xt = $xml->addChild('translations');
         /** @var QuizTranslation $translation */
-        $tid = $this->getAttribute('translation') ?? 1;
+        $tid = $data->get('translation',1) ?? 1;
         if ($tid === 'en') {
             $tid = 1;
         }