You are here

function FrxReportGenerator::define_controls in Forena Reports 7.2

Same name and namespace in other branches
  1. 6.2 FrxReportGenerator.inc \FrxReportGenerator::define_controls()

returns a list of instances of the control classes if there wasn't a class, returns an empty string.

4 calls to FrxReportGenerator::define_controls()
FrxReportGenerator::get_doctypes in ./FrxReportGenerator.inc
Gets the correct format function to render the document and returns an object of that class.
FrxReportGenerator::get_formatter in ./FrxReportGenerator.inc
Load the formatters for all initialized repositories.
FrxReportGenerator::supported_doctypes in ./FrxReportGenerator.inc
FrxReportGenerator::supported_formats in ./FrxReportGenerator.inc

File

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

Class

FrxReportGenerator

Code

function define_controls($class = '') {
  static $instances = '';
  if (!$instances) {
    $classes = $this->app
      ->controls();
    foreach ($classes as $c) {
      if ($class == '' || $class == $c['class']) {
        if ($c['file']) {
          include_once $c['file'];
          if (class_exists($c['class'])) {
            $instances[$c['class']] = new $c['class']();
          }
        }
      }
    }
  }
  if ($class) {
    return @$instances[$class];
  }
  return $instances;
}