You are here

function views_bonus_export in Views Bonus Pack 5

Menu callback to make the CSV/DOC

3 calls to views_bonus_export()
theme_views_csv in ./views_bonus_export.module
theme_views_doc in ./views_bonus_export.module
theme_views_txt in ./views_bonus_export.module
1 string reference to 'views_bonus_export'
views_bonus_export_views_file_argument in ./views_bonus_export.module
argument hook that will display the file or display export icons.

File

./views_bonus_export.module, line 163

Code

function views_bonus_export($type, $vid) {
  if (!is_numeric($vid)) {
    drupal_not_found();
    return;
  }
  $view = views_load_view($vid);
  $result = views_build_view('items', $view);
  if ($type == 'csv' || $type == 'doc' || $type == 'txt') {
    if (user_access('export views')) {
      drupal_set_header("Cache-Control: no-store, no-cache, must-revalidate");
      theme('views_bonus_export_' . $type, $view, $result['items']);
    }
    else {
      drupal_access_denied();
    }
  }
}