You are here

function FrxInclude::render_reference in Forena Reports 7.4

Same name and namespace in other branches
  1. 6.2 plugins/FrxInclude.inc \FrxInclude::render_reference()
  2. 7.2 plugins/FrxInclude.inc \FrxInclude::render_reference()
  3. 7.3 renderers/FrxInclude.inc \FrxInclude::render_reference()
1 call to FrxInclude::render_reference()
FrxInclude::render in renderers/FrxInclude.inc
Default Render action, which simply does normal forena rendering. You can use renderDomNode at any time to generate the default forena rendering methods.

File

renderers/FrxInclude.inc, line 75
FrxInclude Include a reference to another report as an asset. @author davidmetzler

Class

FrxInclude
@file FrxInclude Include a reference to another report as an asset. @author davidmetzler

Code

function render_reference($url, $ext, $attributes, $title) {
  $ext = strtolower($ext);
  if (!$title) {
    $title = "{$ext} document";
  }
  $attributes = $this->teng
    ->replace($attributes);
  switch ($ext) {
    case 'png':
    case 'gif':
    case 'jpg':
    case 'jpeg':
      $x = new SimpleXMLElement('<img/>');
      $x['src'] = $url;
      if (isset($attributes['height'])) {
        $x['height'] = $attributes['height'];
      }
      if (isset($attributes['width'])) {
        $x['width'] = $attributes['width'];
      }
      break;
    case 'svg':
      $x = new SimpleXMLElement('<embed/>');
      $x['src'] = $url;
      $x['type'] = 'image/svg+xml';
      $x['pluginspage'] = "http://www.adobe.com/svg/viewer/install/";
      if (isset($attributes['height'])) {
        $x['height'] = $attributes['height'];
      }
      if (isset($attributes['width'])) {
        $x['width'] = $attributes['width'];
      }
      break;
    default:
      $x = new SimpleXMLElement('<a>' . htmlentities($title, ENT_QUOTES, 'UTF-8') . '</a>');
      $x['href'] = $url;
  }
  if (isset($attributes['id'])) {
    $x['id'] = $attributes['id'];
  }
  if (isset($attributes['class'])) {
    $x['class'] = $attributes['class'];
  }
  return $x
    ->asXML();
}