function better_statistics_handler_field_block_ip::render in Better Statistics 7
Based on the IID, IP, and UID, display a block or unblock operation.
Overrides views_handler_field::render
File
- views/
better_statistics_handler_field_block_ip.inc, line 42 - Views field handler to supply a block/unblock IP link.
Class
- better_statistics_handler_field_block_ip
- A field handler to provide block/unblock IP operation links.
Code
function render($values) {
$iid = $values->blocked_ips_iid;
$ip = $values->accesslog_hostname;
$uid = isset($values->users_accesslog_uid) ? $values->users_accesslog_uid : 0;
// We don't block IPs of users.
if ($uid) {
return NULL;
}
elseif (!empty($iid)) {
$title = t('unblock IP address');
$url = 'admin/config/people/ip-blocking/delete/' . $iid;
}
else {
$title = t('block IP address');
$url = 'admin/config/people/ip-blocking/' . $ip;
}
return l($title, $url, array(
'query' => drupal_get_destination(),
));
}