function userpoints_views_views_tables in User Points 5.3
Same name and namespace in other branches
- 5.2 userpoints_views.module \userpoints_views_views_tables()
Implementation of hook_views_tables(): Present fields and filters for user data.
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.'),
),
'link' => array(
'name' => t('Node: Author Link'),
'option' => array(
'#type' => 'textfield',
'#default_value' => t('(details)|myuserpoints/$uid'),
'#size' => 20,
'#description' => 'title|destination<br/>$uid is a placeholder.',
),
'help' => t('Displays a link to something, based on the node author.'),
'field' => 'uid',
'handler' => 'views_handler_field_userpoints_link_uid',
),
),
'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.'),
),
'tid' => array(
'name' => t('Node: Author Points Category'),
'help' => t('Filter node authors based on the points categories.'),
'operator' => 'views_handler_operator_eqneq',
'value' => array(
'#type' => 'select',
'#options' => 'userpoints_get_categories',
),
),
),
);
$tables['userpoints_categories'] = array(
'name' => 'term_data',
'provider' => 'internal',
// won't show up in external list.
'join' => array(
'left' => array(
'table' => 'userpoints',
'field' => 'tid',
),
'right' => array(
'field' => 'tid',
),
),
'fields' => array(
'name' => array(
'name' => t('Userpoints: Points Category'),
'sortable' => TRUE,
'handler' => 'views_handler_field_userpoints_category',
'help' => t('Displays the userpoints category of the points.'),
),
'link' => array(
'name' => t('Userpoints: Category Link'),
'option' => array(
'#type' => 'textfield',
'#default_value' => t('(details)|mycategories/$tid'),
'#size' => 20,
'#description' => 'title|destination<br/>$tid is a placeholder.',
),
'help' => t('Displays a link to something, based on the category.'),
'field' => 'tid',
'handler' => 'views_handler_field_userpoints_link_tid',
),
),
);
$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.'),
),
'link' => array(
'name' => t('Comment: Author Link'),
'option' => array(
'#type' => 'textfield',
'#default_value' => t('(details)|myuserpoints/$uid'),
'#size' => 20,
'#description' => 'title|destination<br/>$uid is a placeholder.',
),
'help' => t('Displays a link to something, based on the comment author.'),
'field' => 'uid',
'handler' => 'views_handler_field_userpoints_link_uid',
),
),
'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.'),
),
'tid' => array(
'name' => t('Comment: Author Points Category'),
'help' => t('Filter comment authors based on the points categories.'),
'operator' => 'views_handler_operator_eqneq',
'value' => array(
'#type' => 'select',
'#options' => 'userpoints_get_categories',
),
),
),
);
$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',
),
'extra' => array(
'tid = userpoints.tid' => NULL,
),
'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.'),
),
'status' => array(
'name' => t('Userpoints: Transaction Status'),
'sortable' => TRUE,
'handler' => 'views_handler_field_userpoints_txn_status',
'help' => t('Displays the status (approved, pending or declined) of the transaction.'),
),
'description' => array(
'name' => t('Userpoints: Transaction Description'),
'sortable' => TRUE,
'help' => t('Displays the description given to the transaction.'),
),
'operation' => array(
'name' => t('Userpoints: Transaction Operation'),
'sortable' => TRUE,
'help' => t('Displays the operation which caused 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;
}