4 * Contains default views on behalf of the statistics module.
8 * Implementation of hook_default_view_views().
10 function statistics_views_default_views() {
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';
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(
33 'link_to_node' => TRUE
,
40 'link_to_user' => TRUE
,
44 'table' => 'history_user',
45 'field' => 'timestamp',
48 'relationship' => 'none',
53 $handler->override_option('sorts', array(
54 'totalcount' => array(
56 'table' => 'node_counter',
57 'field' => 'totalcount',
59 'relationship' => 'none',
62 $handler->override_option('filters', array(
76 'totalcount' => array(
78 'table' => 'node_counter',
79 'field' => 'totalcount',
92 'relationship' => 'none',
95 $handler->override_option('access', array(
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(
112 'timestamp' => 'title',
113 'totalcount' => 'totalcount',
128 'timestamp' => array(
131 'totalcount' => array(
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',
145 $handler->override_option('tab_options', array(
147 'title' => 'Popular content',
150 $handler = $view->new_display('page', 'Today (page)', 'page_1');
151 $handler->override_option('fields', array(
163 'link_to_node' => TRUE
,
170 'link_to_user' => TRUE
,
172 'timestamp' => array(
174 'table' => 'history_user',
175 'field' => 'timestamp',
178 'relationship' => 'none',
184 'table' => 'node_counter',
185 'field' => 'daycount',
186 'label' => 'Views today',
187 'set_precision' => FALSE
,
193 'relationship' => 'none',
196 $handler->override_option('sorts', array(
199 'table' => 'node_counter',
200 'field' => 'daycount',
202 'relationship' => 'none',
205 $handler->override_option('path', 'popular/today');
206 $handler->override_option('menu', array(
208 'title' => 'Today\'s popular content',
211 $handler->override_option('tab_options', array(
213 'title' => 'Popular content',
216 $handler = $view->new_display('block', 'Popular (block)', 'block');
217 $handler->override_option('fields', array(
224 'relationship' => 'none',
226 'totalcount' => array(
227 'id' => 'totalcount',
228 'table' => 'node_counter',
229 'field' => 'totalcount',
231 'set_precision' => FALSE
,
237 'relationship' => 'none',
240 $handler->override_option('items_per_page', 5);
241 $handler->override_option('style_plugin', 'list');
242 $handler->override_option('style_options', array(
245 $handler->override_option('row_options', array(
248 'totalcount' => 'totalcount',
252 $handler->override_option('block_description', 'Popular content');
253 $handler = $view->new_display('block', 'Today (block)', 'block_1');
254 $handler->override_option('fields', array(
261 'relationship' => 'none',
265 'table' => 'node_counter',
266 'field' => 'daycount',
268 'set_precision' => FALSE
,
274 'relationship' => 'none',
277 $handler->override_option('sorts', array(
280 'table' => 'node_counter',
281 'field' => 'daycount',
283 'relationship' => 'none',
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(
293 $handler->override_option('row_options', array(
296 'daycount' => 'daycount',
300 $handler->override_option('block_description', 'Today\'s popular content');
301 $views[$view->name
] = $view;