/**
  * @param ilDataCollectionField $field
  * @param array                 $warnings
  *
  * @return bool
  */
 private function checkImportType($field, &$warnings)
 {
     global $lng;
     if (in_array($field->getDatatypeId(), $this->supported_import_datatypes)) {
         return true;
     } else {
         $warnings[] = $field->getTitle() . ": " . $lng->txt("dcl_not_supported_in_import");
         return false;
     }
 }
 /**
  * @param ilDataCollectionField $a_set
  */
 public function fillRow(ilDataCollectionField $a_set)
 {
     global $lng, $ilCtrl;
     if (!$a_set->isStandardField()) {
         $this->tpl->setVariable('FIELD_ID', $a_set->getId());
     }
     $this->tpl->setVariable('NAME', 'order[' . $a_set->getId() . ']');
     $this->tpl->setVariable('VALUE', $this->order);
     $this->tpl->setVariable('CHECKBOX_VISIBLE', 'visible[' . $a_set->getId() . ']');
     if ($a_set->isVisible()) {
         $this->tpl->setVariable('CHECKBOX_VISIBLE_CHECKED', 'checked');
     }
     /* Don't enable setting filter for MOB fields or reference fields that reference a MOB field */
     $show_filter = true;
     $show_exportable = true;
     if ($a_set->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_MOB || $a_set->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_FILE) {
         $show_filter = false;
     }
     if ($a_set->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_REFERENCE) {
         $ref_field = ilDataCollectionCache::getFieldCache((int) $a_set->getFieldRef());
         if ($ref_field && ($ref_field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_MOB || $ref_field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_FILE)) {
             $show_filter = false;
         }
     }
     if ($a_set->getId() == 'comments') {
         $show_filter = false;
         $show_exportable = false;
     }
     if ($show_filter) {
         $this->tpl->setVariable('CHECKBOX_FILTERABLE', 'filterable[' . $a_set->getId() . ']');
         if ($a_set->isFilterable()) {
             $this->tpl->setVariable('CHECKBOX_FILTERABLE_CHECKED', 'checked');
         }
     } else {
         $this->tpl->setVariable('NO_FILTER', '');
     }
     if ($show_exportable) {
         $this->tpl->setVariable('CHECKBOX_EXPORTABLE', 'exportable[' . $a_set->getId() . ']');
         if ($a_set->getExportable()) {
             $this->tpl->setVariable('CHECKBOX_EXPORTABLE_CHECKED', 'checked');
         }
     } else {
         $this->tpl->setVariable('NO_FILTER_EXPORTABLE', '');
     }
     if (!$a_set->isStandardField()) {
         $this->tpl->setVariable('CHECKBOX_NAME_LOCKED', 'locked[' . $a_set->getId() . ']');
         if ($a_set->getLocked()) {
             $this->tpl->setVariable('CHECKBOX_CHECKED_LOCKED', 'checked');
         }
     } else {
         $this->tpl->setVariable('NOT_LOCKED', '');
     }
     $this->order = $this->order + 10;
     $this->tpl->setVariable('ORDER_NAME', 'order[' . $a_set->getId() . ']');
     $this->tpl->setVariable('ORDER_VALUE', $this->order);
     $this->tpl->setVariable('TITLE', $a_set->getTitle());
     $this->tpl->setVariable('DESCRIPTION', $a_set->getDescription());
     $this->tpl->setVariable('DATATYPE', $a_set->getDatatypeTitle());
     if (!$a_set->isStandardField()) {
         switch ($a_set->getRequired()) {
             case 0:
                 $required = ilUtil::getImagePath('icon_not_ok.svg');
                 break;
             case 1:
                 $required = ilUtil::getImagePath('icon_ok.svg');
                 break;
         }
         switch ($a_set->isUnique()) {
             case 0:
                 $uniq = ilUtil::getImagePath('icon_not_ok.svg');
                 break;
             case 1:
                 $uniq = ilUtil::getImagePath('icon_ok.svg');
                 break;
         }
         $this->tpl->setVariable('REQUIRED', $required);
         $this->tpl->setVariable('UNIQUE', $uniq);
     } else {
         $this->tpl->setVariable('NO_REQUIRED', '');
         $this->tpl->setVariable('NO_UNIQUE', '');
     }
     $ilCtrl->setParameterByClass('ildatacollectionfieldeditgui', 'field_id', $a_set->getId());
     if (!$a_set->isStandardField()) {
         include_once './Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php';
         $alist = new ilAdvancedSelectionListGUI();
         $alist->setId($a_set->getId());
         $alist->setListTitle($lng->txt('actions'));
         if ($this->table->hasPermissionToFields($this->parent_obj->parent_obj->ref_id)) {
             $alist->addItem($lng->txt('edit'), 'edit', $ilCtrl->getLinkTargetByClass('ildatacollectionfieldeditgui', 'edit'));
             $alist->addItem($lng->txt('delete'), 'delete', $ilCtrl->getLinkTargetByClass('ildatacollectionfieldeditgui', 'confirmDelete'));
         }
         $this->tpl->setVariable('ACTIONS', $alist->getHTML());
     }
 }
 /**
  * fill row 
  *
  * @access public
  * @param $a_set
  */
 public function fillRow(ilDataCollectionField $a_set)
 {
     global $lng, $ilCtrl;
     $this->tpl->setVariable('NAME', "order[" . $a_set->getId() . "]");
     $this->tpl->setVariable('VALUE', $this->order);
     $this->tpl->setVariable("CHECKBOX_VISIBLE", "visible[" . $a_set->getId() . "]");
     if ($a_set->isVisible()) {
         $this->tpl->setVariable("CHECKBOX_VISIBLE_CHECKED", "checked");
     }
     $this->tpl->setVariable("CHECKBOX_FILTERABLE", "filterable[" . $a_set->getId() . "]");
     if ($a_set->isFilterable()) {
         $this->tpl->setVariable("CHECKBOX_FILTERABLE_CHECKED", "checked");
     }
     if (!$a_set->isStandardField()) {
         $this->tpl->setVariable("CHECKBOX_NAME_LOCKED", "locked[" . $a_set->getId() . "]");
         if ($a_set->getLocked()) {
             $this->tpl->setVariable("CHECKBOX_CHECKED_LOCKED", "checked");
         }
     } else {
         $this->tpl->setVariable("NOT_LOCKED", "-");
     }
     $this->order = $this->order + 10;
     $this->tpl->setVariable("ORDER_NAME", "order[" . $a_set->getId() . "]");
     $this->tpl->setVariable("ORDER_VALUE", $this->order);
     $this->tpl->setVariable('TITLE', $a_set->getTitle());
     $this->tpl->setVariable('DESCRIPTION', $a_set->getDescription());
     $this->tpl->setVariable('DATATYPE', $a_set->getDatatypeTitle());
     if (!$a_set->isStandardField()) {
         switch ($a_set->getRequired()) {
             case 0:
                 $required = ilUtil::getImagePath('icon_not_ok.png');
                 break;
             case 1:
                 $required = ilUtil::getImagePath('icon_ok.png');
                 break;
         }
         switch ($a_set->isUnique()) {
             case 0:
                 $uniq = ilUtil::getImagePath('icon_not_ok.png');
                 break;
             case 1:
                 $uniq = ilUtil::getImagePath('icon_ok.png');
                 break;
         }
         $this->tpl->setVariable('REQUIRED', $required);
         $this->tpl->setVariable('UNIQUE', $uniq);
     } else {
         $this->tpl->setVariable('NO_REQUIRED', "-");
         $this->tpl->setVariable('NO_UNIQUE', "-");
     }
     $ilCtrl->setParameterByClass("ildatacollectionfieldeditgui", "field_id", $a_set->getId());
     if (!$a_set->isStandardField()) {
         include_once "./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php";
         $alist = new ilAdvancedSelectionListGUI();
         $alist->setId($a_set->getId());
         $alist->setListTitle($lng->txt("actions"));
         if ($this->table->hasPermissionToFields($this->parent_obj->parent_obj->ref_id)) {
             $alist->addItem($lng->txt('edit'), 'edit', $ilCtrl->getLinkTargetByClass("ildatacollectionfieldeditgui", 'edit'));
             $alist->addItem($lng->txt('delete'), 'delete', $ilCtrl->getLinkTargetByClass("ildatacollectionfieldeditgui", 'confirmDelete'));
         }
         $this->tpl->setVariable("ACTIONS", $alist->getHTML());
     }
 }
 /**
  * addFilterInputFieldToTable This function adds the according filter item to the table gui passed as argument.
  * @param $field ilDataCollectionField The field which should be filterable.
  * @param &$table ilTable2GUI The table you want the filter to be added to.
  */
 static function addFilterInputFieldToTable(ilDataCollectionField $field, ilTable2GUI &$table)
 {
     global $lng;
     $type_id = $field->getDatatypeId();
     $input = NULL;
     switch ($type_id) {
         case ilDataCollectionDatatype::INPUTFORMAT_TEXT:
             $input = $table->addFilterItemByMetaType("filter_" . $field->getId(), ilTable2GUI::FILTER_TEXT, false, $field->getId());
             $input->setSubmitFormOnEnter(true);
             break;
         case ilDataCollectionDatatype::INPUTFORMAT_NUMBER:
             $input = $table->addFilterItemByMetaType("filter_" . $field->getId(), ilTable2GUI::FILTER_NUMBER_RANGE, false, $field->getId());
             $input->setSubmitFormOnEnter(true);
             break;
         case ilDataCollectionDatatype::INPUTFORMAT_BOOLEAN:
             $input = $table->addFilterItemByMetaType("filter_" . $field->getId(), ilTable2GUI::FILTER_SELECT, false, $field->getId());
             $input->setOptions(array("" => $lng->txt("dcl_any"), "not_checked" => $lng->txt("dcl_not_checked"), "checked" => $lng->txt("dcl_checked")));
             break;
         case ilDataCollectionDatatype::INPUTFORMAT_DATETIME:
             $input = $table->addFilterItemByMetaType("filter_" . $field->getId(), ilTable2GUI::FILTER_DATE_RANGE, false, $field->getId());
             $input->setSubmitFormOnEnter(true);
             $input->setStartYear(date("Y") - 100);
             break;
         case ilDataCollectionDatatype::INPUTFORMAT_FILE:
             $input = $table->addFilterItemByMetaType("filter_" . $field->getId(), ilTable2GUI::FILTER_TEXT, false, $field->getId());
             $input->setSubmitFormOnEnter(true);
             break;
         case ilDataCollectionDatatype::INPUTFORMAT_REFERENCE:
             $input = $table->addFilterItemByMetaType("filter_" . $field->getId(), ilTable2GUI::FILTER_SELECT, false, $field->getId());
             $ref_field_id = $field->getFieldRef();
             $ref_field = ilDataCollectionCache::getFieldCache($ref_field_id);
             $ref_table = ilDataCollectionCache::getTableCache($ref_field->getTableId());
             $options = array();
             foreach ($ref_table->getRecords() as $record) {
                 $options[$record->getId()] = $record->getRecordFieldValue($ref_field_id);
             }
             // Sort by values ASC
             asort($options);
             $options = array('' => $lng->txt('dcl_any')) + $options;
             $input->setOptions($options);
             break;
         case ilDataCollectionDatatype::INPUTFORMAT_RATING:
             $input = $table->addFilterItemByMetaType("filter_" . $field->getId(), ilTable2GUI::FILTER_SELECT, false, $field->getId());
             $options = array("" => $lng->txt("dcl_any"), 1 => ">1", 2 => ">2", 3 => ">3", 4 => ">4", 5 => "5");
             $input->setOptions($options);
             break;
         case ilDataCollectionDatatype::INPUTFORMAT_MOB:
             $input = $table->addFilterItemByMetaType("filter_" . $field->getId(), ilTable2GUI::FILTER_TEXT, false, $field->getId());
             $input->setSubmitFormOnEnter(true);
             break;
         case ilDataCollectionDatatype::INPUTFORMAT_ILIAS_REF:
             $input = $table->addFilterItemByMetaType("filter_" . $field->getId(), ilTable2GUI::FILTER_TEXT, false, $field->getId());
             $input->setSubmitFormOnEnter(true);
             break;
         case ilDataCollectionDatatype::INPUTFORMAT_REFERENCELIST:
             //FIXME
             $input = $table->addFilterItemByMetaType("filter_" . $field->getId(), ilTable2GUI::FILTER_SELECT, false, $field->getId());
             $ref_field_id = $field->getFieldRef();
             $ref_field = ilDataCollectionCache::getFieldCache($ref_field_id);
             $ref_table = ilDataCollectionCache::getTableCache($ref_field->getTableId());
             $options = array();
             foreach ($ref_table->getRecords() as $record) {
                 $options[$record->getId()] = $record->getRecordFieldValue($ref_field_id);
             }
             // Sort by values ASC
             asort($options);
             $options = array('' => $lng->txt('dcl_any')) + $options;
             $input->setOptions($options);
             break;
     }
     if ($input != NULL) {
         $input->setTitle($field->getTitle());
     }
     return $input;
 }