function xmlsitemap_custom_list_links in XML sitemap 6.2
Same name and namespace in other branches
- 7.2 xmlsitemap_custom/xmlsitemap_custom.admin.inc \xmlsitemap_custom_list_links()
1 string reference to 'xmlsitemap_custom_list_links'
- xmlsitemap_custom_menu in xmlsitemap_custom/
xmlsitemap_custom.module - Implements hook_menu().
File
- xmlsitemap_custom/
xmlsitemap_custom.admin.inc, line 13 - Administrative page callbacks for the xmlsitemap_custom module.
Code
function xmlsitemap_custom_list_links() {
$output = '';
$output .= theme('links', xmlsitemap_custom_link_links_local_actions(), array(
'class' => 'item-list action-links',
));
$header = array(
'loc' => array(
'data' => t('Location'),
'field' => 'loc',
'sort' => 'asc',
),
'priority' => array(
'data' => t('Priority'),
'field' => 'priority',
),
'changefreq' => array(
'data' => t('Change frequency'),
'field' => 'changefreq',
),
'language' => array(
'data' => t('Language'),
'field' => 'language',
),
'operations' => array(
'data' => t('Operations'),
),
);
// Do not include the language column if locale is disabled.
if (!module_exists('locale')) {
unset($header['language']);
}
$rows = array();
$destination = drupal_get_destination();
$sql = "SELECT * FROM {xmlsitemap} WHERE type = 'custom'";
$sql .= tablesort_sql($header);
$query = pager_query($sql, 50);
while ($link = db_fetch_object($query)) {
$row = array();
$row['loc'] = l($link->loc, $link->loc);
$row['priority'] = number_format($link->priority, 1);
$row['changefreq'] = $link->changefreq ? drupal_ucfirst(xmlsitemap_get_changefreq($link->changefreq)) : t('None');
if (isset($header['language'])) {
$row['language'] = module_invoke('locale', 'language_name', $link->language);
}
$operations = array();
$operations['edit'] = xmlsitemap_get_operation_link('admin/settings/xmlsitemap/custom/edit/' . $link->id, array(
'title' => t('Edit'),
'modal' => TRUE,
));
$operations['delete'] = xmlsitemap_get_operation_link('admin/settings/xmlsitemap/custom/delete/' . $link->id, array(
'title' => t('Delete'),
'modal' => TRUE,
));
$row['operations'] = theme('links', $operations, array(
'class' => 'links inline nowrap',
));
$rows[] = $row;
}
if (empty($rows)) {
$rows[] = array(
array(
'data' => t('No custom links available.') . ' ' . l(t('Add custom link'), 'admin/settings/xmlsitemap/custom/add', array(
'query' => $destination,
)),
'colspan' => count($header),
),
);
}
$output .= theme('table', $header, $rows);
$output .= theme('pager', NULL, 50, 0);
return $output;
}