function theme_node_ad in Advertisement 5
Same name and namespace in other branches
- 5.2 ad.module \theme_node_ad()
- 6.3 ad.pages.inc \theme_node_ad()
- 6 ad.pages.inc \theme_node_ad()
- 6.2 ad.pages.inc \theme_node_ad()
- 7 ad.pages.inc \theme_node_ad()
1 theme call to theme_node_ad()
- ad_nodeapi in ./
ad.module - Drupal _nodeapi hook.
File
- ./
ad.module, line 980 - An advertising system for Drupal powered websites.
Code
function theme_node_ad($node, $yield_form = TRUE) {
$output = '';
if (ad_adaccess($node->nid, 'access statistics')) {
$output = theme('ad_status_display', $node);
$output .= theme('ad_statistics_display', ad_statistics($node->nid));
}
if (ad_adaccess($node->nid, 'access click history')) {
$header = array(
array(
'data' => t('Time'),
'field' => 'timestamp',
'sort' => 'desc',
),
array(
'data' => t('IP address'),
'field' => 'hostname',
),
array(
'data' => t('URL where clicked'),
'field' => 'url',
),
);
if (function_exists('click_filter_status_text') && user_access('view filtered clicks')) {
$header[] = array(
'data' => t('Status'),
'field' => 'status',
);
}
$header[] = array(
'data' => t(' '),
);
if ($node->nid) {
$sql = "SELECT cid, timestamp, uid, status, hostname, url FROM {ad_clicks} WHERE aid = {$node->nid}";
$sql .= tablesort_sql($header);
$result = pager_query($sql, 25);
while ($ad = db_fetch_object($result)) {
if (module_exists('click_filter') && $ad->status != CLICK_VALID) {
// Only show filtered clicks to users with permission to view them.
if (!user_access('view filtered clicks')) {
continue;
}
}
if (strlen($ad->url) > 40) {
$url = substr($ad->url, 0, 37) . '...';
}
else {
$url = $ad->url;
}
$row = array();
$click_user = user_load(array(
'uid' => $ad->uid,
));
$row[] = format_date($ad->timestamp, 'custom', 'M j H:i');
$row[] = check_plain($ad->hostname);
$row[] = l($url, $ad->url);
if (function_exists('click_filter_status_text') && user_access('view filtered clicks')) {
$row[] = click_filter_status_text($ad->status);
}
$row[] = '[' . l('details', "node/{$node->nid}/details/{$ad->cid}") . ']';
$rows[] = $row;
}
$click_history = theme('table', $header, $rows);
$click_history .= theme('pager', NULL, 25, 0);
$output .= theme('box', t('Click history'), $click_history);
}
}
return $output;
}