/** * Export DC as Excel sheet * */ public function exportExcel() { global $ilCtrl, $lng; if (!($this->table_obj->getExportEnabled() || $this->table_obj->hasPermissionToFields($this->parent_obj->ref_id))) { echo $lng->txt("access_denied"); exit; } require_once './Modules/DataCollection/classes/class.ilDataCollectionRecordListTableGUI.php'; $list = new ilDataCollectionRecordListTableGUI($this, $ilCtrl->getCmd(), $this->table_obj); $list->setRecordData($this->table_obj->getRecordsByFilter($list->getFilter())); $list->setExternalSorting(true); if (!$list->dataExists()) { $this->ctrl->redirect($this->parent_obj); } $list->exportData(ilTable2GUI::EXPORT_EXCEL, true); }
public function __construct(ilDataCollectionRecordListGUI $a_parent_obj, $a_parent_cmd, ilDataCollectionTable $table) { global $lng, $tpl, $ilCtrl; $this->setPrefix("dcl_record_list"); $this->setFormName('record_list'); $this->setId("dcl_record_list"); parent::__construct($a_parent_obj, $a_parent_cmd); $this->table = $table; include_once "class.ilDataCollectionDatatype.php"; $this->parent_obj = $a_parent_obj; $this->setRowTemplate("tpl.record_list_row.html", "Modules/DataCollection"); $this->addColumn("", "_front", "15px"); $this->numeric_fields = array(); foreach ($this->table->getVisibleFields() as $field) { $title = $field->getTitle(); $sort_field = $title; if ($field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_DATETIME) { $sort_field = $title . self::DATETIME_SORTING_STR; } $this->addColumn($title, $sort_field); if ($field->getLearningProgress()) { $this->addColumn($lng->txt("dcl_status"), "_status_" . $field->getTitle()); } if ($field->getDatatypeId() == ilDataCollectionDatatype::INPUTFORMAT_NUMBER) { $this->numeric_fields[] = $field->getTitle(); } } $this->setId("dcl_record_list"); $this->addColumn($lng->txt("actions"), "", "30px"); //$ilCtrl->saveParameterByClass("ildatacollectionrecordlistgui", "dcl_record_list_trows"); $this->setTopCommands(true); $this->setEnableHeader(true); $this->setShowRowsSelector(true); $this->setShowTemplates(true); $this->setEnableHeader(true); $this->setEnableTitle(true); $this->setDefaultOrderDirection("asc"); $this->setFormAction($ilCtrl->getFormAction($a_parent_obj, "applyFilter")); $this->initFilter(); $this->object_data = $table->getRecordsByFilter($this->filter); $this->buildData(); // $this->setData($table->getRecordsByFilter($this->filter)); //leave these two $this->setExternalSegmentation(false); // $this->setExternalSorting(true); }