You are here

public static function Frx::Document in Forena Reports 7.5

Same name and namespace in other branches
  1. 7.3 Frx.inc \Frx::Document()
  2. 7.4 Frx.inc \Frx::Document()

Enter description here ...

Parameters

unknown_type $type:

Return value

DocumentTypeBase

1 call to Frx::Document()
ReportEditor::report in src/Editor/ReportEditor.php
Load and render a report based on a drupal path. In this function the arglist is used to get the full path to the report. Pass parameters or NULL to use get /post parameters.

File

./Frx.inc, line 122
Frx.incL General Forena Reporting Class

Class

Frx

Code

public static function Document($type = 'web') {
  static $doc_types = '';
  static $objects = '';

  // Invoke doc_type hook to see which document types are there.
  if (!$doc_types) {
    $doc_types = module_invoke_all('forena_document_types');
  }
  if (!$type) {
    $type = 'web';
  }
  if (isset($doc_types[$type]) && class_exists(@$doc_types[$type]['class'])) {
    if (!@$doc_types[$type]['object']) {
      $class = $doc_types[$type]['class'];
      $o = new $class();
      $o->format = $type;
      $doc_types[$type]['object'] = $o;
    }
    else {
      $o = $doc_types[$type]['object'];
    }
    return $o;
  }
  else {
    drupal_set_message(t('Unsupported document type: %s', array(
      '%s' => $type,
    )), 'error');
    drupal_not_found();
    exit;
  }
}