You are here

function views_data_export_plugin_display_export::render in Views data export 7.4

Same name and namespace in other branches
  1. 6.3 plugins/views_data_export_plugin_display_export.inc \views_data_export_plugin_display_export::render()
  2. 6 plugins/views_data_export_plugin_display_export.inc \views_data_export_plugin_display_export::render()
  3. 6.2 plugins/views_data_export_plugin_display_export.inc \views_data_export_plugin_display_export::render()
  4. 7 plugins/views_data_export_plugin_display_export.inc \views_data_export_plugin_display_export::render()
  5. 7.3 plugins/views_data_export_plugin_display_export.inc \views_data_export_plugin_display_export::render()

Render the display.

We basically just work out if we should be rendering the header, body or footer and call the appropriate functions on the style plugins.

Overrides views_plugin_display_feed::render

File

plugins/views_data_export_plugin_display_export.inc, line 440
Contains the bulk export display plugin.

Class

views_data_export_plugin_display_export
The plugin that batches its rendering.

Code

function render() {
  if (!$this
    ->is_batched()) {
    $result = parent::render();
    if (empty($this->view->live_preview)) {
      $this
        ->add_http_headers();
    }
    return $result;
  }
  $this->view
    ->build();

  // Give the view a handle on our output file.
  $file_handle = NULL;
  if ($uri = $this
    ->outputfile_path()) {
    $file_handle = fopen($this
      ->outputfile_path(), 'r+');
    fseek($file_handle, 0, SEEK_END);
  }
  switch ($this->batched_execution_state->batch_state) {
    case VIEWS_DATA_EXPORT_BODY:
      $output = $this->view->style_plugin
        ->render_body($file_handle);
      break;
    case VIEWS_DATA_EXPORT_HEADER:
      $output = $this->view->style_plugin
        ->render_header($file_handle);
      break;
    case VIEWS_DATA_EXPORT_FOOTER:
      $output = $this->view->style_plugin
        ->render_footer($file_handle);
      break;
  }
  if (isset($file_handle)) {
    fclose($file_handle);
  }
  return $output;
}