_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'; if (array_key_exists('companyId', $data) && !$data['companyId']) { $data['companyId'] = null; } $this->_getDataObj()->initFromForm($data); return $this; } /** * @param string|null $companyId * @return string (format for string: http://BASE_URL/NEED_PAGE?status=active&companyId=%d or http://BASE_URL/NEED_PAGE?status=active&companyId=$companyId) */ public static function getActiveCompanyUsersUrl($companyId = null) { $url = static::getPage('url') . '?status=' . htmlspecialchars(Entity::STATUS_ACTIVE) . '&companyId='; if ($companyId) { $url .= $companyId; } else { $url .= '%d'; } return $url; } 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 _doAutocompleteCompany() { return $this; } protected function _doAutocompleteCompanyAjax() { $filter = Qs_Request::getRequestValue('term'); $list = $this->_getDataObj()->getCompany4Select($filter); $response = array(); foreach ($list as $value => $title) { $response[] = compact('value', 'title'); } $this->_displayJson($response); return $this; } public static function getFilterByCommitteeUrl($id = null) { $url = static::getPage('url') . '?committeeId='; if ($id) { return $url . $id; } return $url . '%d'; } protected function _doRenderCommitteeRow() { exit; } protected function _doRenderCommitteeRowAjax() { $itemIndex = (string) Qs_Request::getPostValue('itemIndex'); $itemClass = (string) Qs_Request::getPostValue('itemClass'); $itemName = (string) Qs_Request::getPostValue('itemName'); $this->_doc->clearInitFunctions()->clearInlineScripts()->clearScripts()->clearStylesheets(); $form = $this->_getNewForm(); $form->getSubForm($itemName)->clearSubForms(); $form->getSubForm($itemName)->addSubForm(new $itemClass, $itemIndex); $form->getSubForm($itemName)->initRender(); $response = array( 'status' => 'success', 'html' => $form->getSubForm($itemName)->getSubForm($itemIndex)->render(), 'scripts' => $this->_doc->renderInitFunctions() ); $this->_displayJson($response); } 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($options); $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->getExportColumns(), 'rowCallback' => $rowCallback, ]); $helper->export(); $this->_postExportCsv(); exit; } protected function _postExportCsv() { $this->_log(); return $this; } }