You are here

public function FrxControls::table in Forena Reports 7

Same name and namespace in other branches
  1. 6 plugins/FrxControls.inc \FrxControls::table()

File

plugins/FrxControls.inc, line 245
contains various methods for extending report formating, layout, transformation and design.

Class

FrxControls
@file contains various methods for extending report formating, layout, transformation and design.

Code

public function table($columns, $data_block, $clause = '') {
  if ($clause) {
    $clause = 'frx:clause ="' . $clause . '"';
  }
  $xml = '<div frx:block="' . $data_block . '" ' . $clause . '>';
  $xml .= '<table>';
  $xml .= '<thead>';
  $xml .= '<tr>';

  //Create the headers
  foreach ($columns as $header) {
    $xml .= '<th>' . $header . '</th>';
  }
  $xml .= '</tr>';
  $xml .= '</thead>';
  $xml .= '<tbody>';
  $xml .= '<tr frx:foreach="*">';
  foreach ($columns as $column) {
    $xml .= '<td>{' . $column . '}</td>';
  }
  $xml .= '</tr>';
  $xml .= '</tbody>';
  $xml .= '</table>';
  $xml .= '</div>';
  return $xml;
}