You are here

function statspro_get_array_as_fixed_space_fields in Statistics Pro 6.2

1 call to statspro_get_array_as_fixed_space_fields()
statspro_drush_run in ./statspro.drush.inc
Run drush command for specified mode

File

./statspro.drush.inc, line 96
Drush include file for statuspro

Code

function statspro_get_array_as_fixed_space_fields($headers, $rows) {
  $column_widths = array();
  foreach ($headers as $header) {
    $column_widths[] = drupal_strlen($header);
  }
  foreach ($rows as $row) {
    $index = 0;
    foreach ($row as $cell) {
      $width = drupal_strlen($cell);
      if (!isset($column_widths[$index]) || $width > $column_widths[$index]) {
        $column_widths[$index] = $width;
      }
      $index++;
    }
  }
  $lines = array();
  $lines[] = _statspro_get_array_as_fixed_space_fields_line($column_widths, $headers);
  foreach ($rows as $row) {
    $lines[] = _statspro_get_array_as_fixed_space_fields_line($column_widths, $row);
  }
  return $lines;
}