You are here

protected function views_aggregator_plugin_style_table::set_totals_row in Views Aggregator Plus 7

Write the aggregated results back into the View results totals (footer).

Parameters

array $values: An array of field value arrays, indexed by field name and 'column'.

1 call to views_aggregator_plugin_style_table::set_totals_row()
views_aggregator_plugin_style_table::pre_render in views/views_aggregator_plugin_style_table.inc
Overrides pre_render().

File

views/views_aggregator_plugin_style_table.inc, line 929
views_aggregator_plugin_style_table.inc

Class

views_aggregator_plugin_style_table
Style plugin to render each item as a row in a table.

Code

protected function set_totals_row($values) {
  $totals = array();
  foreach ($values as $field_name => $group) {
    if (!empty($this->options['info'][$field_name]['has_aggr_column']) && isset($group['column'])) {
      $total = $group['column'];
      if ($this
        ->is_renderable($field_name, TRUE)) {
        $field_handler = $this->view->field[$field_name];
        $is_webform_value = is_a($field_handler, 'webform_handler_field_submission_data');

        // This is to make render_text() work properly.
        $field_handler->original_value = $total;
        $separator = $this->options['info'][$field_name]['aggr_par_column'];
        $totals[$field_name] = $is_webform_value ? $this
          ->render_new_webform_value($field_handler, 0, $total, $separator) : $this
          ->render_new_value($field_handler, NULL, $total, $separator);
      }
      else {
        $totals[$field_name] = $total;
      }
    }
  }
  return $totals;
}