function context_prefix_admin in Context 5
Page callback for the context_prefix administration page.
1 string reference to 'context_prefix_admin'
- context_prefix_menu in context_prefix/
context_prefix.module - Implementation of hook_menu().
File
- context_prefix/
context_prefix.module, line 403
Code
function context_prefix_admin() {
global $pager_page_array, $pager_total, $pager_total_items;
$page = isset($_GET['page']) ? $_GET['page'] : 0;
$element = 0;
$limit = 20;
// Convert $page to an array, used by other functions.
$pager_page_array = array(
$page,
);
$methods = _context_ui_options();
$merged = array();
foreach (array_keys($methods) as $method) {
foreach (context_prefix_prefixes($method) as $prefix => $info) {
$info['prefix'] = $prefix;
$merged[] = $info;
}
}
$rows = array();
for ($i = $page * $limit; $i < ($page + 1) * $limit && $i < count($merged); $i++) {
$rows[] = array(
$merged[$i]['provider'],
$merged[$i]['prefix'],
$merged[$i]['id'],
$methods[variable_get('context_prefix_method_' . $merged[$i]['provider'], CONTEXT_PREFIX_PATH)],
);
}
// We calculate the total of pages as ceil(items / limit).
$pager_total_items[$element] = count($merged);
$pager_total[$element] = ceil($pager_total_items[$element] / $limit);
$pager_page_array[$element] = max(0, min((int) $pager_page_array[$element], (int) $pager_total[$element] - 1));
if ($rows) {
$output .= theme('table', array(
t('Provider'),
t('Prefix'),
t('ID'),
t('Method'),
), $rows);
$output .= theme('pager');
}
else {
$output .= "<p>" . t('No context prefixes have been registered.') . "</p>";
}
return $output;
}