function theme_context_ui_admin in Context 6
Same name and namespace in other branches
- 5 context_ui/context_ui_admin.inc \theme_context_ui_admin()
Generates the main context_ui admin page with a tiered context listing.
1 theme call to theme_context_ui_admin()
- context_ui_admin in context_ui/
context_ui.admin.inc - Page callback for context_ui admin landing page.
File
- context_ui/
context_ui.admin.inc, line 692
Code
function theme_context_ui_admin($contexts) {
$rows = $headings = array();
foreach ($contexts as $key => $context) {
$row = array();
$namespace = $context->namespace;
$attribute = $context->attribute;
$value = $context->value;
if (isset($context->cid) && $context->cid) {
$identifier = $context->cid;
}
else {
$identifier = $key;
}
// If no heading has been printed for this n/a pair, do so
if (!isset($rows["{$namespace}-{$attribute}"])) {
$row = array(
array(
'data' => "<span class='context-namespace'>{$namespace} > {$attribute}</span>",
'colspan' => 2,
),
);
$rows["{$namespace}-{$attribute}"] = $row;
}
// Add row for context
$links = array();
$icon = theme('advanced_help_topic', 'context_ui', 'type');
switch ($context->type) {
case CONTEXT_STORAGE_DEFAULT:
$type = 'Default';
$links[0] = l(t('Override'), "admin/build/context/{$identifier}/clone");
$links[2] = l(t('Export'), "admin/build/context/{$identifier}/export");
$links[3] = l(t('Clone'), "admin/build/context/{$identifier}/clone");
break;
case CONTEXT_STORAGE_OVERRIDDEN:
$type = 'Overridden';
$links[0] = l(t('Edit'), "admin/build/context/{$identifier}");
$links[2] = l(t('Export'), "admin/build/context/{$identifier}/export");
$links[3] = l(t('Clone'), "admin/build/context/{$identifier}/clone");
$links[4] = l(t('Revert'), "admin/build/context/{$identifier}/delete");
break;
case CONTEXT_STORAGE_NORMAL:
$type = 'Normal';
$links[0] = l(t('Edit'), "admin/build/context/{$identifier}");
$links[2] = l(t('Export'), "admin/build/context/{$identifier}/export");
$links[3] = l(t('Clone'), "admin/build/context/{$identifier}/clone");
$links[4] = l(t('Delete'), "admin/build/context/{$identifier}/delete");
}
switch ($context->status) {
case CONTEXT_STATUS_DISABLED:
$class = 'disabled';
$enable = l(t('Enable'), "admin/build/context/{$identifier}/enable");
break;
case CONTEXT_STATUS_ENABLED:
$class = 'enabled';
$enable = l(t('Disable'), "admin/build/context/{$identifier}/disable");
}
$links[1] = $enable;
if ($icon) {
// These spans are used to work-around advanced help's default styling of
// floating the help icon left. We would like to display it after the text,
// so we put a series of floats next to each other.
$data = "<strong>{$value}</strong> <em><span>({$type}</span> {$icon}<span>)</span></em>";
}
else {
$data = "<strong>{$value}</strong> <em>({$type})</em>";
}
$description = !empty($context->description) ? '<div class="description">' . filter_xss_admin($context->description) . '</div>' : '';
ksort($links);
$rows[$key] = array(
'data' => array(
array(
'data' => $data . $description,
'class' => 'context-name ' . ($icon ? 'icon' : 'no-icon'),
),
implode(' | ', $links),
),
'class' => 'context-table-row ' . $class,
);
}
return theme('table', array(
t('Context'),
t('Operations'),
), $rows, array(
'class' => 'context-ui-overview',
));
}