ILIAS  release_8 Revision v8.23
class.ilDclMobFieldRepresentation.php
Go to the documentation of this file.
1 <?php
2 
20 {
21  public function getInputField(ilPropertyFormGUI $form, ?int $record_id = null): ilFileInputGUI
22  {
23  $input = new ilFileInputGUI($this->getField()->getTitle(), 'field_' . $this->getField()->getId());
24  $input->setSuffixes(ilDclMobFieldModel::$mob_suffixes);
25  $input->setAllowDeletion(true);
26 
27  $this->requiredWorkaroundForInputField($input, $record_id);
28 
29  return $input;
30  }
31 
36  public function addFilterInputFieldToTable(ilTable2GUI $table)
37  {
38  $input = $table->addFilterItemByMetaType(
39  "filter_" . $this->getField()->getId(),
41  false,
42  $this->getField()->getId()
43  );
44  $input->setSubmitFormOnEnter(true);
45 
46  $this->setupFilterInputField($input);
47 
48  return $this->getFilterInputFieldValue($input);
49  }
50 
54  public function passThroughFilter(ilDclBaseRecordModel $record, $filter): bool
55  {
56  $value = $record->getRecordFieldValue($this->getField()->getId());
57 
58  $m_obj = new ilObjMediaObject($value);
59  $file_name = $m_obj->getTitle();
60  if (!$filter || strpos(strtolower($file_name), strtolower($filter)) !== false) {
61  return true;
62  }
63 
64  return false;
65  }
66 
67  protected function buildFieldCreationInput(ilObjDataCollection $dcl, string $mode = 'create'): ilRadioOption
68  {
69  $opt = new ilRadioOption(
70  $this->lng->txt('dcl_' . $this->getField()->getDatatype()->getTitle()),
71  $this->getField()->getDatatypeId()
72  );
73  $opt->setInfo($this->lng->txt('dcl_' . $this->getField()->getDatatype()->getTitle() . '_desc'));
74 
75  $opt->setInfo(sprintf($opt->getInfo(), implode(", ", ilDclMobFieldModel::$mob_suffixes)));
76 
77  $prop_width = new ilNumberInputGUI($this->lng->txt('dcl_width'), 'prop_' . ilDclBaseFieldModel::PROP_WIDTH);
78  $prop_width->setSize(5);
79  $prop_width->setMaxValue(4000);
80 
81  $opt->addSubItem($prop_width);
82 
83  $prop_height = new ilNumberInputGUI($this->lng->txt('dcl_height'), 'prop_' . ilDclBaseFieldModel::PROP_HEIGHT);
84  $prop_height->setSize(5);
85  $prop_height->setMaxValue(4000);
86 
87  $opt->addSubItem($prop_height);
88 
89  $prop_page_details = new ilDclCheckboxInputGUI(
90  $this->lng->txt('dcl_link_detail_page'),
92  );
93  $opt->addSubItem($prop_page_details);
94 
95  return $opt;
96  }
97 }
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This class represents a file property in a property form.
setInfo(string $a_info)
requiredWorkaroundForInputField(ilFileInputGUI $input, ?int $record_id)
passThroughFilter(ilDclBaseRecordModel $record, $filter)
getRecordFieldValue(?int $field_id)
Get Field Value.
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.
setupFilterInputField(?ilTableFilterItem $input)
Set basic settings for filter-input-gui.
getInputField(ilPropertyFormGUI $form, ?int $record_id=null)
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...
buildFieldCreationInput(ilObjDataCollection $dcl, string $mode='create')
This file is part of ILIAS, a powerful learning management system published by ILIAS open source e-Le...