• Main Page
  • Related Pages
  • Modules
  • Classes
  • Files
  • File List
  • File Members

modules/statistics.views.inc

Go to the documentation of this file.
00001 <?php
00017 function statistics_views_data() {
00018   // Basic table information.
00019 
00020   // ----------------------------------------------------------------
00021   // node_counter table
00022 
00023   $data['node_counter']['table']['group']  = t('Content statistics');
00024 
00025   $data['node_counter']['table']['join'] = array(
00026     // ...to the node table
00027     'node' => array(
00028       'left_field' => 'nid',
00029       'field' => 'nid',
00030     ),
00031   );
00032 
00033   // totalcount
00034   $data['node_counter']['totalcount'] = array(
00035     'title' => t('Total views'),
00036     'help' => t('The total number of times the node has been viewed.'),
00037 
00038     'field' => array(
00039       'handler' => 'views_handler_field_numeric',
00040       'click sortable' => TRUE,
00041      ),
00042     'filter' => array(
00043       'handler' => 'views_handler_filter_numeric',
00044     ),
00045     'sort' => array(
00046       'handler' => 'views_handler_sort',
00047     ),
00048   );
00049 
00050   // daycount
00051   $data['node_counter']['daycount'] = array(
00052     'title' => t('Views today'),
00053     'help' => t('The total number of times the node has been viewed today.'),
00054 
00055     'field' => array(
00056       'handler' => 'views_handler_field_numeric',
00057       'click sortable' => TRUE,
00058      ),
00059     'filter' => array(
00060       'handler' => 'views_handler_filter_numeric',
00061     ),
00062     'sort' => array(
00063       'handler' => 'views_handler_sort',
00064     ),
00065   );
00066 
00067   // timestamp
00068   $data['node_counter']['timestamp'] = array(
00069     'title' => t('Most recent view'),
00070     'help' => t('The most recent time the node has been viewed.'),
00071 
00072     'field' => array(
00073       'handler' => 'views_handler_field_date',
00074       'click sortable' => TRUE,
00075     ),
00076     'filter' => array(
00077       'handler' => 'views_handler_filter_date',
00078     ),
00079     'sort' => array(
00080       'handler' => 'views_handler_sort',
00081     ),
00082   );
00083 
00084 
00085   // ----------------------------------------------------------------
00086   // accesslog table
00087 
00088   $data['accesslog']['table']['group']  = t('Access log');
00089 
00090   // Advertise this table as a possible base table
00091   $data['accesslog']['table']['base'] = array(
00092     'field' => 'aid',
00093     'title' => t('Access log'),
00094     'help' => t('Stores site access information.'),
00095     'weight' => 10,
00096   );
00097 
00098   // For other base tables, explain how we join
00099   $data['accesslog']['table']['join'] = array(
00100     'users' => array(
00101       'field' => 'uid',
00102       'left_field' => 'uid',
00103      ),
00104   );
00105 
00106   // accesslog.aid
00107   $data['accesslog']['aid'] = array(
00108     'title' => t('Aid'),
00109     'help' => t('Unique access event ID.'),
00110     'field' => array(
00111       'handler' => 'views_handler_field_numeric',
00112       'click sortable' => TRUE,
00113     ),
00114     'argument' => array(
00115       'handler' => 'views_handler_argument_numeric',
00116       'name field' => 'wid',
00117       'numeric' => TRUE,
00118     ),
00119     'filter' => array(
00120       'handler' => 'views_handler_filter_numeric',
00121     ),
00122     'sort' => array(
00123       'handler' => 'views_handler_sort',
00124     ),
00125   );
00126 
00127   // session id
00128   $data['accesslog']['sid'] = array(
00129     'title' => t('Session ID'),
00130     'help' => t('Browser session ID of user that visited page.'),
00131 
00132     'field' => array(
00133       'handler' => 'views_handler_field',
00134       'click sortable' => TRUE,
00135      ),
00136      'filter' => array(
00137       'handler' => 'views_handler_filter_string',
00138      ),
00139      'argument' => array(
00140        'handler' => 'views_handler_argument_string',
00141      ),
00142      'sort' => array(
00143       'handler' => 'views_handler_sort',
00144      ),
00145   );
00146 
00147   // title
00148   $data['accesslog']['title'] = array(
00149     'title' => t('Page title'),
00150     'help' => t('Title of page visited.'),
00151 
00152     'field' => array(
00153       'handler' => 'views_handler_field_accesslog_path',
00154       'click sortable' => TRUE,
00155      ),
00156      'filter' => array(
00157       'handler' => 'views_handler_filter_string',
00158      ),
00159      'sort' => array(
00160       'handler' => 'views_handler_sort',
00161      ),
00162      'argument' => array(
00163       'handler' => 'views_handler_argument_string',
00164      ),
00165   );
00166 
00167   // path
00168   $data['accesslog']['path'] = array(
00169     'title' => t('Path'),
00170     'help' => t('Internal path to page visited (relative to Drupal root.)'),
00171 
00172     'field' => array(
00173       'handler' => 'views_handler_field_accesslog_path',
00174       'click sortable' => TRUE,
00175      ),
00176      'filter' => array(
00177        'handler' => 'views_handler_filter_string',
00178      ),
00179      'sort' => array(
00180        'handler' => 'views_handler_sort',
00181      ),
00182      //No argument here.  Can't send forward slashes as arguments.
00183      //Can be worked around by node ID.
00184      //(but what about aliases?)
00185   );
00186 
00187   // referrer
00188   $data['accesslog']['url'] = array(
00189     'title' => t('Referrer'),
00190     'help' => t('Referrer URI.'),
00191     'field' => array(
00192       'handler' => 'views_handler_field_url',
00193       'click sortable' => TRUE,
00194      ),
00195     'filter' => array(
00196       'handler' => 'views_handler_filter_string',
00197     ),
00198     'sort' => array(
00199       'handler' => 'views_handler_sort',
00200     ),
00201   );
00202 
00203   // hostname
00204   $data['accesslog']['hostname'] = array(
00205     'title' => t('Hostname'),
00206     'help' => t('Hostname of user that visited the page.'),
00207     'field' => array(
00208       'handler' => 'views_handler_field',
00209       'click sortable' => TRUE,
00210      ),
00211     'filter' => array(
00212       'handler' => 'views_handler_filter_string',
00213     ),
00214     'sort' => array(
00215       'handler' => 'views_handler_sort',
00216     ),
00217     'argument' => array(
00218       'handler' => 'views_handler_argument_string',
00219     ),
00220   );
00221 
00222   // user
00223   $data['accesslog']['uid'] = array(
00224     'title' => t('User'),
00225     'help' => t('The user who visited the site.'),
00226     'relationship' => array(
00227       'handler' => 'views_handler_relationship',
00228       'base' => 'users',
00229       'base field' => 'uid',
00230      ),
00231   );
00232 
00233   // timer
00234   $data['accesslog']['timer'] = array(
00235     'title' => t('Timer'),
00236     'help' => t('Time in milliseconds that the page took to load.'),
00237     'field' => array(
00238       'handler' => 'views_handler_field_numeric',
00239       'click sortable' => TRUE,
00240     ),
00241     'filter' => array(
00242       'handler' => 'views_handler_filter_numeric',
00243     ),
00244     'sort' => array(
00245       'handler' => 'views_handler_sort',
00246     ),
00247   );
00248 
00249   // timestamp
00250   $data['accesslog']['timestamp'] = array(
00251     'title' => t('Timestamp'),
00252     'help' => t('Timestamp of when the page was visited.'),
00253     'field' => array(
00254       'handler' => 'views_handler_field_date',
00255       'click sortable' => TRUE,
00256     ),
00257     'sort' => array(
00258       'handler' => 'views_handler_sort',
00259     ),
00260     'filter' => array(
00261       'handler' => 'views_handler_filter_date',
00262     ),
00263   );
00264 
00265 
00266   return $data;
00267 }
00268 

Generated on Sun Feb 26 2012 12:52:51 for Views by  doxygen 1.7.1