You are here

public function FrxReportEditor::verifyHeaderElements in Forena Reports 6.2

Same name and namespace in other branches
  1. 6 FrxReportEditor.inc \FrxReportEditor::verifyHeaderElements()
  2. 7 FrxReportEditor.inc \FrxReportEditor::verifyHeaderElements()
  3. 7.2 FrxReportEditor.inc \FrxReportEditor::verifyHeaderElements()

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

9 calls to FrxReportEditor::verifyHeaderElements()
FrxReportEditor::getCategory in ./FrxReportEditor.inc
FrxReportEditor::getOptions in ./FrxReportEditor.inc
Retrieve options element in array form
FrxReportEditor::setCategory in ./FrxReportEditor.inc
Set the report category Enter description here ...
FrxReportEditor::setDocgen in ./FrxReportEditor.inc
Set document generation types that apply to this report. Enter description here ...
FrxReportEditor::setFields in ./FrxReportEditor.inc
Builds the fields from an array of elements. Enter description here ...

... See full list

File

./FrxReportEditor.inc, line 144

Class

FrxReportEditor
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);
    }
  }
}