statistics.views.inc

  1. cis7 sites/all/modules/ulmus/views/modules/statistics.views.inc
  2. cle7 sites/all/modules/ulmus/views/modules/statistics.views.inc
  3. ecd7 sites/all/modules/ulmus/views/modules/statistics.views.inc
  4. elmsmedia7 sites/all/modules/ulmus/views/modules/statistics.views.inc
  5. harmony7 sites/all/modules/ulmus/views/modules/statistics.views.inc
  6. icor7 sites/all/modules/ulmus/views/modules/statistics.views.inc
  7. meedjum_blog7 sites/all/modules/ulmus/views/modules/statistics.views.inc
  8. mooc7 sites/all/modules/ulmus/views/modules/statistics.views.inc

Provide views data and handlers for statistics.module.

Functions

Namesort descending Description
statistics_views_data Implements hook_views_data().

File

sites/all/modules/ulmus/views/modules/statistics.views.inc
View source
  1. <?php
  2. /**
  3. * @file
  4. * Provide views data and handlers for statistics.module.
  5. *
  6. * @ingroup views_module_handlers
  7. */
  8. /**
  9. * Implements hook_views_data().
  10. */
  11. function statistics_views_data() {
  12. // Basic table information.
  13. // ----------------------------------------------------------------
  14. // node_counter table
  15. $data['node_counter']['table']['group'] = t('Content statistics');
  16. $data['node_counter']['table']['join'] = array(
  17. // ...to the node table
  18. 'node' => array(
  19. 'left_field' => 'nid',
  20. 'field' => 'nid',
  21. ),
  22. );
  23. // totalcount
  24. $data['node_counter']['totalcount'] = array(
  25. 'title' => t('Total views'),
  26. 'help' => t('The total number of times the node has been viewed.'),
  27. 'field' => array(
  28. 'handler' => 'views_handler_field_numeric',
  29. 'click sortable' => TRUE,
  30. ),
  31. 'filter' => array(
  32. 'handler' => 'views_handler_filter_numeric',
  33. ),
  34. 'sort' => array(
  35. 'handler' => 'views_handler_sort',
  36. ),
  37. );
  38. // daycount
  39. $data['node_counter']['daycount'] = array(
  40. 'title' => t('Views today'),
  41. 'help' => t('The total number of times the node has been viewed today.'),
  42. 'field' => array(
  43. 'handler' => 'views_handler_field_numeric',
  44. 'click sortable' => TRUE,
  45. ),
  46. 'filter' => array(
  47. 'handler' => 'views_handler_filter_numeric',
  48. ),
  49. 'sort' => array(
  50. 'handler' => 'views_handler_sort',
  51. ),
  52. );
  53. // timestamp
  54. $data['node_counter']['timestamp'] = array(
  55. 'title' => t('Most recent view'),
  56. 'help' => t('The most recent time the node has been viewed.'),
  57. 'field' => array(
  58. 'handler' => 'views_handler_field_date',
  59. 'click sortable' => TRUE,
  60. ),
  61. 'filter' => array(
  62. 'handler' => 'views_handler_filter_date',
  63. ),
  64. 'sort' => array(
  65. 'handler' => 'views_handler_sort',
  66. ),
  67. );
  68. // ----------------------------------------------------------------
  69. // accesslog table
  70. $data['accesslog']['table']['group'] = t('Access log');
  71. // Advertise this table as a possible base table
  72. $data['accesslog']['table']['base'] = array(
  73. 'field' => 'aid',
  74. 'title' => t('Access log'),
  75. 'help' => t('Stores site access information.'),
  76. 'weight' => 10,
  77. );
  78. // For other base tables, explain how we join
  79. $data['accesslog']['table']['join'] = array(
  80. 'users' => array(
  81. 'field' => 'uid',
  82. 'left_field' => 'uid',
  83. ),
  84. );
  85. // accesslog.aid
  86. $data['accesslog']['aid'] = array(
  87. 'title' => t('Aid'),
  88. 'help' => t('Unique access event ID.'),
  89. 'field' => array(
  90. 'handler' => 'views_handler_field_numeric',
  91. 'click sortable' => TRUE,
  92. ),
  93. 'argument' => array(
  94. 'handler' => 'views_handler_argument_numeric',
  95. 'name field' => 'wid',
  96. 'numeric' => TRUE,
  97. ),
  98. 'filter' => array(
  99. 'handler' => 'views_handler_filter_numeric',
  100. ),
  101. 'sort' => array(
  102. 'handler' => 'views_handler_sort',
  103. ),
  104. );
  105. // session id
  106. $data['accesslog']['sid'] = array(
  107. 'title' => t('Session ID'),
  108. 'help' => t('Browser session ID of user that visited page.'),
  109. 'field' => array(
  110. 'handler' => 'views_handler_field',
  111. 'click sortable' => TRUE,
  112. ),
  113. 'filter' => array(
  114. 'handler' => 'views_handler_filter_string',
  115. ),
  116. 'argument' => array(
  117. 'handler' => 'views_handler_argument_string',
  118. ),
  119. 'sort' => array(
  120. 'handler' => 'views_handler_sort',
  121. ),
  122. );
  123. // title
  124. $data['accesslog']['title'] = array(
  125. 'title' => t('Page title'),
  126. 'help' => t('Title of page visited.'),
  127. 'field' => array(
  128. 'handler' => 'views_handler_field_accesslog_path',
  129. 'click sortable' => TRUE,
  130. ),
  131. 'filter' => array(
  132. 'handler' => 'views_handler_filter_string',
  133. ),
  134. 'sort' => array(
  135. 'handler' => 'views_handler_sort',
  136. ),
  137. 'argument' => array(
  138. 'handler' => 'views_handler_argument_string',
  139. ),
  140. );
  141. // path
  142. $data['accesslog']['path'] = array(
  143. 'title' => t('Path'),
  144. 'help' => t('Internal path to page visited (relative to Drupal root.)'),
  145. 'field' => array(
  146. 'handler' => 'views_handler_field_accesslog_path',
  147. 'click sortable' => TRUE,
  148. ),
  149. 'filter' => array(
  150. 'handler' => 'views_handler_filter_string',
  151. ),
  152. 'sort' => array(
  153. 'handler' => 'views_handler_sort',
  154. ),
  155. //No argument here. Can't send forward slashes as arguments.
  156. //Can be worked around by node ID.
  157. //(but what about aliases?)
  158. );
  159. // referrer
  160. $data['accesslog']['url'] = array(
  161. 'title' => t('Referrer'),
  162. 'help' => t('Referrer URI.'),
  163. 'field' => array(
  164. 'handler' => 'views_handler_field_url',
  165. 'click sortable' => TRUE,
  166. ),
  167. 'filter' => array(
  168. 'handler' => 'views_handler_filter_string',
  169. ),
  170. 'sort' => array(
  171. 'handler' => 'views_handler_sort',
  172. ),
  173. );
  174. // hostname
  175. $data['accesslog']['hostname'] = array(
  176. 'title' => t('Hostname'),
  177. 'help' => t('Hostname of user that visited the page.'),
  178. 'field' => array(
  179. 'handler' => 'views_handler_field',
  180. 'click sortable' => TRUE,
  181. ),
  182. 'filter' => array(
  183. 'handler' => 'views_handler_filter_string',
  184. ),
  185. 'sort' => array(
  186. 'handler' => 'views_handler_sort',
  187. ),
  188. 'argument' => array(
  189. 'handler' => 'views_handler_argument_string',
  190. ),
  191. );
  192. // user
  193. $data['accesslog']['uid'] = array(
  194. 'title' => t('User'),
  195. 'help' => t('The user who visited the site.'),
  196. 'relationship' => array(
  197. 'handler' => 'views_handler_relationship',
  198. 'base' => 'users',
  199. 'base field' => 'uid',
  200. ),
  201. );
  202. // timer
  203. $data['accesslog']['timer'] = array(
  204. 'title' => t('Timer'),
  205. 'help' => t('Time in milliseconds that the page took to load.'),
  206. 'field' => array(
  207. 'handler' => 'views_handler_field_numeric',
  208. 'click sortable' => TRUE,
  209. ),
  210. 'filter' => array(
  211. 'handler' => 'views_handler_filter_numeric',
  212. ),
  213. 'sort' => array(
  214. 'handler' => 'views_handler_sort',
  215. ),
  216. );
  217. // timestamp
  218. $data['accesslog']['timestamp'] = array(
  219. 'title' => t('Timestamp'),
  220. 'help' => t('Timestamp of when the page was visited.'),
  221. 'field' => array(
  222. 'handler' => 'views_handler_field_date',
  223. 'click sortable' => TRUE,
  224. ),
  225. 'sort' => array(
  226. 'handler' => 'views_handler_sort',
  227. ),
  228. 'filter' => array(
  229. 'handler' => 'views_handler_filter_date',
  230. ),
  231. );
  232. return $data;
  233. }

Related topics