summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPlazik2016-06-15 19:37:02 (GMT)
committerDaniel Wehner2016-06-15 19:37:02 (GMT)
commit485b697082cf2ec42cc596eed952daa6f61e8012 (patch)
tree52d0a76812bd4f40908b4439f911625d626ded24
parentbebb2ffcc66a7bbede9d4c53d0417cd806e9c53f (diff)
Adding field handlers for statistics fields7.x-3.14
-rw-r--r--modules/statistics.views.inc6
-rw-r--r--modules/statistics/views_handler_field_node_counter_timestamp.inc21
-rw-r--r--modules/statistics/views_handler_field_statistics_numeric.inc21
-rw-r--r--views.info2
4 files changed, 47 insertions, 3 deletions
diff --git a/modules/statistics.views.inc b/modules/statistics.views.inc
index d6637f3..6d99c5e 100644
--- a/modules/statistics.views.inc
+++ b/modules/statistics.views.inc
@@ -32,7 +32,7 @@ function statistics_views_data() {
'help' => t('The total number of times the node has been viewed.'),
'field' => array(
- 'handler' => 'views_handler_field_numeric',
+ 'handler' => 'views_handler_field_statistics_numeric',
'click sortable' => TRUE,
),
'filter' => array(
@@ -49,7 +49,7 @@ function statistics_views_data() {
'help' => t('The total number of times the node has been viewed today.'),
'field' => array(
- 'handler' => 'views_handler_field_numeric',
+ 'handler' => 'views_handler_field_statistics_numeric',
'click sortable' => TRUE,
),
'filter' => array(
@@ -66,7 +66,7 @@ function statistics_views_data() {
'help' => t('The most recent time the node has been viewed.'),
'field' => array(
- 'handler' => 'views_handler_field_date',
+ 'handler' => 'views_handler_field_node_counter_timestamp',
'click sortable' => TRUE,
),
'filter' => array(
diff --git a/modules/statistics/views_handler_field_node_counter_timestamp.inc b/modules/statistics/views_handler_field_node_counter_timestamp.inc
new file mode 100644
index 0000000..d665519
--- /dev/null
+++ b/modules/statistics/views_handler_field_node_counter_timestamp.inc
@@ -0,0 +1,21 @@
+<?php
+
+/**
+ * @file
+ * Definition of views_handler_field_node_counter_timestamp.
+ */
+
+/**
+ * Field handler to present the most recent time the node has been viewed.
+ *
+ * @ingroup views_field_handlers
+ */
+class views_handler_field_node_counter_timestamp extends views_handler_field_date {
+ /**
+ * {@inheritdoc}
+ */
+ public function access() {
+ // Needs permission to see total page views.
+ return user_access('view post access counter');
+ }
+}
diff --git a/modules/statistics/views_handler_field_statistics_numeric.inc b/modules/statistics/views_handler_field_statistics_numeric.inc
new file mode 100644
index 0000000..3e60c8d
--- /dev/null
+++ b/modules/statistics/views_handler_field_statistics_numeric.inc
@@ -0,0 +1,21 @@
+<?php
+
+/**
+ * @file
+ * Definition of views_handler_field_statistics_numeric.
+ */
+
+/**
+ * Field handler to present numeric values from the statistics module.
+ *
+ * @ingroup views_field_handlers
+ */
+class views_handler_field_statistics_numeric extends views_handler_field_numeric {
+ /**
+ * {@inheritdoc}
+ */
+ public function access() {
+ // Needs permission to see total page views.
+ return user_access('view post access counter');
+ }
+}
diff --git a/views.info b/views.info
index 3283598..5189bea 100644
--- a/views.info
+++ b/views.info
@@ -157,6 +157,8 @@ files[] = modules/search/views_handler_filter_search.inc
files[] = modules/search/views_handler_sort_search_score.inc
files[] = modules/search/views_plugin_row_search_view.inc
files[] = modules/statistics/views_handler_field_accesslog_path.inc
+files[] = modules/statistics/views_handler_field_node_counter_timestamp.inc
+files[] = modules/statistics/views_handler_field_statistics_numeric.inc
files[] = modules/system/views_handler_argument_file_fid.inc
files[] = modules/system/views_handler_field_file.inc
files[] = modules/system/views_handler_field_file_extension.inc