ILIAS  release_5-2 Revision v5.2.25-18-g3f80b828510
class.ilDclMobFieldRepresentation.php
Go to the documentation of this file.
1 <?php
2 require_once ('./Modules/DataCollection/classes/Fields/Mob/class.ilDclMobFieldModel.php');
3 require_once('./Modules/DataCollection/classes/Fields/Fileupload/class.ilDclFileuploadFieldRepresentation.php');
4 
12 
13  public function getInputField(ilPropertyFormGUI $form, $record_id = 0) {
14  $input = new ilFileInputGUI($this->getField()->getTitle(), 'field_' . $this->getField()->getId());
15  $input->setSuffixes(ilDclMobFieldModel::$mob_suffixes);
16  $input->setAllowDeletion(true);
17 
18  $this->requiredWorkaroundForInputField($input, $record_id);
19 
20  return $input;
21  }
22 
23 
24  public function addFilterInputFieldToTable(ilTable2GUI $table) {
25  $input = $table->addFilterItemByMetaType("filter_" . $this->getField()->getId(), ilTable2GUI::FILTER_TEXT, false, $this->getField()->getId());
26  $input->setSubmitFormOnEnter(true);
27 
28  $this->setupFilterInputField($input);
29  return $this->getFilterInputFieldValue($input);
30  }
31 
32 
33  public function passThroughFilter(ilDclBaseRecordModel $record, $filter) {
34  $value = $record->getRecordFieldValue($this->getField()->getId());
35 
36  $m_obj = new ilObjMediaObject($value, false);
37  $file_name = $m_obj->getTitle();
38  if (!$filter || strpos(strtolower($file_name), strtolower($filter)) !== false) {
39  return true;
40  }
41  return false;
42  }
43 
47  public function buildFieldCreationInput(ilObjDataCollection $dcl, $mode = 'create') {
48  $opt = new ilRadioOption($this->lng->txt('dcl_' . $this->getField()->getDatatype()->getTitle()), $this->getField()->getDatatypeId());
49  $opt->setInfo($this->lng->txt('dcl_' . $this->getField()->getDatatype()->getTitle(). '_desc'));
50 
51  $opt->setInfo(sprintf($opt->getInfo(), implode(", ", ilDclMobFieldModel::$mob_suffixes)));
52 
53  $prop_width = new ilNumberInputGUI($this->lng->txt('dcl_width'), 'prop_'.ilDclBaseFieldModel::PROP_WIDTH);
54  $prop_width->setSize(5);
55  $prop_width->setMaxValue(4000);
56 
57  $opt->addSubItem($prop_width);
58 
59  $prop_height = new ilNumberInputGUI($this->lng->txt('dcl_height'), 'prop_'.ilDclBaseFieldModel::PROP_HEIGHT);
60  $prop_height->setSize(5);
61  $prop_height->setMaxValue(4000);
62 
63  $opt->addSubItem($prop_height);
64 
65  $prop_page_details = new ilDclCheckboxInputGUI($this->lng->txt('dcl_link_detail_page'), 'prop_'.ilDclBaseFieldModel::PROP_LINK_DETAIL_PAGE_TEXT);
66  $opt->addSubItem($prop_page_details);
67 
68  return $opt;
69  }
70 }
This class represents an option in a radio group.
addFilterItemByMetaType($id, $type=self::FILTER_TEXT, $a_optional=false, $caption=NULL)
Add filter by standard type.
This class represents a property form user interface.
This class represents a file property in a property form.
buildFieldCreationInput(ilObjDataCollection $dcl, $mode='create')
setInfo($a_info)
Set Info.
passThroughFilter(ilDclBaseRecordModel $record, $filter)
Class ilTable2GUI.
This class represents a number property in a property form.
Class ilObjMediaObject.
setupFilterInputField(ilFormPropertyGUI $input)
Set basic settings for filter-input-gui.
setSize($a_size)
Set Size.
Class ilDclFileuploadFieldRepresentaion.
getInputField(ilPropertyFormGUI $form, $record_id=0)
Class ilDclBaseRecordModel.
getRecordFieldValue($field_id)
Get Field Value.
Class ilDclCheckboxInputGUI.
Class ilObjDataCollection.