You are here

function forward_views_tables in Forward 5

Implementation of hook_views_tables().

Exposes forward statistics to the views system.

File

./forward.module, line 1011

Code

function forward_views_tables() {
  $tables['forward_statistics'] = array(
    'name' => 'forward_statistics',
    'join' => array(
      'left' => array(
        'table' => 'node',
        'field' => 'nid',
      ),
      'right' => array(
        'field' => 'nid',
      ),
    ),
    'fields' => array(
      'forward_count' => array(
        'name' => t('Forward: Forward Count'),
        'sortable' => true,
        'handler' => 'views_handler_field_int',
        'help' => t('This will display the forward count.'),
      ),
      'clickthrough_count' => array(
        'name' => t('Forward: Clickthrough Count'),
        'sortable' => true,
        'handler' => 'views_handler_field_int',
        'help' => t('This will display the forward clickthrough count.'),
      ),
      'last_forward_timestamp' => array(
        'name' => t('Forward: Last Forward Time'),
        'sortable' => true,
        'handler' => views_handler_field_dates(),
        'option' => 'string',
        'help' => t('This will display the last forward time.') . ' ' . t('The option field may be used to specify the custom date format as it\'s required by the date() function or if "as time ago" has been chosen to customize the granularity of the time interval.'),
      ),
    ),
    'filters' => array(
      'forward_count' => array(
        'name' => t('Forward: Forward Count'),
        'operator' => 'views_handler_operator_gtlt',
        'option' => 'integer',
        'help' => t('This filter allows you to filter by the amount of forwards.'),
      ),
      'clickthrough_count' => array(
        'name' => t('Forward: Clickthrough Count'),
        'operator' => 'views_handler_operator_gtlt',
        'option' => 'integer',
        'help' => t('This filter allows you to filter by the amount of clickthroughs.'),
      ),
      'last_forward_timestamp' => array(
        'name' => t('Forward: Last Forward Time'),
        'operator' => 'views_handler_operator_gtlt',
        'value' => views_handler_filter_date_value_form(),
        'handler' => 'views_handler_filter_timestamp',
        'option' => 'string',
        'help' => t('This filter allows nodes to be filtered by the timestamp for the last forward or node edit.') . ' ' . views_t_strings('filter date'),
      ),
    ),
    'sorts' => array(
      'forward_count' => array(
        'name' => t('Forward: Forward Count'),
        'help' => t('This filter allows you to sort by the number of forwards.'),
      ),
      'clickthrough_count' => array(
        'name' => t('Forward: Clickthrough Count'),
        'help' => t('This filter allows you to sort by the number of forward clickthroughs.'),
      ),
      'last_forward_timestamp' => array(
        'name' => t('Forward: Last Forward Time'),
        'handler' => 'views_handler_sort_date',
        'option' => views_handler_sort_date_options(),
        'help' => t('This will allow you to sort by the date of the most recent forward on a node.'),
      ),
    ),
  );
  return $tables;
}