function visitors_hours in Visitors 7
Same name and namespace in other branches
- 8 reports/hours.inc \visitors_hours()
- 7.2 reports/hours.inc \visitors_hours()
- 7.0 reports/hours.inc \visitors_hours()
Display hours report.
Return value
string hours report html source
1 string reference to 'visitors_hours'
- visitors_menu in ./
visitors.module - Menu callback. Prints a listing of active nodes on the site.
File
- reports/
hours.inc, line 39 - Hours report for the visitors module.
Code
function visitors_hours() {
$header = array(
array(
'data' => t('#'),
),
array(
'data' => t('Hour'),
'field' => 'hour',
'sort' => 'asc',
),
array(
'data' => t('Pages'),
'field' => 'count',
),
);
$results = visitors_hours_data($header);
$rows = array();
$i = 0;
$count = 0;
foreach ($results as $data) {
$rows[] = array(
++$i,
$data->hour,
$data->count,
);
$count += $data->count;
}
$output = visitors_date_filter();
if ($count > 0) {
$output .= sprintf('<img src="%s" alt="%s">', url('visitors/hours/chart'), t('Hours'));
}
$output .= theme('table', array(
'header' => $header,
'rows' => $rows,
));
return $output;
}