Removing translation directories
[project/views.git] / modules / statistics.views_default.inc
1 <?php
2 /**
3 * @file
4 * Contains default views on behalf of the statistics module.
5 */
6
7 /**
8 * Implementation of hook_default_view_views().
9 */
10 function statistics_views_default_views() {
11 $view = new view;
12 $view->name = 'popular';
13 $view->description = 'Shows the most-viewed nodes on the site. This requires the statistics to be enabled at administer >> reports >> access log settings.';
14 $view->tag = 'default';
15 $view->view_php = '';
16 $view->base_table = 'node';
17 $view->is_cacheable = '0';
18 $view->api_version = 2;
19 $view->disabled = TRUE; /* Edit this to true to make a default view disabled initially */
20 $handler = $view->new_display('default', 'Defaults', 'default');
21 $handler->override_option('fields', array(
22 'type' => array(
23 'id' => 'type',
24 'table' => 'node',
25 'field' => 'type',
26 'label' => 'Type',
27 ),
28 'title' => array(
29 'id' => 'title',
30 'table' => 'node',
31 'field' => 'title',
32 'label' => 'Title',
33 'link_to_node' => TRUE,
34 ),
35 'name' => array(
36 'id' => 'name',
37 'table' => 'users',
38 'field' => 'name',
39 'label' => 'Author',
40 'link_to_user' => TRUE,
41 ),
42 'timestamp' => array(
43 'id' => 'timestamp',
44 'table' => 'history_user',
45 'field' => 'timestamp',
46 'label' => '',
47 'comments' => 1,
48 'relationship' => 'none',
49 'link_to_node' => 0,
50 'comment' => 1,
51 ),
52 ));
53 $handler->override_option('sorts', array(
54 'totalcount' => array(
55 'id' => 'totalcount',
56 'table' => 'node_counter',
57 'field' => 'totalcount',
58 'order' => 'DESC',
59 'relationship' => 'none',
60 ),
61 ));
62 $handler->override_option('filters', array(
63 'status' => array(
64 'id' => 'status',
65 'table' => 'node',
66 'field' => 'status',
67 'operator' => '=',
68 'value' => '1',
69 'group' => 0,
70 'exposed' => FALSE,
71 'expose' => array(
72 'operator' => FALSE,
73 'label' => '',
74 ),
75 ),
76 'totalcount' => array(
77 'id' => 'totalcount',
78 'table' => 'node_counter',
79 'field' => 'totalcount',
80 'operator' => '>',
81 'value' => array(
82 'value' => '0',
83 'min' => '',
84 'max' => '',
85 ),
86 'group' => 0,
87 'exposed' => FALSE,
88 'expose' => array(
89 'operator' => FALSE,
90 'label' => '',
91 ),
92 'relationship' => 'none',
93 ),
94 ));
95 $handler->override_option('access', array(
96 'type' => 'none',
97 'role' => array(),
98 'perm' => '',
99 ));
100 $handler->override_option('title', 'Popular content');
101 $handler->override_option('items_per_page', '25');
102 $handler->override_option('use_pager', TRUE);
103 $handler->override_option('use_more', 1);
104 $handler->override_option('style_plugin', 'table');
105 $handler->override_option('style_options', array(
106 'override' => 0,
107 'order' => 'desc',
108 'columns' => array(
109 'type' => 'type',
110 'title' => 'title',
111 'name' => 'name',
112 'timestamp' => 'title',
113 'totalcount' => 'totalcount',
114 ),
115 'info' => array(
116 'type' => array(
117 'sortable' => 0,
118 'separator' => '',
119 ),
120 'title' => array(
121 'sortable' => 0,
122 'separator' => '',
123 ),
124 'name' => array(
125 'sortable' => 0,
126 'separator' => '',
127 ),
128 'timestamp' => array(
129 'separator' => '',
130 ),
131 'totalcount' => array(
132 'sortable' => 0,
133 'separator' => '',
134 ),
135 ),
136 'default' => '-1',
137 ));
138 $handler = $view->new_display('page', 'Popular (page)', 'page');
139 $handler->override_option('path', 'popular/all');
140 $handler->override_option('menu', array(
141 'type' => 'default tab',
142 'title' => 'Popular content',
143 'weight' => '-1',
144 ));
145 $handler->override_option('tab_options', array(
146 'type' => 'normal',
147 'title' => 'Popular content',
148 'weight' => '',
149 ));
150 $handler = $view->new_display('page', 'Today (page)', 'page_1');
151 $handler->override_option('fields', array(
152 'type' => array(
153 'id' => 'type',
154 'table' => 'node',
155 'field' => 'type',
156 'label' => 'Type',
157 ),
158 'title' => array(
159 'id' => 'title',
160 'table' => 'node',
161 'field' => 'title',
162 'label' => 'Title',
163 'link_to_node' => TRUE,
164 ),
165 'name' => array(
166 'id' => 'name',
167 'table' => 'users',
168 'field' => 'name',
169 'label' => 'Author',
170 'link_to_user' => TRUE,
171 ),
172 'timestamp' => array(
173 'id' => 'timestamp',
174 'table' => 'history_user',
175 'field' => 'timestamp',
176 'label' => '',
177 'comments' => 1,
178 'relationship' => 'none',
179 'link_to_node' => 0,
180 'comment' => 1,
181 ),
182 'daycount' => array(
183 'id' => 'daycount',
184 'table' => 'node_counter',
185 'field' => 'daycount',
186 'label' => 'Views today',
187 'set_precision' => FALSE,
188 'precision' => 0,
189 'decimal' => '.',
190 'separator' => ',',
191 'prefix' => '',
192 'suffix' => '',
193 'relationship' => 'none',
194 ),
195 ));
196 $handler->override_option('sorts', array(
197 'daycount' => array(
198 'id' => 'daycount',
199 'table' => 'node_counter',
200 'field' => 'daycount',
201 'order' => 'DESC',
202 'relationship' => 'none',
203 ),
204 ));
205 $handler->override_option('path', 'popular/today');
206 $handler->override_option('menu', array(
207 'type' => 'tab',
208 'title' => 'Today\'s popular content',
209 'weight' => '0',
210 ));
211 $handler->override_option('tab_options', array(
212 'type' => 'normal',
213 'title' => 'Popular content',
214 'weight' => '0',
215 ));
216 $handler = $view->new_display('block', 'Popular (block)', 'block');
217 $handler->override_option('fields', array(
218 'title' => array(
219 'id' => 'title',
220 'table' => 'node',
221 'field' => 'title',
222 'label' => '',
223 'link_to_node' => 1,
224 'relationship' => 'none',
225 ),
226 'totalcount' => array(
227 'id' => 'totalcount',
228 'table' => 'node_counter',
229 'field' => 'totalcount',
230 'label' => '',
231 'set_precision' => FALSE,
232 'precision' => 0,
233 'decimal' => '.',
234 'separator' => ',',
235 'prefix' => ' (',
236 'suffix' => ')',
237 'relationship' => 'none',
238 ),
239 ));
240 $handler->override_option('items_per_page', 5);
241 $handler->override_option('style_plugin', 'list');
242 $handler->override_option('style_options', array(
243 'type' => 'ul',
244 ));
245 $handler->override_option('row_options', array(
246 'inline' => array(
247 'title' => 'title',
248 'totalcount' => 'totalcount',
249 ),
250 'separator' => '',
251 ));
252 $handler->override_option('block_description', 'Popular content');
253 $handler = $view->new_display('block', 'Today (block)', 'block_1');
254 $handler->override_option('fields', array(
255 'title' => array(
256 'id' => 'title',
257 'table' => 'node',
258 'field' => 'title',
259 'label' => '',
260 'link_to_node' => 1,
261 'relationship' => 'none',
262 ),
263 'daycount' => array(
264 'id' => 'daycount',
265 'table' => 'node_counter',
266 'field' => 'daycount',
267 'label' => '',
268 'set_precision' => FALSE,
269 'precision' => 0,
270 'decimal' => '.',
271 'separator' => ',',
272 'prefix' => ' (',
273 'suffix' => ')',
274 'relationship' => 'none',
275 ),
276 ));
277 $handler->override_option('sorts', array(
278 'daycount' => array(
279 'id' => 'daycount',
280 'table' => 'node_counter',
281 'field' => 'daycount',
282 'order' => 'DESC',
283 'relationship' => 'none',
284 ),
285 ));
286 $handler->override_option('title', 'Today\'s popular content');
287 $handler->override_option('items_per_page', 5);
288 $handler->override_option('link_display', 'page_1');
289 $handler->override_option('style_plugin', 'list');
290 $handler->override_option('style_options', array(
291 'type' => 'ul',
292 ));
293 $handler->override_option('row_options', array(
294 'inline' => array(
295 'title' => 'title',
296 'daycount' => 'daycount',
297 ),
298 'separator' => '',
299 ));
300 $handler->override_option('block_description', 'Today\'s popular content');
301 $views[$view->name] = $view;
302
303 return $views;
304 }