function theme_feedapi_stat in FeedAPI 6
Theme stats. Accepts result of feedapi_stat_get().
1 theme call to theme_feedapi_stat()
- feedapi_stat_nodeapi in feedapi_stat/
feedapi_stat.module - Implementation of hook_nodeapi().
File
- feedapi_stat/
feedapi_stat.module, line 38 - Visualize standard FeedAPI statistics logs.
Code
function theme_feedapi_stat($values) {
drupal_add_css(drupal_get_path('module', 'feedapi_stat') . '/feedapi_stat.css');
// Get all timestamps.
$timestamps = array();
foreach ($values as $type => $val) {
foreach ($val as $timestamp => $v) {
$timestamps[$timestamp] = $timestamp;
}
}
arsort($timestamps);
// Build rows.
$names = feedapi_stat_types();
$rows = array();
foreach ($values as $type => $val) {
$row = array(
$names[$type],
theme('feedapi_stat_sparkline', $val),
);
foreach ($timestamps as $timestamp) {
$row[$timestamp] = theme('feedapi_stat_format', $val[$timestamp], $type);
}
$rows[] = $row;
}
// Build rows, first headers and sparklines, then all values.
$names = feedapi_stat_types();
$rows = array();
$row = array(
' ',
);
$header = array(
'Time of refresh',
);
foreach ($values as $type => $val) {
$header[$type] = $names[$type];
// Only add sparklines for dynamic data.
if (!in_array($type, array(
'update_times',
'next_refresh_time',
))) {
$row[$type] = theme('feedapi_stat_sparkline', $val);
}
else {
$row[$type] = ' ';
}
}
$rows[] = $row;
foreach ($timestamps as $timestamp) {
$row = array(
format_date($timestamp, 'custom', 'Y-m-d H:m:s'),
);
foreach ($values as $type => $val) {
$row[$type] = theme('feedapi_stat_format', $val[$timestamp], $type);
}
$rows[] = $row;
}
return '<div class="feedapi-stat-wrapper">' . '<h3 class="feedapi-stat">' . t('FeedAPI Refresh Log') . '</h3>' . theme('table', $header, $rows) . '</div>';
}