/** * @description Parse data from record objects to an array that is then set to this table with ::setData() */ private function buildData() { global $ilCtrl, $lng; $data = array(); foreach ($this->object_data as $record) { $record_data = array(); $record_data["_front"] = NULL; $record_data['_record'] = $record; foreach ($this->table->getVisibleFields() as $field) { $title = $field->getTitle(); $record_data[$title] = $record->getRecordFieldHTML($field->getId()); // Additional column filled in ::fillRow() method, showing the learning progress if ($field->getLearningProgress()) { $record_data["_status_" . $title] = $this->getStatus($record, $field); } if ($field->getId() == 'comments') { $record_data['n_comments'] = count($record->getComments()); } } $ilCtrl->setParameterByClass("ildatacollectionfieldeditgui", "record_id", $record->getId()); $ilCtrl->setParameterByClass("ildatacollectionrecordviewgui", "record_id", $record->getId()); $ilCtrl->setParameterByClass("ildatacollectionrecordeditgui", "record_id", $record->getId()); if (ilDataCollectionRecordViewGUI::hasTableValidViewDefinition($this->table)) { $record_data["_front"] = $ilCtrl->getLinkTargetByClass("ildatacollectionrecordviewgui", 'renderRecord'); } $alist = new ilAdvancedSelectionListGUI(); $alist->setId($record->getId()); $alist->setListTitle($lng->txt("actions")); if (ilDataCollectionRecordViewGUI::hasTableValidViewDefinition($this->table)) { $alist->addItem($lng->txt('view'), 'view', $ilCtrl->getLinkTargetByClass("ildatacollectionrecordviewgui", 'renderRecord')); } if ($record->hasPermissionToEdit($this->parent_obj->parent_obj->ref_id)) { $alist->addItem($lng->txt('edit'), 'edit', $ilCtrl->getLinkTargetByClass("ildatacollectionrecordeditgui", 'edit')); } if ($record->hasPermissionToDelete($this->parent_obj->parent_obj->ref_id)) { $alist->addItem($lng->txt('delete'), 'delete', $ilCtrl->getLinkTargetByClass("ildatacollectionrecordeditgui", 'confirmDelete')); } if ($this->table->getPublicCommentsEnabled()) { $alist->addItem($lng->txt('dcl_comments'), 'comment', '', '', '', '', '', '', $this->getCommentsAjaxLink($record->getId())); } $record_data["_actions"] = $alist->getHTML(); $data[] = $record_data; } $this->setData($data); }
private function buildData() { global $ilCtrl, $lng; $data = array(); foreach ($this->object_data as $record) { $record_data = array(); $record_data["_front"] = null; foreach ($this->table->getVisibleFields() as $field) { $title = $field->getTitle(); //Check Options of Displaying $options = array(); $arr_properties = $field->getProperties(); if ($arr_properties[ilDataCollectionField::PROPERTYID_REFERENCE_LINK]) { $options['link']['display'] = true; } if ($arr_properties[ilDataCollectionField::PROPERTYID_ILIAS_REFERENCE_LINK]) { $options['link']['display'] = true; } if ($field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_RATING) { $val = ilRating::getOverallRatingForObject($record->getId(), "dcl_record", $field->getId(), "dcl_field"); $record_data[$title] = $val["avg"] . " (" . $val["cnt"] . ")"; } else { $record_data[$title] = $record->getRecordFieldHTML($field->getId(), $options) ? $record->getRecordFieldHTML($field->getId(), $options) : null; } if ($field->getLearningProgress()) { $record_data["_status_" . $title] = $this->getStatus($record, $field); } } $ilCtrl->setParameterByClass("ildatacollectionfieldeditgui", "record_id", $record->getId()); $ilCtrl->setParameterByClass("ildatacollectionrecordviewgui", "record_id", $record->getId()); $ilCtrl->setParameterByClass("ildatacollectionrecordeditgui", "record_id", $record->getId()); include_once "./Services/UIComponent/AdvancedSelectionList/classes/class.ilAdvancedSelectionListGUI.php"; if (ilDataCollectionRecordViewGUI::_getViewDefinitionId($record)) { $record_data["_front"] = $ilCtrl->getLinkTargetByClass("ildatacollectionrecordviewgui", 'renderRecord'); } $alist = new ilAdvancedSelectionListGUI(); $alist->setId($record->getId()); $alist->setListTitle($lng->txt("actions")); if (ilDataCollectionRecordViewGUI::_getViewDefinitionId($record)) { $alist->addItem($lng->txt('view'), 'view', $ilCtrl->getLinkTargetByClass("ildatacollectionrecordviewgui", 'renderRecord')); } if ($record->hasPermissionToEdit($this->parent_obj->parent_obj->ref_id)) { $alist->addItem($lng->txt('edit'), 'edit', $ilCtrl->getLinkTargetByClass("ildatacollectionrecordeditgui", 'edit')); } if ($record->hasPermissionToDelete($this->parent_obj->parent_obj->ref_id)) { $alist->addItem($lng->txt('delete'), 'delete', $ilCtrl->getLinkTargetByClass("ildatacollectionrecordeditgui", 'confirmDelete')); } $record_data["_actions"] = $alist->getHTML(); $record_data["_record"] = $record; $data[] = $record_data; } $this->setData($data); }