You are here

protected function views_aggregator_plugin_style_table::aggregate_groups in Views Aggregator Plus 7

Aggregate and compress the View's rows into groups.

Return value

array an array of aggregated groups

1 call to views_aggregator_plugin_style_table::aggregate_groups()
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 359
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 aggregate_groups() {
  $field_handlers = $this->view->field;

  // Find the one column to group by and execute the grouping.
  foreach ($this->options['info'] as $field_name => $options) {
    if (!empty($options['has_aggr']) && in_array('views_aggregator_group_and_compress', $options['aggr'], FALSE)) {
      $groups = views_aggregator_group_and_compress($this->view->result, $field_handlers[$field_name], $options['aggr_par']);
      break;
    }
  }
  if (empty($groups)) {

    // If there are no regular groups, create a special group for column
    // aggregation. This group holds all View result rows.
    foreach ($this->view->result as $num => $row) {
      $groups['column'][$num] = $row;
    }
  }
  return $groups;
}