function ad_report_menu in Advertisement 5
Same name and namespace in other branches
- 5.2 report/ad_report.module \ad_report_menu()
- 6.3 report/ad_report.module \ad_report_menu()
- 6 report/ad_report.module \ad_report_menu()
- 6.2 report/ad_report.module \ad_report_menu()
- 7 report/ad_report.module \ad_report_menu()
Implementation of hook_menu().
File
- report/
ad_report.module, line 14 - Provides comprehensive charts and reports about advertising statistics.
Code
function ad_report_menu($may_cache) {
$items = array();
if (!$may_cache) {
if (arg(0) == 'node' && is_numeric(arg(1)) && ad_adaccess(arg(1), 'access statistics')) {
$node = node_load(array(
'nid' => arg(1),
));
if ($node->adtype) {
$items[] = array(
'path' => "node/{$node->nid}/report",
'title' => t('Reports'),
'callback' => 'ad_report_bargraph',
'callback arguments' => array(
$node,
arg(3),
'node',
),
'type' => MENU_LOCAL_TASK,
'access' => ad_adaccess($node->nid, 'access statistics'),
);
$items[] = array(
'path' => "node/{$node->nid}/report/hourly",
'access' => ad_adaccess($node->nid, 'access statistics'),
'title' => t('Hourly'),
'type' => MENU_LOCAL_TASK,
'weight' => 0,
);
$items[] = array(
'path' => "node/{$node->nid}/report/daily",
'access' => ad_adaccess($node->nid, 'access statistics'),
'title' => t('Daily'),
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => 1,
);
$items[] = array(
'path' => "node/{$node->nid}/report/weekly",
'access' => ad_adaccess($node->nid, 'access statistics'),
'title' => t('Weekly'),
'type' => MENU_LOCAL_TASK,
'weight' => 2,
);
$items[] = array(
'path' => "node/{$node->nid}/report/monthly",
'access' => ad_adaccess($node->nid, 'access statistics'),
'title' => t('Monthly'),
'type' => MENU_LOCAL_TASK,
'weight' => 3,
);
}
}
else {
if (arg(0) == 'ad_report' && is_numeric(arg(1))) {
if (arg(3) == 'node') {
$access = ad_adaccess(arg(1), 'access statistics');
}
else {
// TODO: Need to implement proper permissions here.
$access = TRUE;
}
$items[] = array(
'path' => 'ad_report/' . arg(1) . '/bargraph/' . arg(3),
'title' => 'Bar graph',
'callback' => 'ad_report_generate_bargraph',
'callback arguments' => array(
arg(1),
arg(3),
),
'type' => MENU_CALLBACK,
'access' => $access,
);
}
}
}
return $items;
}