123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183 |
- <?php
- /**
- * @file
- * Provide views data and handlers for tracker.module.
- *
- * @ingroup views_module_handlers
- */
- /**
- * Implementation of hook_views_data().
- */
- function tracker_views_data() {
- $data = array();
- $data['tracker_node']['table']['group'] = t('Tracker');
- $data['tracker_node']['table']['join'] = array(
- 'node' => array(
- 'type' => 'INNER',
- 'left_field' => 'nid',
- 'field' => 'nid',
- ),
- );
- $data['tracker_node']['nid'] = array(
- 'title' => t('Nid'),
- 'help' => t('The node ID of the node.'),
- 'field' => array(
- 'handler' => 'views_handler_field_node',
- 'click sortable' => TRUE,
- ),
- 'argument' => array(
- 'handler' => 'views_handler_argument_node_nid',
- 'name field' => 'title',
- 'numeric' => TRUE,
- 'validate type' => 'nid',
- ),
- 'filter' => array(
- 'handler' => 'views_handler_filter_numeric',
- ),
- 'sort' => array(
- 'handler' => 'views_handler_sort',
- ),
- );
- $data['tracker_node']['changed'] = array(
- 'title' => t('Updated date'),
- 'help' => t('The date the node was last updated.'),
- 'field' => array(
- 'handler' => 'views_handler_field_date',
- 'click sortable' => TRUE,
- ),
- 'sort' => array(
- 'handler' => 'views_handler_sort_date',
- ),
- 'filter' => array(
- 'handler' => 'views_handler_filter_date',
- ),
- );
- $data['tracker_node']['published'] = array(
- 'title' => t('Published'),
- 'help' => t('Whether or not the node is published.'),
- 'field' => array(
- 'handler' => 'views_handler_field_boolean',
- 'click sortable' => TRUE,
- ),
- 'filter' => array(
- 'handler' => 'views_handler_filter_tracker_boolean_operator',
- 'label' => t('Published'),
- 'type' => 'yes-no',
- ),
- 'sort' => array(
- 'handler' => 'views_handler_sort',
- ),
- );
- $data['tracker_user']['table']['group'] = t('Tracker - User');
- $data['tracker_user']['table']['join'] = array(
- 'node' => array(
- 'type' => 'INNER',
- 'left_field' => 'nid',
- 'field' => 'nid',
- ),
- 'user' => array(
- 'type' => 'INNER',
- 'left_field' => 'uid',
- 'field' => 'uid',
- ),
- );
- $data['tracker_user']['nid'] = array(
- 'title' => t('Nid'),
- 'help' => t('The node ID of the node a user created or commented on. You must use an argument or filter on UID or you will get misleading results using this field.'),
- 'field' => array(
- 'handler' => 'views_handler_field_node',
- 'click sortable' => TRUE,
- ),
- 'argument' => array(
- 'handler' => 'views_handler_argument_node_nid',
- 'name field' => 'title',
- 'numeric' => TRUE,
- 'validate type' => 'nid',
- ),
- 'filter' => array(
- 'handler' => 'views_handler_filter_numeric',
- ),
- 'sort' => array(
- 'handler' => 'views_handler_sort',
- ),
- );
- $data['tracker_user']['uid'] = array(
- 'title' => t('Uid'),
- 'help' => t('The user ID of a user who touched the node (either created or commented on it).'),
- 'field' => array(
- 'handler' => 'views_handler_field_user',
- 'click sortable' => TRUE,
- ),
- 'argument' => array(
- 'handler' => 'views_handler_argument_user_uid',
- 'name field' => 'name',
- ),
- 'filter' => array(
- 'title' => t('Name'),
- 'handler' => 'views_handler_filter_user_name',
- ),
- 'sort' => array(
- 'handler' => 'views_handler_sort',
- ),
- );
- $data['tracker_user']['changed'] = array(
- 'title' => t('Updated date'),
- 'help' => t('The date the node was last updated or commented on. You must use an argument or filter on UID or you will get misleading results using this field.'),
- 'field' => array(
- 'handler' => 'views_handler_field_date',
- 'click sortable' => TRUE,
- ),
- 'sort' => array(
- 'handler' => 'views_handler_sort_date',
- ),
- 'filter' => array(
- 'handler' => 'views_handler_filter_date',
- ),
- );
- $data['tracker_user']['published'] = array(
- 'title' => t('Published'),
- 'help' => t('Whether or not the node is published. You must use an argument or filter on UID or you will get misleading results using this field.'),
- 'field' => array(
- 'handler' => 'views_handler_field_boolean',
- 'click sortable' => TRUE,
- ),
- 'filter' => array(
- 'handler' => 'views_handler_filter_tracker_boolean_operator',
- 'label' => t('Published'),
- 'type' => 'yes-no',
- ),
- 'sort' => array(
- 'handler' => 'views_handler_sort',
- ),
- );
- return $data;
- }
- /**
- * Implementation of hook_views_data_alter().
- */
- function tracker_views_data_alter(&$data) {
- // Provide additional uid_touch handlers which are handled by tracker
- $data['node']['uid_touch_tracker'] = array(
- 'group' => t('Tracker - User'),
- 'title' => t('User posted or commented'),
- 'help' => t('Display nodes only if a user posted the node or commented on the node.'),
- 'argument' => array(
- 'field' => 'uid',
- 'name table' => 'users',
- 'name field' => 'name',
- 'handler' => 'views_handler_argument_tracker_comment_user_uid',
- 'no group by' => TRUE,
- ),
- 'filter' => array(
- 'field' => 'uid',
- 'name table' => 'users',
- 'name field' => 'name',
- 'handler' => 'views_handler_filter_tracker_comment_user_uid'
- ),
- );
- }
|