From f14fe58e9c12bcf7d40997cac2714cbcccdaf9a4 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Tue, 13 Oct 2020 11:31:35 +0200 Subject: [PATCH] wip #3924 @1 --- app/Models/Quiz.php | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/app/Models/Quiz.php b/app/Models/Quiz.php index 50641defb..045d18db9 100644 --- a/app/Models/Quiz.php +++ b/app/Models/Quiz.php @@ -212,17 +212,19 @@ class Quiz extends CubistMagicAbstractModel } } + $data = $this->getPageData(); + // Create data.xml $xml = simplexml_load_string(''); - $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; } -- 2.39.5