ILIAS  trunk Revision v11.0_alpha-1713-gd8962da2f67
All Data Structures Namespaces Files Functions Variables Enumerations Enumerator Modules Pages
class.ilDclNumberFieldRepresentation.php
Go to the documentation of this file.
1 <?php
2 
19 declare(strict_types=1);
20 
22 {
23  public function getInputField(ilPropertyFormGUI $form, ?int $record_id = null): ilNumberInputGUI
24  {
25  $input = new ilNumberInputGUI($this->getField()->getTitle(), 'field_' . $this->getField()->getId());
26  // 9 is the maximum number of digits for an integer
27  $input->setMaxLength(9);
28  $input->setInfo($this->lng->txt('dcl_max_digits') . ": 9");
29  $this->setupInputField($input, $this->getField());
30 
31  return $input;
32  }
33 
39  public function addFilterInputFieldToTable(ilTable2GUI $table)
40  {
41  $input = $table->addFilterItemByMetaType(
42  "filter_" . $this->getField()->getId(),
44  false,
45  $this->getField()->getId()
46  );
47  $input->setSubmitFormOnEnter(true);
48 
49  $this->setupFilterInputField($input);
50 
51  return $this->getFilterInputFieldValue($input);
52  }
53 
57  public function passThroughFilter(ilDclBaseRecordModel $record, $filter): bool
58  {
59  $value = $record->getRecordFieldValue($this->getField()->getId());
60  if ((!$filter['from'] || $value >= $filter['from']) && (!$filter['to'] || $value <= $filter['to'])) {
61  return true;
62  }
63 
64  return false;
65  }
66 
67  protected function buildFieldCreationInput(ilObjDataCollection $dcl, string $mode = 'create'): ilRadioOption
68  {
69  return parent::buildFieldCreationInput($dcl, $mode);
70  }
71 }
This class represents an option in a radio group.
buildFieldCreationInput(ilObjDataCollection $dcl, string $mode='create')
getRecordFieldValue(?string $field_id)
Get Field Value.
const FILTER_NUMBER_RANGE
setupInputField(ilFormPropertyGUI $input, ilDclBaseFieldModel $field)
Sets basic settings on field-input.
while($session_entry=$r->fetchRow(ilDBConstants::FETCHMODE_ASSOC)) return null
addFilterItemByMetaType(string $id, int $type=self::FILTER_TEXT, bool $a_optional=false, string $caption="")
Add filter by standard type.
This class represents a number property in a property form.
getInputField(ilPropertyFormGUI $form, ?int $record_id=null)
setupFilterInputField(?ilTableFilterItem $input)
Set basic settings for filter-input-gui.
passThroughFilter(ilDclBaseRecordModel $record, $filter)