--- /dev/null
+<?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);
+ }
+ }
+}
<!-- 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>