You are here

function context_ui_tree in Context 5

Generates an array tree representation of available space/key/value context definitions.

2 calls to context_ui_tree()
context_ui_admin in context_ui/context_ui_admin.inc
Page callback for context_ui admin landing page.
context_ui_rebuild in context_ui/context_ui_admin.inc
Cache system contexts

File

context_ui/context_ui_admin.inc, line 494

Code

function context_ui_tree($op = '') {
  static $tree;
  if (!$tree) {
    $tree = array(
      'system' => array(),
      'ui' => array(),
    );
    $result = db_query("\n      SELECT *\n      FROM {context_ui}\n      ORDER BY system ASC, namespace ASC, attribute ASC, value ASC");
    while ($context = db_fetch_object($result)) {
      $branch = $context->system ? 'system' : 'ui';
      $tree[$branch][$context->namespace][$context->attribute][$context->value] = $context;
    }
  }
  switch ($op) {
    case 'ui':
      return $tree['ui'];
    case 'system':
      return $tree['system'];
    default:
      return $tree;
  }
}