You are here

public function DocumentTypeBase::render in Forena Reports 7.5

11 methods override DocumentTypeBase::render()
CSVDocument::render in src/DocumentFormats/CSVDocument.php
DocRaptorPDF::render in src/DocumentFormats/DocRaptorPDF.php
DrupalPage::render in src/DocumentFormats/DrupalPage.php
EmailMerge::render in src/DocumentFormats/EmailMerge.php
ExcelDocument::render in src/DocumentFormats/ExcelDocument.php

... See full list

File

src/DocumentFormats/DocumentTypeBase.php, line 46
FrxDocument.inc Given a report, render the appropriate output given the document format. @author davidmetzler

Class

DocumentTypeBase

Namespace

Drupal\forena\DocumentFormats

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;
  }
}