You are here

public function FrxDocument::render in Forena Reports 7.4

Same name and namespace in other branches
  1. 7.3 FrxDocument.inc \FrxDocument::render()
11 methods override FrxDocument::render()
FrxCSVDoc::render in docformats/FrxCSVDoc.inc
FrxDocRaptor::render in docformats/FrxDocRaptor.inc
FrxEmailMergeDoc::render in docformats/FrxEmailMergeDoc.inc
FrxHtmlDoc::render in docformats/FrxHtmlDoc.inc
FrxMPDF::render in docformats/FrxMPDF.inc

... See full list

File

./FrxDocument.inc, line 44
FrxDocument.inc Given a report, render the appropriate output given the document format. @author davidmetzler

Class

FrxDocument
@file FrxDocument.inc Given a report, render the appropriate output given the document format. @author davidmetzler

Code

public function render($r, $format, $options = array()) {
  $header = '<h1>' . $r->title . '</h1>';
  $output = $header . $output;
  $css_text = '';
  $r_text = '';
  $stylesheets = Frx::Skin()->stylesheets;
  foreach ($stylesheets as $type => $sheets) {
    foreach ($sheets as $sheet) {
      switch ($type) {
        case 'all':
        case $this->format:
          $css_file[] = $sheet;
          break;
      }
    }
  }
  if ($css_files) {
    foreach ($css_files as $css_file) {
      $css_text .= file_get_contents($css_file);
    }
  }
  $options = array(
    'css' => $css_text,
    'docname' => str_replace(' ', '_', $title),
    'xml' => $r_text,
    'title' => $title,
  );
  $output = $this
    ->generate_doc($format, $output, $options, $print);
  if ($format != 'email') {
    print $output;
  }
}