You are here

function userpoints_views_views_tables in User Points 5.2

Same name and namespace in other branches
  1. 5.3 userpoints_views.module \userpoints_views_views_tables()

This include file implements views functionality on behalf of userpoints.module

File

./userpoints_views.module, line 7

Code

function userpoints_views_views_tables() {
  $tables['userpoints'] = array(
    'name' => 'userpoints',
    'provider' => 'internal',
    // won't show up in external list.
    'join' => array(
      'left' => array(
        'table' => 'node',
        'field' => 'uid',
      ),
      'right' => array(
        'field' => 'uid',
      ),
    ),
    'fields' => array(
      'points' => array(
        'name' => t('Node: Author Points'),
        'sortable' => TRUE,
        'option' => 'integer',
        'handler' => 'views_handler_field_int',
        'help' => t('Displays the number of userpoints that the author of the node currently has.'),
      ),
      'max_points' => array(
        'name' => t('Node: Author Maximum Points'),
        'sortable' => TRUE,
        'option' => 'integer',
        'handler' => 'views_handler_field_int',
        'help' => t('Displays the maximum number of userpoints of the author of the node.'),
      ),
    ),
    'sorts' => array(
      'points' => array(
        'name' => t('Node: Author Points'),
        'help' => t("Sort by the node's author current number of userpoints"),
      ),
      'max_points' => array(
        'name' => t('Node: Author Maximum Points'),
        'help' => t("Sort by the node's author maximum number of userpoints"),
      ),
    ),
    'filters' => array(
      'points' => array(
        'name' => t('Node: Author Points'),
        'value-type' => 'integer',
        'operator' => 'views_handler_operator_gtlt',
        'help' => t('Filter node authors based on points.'),
      ),
    ),
  );
  $tables['userpoints_comments'] = array(
    'name' => 'userpoints',
    'provider' => 'internal',
    // won't show up in external list.
    'join' => array(
      'left' => array(
        'table' => 'comments',
        'field' => 'uid',
      ),
      'right' => array(
        'field' => 'uid',
      ),
    ),
    'fields' => array(
      'points' => array(
        'name' => t('Comment: Author Points'),
        'sortable' => TRUE,
        'option' => 'integer',
        'handler' => 'views_handler_field_int',
        'help' => t('Displays the number of userpoints that the author of the comment currently has.'),
      ),
      'max_points' => array(
        'name' => t('Comment: Author Maximum Points'),
        'sortable' => TRUE,
        'option' => 'integer',
        'handler' => 'views_handler_field_int',
        'help' => t('Displays the maximum number of userpoints of the author of the comment.'),
      ),
    ),
    'sorts' => array(
      'points' => array(
        'name' => t('Comment: Author Points'),
        'help' => t("Sort by the comment's author current number of userpoints"),
      ),
      'max_points' => array(
        'name' => t('Comment: Author Maximum Points'),
        'help' => t("Sort by the comment's author maximum number of userpoints"),
      ),
    ),
    'filters' => array(
      'points' => array(
        'name' => t('Comment: Author Points'),
        'value-type' => 'integer',
        'operator' => 'views_handler_operator_gtlt',
        'help' => t('Filter comment authors based on points.'),
      ),
    ),
  );
  $tables['userpoints_txn'] = array(
    'provider' => 'internal',
    // won't show up in external list.
    'join' => array(
      'left' => array(
        'table' => 'userpoints',
        'field' => 'uid',
      ),
      'right' => array(
        'field' => 'uid',
      ),
      'type' => 'inner',
    ),
    'fields' => array(
      'points' => array(
        'name' => t('Userpoints: Transaction Points'),
        'sortable' => TRUE,
        'option' => 'integer',
        'handler' => 'views_handler_field_int',
        'help' => t('Displays the number of userpoints assigned in the transaction.'),
      ),
      'time_stamp' => array(
        'name' => t('Userpoints: Transaction Time'),
        'sortable' => TRUE,
        'handler' => views_handler_field_dates(),
        'option' => 'string',
        'help' => t('Displays the date and time of the transaction.'),
      ),
    ),
    'sorts' => array(
      'points' => array(
        'name' => t('Userpoints: Transaction Points'),
        'help' => t("Sort by the number of userpoints assigned in the transaction"),
      ),
      'time_stamp' => array(
        'name' => t('Userpoints: Transaction Time'),
        'handler' => 'views_handler_sort_date',
        'option' => views_handler_sort_date_options(),
        'help' => t("Sort by the transaction time"),
      ),
    ),
    'filters' => array(),
  );
  return $tables;
}