class FrxInclude in Forena Reports 7.2
Same name and namespace in other branches
- 6.2 plugins/FrxInclude.inc \FrxInclude
- 7.3 renderers/FrxInclude.inc \FrxInclude
- 7.4 renderers/FrxInclude.inc \FrxInclude
Hierarchy
- class \FrxRenderer
- class \FrxInclude
Expanded class hierarchy of FrxInclude
4 string references to 'FrxInclude'
- forena_forena_controls in ./
forena.module - Self register controls with forena.
- FrxHostApplication::controls in ./
FrxHostApplication.inc - * Self register controls with forena. *
- FrxRptInclude::generate in templates/
FrxRptInclude.inc - * * Enter description here ... *
- FrxTemplate::blockDiv in templates/
FrxTemplate.inc - Generate generic div tag.
File
- plugins/
FrxInclude.inc, line 2
View source
class FrxInclude extends FrxRenderer {
public function render() {
// Get data from source
$attributes = $this
->mergedAttributes();
$output = '';
// Determine data type
$include = @$attributes['src'];
$include = $this->teng
->replace($include);
@(list($url, $query_str) = @explode('?', $include));
$parts = @explode('/', $url);
$file = @$parts[count($parts) - 1];
$parts = explode('.', $file);
// Determine file extention
$ext = count($parts) > 1 ? $parts[count($parts) - 1] : '';
$query = array();
parse_str($query_str, $query);
$options = array(
'query' => $query,
);
$url = FrxReportGenerator::instance()
->url($url, $options);
$doc_types = FrxReportGenerator::instance()
->configuration('doc_formats');
if (@$doc_types[$ext]) {
$output = $this
->render_reference($url, $ext, $attributes);
}
else {
$output = $this->teng
->replace($this->reportDocNode
->asXML());
}
return $output;
}
function render_reference($url, $ext, $attributes) {
$ext = strtolower($ext);
$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>' . $ext . ' document</a>');
$x['href'] = $url;
}
if (isset($attributes['id'])) {
$x['id'] = $attributes['id'];
}
return $x
->asXML();
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
FrxInclude:: |
public | function |
Overrides FrxRenderer:: |
|
FrxInclude:: |
function | |||
FrxRenderer:: |
public | property | ||
FrxRenderer:: |
public | property | ||
FrxRenderer:: |
public | property | ||
FrxRenderer:: |
public | property | ||
FrxRenderer:: |
public | property | ||
FrxRenderer:: |
public | property | ||
FrxRenderer:: |
public | property | ||
FrxRenderer:: |
public | property | ||
FrxRenderer:: |
public | function | ||
FrxRenderer:: |
public | function | * Standard php array containing merged attributes * Enter description here ... | |
FrxRenderer:: |
public | function | ||
FrxRenderer:: |
public | function | 1 |