public function listAction() { $request = $this->getRequest(); $role = $request->getParam('role'); $number = $request->getParam('number'); $downloadList = new Remotecontrol_Model_DownloadList(); $this->_helper->viewRenderer->setNoRender(true); $this->_helper->layout()->disableLayout(); try { $this->getResponse()->setBody($downloadList->getCvsFile($role, $number)); } catch (Remotecontrol_Model_Exception $e) { if ($e->getPrevious() instanceof Opus_Search_Exception) { throw new Application_SearchException($e->getPrevious(), true); } if ($e->collectionIsNotUnique()) { $e = new Application_Exception(); $e->setHttpResponseCode(501); throw $e; } $e = new Application_Exception(); $e->setHttpResponseCode(400); throw $e; } $this->getResponse()->setHeader('Content-Type', 'text/plain; charset=UTF-8', true); $filename = $role . '_' . $number; $this->getResponse()->setHeader('Content-Disposition', 'attachment; filename=' . $filename . '.csv', true); }
private function handleSolrError(Opus_SolrSearch_Exception $exception) { $this->_helper->layout()->enableLayout(); $this->log->err(__METHOD__ . ' : ' . $exception); if ($exception->isServerUnreachable()) { $e = new Application_Exception('error_search_unavailable'); $e->setHttpResponseCode(503); throw $e; } elseif ($exception->isInvalidQuery()) { $e = new Application_Exception('error_search_invalidquery'); $e->setHttpResponseCode(500); throw $e; } else { $e = new Application_Exception('error_search_unknown'); $e->setHttpResponseCode(500); throw $e; } }