function path_admin_overview in Drupal 6
Same name and namespace in other branches
- 7 modules/path/path.admin.inc \path_admin_overview()
Return a listing of all defined URL aliases. When filter key passed, perform a standard search on the given key, and return the list of matching URL aliases.
1 string reference to 'path_admin_overview'
- path_menu in modules/
path/ path.module - Implementation of hook_menu().
File
- modules/
path/ path.admin.inc, line 13 - Administrative page callbacks for the path module.
Code
function path_admin_overview($keys = NULL) {
// Add the filter form above the overview table.
$output = drupal_get_form('path_admin_filter_form', $keys);
// Enable language column if locale is enabled or if we have any alias with language
$count = db_result(db_query("SELECT COUNT(*) FROM {url_alias} WHERE language != ''"));
$multilanguage = module_exists('locale') || $count;
if ($keys) {
// Replace wildcards with MySQL/PostgreSQL wildcards.
$keys = preg_replace('!\\*+!', '%', $keys);
$sql = "SELECT * FROM {url_alias} WHERE dst LIKE '%%%s%%'";
}
else {
$sql = 'SELECT * FROM {url_alias}';
}
$header = array(
array(
'data' => t('Alias'),
'field' => 'dst',
'sort' => 'asc',
),
array(
'data' => t('System'),
'field' => 'src',
),
array(
'data' => t('Operations'),
'colspan' => '2',
),
);
if ($multilanguage) {
$header[3] = $header[2];
$header[2] = array(
'data' => t('Language'),
'field' => 'language',
);
}
$sql .= tablesort_sql($header);
$result = pager_query($sql, 50, 0, NULL, $keys);
$rows = array();
$destination = drupal_get_destination();
while ($data = db_fetch_object($result)) {
$row = array(
check_plain($data->dst),
check_plain($data->src),
l(t('edit'), "admin/build/path/edit/{$data->pid}", array(
'query' => $destination,
)),
l(t('delete'), "admin/build/path/delete/{$data->pid}", array(
'query' => $destination,
)),
);
if ($multilanguage) {
$row[4] = $row[3];
$row[3] = $row[2];
$row[2] = module_invoke('locale', 'language_name', $data->language);
}
$rows[] = $row;
}
if (empty($rows)) {
$empty_message = $keys ? t('No URL aliases found.') : t('No URL aliases available.');
$rows[] = array(
array(
'data' => $empty_message,
'colspan' => $multilanguage ? 5 : 4,
),
);
}
$output .= theme('table', $header, $rows);
$output .= theme('pager', NULL, 50, 0);
return $output;
}