You are here

public function FrxEditor::verifyHeaderElements in Forena Reports 7.3

Same name and namespace in other branches
  1. 7.4 FrxEditor.inc \FrxEditor::verifyHeaderElements()

Makes sure that the normal header elements for a report are there. Enter description here ...

11 calls to FrxEditor::verifyHeaderElements()
FrxEditor::getCategory in ./FrxEditor.inc
FrxEditor::getMenu in ./FrxEditor.inc
FrxEditor::getOptions in ./FrxEditor.inc
Retrieve options element in array form
FrxEditor::setCategory in ./FrxEditor.inc
Set the report category Enter description here ...
FrxEditor::setDocgen in ./FrxEditor.inc
Set document generation types that apply to this report. Enter description here ...

... See full list

File

./FrxEditor.inc, line 145
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 verifyHeaderElements($required_elements = array()) {
  if (!$required_elements) {
    $required_elements = array(
      'category',
      'options',
      'fields',
      'parameters',
      'docgen',
    );
  }
  $dom = $this->dom;
  $head = $dom
    ->getElementsByTagName('head')
    ->item(0);

  // Make sure the report title exists.
  if ($dom
    ->getElementsByTagName('title')->length == 0) {
    $n = $dom
      ->createElement('title');
    $head
      ->appendChild($n);
  }

  // Make sure each of these exists in the header
  foreach ($required_elements as $tag) {
    if ($dom
      ->getElementsByTagNameNS($this->xmlns, $tag)->length == 0) {
      $n = $dom
        ->createElementNS($this->xmlns, $tag);
      $head
        ->appendChild($n);
    }
  }
}