You are here

function _spaces_core_views_comments in Spaces 5

Same name and namespace in other branches
  1. 5.2 spaces_core/spaces_core.module \_spaces_core_views_comments()
1 string reference to '_spaces_core_views_comments'
spaces_core_views_default_views in spaces_core/spaces_core.module
Implementation of hook_default_views

File

spaces_core/spaces_core.module, line 811

Code

function _spaces_core_views_comments() {
  $view = new stdClass();
  $view->name = 'spaces_comments';
  $view->description = t('Displays a listing of recent comments');
  $view->access = array();
  $view->view_args_php = 'return _spaces_views_arg_og_handler($args);';
  $view->page = TRUE;
  $view->page_title = t('Recent Comments');
  $view->page_empty = '<p class="views-empty">' . t('No recent comments found.') . '</p>';
  $view->page_empty_format = '2';
  $view->page_type = 'table';
  $view->url = 'comments';
  $view->use_pager = TRUE;
  $view->nodes_per_page = '25';
  $view->block = TRUE;
  $view->block_title = t('Recent Comments');
  $view->block_empty = "<p class='views-empty'>" . t('No recent comments.') . "</p>";
  $view->block_empty_format = '1';
  $view->block_type = 'spaces_datetitle';
  $view->nodes_per_block = '5';
  $view->sort = array(
    array(
      'tablename' => 'node_comment_statistics',
      'field' => 'last_comment_timestamp',
      'sortorder' => 'DESC',
      'options' => 'normal',
    ),
  );
  $view->argument = array(
    array(
      'type' => 'gid',
      'argdefault' => '2',
    ),
  );
  $view->field = array(
    array(
      'tablename' => 'og_node_data',
      'field' => 'title',
      'label' => 'Group',
      'handler' => 'spaces_views_handler_crayon_name',
      'options' => 'og',
    ),
    array(
      'tablename' => 'comments',
      'field' => 'subject',
      'label' => t('Comment'),
      'handler' => 'views_handler_field_commentlink',
      'options' => 'link',
    ),
    array(
      'tablename' => 'comments',
      'field' => 'name',
      'label' => t('By'),
    ),
    array(
      'tablename' => 'node',
      'field' => 'title',
      'label' => t('On Post'),
      'handler' => 'views_handler_field_nodelink',
      'options' => 'nolink',
    ),
    array(
      'tablename' => 'node',
      'field' => 'type',
      'label' => t('Type'),
    ),
    array(
      'tablename' => 'node_comment_statistics',
      'field' => 'last_comment_timestamp',
      'label' => t('Date'),
      'handler' => 'views_handler_field_date_small',
    ),
  );
  $view->filter = array(
    array(
      'tablename' => 'node',
      'field' => 'status',
      'operator' => '=',
      'options' => '',
      'value' => '1',
    ),
    array(
      'tablename' => 'node_comment_statistics',
      'field' => 'comment_count',
      'operator' => '>',
      'options' => '',
      'value' => '0',
    ),
    array(
      'tablename' => 'og_uid_node',
      'field' => 'currentuid',
      'operator' => '=',
      'options' => '',
      'value' => '***CURRENT_USER***',
    ),
    array(
      'tablename' => 'node_comment_statistics',
      'field' => 'last_comment_timestamp',
      'operator' => '>',
      'options' => -1 * SPACES_ARCHIVE_TIMESTAMP,
      'value' => 'now',
    ),
  );
  $view->exposed_filter = array();
  $view->requires = array(
    node_comment_statistics,
    comments,
    node,
    og_node_data,
    og_uid_node,
  );
  return $view;
}