Exam Table/Model/Controller
This commit is contained in:
parent
38efe1af1b
commit
42e06d1005
12
README.md
12
README.md
@ -26,3 +26,15 @@
|
|||||||
## ExamTyperatingAnswer
|
## ExamTyperatingAnswer
|
||||||
|
|
||||||
- BelongsTo ExamTyperatingQuestion
|
- BelongsTo ExamTyperatingQuestion
|
||||||
|
|
||||||
|
## ExamMemberRank
|
||||||
|
|
||||||
|
- BelongsTo MemberRank
|
||||||
|
- **TODO** BelongsTo Member (External DB)
|
||||||
|
- **TODO** HasMany ExamMemberRankQuestion
|
||||||
|
|
||||||
|
## ExamTyperating
|
||||||
|
|
||||||
|
- BelongsTo Typerating
|
||||||
|
- **TODO** BelongsTo Member (External DB)
|
||||||
|
- **TODO** HasMany ExamTyperatingQuestion
|
||||||
|
|||||||
21
controllers/ExamMemberRank.php
Normal file
21
controllers/ExamMemberRank.php
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?php namespace GermanAirlinesVa\Schooling\Controllers;
|
||||||
|
|
||||||
|
use Backend\Classes\Controller;
|
||||||
|
use BackendMenu;
|
||||||
|
|
||||||
|
class ExamMemberRank extends Controller
|
||||||
|
{
|
||||||
|
public $implement = ['Backend\Behaviors\ListController'];
|
||||||
|
|
||||||
|
public $listConfig = 'config_list.yaml';
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function listExtendQuery($query)
|
||||||
|
{
|
||||||
|
$query->where('member_rank_id', '<>', null);
|
||||||
|
}
|
||||||
|
}
|
||||||
21
controllers/ExamTyperating.php
Normal file
21
controllers/ExamTyperating.php
Normal file
@ -0,0 +1,21 @@
|
|||||||
|
<?php namespace GermanAirlinesVa\Schooling\Controllers;
|
||||||
|
|
||||||
|
use Backend\Classes\Controller;
|
||||||
|
use BackendMenu;
|
||||||
|
|
||||||
|
class ExamTyperating extends Controller
|
||||||
|
{
|
||||||
|
public $implement = ['Backend\Behaviors\ListController'];
|
||||||
|
|
||||||
|
public $listConfig = 'config_list.yaml';
|
||||||
|
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
parent::__construct();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function listExtendQuery($query)
|
||||||
|
{
|
||||||
|
$query->where('typerating_id', '<>', null);
|
||||||
|
}
|
||||||
|
}
|
||||||
17
controllers/exammemberrank/_list_toolbar.htm
Normal file
17
controllers/exammemberrank/_list_toolbar.htm
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<div data-control="toolbar">
|
||||||
|
<button
|
||||||
|
class="btn btn-default oc-icon-trash-o"
|
||||||
|
disabled="disabled"
|
||||||
|
onclick="$(this).data('request-data', {
|
||||||
|
checked: $('.control-list').listWidget('getChecked')
|
||||||
|
})"
|
||||||
|
data-request="onDelete"
|
||||||
|
data-request-confirm="<?= e(trans('backend::lang.list.delete_selected_confirm')) ?>"
|
||||||
|
data-trigger-action="enable"
|
||||||
|
data-trigger=".control-list input[type=checkbox]"
|
||||||
|
data-trigger-condition="checked"
|
||||||
|
data-request-success="$(this).prop('disabled', true)"
|
||||||
|
data-stripe-load-indicator>
|
||||||
|
<?= e(trans('backend::lang.list.delete_selected')) ?>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
11
controllers/exammemberrank/config_list.yaml
Normal file
11
controllers/exammemberrank/config_list.yaml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
list: $/germanairlinesva/schooling/models/exammemberrank/columns.yaml
|
||||||
|
modelClass: GermanAirlinesVa\Schooling\Models\ExamMemberRank
|
||||||
|
title: Exams Member Rank
|
||||||
|
noRecordsMessage: 'backend::lang.list.no_records'
|
||||||
|
showSetup: true
|
||||||
|
showCheckboxes: true
|
||||||
|
recordsPerPage: 20
|
||||||
|
toolbar:
|
||||||
|
buttons: list_toolbar
|
||||||
|
search:
|
||||||
|
prompt: 'backend::lang.list.search_prompt'
|
||||||
1
controllers/exammemberrank/index.htm
Normal file
1
controllers/exammemberrank/index.htm
Normal file
@ -0,0 +1 @@
|
|||||||
|
<?= $this->listRender() ?>
|
||||||
17
controllers/examtyperating/_list_toolbar.htm
Normal file
17
controllers/examtyperating/_list_toolbar.htm
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<div data-control="toolbar">
|
||||||
|
<button
|
||||||
|
class="btn btn-default oc-icon-trash-o"
|
||||||
|
disabled="disabled"
|
||||||
|
onclick="$(this).data('request-data', {
|
||||||
|
checked: $('.control-list').listWidget('getChecked')
|
||||||
|
})"
|
||||||
|
data-request="onDelete"
|
||||||
|
data-request-confirm="<?= e(trans('backend::lang.list.delete_selected_confirm')) ?>"
|
||||||
|
data-trigger-action="enable"
|
||||||
|
data-trigger=".control-list input[type=checkbox]"
|
||||||
|
data-trigger-condition="checked"
|
||||||
|
data-request-success="$(this).prop('disabled', true)"
|
||||||
|
data-stripe-load-indicator>
|
||||||
|
<?= e(trans('backend::lang.list.delete_selected')) ?>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
11
controllers/examtyperating/config_list.yaml
Normal file
11
controllers/examtyperating/config_list.yaml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
list: $/germanairlinesva/schooling/models/examtyperating/columns.yaml
|
||||||
|
modelClass: GermanAirlinesVa\Schooling\Models\ExamTyperating
|
||||||
|
title: Exams Typerating
|
||||||
|
noRecordsMessage: 'backend::lang.list.no_records'
|
||||||
|
showSetup: true
|
||||||
|
showCheckboxes: true
|
||||||
|
recordsPerPage: 20
|
||||||
|
toolbar:
|
||||||
|
buttons: list_toolbar
|
||||||
|
search:
|
||||||
|
prompt: 'backend::lang.list.search_prompt'
|
||||||
1
controllers/examtyperating/index.htm
Normal file
1
controllers/examtyperating/index.htm
Normal file
@ -0,0 +1 @@
|
|||||||
|
<?= $this->listRender() ?>
|
||||||
@ -15,6 +15,8 @@
|
|||||||
'exam_question_typerating' => 'Exam Typerating Questions',
|
'exam_question_typerating' => 'Exam Typerating Questions',
|
||||||
'exam_answer_rank' => 'Exam Member Rank Answers',
|
'exam_answer_rank' => 'Exam Member Rank Answers',
|
||||||
'exam_answer_typerating' => 'Exam Typerating Answers',
|
'exam_answer_typerating' => 'Exam Typerating Answers',
|
||||||
|
'exam_member_rank' => 'Exams Member Rank',
|
||||||
|
'exam_typerating' => 'Exams Typerating',
|
||||||
],
|
],
|
||||||
'permissions' => [
|
'permissions' => [
|
||||||
'tab' => 'German Airlines VA - Schooling',
|
'tab' => 'German Airlines VA - Schooling',
|
||||||
|
|||||||
37
models/ExamMemberRank.php
Normal file
37
models/ExamMemberRank.php
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<?php namespace GermanAirlinesVa\Schooling\Models;
|
||||||
|
|
||||||
|
use Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Model
|
||||||
|
*/
|
||||||
|
class ExamMemberRank extends Model
|
||||||
|
{
|
||||||
|
use \October\Rain\Database\Traits\Validation;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Disable timestamps by default.
|
||||||
|
* Remove this line if timestamps are defined in the database table.
|
||||||
|
*/
|
||||||
|
public $timestamps = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string The database table used by the model.
|
||||||
|
*/
|
||||||
|
public $table = 'exams';
|
||||||
|
protected $connection = 'germanairlinesva_schooling';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array Validation rules
|
||||||
|
*/
|
||||||
|
public $rules = [
|
||||||
|
'member_id' => 'required',
|
||||||
|
'member_rank_id' => 'required',
|
||||||
|
'start' => 'required',
|
||||||
|
'status' => 'required',
|
||||||
|
];
|
||||||
|
|
||||||
|
public $belongsTo = [
|
||||||
|
'member_rank' => 'GermanAirlinesVa\Schooling\Models\MemberRank',
|
||||||
|
];
|
||||||
|
}
|
||||||
37
models/ExamTyperating.php
Normal file
37
models/ExamTyperating.php
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
<?php namespace GermanAirlinesVa\Schooling\Models;
|
||||||
|
|
||||||
|
use Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Model
|
||||||
|
*/
|
||||||
|
class ExamTyperating extends Model
|
||||||
|
{
|
||||||
|
use \October\Rain\Database\Traits\Validation;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Disable timestamps by default.
|
||||||
|
* Remove this line if timestamps are defined in the database table.
|
||||||
|
*/
|
||||||
|
public $timestamps = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var string The database table used by the model.
|
||||||
|
*/
|
||||||
|
public $table = 'exams';
|
||||||
|
protected $connection = 'germanairlinesva_schooling';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var array Validation rules
|
||||||
|
*/
|
||||||
|
public $rules = [
|
||||||
|
'member_id' => 'required',
|
||||||
|
'typerating_id' => 'required',
|
||||||
|
'start' => 'required',
|
||||||
|
'status' => 'required',
|
||||||
|
];
|
||||||
|
|
||||||
|
public $belongsTo = [
|
||||||
|
'typerating' => 'GermanAirlinesVa\Schooling\Models\Typerating',
|
||||||
|
];
|
||||||
|
}
|
||||||
@ -31,6 +31,10 @@ class ExamTyperatingQuestion extends Model
|
|||||||
'text' => 'required',
|
'text' => 'required',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
public $hasMany = [
|
||||||
|
'exam_answers' => 'GermanAirlinesVa\Schooling\Models\ExamTyperatingAnswer',
|
||||||
|
];
|
||||||
|
|
||||||
public $belongsTo = [
|
public $belongsTo = [
|
||||||
'typerating' => 'GermanAirlinesVa\Schooling\Models\Typerating',
|
'typerating' => 'GermanAirlinesVa\Schooling\Models\Typerating',
|
||||||
];
|
];
|
||||||
|
|||||||
18
models/exammemberrank/columns.yaml
Normal file
18
models/exammemberrank/columns.yaml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
columns:
|
||||||
|
id:
|
||||||
|
label: id
|
||||||
|
type: number
|
||||||
|
member_id:
|
||||||
|
label: member_id
|
||||||
|
type: number
|
||||||
|
member_rank:
|
||||||
|
label: member_rank
|
||||||
|
type: text
|
||||||
|
relation: member_rank
|
||||||
|
valueFrom: name
|
||||||
|
start:
|
||||||
|
label: start
|
||||||
|
type: datetime
|
||||||
|
status:
|
||||||
|
label: status
|
||||||
|
type: text
|
||||||
18
models/examtyperating/columns.yaml
Normal file
18
models/examtyperating/columns.yaml
Normal file
@ -0,0 +1,18 @@
|
|||||||
|
columns:
|
||||||
|
id:
|
||||||
|
label: id
|
||||||
|
type: number
|
||||||
|
member_id:
|
||||||
|
label: member_id
|
||||||
|
type: number
|
||||||
|
typerating:
|
||||||
|
label: typerating
|
||||||
|
type: text
|
||||||
|
relation: typerating
|
||||||
|
valueFrom: name
|
||||||
|
start:
|
||||||
|
label: start
|
||||||
|
type: datetime
|
||||||
|
status:
|
||||||
|
label: status
|
||||||
|
type: text
|
||||||
@ -36,6 +36,14 @@ navigation:
|
|||||||
label: 'germanairlinesva.schooling::lang.menu.exam_answer_typerating'
|
label: 'germanairlinesva.schooling::lang.menu.exam_answer_typerating'
|
||||||
url: germanairlinesva/schooling/examtyperatinganswer
|
url: germanairlinesva/schooling/examtyperatinganswer
|
||||||
icon: icon-check
|
icon: icon-check
|
||||||
|
side-menu-item7:
|
||||||
|
label: 'germanairlinesva.schooling::lang.menu.exam_member_rank'
|
||||||
|
url: germanairlinesva/schooling/exammemberrank
|
||||||
|
icon: icon-file-text
|
||||||
|
side-menu-item8:
|
||||||
|
label: 'germanairlinesva.schooling::lang.menu.exam_typerating'
|
||||||
|
url: germanairlinesva/schooling/examtyperating
|
||||||
|
icon: icon-file-text
|
||||||
permissions:
|
permissions:
|
||||||
schooling:
|
schooling:
|
||||||
tab: 'germanairlinesva.schooling::lang.permissions.tab'
|
tab: 'germanairlinesva.schooling::lang.permissions.tab'
|
||||||
|
|||||||
40
updates/builder_table_create_exams.php
Normal file
40
updates/builder_table_create_exams.php
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
<?php namespace GermanAirlinesVa\Schooling\Updates;
|
||||||
|
|
||||||
|
use DB;
|
||||||
|
use Schema;
|
||||||
|
use October\Rain\Database\Updates\Migration;
|
||||||
|
|
||||||
|
class BuilderTableCreateExams extends Migration
|
||||||
|
{
|
||||||
|
public function up()
|
||||||
|
{
|
||||||
|
Schema::connection('germanairlinesva_schooling')->create('exams', function ($table) {
|
||||||
|
$table->engine = 'InnoDB';
|
||||||
|
$table->bigIncrements('id')->unsigned();
|
||||||
|
$table->bigInteger('member_id')->unsigned();
|
||||||
|
$table
|
||||||
|
->bigInteger('member_rank_id')
|
||||||
|
->unsigned()
|
||||||
|
->nullable();
|
||||||
|
$table
|
||||||
|
->foreign('member_rank_id')
|
||||||
|
->references('id')
|
||||||
|
->on('member_ranks');
|
||||||
|
$table
|
||||||
|
->bigInteger('typerating_id')
|
||||||
|
->unsigned()
|
||||||
|
->nullable();
|
||||||
|
$table
|
||||||
|
->foreign('typerating_id')
|
||||||
|
->references('id')
|
||||||
|
->on('typeratings');
|
||||||
|
$table->datetime('start')->default(DB::raw('NOW()'));
|
||||||
|
$table->enum('status', ['pending', 'validated', 'closed', 'open']);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public function down()
|
||||||
|
{
|
||||||
|
Schema::connection('germanairlinesva_schooling')->dropIfExists('exams');
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -11,3 +11,5 @@
|
|||||||
- builder_table_create_exam_questions.php
|
- builder_table_create_exam_questions.php
|
||||||
- 'Created table exam_answers'
|
- 'Created table exam_answers'
|
||||||
- builder_table_create_exam_answers.php
|
- builder_table_create_exam_answers.php
|
||||||
|
- 'Created table exams'
|
||||||
|
- builder_table_create_exams.php
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user