1
|
<?php
|
2
|
/**
|
3
|
* @file
|
4
|
* Views include file with views hooks.
|
5
|
*/
|
6
|
|
7
|
/**
|
8
|
* Implementation of hook_views_plugins().
|
9
|
*/
|
10
|
function views_data_export_views_plugins() {
|
11
|
$path = drupal_get_path('module', 'views_data_export');
|
12
|
|
13
|
$style_defaults = array(
|
14
|
'path' => $path . '/plugins',
|
15
|
'parent' => 'views_data_export',
|
16
|
'theme' => 'views_data_export',
|
17
|
'theme path' => $path . '/theme',
|
18
|
'theme file' => 'views_data_export.theme.inc',
|
19
|
'uses row plugin' => FALSE,
|
20
|
'uses fields' => TRUE,
|
21
|
'uses options' => TRUE,
|
22
|
'type' => 'data_export',
|
23
|
);
|
24
|
|
25
|
return array(
|
26
|
'display' => array (
|
27
|
'views_data_export' => array(
|
28
|
'title' => t('Data export'),
|
29
|
'help' => t('Export the view results to a file. Can handle very large result sets.'),
|
30
|
'path' => $path . '/plugins',
|
31
|
'handler' => 'views_data_export_plugin_display_export',
|
32
|
'parent' => 'feed',
|
33
|
'uses hook menu' => TRUE,
|
34
|
'use ajax' => FALSE,
|
35
|
'use pager' => FALSE,
|
36
|
'accept attachments' => FALSE,
|
37
|
'admin' => t('Data export'),
|
38
|
'help topic' => 'display-data-export',
|
39
|
),
|
40
|
),
|
41
|
'style' => array(
|
42
|
'views_data_export' => array(
|
43
|
// this isn't really a display but is necessary so the file can
|
44
|
// be included.
|
45
|
'no ui' => TRUE,
|
46
|
'handler' => 'views_data_export_plugin_style_export',
|
47
|
'path' => $path . '/plugins',
|
48
|
'theme path' => $path . '/theme',
|
49
|
'theme file' => 'views_data_export.theme.inc',
|
50
|
'type' => 'normal',
|
51
|
),
|
52
|
'views_data_export_csv' => array(
|
53
|
'title' => t('CSV file'),
|
54
|
'help' => t('Display the view as a comma separated list.'),
|
55
|
'handler' => 'views_data_export_plugin_style_export_csv',
|
56
|
// Views Data Export element that will be used to set additional headers when serving the feed.
|
57
|
'export headers' => array('Content-type' => 'text/csv; charset=utf-8'),
|
58
|
// Views Data Export element mostly used for creating some additional classes and template names.
|
59
|
'export feed type' => 'csv',
|
60
|
'export feed text' => 'CSV',
|
61
|
'export feed file' => '%view.csv',
|
62
|
'export feed icon' => drupal_get_path('module', 'views_data_export') . '/images/csv.png',
|
63
|
'additional themes' => array(
|
64
|
'views_data_export_csv_header' => 'style',
|
65
|
'views_data_export_csv_body' => 'style',
|
66
|
'views_data_export_csv_footer' => 'style',
|
67
|
),
|
68
|
'additional themes base' => 'views_data_export_csv',
|
69
|
) + $style_defaults,
|
70
|
'views_data_export_doc' => array(
|
71
|
'title' => t('DOC file'),
|
72
|
'help' => t('Display the view as a doc file.'),
|
73
|
'handler' => 'views_data_export_plugin_style_export',
|
74
|
'export headers' => array('Content-Type' => 'application/msword'),
|
75
|
'export feed type' => 'doc',
|
76
|
'export feed text' => 'Word Document',
|
77
|
'export feed file' => '%view.doc',
|
78
|
'export feed icon' => drupal_get_path('module', 'views_data_export') . '/images/doc.png',
|
79
|
'additional themes' => array(
|
80
|
'views_data_export_doc_header' => 'style',
|
81
|
'views_data_export_doc_body' => 'style',
|
82
|
'views_data_export_doc_footer' => 'style',
|
83
|
),
|
84
|
'additional themes base' => 'views_data_export_doc',
|
85
|
) + $style_defaults,
|
86
|
'views_data_export_txt' => array(
|
87
|
'title' => t('TXT file'),
|
88
|
'help' => t('Display the view as a txt file.'),
|
89
|
'handler' => 'views_data_export_plugin_style_export',
|
90
|
'export headers' => array('Content-Type' => 'text/plain'),
|
91
|
'export feed type' => 'txt',
|
92
|
'export feed text' => 'Plain Text Document',
|
93
|
'export feed file' => '%view.txt',
|
94
|
'export feed icon' => drupal_get_path('module', 'views_data_export') . '/images/txt.png',
|
95
|
'additional themes' => array(
|
96
|
'views_data_export_txt_header' => 'style',
|
97
|
'views_data_export_txt_body' => 'style',
|
98
|
'views_data_export_txt_footer' => 'style',
|
99
|
),
|
100
|
'additional themes base' => 'views_data_export_txt',
|
101
|
) + $style_defaults,
|
102
|
'views_data_export_xls' => array(
|
103
|
'title' => t('XLS file'),
|
104
|
'help' => t('Display the view as a xls file.'),
|
105
|
'handler' => 'views_data_export_plugin_style_export',
|
106
|
'export headers' => array('Content-Type' => 'application/vnd.ms-excel'),
|
107
|
'export feed type' => 'xls',
|
108
|
'export feed text' => 'XLS',
|
109
|
'export feed file' => '%view.xls',
|
110
|
'export feed icon' => drupal_get_path('module', 'views_data_export') . '/images/xls.png',
|
111
|
'additional themes' => array(
|
112
|
'views_data_export_xls_header' => 'style',
|
113
|
'views_data_export_xls_body' => 'style',
|
114
|
'views_data_export_xls_footer' => 'style',
|
115
|
),
|
116
|
'additional themes base' => 'views_data_export_xls',
|
117
|
) + $style_defaults,
|
118
|
'views_data_export_xml' => array(
|
119
|
'title' => t('XML file'),
|
120
|
'help' => t('Display the view as a txt file.'),
|
121
|
'handler' => 'views_data_export_plugin_style_export_xml',
|
122
|
'export headers' => array('Content-Type' => 'text/xml'),
|
123
|
'export feed type' => 'xml',
|
124
|
'export feed text' => 'XML',
|
125
|
'export feed file' => '%view.xml',
|
126
|
'export feed icon' => drupal_get_path('module', 'views_data_export') . '/images/xml.png',
|
127
|
'additional themes' => array(
|
128
|
'views_data_export_xml_header' => 'style',
|
129
|
'views_data_export_xml_body' => 'style',
|
130
|
'views_data_export_xml_footer' => 'style',
|
131
|
),
|
132
|
'additional themes base' => 'views_data_export_xml',
|
133
|
) + $style_defaults,
|
134
|
),
|
135
|
);
|
136
|
}
|