You are here

function template_preprocess_views_data_export_msoffice_body in Views data export 7.4

Same name and namespace in other branches
  1. 6.3 theme/views_data_export.theme.inc \template_preprocess_views_data_export_msoffice_body()
  2. 6 theme/views_data_export.theme.inc \template_preprocess_views_data_export_msoffice_body()
  3. 6.2 theme/views_data_export.theme.inc \template_preprocess_views_data_export_msoffice_body()
  4. 7 theme/views_data_export.theme.inc \template_preprocess_views_data_export_msoffice_body()
  5. 7.3 theme/views_data_export.theme.inc \template_preprocess_views_data_export_msoffice_body()
2 calls to template_preprocess_views_data_export_msoffice_body()
template_preprocess_views_data_export_doc_body in theme/views_data_export.theme.inc
template_preprocess_views_data_export_xls_body in theme/views_data_export.theme.inc

File

theme/views_data_export.theme.inc, line 267
Theme related functions for processing our output style plugins.

Code

function template_preprocess_views_data_export_msoffice_body(&$vars) {
  _views_data_export_header_shared_preprocess($vars);
  _views_data_export_body_shared_preprocess($vars);
  $output = '';

  // Construct the tbody of a table, see theme_table().
  $ts = tablesort_init($vars['header']);
  $flip = array(
    'even' => 'odd',
    'odd' => 'even',
  );
  $class = 'even';
  foreach ($vars['themed_rows'] as $number => $row) {
    $attributes = array();

    // Check if we're dealing with a simple or complex row
    if (isset($row['data'])) {
      foreach ($row as $key => $value) {
        if ($key == 'data') {
          $cells = $value;
        }
        else {
          $attributes[$key] = $value;
        }
      }
    }
    else {
      $cells = $row;
    }
    if (count($cells)) {

      // Add odd/even class
      $class = $flip[$class];
      if (isset($attributes['class'])) {
        $attributes['class'] .= ' ' . $class;
      }
      else {
        $attributes['class'] = $class;
      }

      // Build row
      $output .= ' <tr' . drupal_attributes($attributes) . '>';
      $i = 0;
      foreach ($cells as $cell) {
        $cell = tablesort_cell($cell, $vars['header'], $ts, $i++);
        $output .= _theme_table_cell($cell);
      }
      $output .= " </tr>\n";
    }
  }
  $vars['tbody'] = preg_replace('/<\\/?(a|span) ?.*?>/', '', $output);

  // strip 'a' and 'span' tags
}