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