ILIAS  trunk Revision v11.0_alpha-3011-gc6b235a2e85
class.ilDclBooleanFieldRepresentation.php
Go to the documentation of this file.
1<?php
2
19declare(strict_types=1);
20
22{
23 public function getInputField(ilPropertyFormGUI $form, ?int $record_id = null): ilDclCheckboxInputGUI
24 {
25 $input = new ilDclCheckboxInputGUI($this->getField()->getTitle(), 'field_' . $this->getField()->getId());
26 $this->setupInputField($input, $this->getField());
27
28 return $input;
29 }
30
37 {
38 $input = $table->addFilterItemByMetaType(
39 "filter_" . $this->getField()->getId(),
41 false,
42 $this->getField()->getId()
43 );
44 $input->setOptions(
45 [
46 "" => $this->lng->txt("dcl_any"),
47 "not_checked" => $this->lng->txt("dcl_not_checked"),
48 "checked" => $this->lng->txt("dcl_checked"),
49 ]
50 );
51
52 $this->setupFilterInputField($input);
53
54 return $this->getFilterInputFieldValue($input);
55 }
56
57 public function passThroughFilter(ilDclBaseRecordModel $record, $filter): bool
58 {
59 $value = $record->getRecordFieldValue($this->getField()->getId());
60 if ((($filter == "checked" && $value == 1) || ($filter == "not_checked" && $value == 0)) || $filter == '' || !$filter) {
61 return true;
62 }
63
64 return false;
65 }
66}
setupInputField(ilFormPropertyGUI $input, ilDclBaseFieldModel $field)
Sets basic settings on field-input.
setupFilterInputField(?ilTableFilterItem $input)
Set basic settings for filter-input-gui.
getRecordFieldValue(?string $field_id)
Get Field Value.
getInputField(ilPropertyFormGUI $form, ?int $record_id=null)
Returns field-input.
passThroughFilter(ilDclBaseRecordModel $record, $filter)
Checks if a filter affects a record.
This class represents a property form user interface.
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
addFilterItemByMetaType(string $id, int $type=self::FILTER_TEXT, bool $a_optional=false, string $caption="")
Add filter by standard type.