statistics.views.inc 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. <?php
  2. /**
  3. * @file
  4. * Provide views data for statistics.module.
  5. */
  6. /**
  7. * Implements hook_views_data().
  8. */
  9. function statistics_views_data() {
  10. $data['node_counter']['table']['group'] = t('Content statistics');
  11. $data['node_counter']['table']['join'] = array(
  12. 'node_field_data' => array(
  13. 'left_field' => 'nid',
  14. 'field' => 'nid',
  15. ),
  16. );
  17. $data['node_counter']['totalcount'] = array(
  18. 'title' => t('Total views'),
  19. 'help' => t('The total number of times the node has been viewed.'),
  20. 'field' => array(
  21. 'id' => 'statistics_numeric',
  22. 'click sortable' => TRUE,
  23. ),
  24. 'filter' => array(
  25. 'id' => 'numeric',
  26. ),
  27. 'argument' => array(
  28. 'id' => 'numeric',
  29. ),
  30. 'sort' => array(
  31. 'id' => 'standard',
  32. ),
  33. );
  34. $data['node_counter']['daycount'] = array(
  35. 'title' => t('Views today'),
  36. 'help' => t('The total number of times the node has been viewed today.'),
  37. 'field' => array(
  38. 'id' => 'statistics_numeric',
  39. 'click sortable' => TRUE,
  40. ),
  41. 'filter' => array(
  42. 'id' => 'numeric',
  43. ),
  44. 'argument' => array(
  45. 'id' => 'numeric',
  46. ),
  47. 'sort' => array(
  48. 'id' => 'standard',
  49. ),
  50. );
  51. $data['node_counter']['timestamp'] = array(
  52. 'title' => t('Most recent view'),
  53. 'help' => t('The most recent time the node has been viewed.'),
  54. 'field' => array(
  55. 'id' => 'node_counter_timestamp',
  56. 'click sortable' => TRUE,
  57. ),
  58. 'filter' => array(
  59. 'id' => 'date',
  60. ),
  61. 'argument' => array(
  62. 'id' => 'date',
  63. ),
  64. 'sort' => array(
  65. 'id' => 'standard',
  66. ),
  67. );
  68. return $data;
  69. }