You are here

function forena_get_doctypes in Forena Reports 7

Same name and namespace in other branches
  1. 6 forena.common.inc \forena_get_doctypes()

Gets the correct format function to render the document and returns an object of that class.

If it fails it returns a 0;

3 calls to forena_get_doctypes()
forena_generate_doc in ./forena.common.inc
@return: The document in the requested format. Returns a string if not able to format.
forena_layout_form in ./forena.admin.inc
Form function for the edit report form
forena_report in ./forena.module
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.

File

./forena.common.inc, line 750
Common functions used throughout the project but loaded in this file to keep the module file lean.

Code

function forena_get_doctypes($fkey) {
  $controls = forena_define_controls();
  foreach ($controls as $k => $r) {
    $provider = $r;
    if ($provider && method_exists($provider, 'doc_types')) {
      $f = $provider
        ->doc_types();
      if (isset($f[$fkey]) && method_exists($provider, $f[$fkey])) {

        // We found an object with the advertised method return it
        return $provider;
      }
    }
  }
  return 0;
}