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

modules/comment/views_handler_field_comment_link_approve.inc

Go to the documentation of this file.
00001 <?php
00008 class views_handler_field_comment_link_approve extends views_handler_field_comment_link {
00009   function access() {
00010     //needs permission to administer comments in general
00011     return user_access('administer comments');
00012   }
00013 
00014   function render_link($data, $values) {
00015     $status = $this->get_value($values, 'status');
00016 
00017     // Don't show an approve link on published nodes.
00018     if ($status == COMMENT_PUBLISHED) {
00019       return;
00020     }
00021 
00022     $text = !empty($this->options['text']) ? $this->options['text'] : t('approve');
00023     $cid =  $this->get_value($values, 'cid');
00024 
00025     $this->options['alter']['make_link'] = TRUE;
00026     $this->options['alter']['path'] = "comment/" . $cid . "/approve";
00027     $this->options['alter']['query'] = drupal_get_destination() + array('token' => drupal_get_token("comment/$cid/approve"));
00028 
00029     return $text;
00030   }
00031 }

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