function _google_image_sitemap_list in Google Image Sitemap 7
Same name and namespace in other branches
- 6 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 73 - A module gives to Google information about images on your site.
Code
function _google_image_sitemap_list() {
global $base_url;
$output = '';
$header = array(
t('S.NO.'),
t('SITEMAP URL'),
t('RANGE'),
t('CONTENT TYPE'),
t('LAST UPDATED'),
t('ACTIONS'),
);
$query = db_select('google_image_sitemap', 'g');
$query
->fields('g');
$result = $query
->execute();
$counter = 0;
$rows = array();
while ($gis_obj = $result
->fetchObject()) {
$url = 'google_image_sitemap/sitemap_' . $gis_obj->created . '.xml';
// $url = file_create_url(file_build_uri($url));
$url = variable_get('file_public_path', 'sites/default/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);
$build_link = "<a href='{$base_url}/{$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),
);
}
$theme_args = array(
'header' => $header,
'rows' => $rows,
'empty' => t('No sitemaps available.') . ' ' . l(t('Add a new sitemap'), GOOGLE_IMAGE_SITEMAP_ADMIN_PATH . '/add'),
);
$output = theme('table', $theme_args);
return $output;
}