You are here

function theme_context_ui_bulk_export_table in Context 6.2

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

File

context_ui/context_ui.admin.inc, line 753

Code

function theme_context_ui_bulk_export_table($form) {

  // Add css
  drupal_add_css(drupal_get_path("module", "context_ui") . "/context_ui.css");
  $rows = $headings = array();
  foreach (element_children($form['checkboxes']) as $key) {
    $context = $form['#contexts'][$key];
    $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} &gt; {$attribute}</span>",
          'colspan' => 2,
        ),
      );
      $rows["{$namespace}-{$attribute}"] = $row;
    }
    unset($form['checkboxes'][$key]['#title']);
    $rows[$key] = array(
      'data' => array(
        array(
          'data' => drupal_render($form['checkboxes'][$key]),
          'class' => 'context-ui-checkbox',
        ),
        array(
          'data' => '<strong>' . $value . '</strong>',
          'class' => 'context-name',
        ),
      ),
      'class' => 'context-table-row ',
    );
  }
  $output = theme('table', array(
    theme('table_select_header_cell'),
    t('Context'),
  ), $rows, array(
    'class' => 'context-ui-bulk-export context-ui-overview',
  ));
  $output .= drupal_render($form);
  return $output;
}