You are here

public function ForenaController::report in Forena Reports 8

Render a single report.

Parameters

$report:

Return value

array | string

1 call to ForenaController::report()
ForenaController::ajaxReport in src/Controller/ForenaController.php
Ajax callback handler for ajax requests.
1 string reference to 'ForenaController::report'
forena.routing.yml in ./forena.routing.yml
forena.routing.yml

File

src/Controller/ForenaController.php, line 30

Class

ForenaController

Namespace

Drupal\forena\Controller

Code

public function report($report) {
  $content = ReportManager::instance()
    ->report($report, $_GET);
  $d = DocManager::instance();
  $doc_type = $d
    ->getDocumentType();
  switch ($doc_type) {
    case 'drupal':
    case 'email':
      if ($content === FALSE) {
        throw new AccessDeniedHttpException();
      }
      if (!$content) {
        throw new NotFoundHttpException();
      }
      return $content;
      break;
    default:
      $response = new Response();
      $doc = $d
        ->getDocument();
      if ($doc->headers) {
        foreach ($doc->headers as $k => $header) {
          $response->headers
            ->set($k, $header);
        }
      }
      $response
        ->setContent($content);
      return $response;
  }
}