_getDataObj()->getQuestions(); } return $options; } protected function _getDefaultLinks() { $links = parent::_getDefaultLinks(); $query = $this->getFilter(); $query['orderBy'] = $this->_getList()->getOrderBy(); $query = array_filter($query); $links['exportToCsv'] = [ 'title' => 'Export to .csv', 'url' => $this->url(array_merge(['action' => 'exportToCsv'], $query)), ]; return $links; } protected function _doExportToCsv() { $dataObj = $this->_getDataObj(); if ($dataObj->hasFilter()) { $form = $this->_getFilterForm(); if ($form->validate()) { $dataObj->addFilter($form->getValues()); } } $options = ['order' => $this->_getList()->getOrderBy()]; $dataObj->setSelectOptions($options); $stmt = $dataObj->getList4ExportStatement(); $rowCallback = function () use ($stmt, $dataObj) { $row = $stmt->fetch(); if ($row) { $dataObj->prepareExportRow($row); } return $row; }; $helper = new ExportCsv([ 'fileName' => $this->getConfig('itemsName') . ' {date}.csv', 'columns' => $dataObj->getExportCsvColumns(), 'rowCallback' => $rowCallback, ]); $helper->export(); exit; } }