]> _ Git - QuizFactory.git/commitdiff
wip #3438 @0.5
authorVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 26 Feb 2020 18:47:31 +0000 (19:47 +0100)
committerVincent Vanwaelscappel <vincent@cubedesigners.com>
Wed, 26 Feb 2020 18:47:31 +0000 (19:47 +0100)
app/Models/Quiz.php [new file with mode: 0644]
resources/views/vendor/backpack/base/inc/sidebar_content.blade.php

diff --git a/app/Models/Quiz.php b/app/Models/Quiz.php
new file mode 100644 (file)
index 0000000..1dc196e
--- /dev/null
@@ -0,0 +1,68 @@
+<?php
+
+
+namespace App\Models;
+
+use Cubist\Backpack\app\Magic\Models\CubistMagicAbstractModel;
+
+class Quiz extends CubistMagicAbstractModel
+{
+    protected $table = 'quiz';
+
+    protected $_options = ['name' => 'quiz',
+        'singular' => 'quiz',
+        'plural' => 'quizzes'];
+
+    public function setFields()
+    {
+        parent::setFields();
+
+        $this->addField(['name' => 'title',
+            'label' => 'Quiz title',
+            'type' => 'Text',
+            'column' => true,
+            'tab' => 'Settings']);
+
+        $this->addField(['name' => 'scorm',
+            'label' => 'SCORM enabled',
+            'type' => 'Checkbox',
+            'column' => true,
+            'tab' => 'Settings']);
+
+        $this->addField(['name' => 'review',
+            'label' => 'Enable answer review',
+            'hint' => 'Let the user review his answers and the correct ones at the end of the quiz',
+            'type' => 'Checkbox',
+            'tab' => 'Settings']);
+
+        $this->addField(['name' => 'locale',
+            'label' => 'Quiz language',
+            'type' => 'Locale',
+            'column' => true,
+            'tab' => 'Texts and translations']);
+
+        $colors = [
+            'mainColor' => ['label' => 'Main color', 'hint' => 'Buttons and rollovers color'],
+            'overlay' => ['label' => 'Overlay', 'hint' => 'Overlay set on the banner'],
+            'okColor' => ['label' => 'OK color', 'hint' => 'Color of the ok badge (usually green)'],
+            'nokColor' => ['label' => 'NOK color', 'hint' => 'Color of the not ok badge (usually red)'],
+            'reviewBackground' => ['label' => 'Review panel background color'],
+        ];
+
+        $default = ['tab' => 'Theme', 'type' => 'Color'];
+        foreach ($colors as $name => $color) {
+            $f = array_merge($default, $color, ['name' => $name]);
+            $this->addField($f);
+        }
+
+        $images = [
+            'logo' => 'Logo',
+            'banner' => 'Banner',
+        ];
+        $default = ['tab' => 'Theme', 'type' => 'Images', 'maxFiles' => 1];
+        foreach ($images as $name => $label) {
+            $f = array_merge($default, ['name' => $name, 'label' => $label]);
+            $this->addField($f);
+        }
+    }
+}
index d3c343a50c5a5f5601f8c3bbf29c4cb2354a64a8..72b37a8eb1141f0b3522c37974748d43c4109365 100644 (file)
@@ -1,6 +1,9 @@
 <!-- This file is used to store sidebar items, starting with Backpack\Base 0.9.0 -->
 <li class="nav-item"><a class="nav-link" href="{{ backpack_url('dashboard') }}"><i
             class="fa fa-dashboard nav-icon"></i> {{ trans('backpack::base.dashboard') }}</a></li>
+<li class="nav-item"><a class="nav-link" href="{{ backpack_url('quiz') }}"><i
+            class="fa fa-table nav-icon"></i> Quizzes</a></li>
+
 <li class='nav-item nav-dropdown'><a class='nav-link nav-dropdown-toggle' href='#'><i class='nav-icon fa fa-cogs'></i>Maintenance</a>
     <ul class='nav-dropdown-items'>
         <li class="nav-item"><a class="nav-link" href='{{ backpack_url('backup') }}'><i class='fa fa-hdd-o'></i> <span>Backups</span></a>