function referral_admin_view_unflagged in User Referral 5
Same name and namespace in other branches
- 6 referral.module \referral_admin_view_unflagged()
- 7 referral.module \referral_admin_view_unflagged()
1 string reference to 'referral_admin_view_unflagged'
File
- ./
referral.module, line 419
Code
function referral_admin_view_unflagged() {
$header = array(
array(
'data' => t('Referring User'),
'field' => 'u.name',
),
array(
'data' => t('# Unflagged'),
'field' => 'cnt',
),
array(
'data' => t('Last'),
'field' => 'last',
'sort' => 'desc',
),
array(
'data' => t('Operations'),
),
);
$sql = 'SELECT r.referral_uid, u.name, COUNT(*) AS cnt, MAX(r.created) AS last
FROM {referral} r INNER JOIN {users} u ON(r.referral_uid = u.uid)
WHERE r.flag = 0
AND r.uid IN
( SELECT u.uid FROM {users} u WHERE status = 1 )
GROUP BY r.referral_uid' . tablesort_sql($header);
$result = pager_query($sql, REFERRAL_PAGE_COUNT);
while ($data = db_fetch_object($result)) {
$rows[] = array(
array(
'data' => l($data->name, "user/{$data->referral_uid}"),
),
array(
'data' => $data->cnt,
),
array(
'data' => format_date($data->last, 'custom', REFERRAL_DATE_FORMAT),
),
array(
'data' => l(t('details'), "admin/logs/referral/roles/{$data->referral_uid}") . ' | ' . l(t('flag'), "admin/referral/flag/{$data->referral_uid}"),
),
);
}
if (!$rows) {
$rows[] = array(
array(
'data' => t('No data.'),
'colspan' => '4',
),
);
}
$pager = theme('pager', null, REFERRAL_PAGE_COUNT, 0);
if (!empty($pager)) {
$rows[] = array(
array(
'data' => $pager,
'colspan' => '4',
),
);
}
print theme('page', theme('table', $header, $rows), t('Referrals Report'));
}