/** * Exports dataselection given by dataHash. */ public function exportAction() { $this->_helper->viewRenderer->setNoRender(); $this->_helper->layout->disableLayout(); // do nothing, if export was deactivated if (false === $this->_privateConfig->get('useExport')) { return; } $model = $this->_owApp->selectedModel; /** * all these parameter pointing to the same dataHash */ $dataselection = $this->_request->getParam('dataselection', ''); $datacube = $this->_request->getParam('datacube', ''); if ('' != $dataselection) { $dataHash = $dataselection; } elseif ('' != $datacube) { $dataHash = $datacube; } else { return; } // optional parameter $type = $this->_request->getParam('type', ''); $filename = 'cubevizExport_' . $dataHash; switch ($type) { case 'csv': // comma separated file $contentType = 'text/csv'; $filename .= '.csv'; break; default: // turtle $contentType = 'application/x-turtle'; $filename .= '.ttl'; break; } // setup response try { $output = CubeViz_Exporter::_($type, $dataHash, $model, $this->_titleHelperLimit, $this->_dimensionElementLimit); $this->getResponse()->setHeader('Content-Type', $contentType, true)->setHeader('Content-Disposition', 'filename="' . $filename . '"')->setHeader('Pragma', 'no-cache')->setHeader('Expires', '0'); echo $output; } catch (Exception $e) { if ('development' === $this->_privateConfig->get('context')) { throw $e; } else { echo "Something went wrong with the Exporter, " . "please contact the side administrator if the problem persists. " . "Sorry."; } } }