/**
  * @param array $record_data
  *
  * @return bool|void
  */
 public function fillRow($record_data)
 {
     global $ilUser, $ilAccess;
     $record_obj = $record_data['_record'];
     /**
      * @var $record_obj ilDataCollectionRecord
      * @var $ilAccess   ilAccessHandler
      */
     foreach ($this->table->getVisibleFields() as $field) {
         $title = $field->getTitle();
         $this->tpl->setCurrentBlock("field");
         $content = $record_data[$title];
         if ($content === false or $content === NULL) {
             $content = '';
         }
         // SW - This ensures to display also zeros in the table...
         switch ($field->getDatatypeId()) {
             case ilDataCollectionDatatype::INPUTFORMAT_NUMBER:
                 $this->tpl->setVariable("ADDITIONAL_CLASS", 'text-right');
                 break;
         }
         $this->tpl->setVariable("CONTENT", $content);
         $this->tpl->parseCurrentBlock();
         if ($field->getLearningProgress()) {
             $this->tpl->setCurrentBlock("field");
             $this->tpl->setVariable("CONTENT", $record_data["_status_" . $title]);
             $this->tpl->parseCurrentBlock();
         }
     }
     if ($record_data["_front"]) {
         $this->tpl->setCurrentBlock('view');
         $this->tpl->setVariable("VIEW_IMAGE_LINK", $record_data["_front"]);
         $this->tpl->setVariable("VIEW_IMAGE_SRC", ilUtil::img(ilUtil::getImagePath("cmd_view_s.png")));
         $this->tpl->parseCurrentBlock();
     }
     $this->tpl->setVariable("ACTIONS", $record_data["_actions"]);
     if ($this->mode == ilDataCollectionRecordListGUI::MODE_MANAGE) {
         if ($record_obj->getOwner() == $ilUser->getId() or $ilAccess->checkAccess('write', '', $_GET['ref_id'])) {
             $this->tpl->setCurrentBlock('mode_manage');
             $this->tpl->setVariable('RECORD_ID', $record_obj->getId());
             $this->tpl->parseCurrentBlock();
         } else {
             $this->tpl->touchBlock('mode_manage_no_owner');
         }
     }
     return true;
 }
 /**
  * initEditCustomForm
  *
  * @param string $a_mode
  */
 public function initForm($a_mode = "create")
 {
     include_once "./Services/Form/classes/class.ilPropertyFormGUI.php";
     $this->form = new ilPropertyFormGUI();
     $item = new ilTextInputGUI($this->lng->txt('title'), 'title');
     $item->setRequired(true);
     $this->form->addItem($item);
     $item = new ilCheckboxInputGUI($this->lng->txt('dcl_visible'), 'is_visible');
     $this->form->addItem($item);
     // Show default order field and direction only in edit mode, because table id is not yet given and there are no fields to select
     if ($a_mode != 'create') {
         $item = new ilSelectInputGUI($this->lng->txt('dcl_default_sort_field'), 'default_sort_field');
         $fields = $this->table->getVisibleFields();
         $options = array(0 => $this->lng->txt('dcl_please_select'));
         foreach ($fields as $field) {
             $options[$field->getId()] = $field->getTitle();
         }
         $item->setOptions($options);
         $this->form->addItem($item);
         $item = new ilSelectInputGUI($this->lng->txt('dcl_default_sort_field_order'), 'default_sort_field_order');
         $options = array('asc' => $this->lng->txt('dcl_asc'), 'desc' => $this->lng->txt('dcl_desc'));
         $item->setOptions($options);
         $this->form->addItem($item);
     }
     $item = new ilTextAreaInputGUI($this->lng->txt('additional_info'), 'description');
     $item->setUseRte(true);
     //        $item->setRTESupport($this->table->getId(), 'dcl', 'table_settings');
     $item->setRteTagSet('mini');
     $this->form->addItem($item);
     $item = new ilCheckboxInputGUI($this->lng->txt('dcl_public_comments'), 'public_comments');
     $this->form->addItem($item);
     $section = new ilFormSectionHeaderGUI();
     $section->setTitle($this->lng->txt('dcl_permissions_form'));
     $this->form->addItem($section);
     $item = new ilCustomInputGUI();
     $item->setHtml($this->lng->txt('dcl_table_info'));
     $item->setTitle($this->lng->txt('dcl_table_info_title'));
     $this->form->addItem($item);
     $item = new ilCheckboxInputGUI($this->lng->txt('dcl_add_perm'), 'add_perm');
     //		$item->setInfo($this->lng->txt("dcl_add_perm_info"));
     $this->form->addItem($item);
     $item = new ilCheckboxInputGUI($this->lng->txt('dcl_edit_perm'), 'edit_perm');
     //		$item->setInfo($this->lng->txt("dcl_edit_perm_info"));
     $this->form->addItem($item);
     $item = new ilCheckboxInputGUI($this->lng->txt('dcl_delete_perm'), 'delete_perm');
     //		$item->setInfo($this->lng->txt("dcl_delete_perm_info"));
     $this->form->addItem($item);
     $item = new ilCheckboxInputGUI($this->lng->txt('dcl_edit_by_owner'), 'edit_by_owner');
     //		$item->setInfo($this->lng->txt("dcl_edit_by_owner_info"));
     $this->form->addItem($item);
     $item = new ilCheckboxInputGUI($this->lng->txt('dcl_view_own_records_perm'), 'view_own_records_perm');
     //		$item->setInfo($this->lng->txt("dcl_edit_by_owner_info"));
     $this->form->addItem($item);
     $item = new ilCheckboxInputGUI($this->lng->txt('dcl_export_enabled'), 'export_enabled');
     $this->form->addItem($item);
     $item = new ilCheckboxInputGUI($this->lng->txt('dcl_limited'), 'limited');
     $sitem1 = new ilDateTimeInputGUI($this->lng->txt('dcl_limit_start'), 'limit_start');
     $sitem1->setShowTime(true);
     $sitem2 = new ilDateTimeInputGUI($this->lng->txt('dcl_limit_end'), 'limit_end');
     $sitem2->setShowTime(true);
     //		$item->setInfo($this->lng->txt("dcl_limited_info"));
     $item->addSubItem($sitem1);
     $item->addSubItem($sitem2);
     $this->form->addItem($item);
     if ($a_mode == "edit") {
         $this->form->addCommandButton('update', $this->lng->txt('dcl_table_' . $a_mode));
     } else {
         $this->form->addCommandButton('save', $this->lng->txt('dcl_table_' . $a_mode));
     }
     $this->form->addCommandButton('cancel', $this->lng->txt('cancel'));
     $this->form->setFormAction($this->ctrl->getFormAction($this, $a_mode));
     if ($a_mode == "edit") {
         $this->form->setTitle($this->lng->txt('dcl_edit_table'));
     } else {
         $this->form->setTitle($this->lng->txt('dcl_new_table'));
     }
 }