You are here

public function FrxData::contextExists in Forena Reports 7.4

Same name and namespace in other branches
  1. 6.2 FrxData.inc \FrxData::contextExists()
  2. 7.2 FrxData.inc \FrxData::contextExists()
  3. 7.3 FrxData.inc \FrxData::contextExists()

Determines whether an array context exists for the specified id. Returns true if the key exists othewise false

Parameters

string $id:

Return value

boolean

1 call to FrxData::contextExists()
FrxData::getValue in ./FrxData.inc
Get the value from the data. This is used by token_replace method to extract the data based on the path provided.

File

./FrxData.inc, line 299

Class

FrxData

Code

public function contextExists($id) {
  $exists = FALSE;
  if (array_key_exists($id, $this->data_sources)) {
    $exists = TRUE;
  }
  else {

    // Check for module provided contexts;
    $contexts = Frx::getContextPlugins();
    if (isset($contexts[$id])) {
      $plugin = $contexts[$id];
      if (isset($plugin['file'])) {
        include_once $plugin['file'];
      }
      $class = $contexts[$id]['class'];
      if (class_exists($class)) {
        $object = new $class();
        $this
          ->setContext($id, $object);
        $exists = TRUE;
      }
    }
  }
  return $exists;
}