From 52b1783a8b6a8b17b9466eae180698c3afea78e6 Mon Sep 17 00:00:00 2001 From: Vincent Vanwaelscappel Date: Tue, 10 Oct 2023 20:26:03 +0200 Subject: [PATCH] wip #6388 --- app/Elearning/QuizCompiler.php | 6 ++++++ app/Elearning/QuizCompiler/Credits.php | 24 ++++++++++++++++++++++++ app/Models/Quiz.php | 6 ++++++ 3 files changed, 36 insertions(+) create mode 100644 app/Elearning/QuizCompiler/Credits.php diff --git a/app/Elearning/QuizCompiler.php b/app/Elearning/QuizCompiler.php index 72c657976..a89634e7d 100644 --- a/app/Elearning/QuizCompiler.php +++ b/app/Elearning/QuizCompiler.php @@ -3,6 +3,7 @@ namespace App\Elearning; use App\Elearning\QuizCompiler\Animations; +use App\Elearning\QuizCompiler\Credits; use App\Elearning\QuizCompiler\L10N; use App\Fields\FluidbookFont; use App\Fields\HorizontalAlign; @@ -11,6 +12,7 @@ use App\Fields\VerticalAlign; use App\Jobs\Base; use App\Models\Quiz; use App\Models\QuizTheme; +use App\Models\Signature; use Cubist\Scorm\Manifest; use Cubist\Scorm\Version; use Cubist\Util\CommandLine\Npx; @@ -26,6 +28,7 @@ class QuizCompiler extends Base use Animations; use L10N; + use Credits; /** * @var Quiz @@ -74,6 +77,7 @@ class QuizCompiler extends Base $this->writeStyles(); $this->writeAnimations(); $this->writeL10n(); + $this->writeCredits(); $this->writeData(); // Run the compiler $this->runWebpack(); @@ -319,4 +323,6 @@ class QuizCompiler extends Base } } } + + } diff --git a/app/Elearning/QuizCompiler/Credits.php b/app/Elearning/QuizCompiler/Credits.php new file mode 100644 index 000000000..73842d9b4 --- /dev/null +++ b/app/Elearning/QuizCompiler/Credits.php @@ -0,0 +1,24 @@ +signature) { + $this->signature = Signature::withoutGlobalScopes()->find($this->quiz->signature); + if (null === $this->signature) { + $this->signature = Signature::withoutGlobalScopes()->find(1); + } + $credits = $this->signature->credits; + } else { + $credits = ''; + } + $this->data->set('credits', $credits); + } +} diff --git a/app/Models/Quiz.php b/app/Models/Quiz.php index 6e253818b..c3136b653 100644 --- a/app/Models/Quiz.php +++ b/app/Models/Quiz.php @@ -4,6 +4,7 @@ namespace App\Models; use App\Elearning\QuizCompiler; use App\Fields\ElearningLocale; +use App\Fields\FluidbookSignature; use App\Fields\QuizDevelopmentVersion; use App\Fields\SCORMVersion; use App\Http\Controllers\Admin\Operations\ChangeownerOperation; @@ -139,6 +140,11 @@ class Quiz extends ToolboxModel 'database_default' => 'quiz', ]); + $this->addField('signature', FluidbookSignature::class, __('Signature'), [ + 'default' => '1', + 'databaseDefault' => '1', + ]); + $this->addField('section_translation', FormSection::class, __('Langue')); $this->addField(['name' => 'translation', 'label' => __('Langue'), -- 2.39.5