function _recommender_views_template_table in Recommender API 7.6
1 call to _recommender_views_template_table()
- recommender_views_data in ./
recommender.views.inc - Implements hook_views_data().
File
- ./
recommender.views.inc, line 55
Code
function _recommender_views_template_table($table_structure, $table_type, $table_human_readable_name, $user_entity_info, $item_entity_info) {
$data = array();
$data['table'] = array(
'group' => t('Recommender'),
'help' => "{$table_human_readable_name}: {$table_type}",
'base' => array(
// this field doesn't matter when showing a list of db rows.
// Perhaps will be used for table joins, but apparently we don't use this table for that purpose.
'field' => 'id',
'title' => "{$table_human_readable_name}: {$table_type}",
),
);
// first field:
switch ($table_type) {
case 'preference':
case 'prediction':
$data[$table_structure['user field']] = _recommender_views_template_user_field(t('!name: user in !type table', array(
'!name' => $table_human_readable_name,
'!type' => $table_type,
)), t('The user field in !type table', array(
'!type' => $table_type,
)), $user_entity_info);
break;
case 'user similarity':
$data[$table_structure['user1 field']] = _recommender_views_template_user_field(t('!name: user 1 in user similarity table', array(
'!name' => $table_human_readable_name,
)), t('The user 1 field in user similarity table'), $user_entity_info);
break;
case 'item similarity':
$data[$table_structure['item1 field']] = _recommender_views_template_item_field(t('!name: item 1 in item similarity table', array(
'!name' => $table_human_readable_name,
)), t('The item 1 field in item similarity table'), $item_entity_info);
break;
}
// second field
switch ($table_type) {
case 'preference':
case 'prediction':
$data[$table_structure['item field']] = _recommender_views_template_item_field(t('!name: item in !type table', array(
'!name' => $table_human_readable_name,
'!type' => $table_type,
)), t('The item field in !type table', array(
'!type' => $table_type,
)), $item_entity_info);
break;
case 'user similarity':
$data[$table_structure['user2 field']] = _recommender_views_template_user_field(t('!name: user 2 in user similarity table', array(
'!name' => $table_human_readable_name,
)), t('The user 2 field in user similarity table'), $user_entity_info);
break;
case 'item similarity':
$data[$table_structure['item2 field']] = _recommender_views_template_item_field(t('!name: item 2 in item similarity table', array(
'!name' => $table_human_readable_name,
)), t('The item 2 field in item similarity table'), $item_entity_info);
break;
}
// third field, always 'score field'
$data[$table_structure['score field']] = _recommender_views_template_score_field(t('!name: score in !type table', array(
'!name' => $table_human_readable_name,
'!type' => $table_type,
)), t('The score field in !type table', array(
'!type' => $table_type,
)));
// forth field, always 'timestamp'.
$data[$table_structure['timestamp field']] = _recommender_views_template_timestamp_field(t('!name: timestamp in !type table', array(
'!name' => $table_human_readable_name,
'!type' => $table_type,
)), t('The timestamp field in !type table', array(
'!type' => $table_type,
)));
return $data;
}