function statspro_views_data in Statistics Pro 6.2
Same name and namespace in other branches
- 6 views/statspro.views.inc \statspro_views_data()
Implementation of hook_views_data().
Return value
array
File
- views/
statspro.views.inc, line 14 - Views support for statistcs pro module
Code
function statspro_views_data() {
require_once drupal_get_path('module', 'statspro') . '/statspro.inc';
//Begin: statspro table
$data['statspro']['table']['group'] = t('Statistics Pro');
// Advertise this table as a possible base table
$data['statspro']['table']['base'] = array(
'field' => 'day',
'title' => t('Daily statistics'),
'help' => t('Stores site statistics aggregated per day.'),
'weight' => 10,
);
// DATE
$data['statspro']['day'] = array(
'title' => t('Date'),
'help' => t('Date of statistics.'),
'field' => array(
'click sortable' => TRUE,
),
'sort' => array(
'handler' => 'views_handler_sort',
),
);
// all data fields
$statspro = new StatsPro();
$data_fields = $statspro
->get_fields();
foreach ($data_fields as $field => $field_desc) {
$data['statspro'][$field] = array(
'title' => strip_tags($field_desc),
'help' => $field_desc,
'field' => array(
'handler' => 'statspro_views_handler_field_graph_trend',
'click sortable' => TRUE,
),
'sort' => array(
'handler' => 'views_handler_sort',
),
'filter' => array(
'handler' => 'views_handler_filter_numeric',
),
);
}
//End: statspro table
//Begin: statspro_term table
$data['statspro_term']['table']['group'] = t('Statistics Pro');
// For other base tables, explain how we join
$data['statspro_term']['table']['join'] = array(
'term_data' => array(
'field' => 'tid',
'left_field' => 'tid',
),
);
// term amounts
$data['statspro_term']['ncount'] = array(
'title' => t('Amount nodes'),
'help' => t('Amount of nodes for term'),
'field' => array(
'handler' => 'statspro_views_handler_field_graph',
'click sortable' => TRUE,
),
'sort' => array(
'handler' => 'views_handler_sort',
),
'filter' => array(
'handler' => 'views_handler_filter_numeric',
),
);
//End: statspro_term table
return $data;
}