function _google_image_sitemap_list in Google Image Sitemap 6
Same name and namespace in other branches
- 7 google_image_sitemap.module \_google_image_sitemap_list()
Menu callback: Displays a list of available sitemaps.
Return value
string Theme table data.
1 string reference to '_google_image_sitemap_list'
- google_image_sitemap_menu in ./
google_image_sitemap.module - Implements hook_menu().
File
- ./
google_image_sitemap.module, line 76 - A module gives to Google information about images on your site.
Code
function _google_image_sitemap_list() {
$output = '';
$header = array(
t('S.NO.'),
t('SITEMAP URL'),
t('RANGE'),
t('CONTENT TYPE'),
t('LAST UPDATED'),
t('ACTIONS'),
);
$result = db_query('SELECT * FROM {google_image_sitemap}');
$counter = 0;
$rows = array();
while ($gis_obj = db_fetch_object($result)) {
$url = 'google_image_sitemap/sitemap_' . $gis_obj->created . '.xml';
// $url = file_create_url($url);
$url = variable_get('file_directory_path', conf_path() . '/files') . '/' . $url;
// Build links.
$link_attributs = array(
'attributes' => array(
'title' => $gis_obj->range_start . " to " . $gis_obj->range_end,
),
);
if (empty($gis_obj->last_updated)) {
$rebuild_link = '';
$build_link = l(t('Generate Sitemap'), GOOGLE_IMAGE_SITEMAP_ADMIN_PATH . '/build/' . $gis_obj->sid, $link_attributs);
}
else {
$rebuild_link = l(t('RE-GENERATE'), GOOGLE_IMAGE_SITEMAP_ADMIN_PATH . '/build/' . $gis_obj->sid) . " | ";
// $build_link = l($url, $url, $link_attributs);
// l() was adding ?q= in the url and user wasn't able to download file.
$build_link = "<a href='{$url}'>{$url}</a>";
}
// Rows of table.
$rows[] = array(
++$counter,
$build_link,
$gis_obj->range_start . " - " . $gis_obj->range_end,
$gis_obj->node_type,
empty($gis_obj->last_updated) ? '-' : date('d-M-Y ', $gis_obj->last_updated),
$rebuild_link . l(t('EDIT'), GOOGLE_IMAGE_SITEMAP_ADMIN_PATH . '/edit/' . $gis_obj->sid) . " | " . l(t('DELETE'), GOOGLE_IMAGE_SITEMAP_ADMIN_PATH . '/delete/' . $gis_obj->sid),
);
}
$output = '<p>' . l(t('Add new Google Image Sitemap'), GOOGLE_IMAGE_SITEMAP_ADMIN_PATH . '/add') . '</p>';
if (!empty($counter)) {
$output .= theme('table', $header, $rows);
}
return $output;
}