_getDataObj()->getFilter(); $linkOptions['action'] = 'exportCsv'; $links['exportCsv']= array('title' => 'Export to CSV', 'url' => $this->url($linkOptions)); return $links; } protected function _initFromForm(\Qs_Form $form) { $data = $form->getValues(); $data['bought'] = 'y'; $this->_getDataObj()->initFromForm($data); return $this; } public static function getCommunicationListUsersUrl($communicationListId = null) { $url = static::getPage('url') . '?listId='; if ($communicationListId) { $url .= $communicationListId; } else { $url .= '%d'; } return $url; } public static function getLeadershipUsersUrl($leadershipId = null) { $url = static::getPage('url') . '?leadershipGroupId='; if ($leadershipId) { $url .= $leadershipId; } else { $url .= '%d'; } return $url; } public static function getLeadershipMemberReorderUrl() { return static::getPage('url') . '?action=reorder'; } protected function _doExportCsv() { $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) { foreach (['pmEnabled', 'pmNotificationEnabled'] as $field) { $row[$field] = 'y' == $row[$field] ? 'Yes' : 'No'; } $dataObj->prepareExportRow($row); } return $row; }; $helper = new ExportCsv([ 'fileName' => $this->getConfig('itemsName') . ' {date}.csv', 'columns' => $dataObj->getExportColumns(), 'rowCallback' => $rowCallback, ]); $helper->export(); $this->_postExportCsv(); exit; } protected function _postExportCsv() { $this->_log(); return $this; } protected function _getEditForm(array $options = []) { $form = parent::_getEditForm($options); if (empty($this->_getDataObj()->getData('email'))) { $form->getElement('email')->setRequired(false); } return $form; } protected function _getFormOptions($type = null) { $options = parent::_getFormOptions($type); $options['memberships'] = $this->_getDataObj()->getMembershipTypes(); return $options; } }