function _gotwo_list in Go - url redirects 6
Same name and namespace in other branches
- 7 gotwo.admin.inc \_gotwo_list()
Shows the list of go redirects
1 string reference to '_gotwo_list'
- gotwo_menu in ./
gotwo.module - Implementation of hook_menu().
File
- ./
gotwo.admin.inc, line 76 - Administrative page callbacks for the gotwo module.
Code
function _gotwo_list() {
$access = user_access('edit gotwo redirects');
$header = array(
array(
'data' => t('ID'),
'field' => 'gid',
),
array(
'data' => t('Label'),
'field' => 'src',
),
array(
'data' => t('Destination'),
'field' => 'dst',
),
array(
'data' => t('Counter'),
'field' => 'cnt',
'sort' => 'desc',
),
);
if ($access) {
$header[] = array(
'data' => t('Operations'),
);
}
$sql = 'SELECT * FROM {gotwo}';
$tablesort = tablesort_sql($header);
$result = pager_query($sql . $tablesort, 50);
$rows = array();
while ($go = db_fetch_object($result)) {
$i = count($rows);
$rows[$i] = array(
'data' => array(
$go->gid,
check_plain($go->src),
check_plain($go->dst),
$go->cnt,
),
);
if ($access) {
$rows[$i]['data'][] = l(t('Reset'), 'admin/build/gotwo/reset/' . $go->gid, array(
'title' => t('Reset the counter'),
)) . ' · ' . l(t('Delete'), 'admin/build/gotwo/delete/' . $go->gid);
}
}
if (!$rows) {
$rows[] = array(
array(
'data' => t('No redirects available.'),
'colspan' => $access ? 5 : 4,
),
);
}
$output = theme('table', $header, $rows);
$output .= theme('pager', NULL, 50, 0);
return $output;
}