You are here

public function FrxRenderer::setAttributes in Forena Reports 7.4

Set FRX attributes.

Parameters

DOMNode $node:

unknown $attributes:

unknown $frxattributes:

3 calls to FrxRenderer::setAttributes()
FrxRenderer::addNode in renderers/FrxRenderer.inc
Add a node to the existing dom element with attributes
FrxRenderer::blockDiv in renderers/FrxRenderer.inc
Generate generic div tag.
FrxRenderer::setFirstNode in renderers/FrxRenderer.inc
Sets the first child element to a node and returns it. IF the node

File

renderers/FrxRenderer.inc, line 415
FrxRenderer.inc Base class for Frx custom renderers @author davidmetzler

Class

FrxRenderer
@file FrxRenderer.inc Base class for Frx custom renderers @author davidmetzler

Code

public function setAttributes(DOMElement $node, $attributes, $frx_attributes) {
  if ($attributes) {
    foreach ($attributes as $key => $value) {
      $node
        ->setAttribute($key, $value);
    }
  }

  // Iterate the value
  if ($frx_attributes) {
    foreach ($frx_attributes as $key => $value) {

      // If the value is an array create multiple attributes
      // that are of the form key_1, key_2 .... etc.
      if (is_array($value)) {
        $i = 0;
        $done = FALSE;
        while (!$done) {
          $v = '';
          if ($value) {
            $v = array_shift($value);
          }
          $i++;
          $k = $key . '_' . trim((string) $i);
          $node
            ->setAttribute($k, $v);
          if (!$v) {
            $done = TRUE;
          }
        }
      }
      else {
        if ($value) {
          $node
            ->setAttributeNS($this->xmlns, $key, $value);
        }
      }
    }
  }
}