ILIAS  trunk Revision v11.0_alpha-2638-g80c1d007f79
class.ilDclRatingFieldRepresentation.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): ilTextInputGUI
24  {
25  $input = new ilTextInputGUI($this->getField()->getTitle(), 'field_' . $this->getField()->getId());
26  $input->setValue($this->lng->txt("dcl_editable_in_table_gui"));
27  $input->setDisabled(true);
28  $this->setupInputField($input, $this->getField());
29 
30  return $input;
31  }
32 
36  public function addFilterInputFieldToTable(ilTable2GUI $table)
37  {
38  $input = $table->addFilterItemByMetaType(
39  "filter_" . $this->getField()->getId(),
41  false,
42  $this->getField()->getId()
43  );
44  $options = ["" => $this->lng->txt("dcl_any"), 1 => ">1", 2 => ">2", 3 => ">3", 4 => ">4", 5 => "5"];
45  $input->setOptions($options);
46 
47  $this->setupFilterInputField($input);
48 
49  return $this->getFilterInputFieldValue($input);
50  }
51 
55  public function passThroughFilter(ilDclBaseRecordModel $record, $filter): bool
56  {
57  $value = $record->getRecordFieldValue($this->getField()->getId());
58  if (!$filter || $filter <= $value['avg']) {
59  return true;
60  }
61 
62  return false;
63  }
64 }
getRecordFieldValue(?string $field_id)
Get Field Value.
getInputField(ilPropertyFormGUI $form, ?int $record_id=null)
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.
setupFilterInputField(?ilTableFilterItem $input)
Set basic settings for filter-input-gui.
passThroughFilter(ilDclBaseRecordModel $record, $filter)