AssignmentEntry
extends Model
in package
Table of Contents
Properties
- $group_counts : mixed
- $type_enum : mixed
- This is how question/entry types are defined.
- $type_to_group : mixed
- $allowedFields : mixed
- $primaryKey : mixed
- $table : mixed
Methods
- __construct() : mixed
- find() : mixed
- Override: Returns null if type is invalid
- find_group() : mixed
- Return the group identifier of a type
- find_group_counts() : array<string|int, mixed>
- returns an array with number of types per group
- findAll() : array<string|int, mixed>
- Override: Do not include invalid types
- findAllUserInputs() : array<string|int, mixed>
- Returns array of entries that explicitly require user input (questions only)
- first() : mixed
- Override: Returns null if type is invalid
- get_type() : array<string|int, mixed>
- Returns true if entry type explicitly requires user input (question only)
- type_to_group_table() : array<string|int, mixed>
- return an array where key represents the type, and the value the group of the type
- user_input_type() : bool
- Returns true if entry type explicitly requires user input (question only)
- valid_type() : bool
- check validity of an entry type by matching with $this->type_enum
Properties
$group_counts
public
mixed
$group_counts
$type_enum
This is how question/entry types are defined.
public
mixed
$type_enum
= [['type' => 'mcq', 'group' => 'mcq', 'name' => '1 kiezen', 'is_input' => true, 'short' => 'Keuze'], ['type' => 'mcq-2', 'group' => 'mcq', 'name' => '2 kiezen', 'is_input' => true, 'short' => 'Keuze'], ['type' => 'mcq-3', 'group' => 'mcq', 'name' => '3 kiezen', 'is_input' => true, 'short' => 'Keuze'], ['type' => 'text_input', 'group' => NULL, 'name' => 'Vrije invoer', 'is_input' => true, 'short' => 'Invoer'], ['type' => 'text_separator', 'group' => NULL, 'name' => 'Scheidingstekst', 'is_input' => false, 'short' => 'Scheiding'], ['type' => 'video_youtube', 'group' => 'video', 'name' => 'Youtube video', 'is_input' => false, 'short' => 'Video']]
IMPORTANT!
Do not change or remove existing type/group 'type' identifiers. This can have negative impact on existing training data.
If required, make sure to update the database enum and all database records that reference that type!
$type_to_group
public
mixed
$type_to_group
$allowedFields
protected
mixed
$allowedFields
= ['id', 'sort_order', 'name', 'info', 'assignment_id', 'type', 'optional']
$primaryKey
protected
mixed
$primaryKey
= 'id'
$table
protected
mixed
$table
= 'assignment_entry'
Methods
__construct()
public
__construct() : mixed
find()
Override: Returns null if type is invalid
public
find([mixed $id = null ]) : mixed
Parameters
- $id : mixed = null
find_group()
Return the group identifier of a type
public
find_group(mixed $type) : mixed
Parameters
- $type : mixed
find_group_counts()
returns an array with number of types per group
public
find_group_counts() : array<string|int, mixed>
Return values
array<string|int, mixed>findAll()
Override: Do not include invalid types
public
findAll([mixed $limit = null ][, mixed $offset = 0 ]) : array<string|int, mixed>
Parameters
- $limit : mixed = null
- $offset : mixed = 0
Return values
array<string|int, mixed>findAllUserInputs()
Returns array of entries that explicitly require user input (questions only)
public
findAllUserInputs([mixed $limit = null ][, mixed $offset = 0 ]) : array<string|int, mixed>
Parameters
- $limit : mixed = null
- $offset : mixed = 0
Return values
array<string|int, mixed>first()
Override: Returns null if type is invalid
public
first() : mixed
get_type()
Returns true if entry type explicitly requires user input (question only)
public
get_type(mixed $type) : array<string|int, mixed>
Parameters
- $type : mixed
Return values
array<string|int, mixed>type_to_group_table()
return an array where key represents the type, and the value the group of the type
public
type_to_group_table() : array<string|int, mixed>
Return values
array<string|int, mixed>user_input_type()
Returns true if entry type explicitly requires user input (question only)
public
user_input_type(mixed $type) : bool
Parameters
- $type : mixed
Return values
boolvalid_type()
check validity of an entry type by matching with $this->type_enum
public
valid_type(mixed $type) : bool
Parameters
- $type : mixed