You are here

public static function Frx::Controls in Forena Reports 7.4

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

Retreive the classes from other modules.

Parameters

string $class:

Return value

Ambigous <string, unknown>

6 calls to Frx::Controls()
Frx::getRendererPlugins in ./Frx.inc
Returns the FrxRendererInstances.
Frx::Template in ./Frx.inc
Returns an object of the template class that has a method named templates.
FrxEditor::templateOptions in ./FrxEditor.inc
Generate the list of possible templates.
FrxRenderer::renderDomNode in renderers/FrxRenderer.inc
Recursive report renderer Walks the nodes rendering the report.
FrxReportGenerator::get_formatter in ./FrxReportGenerator.inc
Load the formatters for all initialized repositories.

... See full list

File

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

Class

Frx

Code

public static function Controls($class = '', $instantiate = TRUE) {
  static $instances = '';
  static $classes = '';
  if (!$instances) {
    $instances = array();
    $classes = array();
    foreach (module_list() as $module) {
      $function = $module . '_forena_controls';
      if (function_exists($function)) {
        $returned_controls = $function();
        if ($returned_controls) {
          foreach ((array) $returned_controls as $c) {
            $c['module'] = $module;
            $c['file'] = drupal_get_path('module', $c['module']) . '/' . trim($c['file'], '/');
            if ($c['file']) {
              include_once $c['file'];
              if (class_exists($c['class']) && $instantiate) {
                $cls = $c['class'];
                $instances[$c['class']] = new $cls();
              }
              $classes[$c['class']] = $c['class'];
            }
          }
        }
      }
    }
  }

  // Return class if we asked for one.
  if ($class && $instantiate) {
    return @$instances[$class];
  }
  elseif (!$instantiate) {
    return @$classes;
  }
  return $instances;
}