/**
  * Actually perform the export operation.
  *
  * @return mixed
  */
 public function doexportAction()
 {
     // We use abbreviated parameters here to keep the URL short (there may
     // be a long list of IDs, and we don't want to run out of room):
     $ids = $this->params()->fromQuery('i', array());
     $format = $this->params()->fromQuery('f');
     // Make sure we have IDs to export:
     if (!is_array($ids) || empty($ids)) {
         return $this->redirectToSource('error', 'bulk_noitems_advice');
     }
     // Send appropriate HTTP headers for requested format:
     $response = $this->getResponse();
     $response->getHeaders()->addHeaders(Export::getHeaders($format));
     // Actually export the records
     $records = $this->getRecordLoader()->loadBatch($ids);
     $recordHelper = $this->getViewRenderer()->plugin('record');
     $parts = array();
     foreach ($records as $record) {
         $parts[] = $recordHelper($record)->getExport($format);
     }
     // Process and display the exported records
     $response->setContent(Export::processGroup($format, $parts));
     return $response;
 }