function referral_admin_view_details in User Referral 7
Same name and namespace in other branches
- 5 referral.module \referral_admin_view_details()
- 6 referral.module \referral_admin_view_details()
1 string reference to 'referral_admin_view_details'
- referral_menu in ./
referral.module - Implements hook_menu().
File
- ./
referral.module, line 504 - The referral module.
Code
function referral_admin_view_details() {
$uid = (int) arg(4);
$ref_user = user_load($uid);
$header = array(
array(
'data' => t('User'),
'field' => 'u.name',
),
array(
'data' => t('Flag'),
'field' => 'r.flag',
),
array(
'data' => t('Roles'),
),
array(
'data' => t('Time'),
'field' => 'r.created',
'sort' => 'desc',
),
array(
'data' => t('IP Address'),
'field' => 'r.host',
),
array(
'data' => t('Referrer'),
'field' => 'r.http_referer',
),
);
$query = db_select('referral', 'r');
$query
->innerJoin('users', 'u', 'u.uid = r.uid');
$result = $query
->fields('u', array(
'uid',
'name',
))
->fields('r', array(
'flag',
'created',
'host',
'http_referer',
))
->condition('r.referral_uid', $uid)
->condition('u.status', 1)
->extend('PagerDefault')
->range(0, REFERRAL_PAGE_COUNT)
->extend('TableSort')
->orderByHeader($header)
->execute();
$rows = array();
foreach ($result as $data) {
$referer = check_plain(_referral_column_width($data->http_referer));
$rows[] = array(
array(
'data' => l($data->name, "user/{$data->uid}"),
),
array(
'data' => $data->flag ? 'Yes' : 'No',
),
array(
'data' => implode(',', _referral_get_user_roles($data->uid)),
),
array(
'data' => format_date($data->created, 'custom', REFERRAL_DATE_FORMAT),
),
array(
'data' => l($data->host, "http://whois.domaintools.com/{$data->host}"),
),
array(
'data' => l($referer, $data->http_referer),
),
);
}
if (!$rows) {
$rows[] = array(
array(
'data' => t('No data.'),
'colspan' => '6',
),
);
}
$pager = theme('pager', array(
'tags' => array(),
));
if (!empty($pager)) {
$rows[] = array(
array(
'data' => $pager,
'colspan' => '6',
),
);
}
return theme('table', array(
'header' => $header,
'rows' => $rows,
));
}