You are here

public function FrxEditor::scrapeBlockConfig in Forena Reports 7.4

Scrape Data block configuration This tries to introspect the frx:block configuration based on the child nodes in the report by calling the getConfig method on the block.

File

./FrxEditor.inc, line 755
FrxEditor.inc Wrapper XML class for working with DOM object. It provides helper Enter description here ... @author metzlerd

Class

FrxEditor
@file FrxEditor.inc Wrapper XML class for working with DOM object. It provides helper Enter description here ... @author metzlerd

Code

public function scrapeBlockConfig($id, &$config) {
  $template_class = "FrxMergeDocument";
  $path = "body//*[@id='{$id}']";
  $nodes = $this->simplexml
    ->xpath($path);
  if ($nodes) {
    $node = dom_import_simplexml($nodes[0]);
  }
  else {
    drupal_set_message(t('Could not find %s in report', array(
      '%s' => $id,
    )), 'error');
    return '';
  }
  $block_name = $node
    ->getAttributeNS($this->xmlns, 'block');
  $class = $node
    ->getAttribute("class");
  $templates = $this
    ->templateOptions();
  $config['id'] = $id;
  foreach ($templates as $tclass => $desc) {
    if (strpos($class, $tclass) !== FALSE) {
      $template_class = $tclass;
      break;
    }
  }
  if ($template_class) {
    $c = Frx::Template($template_class);
    $config['class'] = $template_class;
    if ($c && method_exists($c, 'scrapeConfig')) {
      $c
        ->initReportNode($node, $this->frxReport);
      $config = array_merge($config, $c
        ->scrapeConfig());
    }
  }
  return $template_class;
}