summaryrefslogtreecommitdiff
path: root/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_comment_link_approve.inc
diff options
context:
space:
mode:
authorTorsten Grote <grote@kolabsys.com>2012-08-14 13:29:52 (GMT)
committerTorsten Grote <grote@kolabsys.com>2012-08-14 13:29:52 (GMT)
commit8a7a4f8e58df35a10fda833a9904eb8fd961a1ca (patch)
tree35e2f907372d637f76c0e3c3ac1c0f27f2dc1391 /kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_comment_link_approve.inc
parent146e20fc2d0941a6783641f26b3ea074dc03fc84 (diff)
downloadkolab.org-www-8a7a4f8e58df35a10fda833a9904eb8fd961a1ca.tar.gz
upgrade to drupal 7.15
Diffstat (limited to 'kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_comment_link_approve.inc')
-rw-r--r--kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_comment_link_approve.inc31
1 files changed, 31 insertions, 0 deletions
diff --git a/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_comment_link_approve.inc b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_comment_link_approve.inc
new file mode 100644
index 0000000..8063e20
--- /dev/null
+++ b/kolab.org/www/drupal-7.15/sites/all/modules/views/modules/comment/views_handler_field_comment_link_approve.inc
@@ -0,0 +1,31 @@
+<?php
+/**
+ * @file
+ * Provides a comment approve link.
+ *
+ * @ingroup views_field_handlers
+ */
+class views_handler_field_comment_link_approve extends views_handler_field_comment_link {
+ function access() {
+ //needs permission to administer comments in general
+ return user_access('administer comments');
+ }
+
+ function render_link($data, $values) {
+ $status = $this->get_value($values, 'status');
+
+ // Don't show an approve link on published nodes.
+ if ($status == COMMENT_PUBLISHED) {
+ return;
+ }
+
+ $text = !empty($this->options['text']) ? $this->options['text'] : t('approve');
+ $cid = $this->get_value($values, 'cid');
+
+ $this->options['alter']['make_link'] = TRUE;
+ $this->options['alter']['path'] = "comment/" . $cid . "/approve";
+ $this->options['alter']['query'] = drupal_get_destination() + array('token' => drupal_get_token("comment/$cid/approve"));
+
+ return $text;
+ }
+}