You are here

function recommender_views_data in Recommender API 6.2

Same name and namespace in other branches
  1. 6.3 views/recommender.views.inc \recommender_views_data()
  2. 7.6 recommender.views.inc \recommender_views_data()
  3. 7.3 recommender.views.inc \recommender_views_data()
  4. 7.4 recommender.views.inc \recommender_views_data()
  5. 7.5 recommender.views.inc \recommender_views_data()

File

./recommender.views.inc, line 18
recommender.views.inc Views support for recommender tables Initially contributed by JoeMcGuire at Drupal.org. Thanks!

Code

function recommender_views_data() {
  $views_data = array();
  $views_data['recommender_similarity'] = array(
    'table' => array(
      'group' => t('Recommender'),
      'base' => array(
        'field' => 'pair_id',
        'title' => t('Similarity'),
        'help' => t('Recommendation based on similarity between the same type of nodes.'),
        'weight' => 10,
      ),
    ),
    'pair_id' => array(
      'title' => t('ID'),
      'help' => t('Unique ID for each recommendation pair.'),
      'field' => array(
        'handler' => 'views_handler_field_numeric',
        'click sortable' => TRUE,
      ),
      'filter' => array(
        'handler' => 'views_handler_filter_numeric',
      ),
      'sort' => array(
        'handler' => 'views_handler_sort',
      ),
      'argument' => array(
        'handler' => 'views_handler_argument_numeric',
      ),
    ),
    'app_id' => array(
      'title' => t('Application ID'),
      'help' => t('Application used provide data'),
      'field' => array(
        'handler' => 'views_handler_field_numeric',
        'click sortable' => TRUE,
      ),
      'filter' => array(
        'handler' => 'views_handler_filter_numeric',
      ),
      'sort' => array(
        'handler' => 'views_handler_sort',
      ),
      'argument' => array(
        'handler' => 'views_handler_argument_numeric',
      ),
    ),
    'mouse1_id' => array(
      'title' => t('Node ID'),
      'help' => t('Node ID'),
      'field' => array(
        'handler' => 'views_handler_field_numeric',
        'click sortable' => TRUE,
      ),
      'filter' => array(
        'handler' => 'views_handler_filter_numeric',
      ),
      'sort' => array(
        'handler' => 'views_handler_sort',
      ),
      'relationship' => array(
        'base' => 'node',
        'base field' => 'nid',
        'handler' => 'views_handler_relationship',
        'label' => t('Node'),
      ),
      'argument' => array(
        'handler' => 'views_handler_argument_numeric',
      ),
    ),
    'mouse2_id' => array(
      'title' => t('Similar Node ID'),
      'help' => t('Node ID for recommended content'),
      'field' => array(
        'handler' => 'views_handler_field_numeric',
        'click sortable' => TRUE,
      ),
      'filter' => array(
        'handler' => 'views_handler_filter_numeric',
      ),
      'sort' => array(
        'handler' => 'views_handler_sort',
      ),
      'relationship' => array(
        'base' => 'node',
        'base field' => 'nid',
        'handler' => 'views_handler_relationship',
        'label' => t('Node'),
      ),
      'argument' => array(
        'handler' => 'views_handler_argument_numeric',
      ),
    ),
    'similarity' => array(
      'title' => t('Similarity'),
      'help' => t('Score of how similar Node ID and Similar Node ID are.'),
      'field' => array(
        'handler' => 'views_handler_field_numeric',
        'click sortable' => TRUE,
      ),
      'filter' => array(
        'handler' => 'views_handler_filter_numeric',
      ),
      'sort' => array(
        'handler' => 'views_handler_sort',
      ),
      'argument' => array(
        'handler' => 'views_handler_argument_numeric',
      ),
    ),
    'created' => array(
      'title' => t('Created'),
      'help' => t('Date when the similarity was calculated.'),
      'field' => array(
        'handler' => 'views_handler_field_date',
        'click sortable' => TRUE,
      ),
      'filter' => array(
        'handler' => 'views_handler_filter_date',
      ),
      'sort' => array(
        'handler' => 'views_handler_sort_date',
      ),
      'argument' => array(
        'handler' => 'views_handler_argument_date',
      ),
    ),
  );
  $views_data['recommender_prediction'] = array(
    'table' => array(
      'group' => t('Recommender'),
      'base' => array(
        'field' => 'link_id',
        'title' => t('Recommender predictions'),
        'help' => t('Predictions of content users may like from similar users.'),
        'weight' => 11,
      ),
    ),
    'link_id' => array(
      'title' => t('ID'),
      'help' => t('Unique ID for each prediction.'),
      'field' => array(
        'handler' => 'views_handler_field_numeric',
        'click sortable' => TRUE,
      ),
      'filter' => array(
        'handler' => 'views_handler_filter_numeric',
      ),
      'sort' => array(
        'handler' => 'views_handler_sort',
      ),
      'argument' => array(
        'handler' => 'views_handler_argument_numeric',
      ),
    ),
    'app_id' => array(
      'title' => t('Application ID'),
      'help' => t('Application used provide data'),
      'field' => array(
        'handler' => 'views_handler_field_numeric',
        'click sortable' => TRUE,
      ),
      'filter' => array(
        'handler' => 'views_handler_filter_numeric',
      ),
      'sort' => array(
        'handler' => 'views_handler_sort',
      ),
      'argument' => array(
        'handler' => 'views_handler_argument_numeric',
      ),
    ),
    'mouse_id' => array(
      'title' => t('User ID'),
      'help' => t('User ID'),
      'field' => array(
        'handler' => 'views_handler_field_numeric',
        'click sortable' => TRUE,
      ),
      'filter' => array(
        'handler' => 'views_handler_filter_numeric',
      ),
      'sort' => array(
        'handler' => 'views_handler_sort',
      ),
      'relationship' => array(
        'handler' => 'views_handler_relationship',
        'base' => 'users',
        'base field' => 'uid',
      ),
      'argument' => array(
        'handler' => 'views_handler_argument_user_uid',
        'name field' => 'name',
      ),
    ),
    'cheese_id' => array(
      'title' => t('Predicted Node ID'),
      'help' => t('Node ID for predicted content'),
      'field' => array(
        'handler' => 'views_handler_field_numeric',
        'click sortable' => TRUE,
      ),
      'filter' => array(
        'handler' => 'views_handler_filter_numeric',
      ),
      'sort' => array(
        'handler' => 'views_handler_sort',
      ),
      'relationship' => array(
        'base' => 'node',
        'base field' => 'nid',
        'handler' => 'views_handler_relationship',
        'label' => t('Node'),
      ),
      'argument' => array(
        'handler' => 'views_handler_argument_numeric',
      ),
    ),
    'prediction' => array(
      'title' => t('Predicition confidence'),
      'help' => t('Score of how confidence the user will like the Node ID.'),
      'field' => array(
        'handler' => 'views_handler_field_numeric',
        'click sortable' => TRUE,
      ),
      'filter' => array(
        'handler' => 'views_handler_filter_numeric',
      ),
      'sort' => array(
        'handler' => 'views_handler_sort',
      ),
      'argument' => array(
        'handler' => 'views_handler_argument_numeric',
      ),
    ),
    'created' => array(
      'title' => t('Created'),
      'help' => t('Date when the prediction was calculated.'),
      'field' => array(
        'handler' => 'views_handler_field_date',
        'click sortable' => TRUE,
      ),
      'filter' => array(
        'handler' => 'views_handler_filter_date',
      ),
      'sort' => array(
        'handler' => 'views_handler_sort_date',
      ),
      'argument' => array(
        'handler' => 'views_handler_argument_date',
      ),
    ),
  );
  return $views_data;
}