function record_shorten_records_table in Shorten URLs 7.2
Same name and namespace in other branches
- 8.2 modules/record_shorten/record_shorten.module \record_shorten_records_table()
- 8 modules/record_shorten/record_shorten.module \record_shorten_records_table()
- 6 record_shorten.module \record_shorten_records_table()
- 7 record_shorten.module \record_shorten_records_table()
Builds a list of shortened URLs.
1 call to record_shorten_records_table()
- theme_record_shorten_records in ./
record_shorten.module - Builds a list of shortened URLs.
File
- ./
record_shorten.module, line 91 - Records shortened URLs.
Code
function record_shorten_records_table() {
if (module_exists('views')) {
return views_embed_view('record_shorten', 'default');
}
$header = array(
t('Original'),
t('Short'),
t('Service'),
);
$rows = array();
// SELECT original, short, service FROM {record_shorten} ORDER BY sid DESC
$result = db_select('record_shorten', 'rs')
->extend('PagerDefault')
->limit(10)
->fields('rs', array(
'original',
'short',
'service',
))
->orderBy('rs.sid', 'DESC')
->execute();
foreach ($result as $row) {
// Sigh... DBTNG doesn't have a ->fetchAsNonAssocArray()
$rows[] = array(
check_plain($row->original),
check_plain($row->short),
check_plain($row->service),
);
}
$output = theme('table', array(
'header' => $header,
'rows' => $rows,
));
// Oddly, theme_pager($vars) has no defaults for $vars.
$output .= theme('pager', array(
'tags' => array(),
'element' => 0,
'parameters' => array(),
'quantity' => 9,
));
return $output;
}