You are here

function theme_context_ui_block_ui in Context 5

Same name and namespace in other branches
  1. 6 context_ui/context_ui.admin.inc \theme_context_ui_block_ui()
  2. 6.2 context_ui/context_ui.admin.inc \theme_context_ui_block_ui()

Generates the AJAX enabled block administration portion of the context_ui admin form.

1 theme call to theme_context_ui_block_ui()
context_ui_form in context_ui/context_ui_admin.inc
Generates the omnibus context definition editing form. Note: submission and validation handlers are in context_ui_admin.inc

File

context_ui/context_ui_admin.inc, line 631

Code

function theme_context_ui_block_ui($regions, $context = null) {
  $output = '';
  $tools = "<div class='tools'><span class='up'></span><span class='down'></span><span class='remove'></span></div>";
  foreach ($regions as $region => $label) {
    $items = array();
    $system = _context_ui_get_blocks($region);
    $system_item = array();
    foreach ($system as $block) {
      $system_item[] = $block->label . " ({$block->bid})";
    }
    $system_item = implode("<br/>", $system_item);
    $options = _context_ui_get_blocks($region, $context);
    $midpoint = false;
    if ($options) {
      foreach ($options as $block) {
        if ($block->type == 'context_ui' && !$context->system) {
          $items[] = array(
            'data' => $tools . $block->label . " ({$block->bid})",
            'title' => $block->bid,
          );
        }
        else {
          if ($block->type == 'context_ui' && $context->system) {
            $items[] = array(
              'data' => $block->label . " ({$block->bid})",
              'title' => $block->bid,
              'class' => 'default',
            );
          }
          else {
            if (!$midpoint) {
              $midpoint = true;
              $items[] = array(
                'data' => $system_item,
                'title' => 'system',
                'class' => 'disabled',
              );
            }
          }
        }
      }
    }
    else {
      if ($system_item) {
        $items[] = array(
          'data' => $system_item,
          'title' => 'system',
          'class' => 'disabled',
        );
      }
      else {
        $items[] = array(
          'data' => '',
          'class' => 'dummy',
        );
      }
    }
    $output .= theme('item_list', $items, $label, 'ul', array(
      'class' => form_clean_id($region),
    ));
  }
  return $output;
}