You are here

function theme_context_ui_admin in Context 5

Same name and namespace in other branches
  1. 6 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 569

Code

function theme_context_ui_admin($context_tree) {
  foreach ($context_tree as $namespace => $attributes) {
    $rows[] = array(
      "<span class='context-namespace'>" . $namespace . "</span>",
      null,
    );
    foreach ($attributes as $attribute => $contexts) {
      if (is_array($contexts)) {
        $rows[] = array(
          "<span class='context-attribute'>" . $attribute . "</span>",
          null,
        );
        foreach ($contexts as $value => $context) {
          $links = array();
          $class = '';
          if ($context->system) {
            $links[] = l(t('View'), "admin/build/context/view/{$context->cid}");
            $links[] = l(t('Override'), 'admin/build/context/clone/' . $context->cid);
          }
          else {
            $links[] = l(t('Edit'), 'admin/build/context/edit/' . $context->cid);
            $links[] = l(t('Clone'), 'admin/build/context/clone/' . $context->cid);
            $links[] = l(t('Export'), "admin/build/context/export/{$context->cid}");
            $links[] = l(t('Delete'), 'admin/build/context/delete/' . $context->cid);
          }
          if (!$context->status) {
            $class = 'overridden';
            $value = "{$value} (" . t('Overridden') . ")";
          }
          $rows[] = array(
            "<span class='context-value {$class}'>" . $value . "</span>",
            implode(' | ', $links),
          );
        }
      }
      else {
        $links = array();
        $class = '';
        if ($contexts->system) {
          $links[] = l(t('View'), "admin/build/context/view/{$contexts->cid}");
        }
        else {
          $links[] = l(t('Edit'), 'admin/build/context/edit/' . $contexts->cid);
          $links[] = l(t('Delete'), 'admin/build/context/delete/' . $contexts->cid);
        }
        if ($contexts->overridden) {
          $class = 'overridden';
          $key = "{$key} (" . t('Overridden') . ")";
        }
        $rows[] = array(
          "<span class='context-key'>" . $key . "</span>",
          implode(' | ', $links),
        );
      }
    }
  }
  return theme('table', array(
    t('Context'),
    t('Actions'),
  ), $rows, array(
    'class' => 'context-ui',
  ));
}