class FrxInclude in Forena Reports 7.5
Hierarchy
- class \Drupal\forena\Renderer\RendererBase
- class \Drupal\forena\Renderer\FrxInclude
Expanded class hierarchy of FrxInclude
1 string reference to 'FrxInclude'
- FrxInclude::generate in src/
Renderer/ FrxInclude.php - Implement template generator.
File
- src/
Renderer/ FrxInclude.php, line 10 - FrxInclude Include a reference to another report as an asset. @author davidmetzler
Namespace
Drupal\forena\RendererView source
class FrxInclude extends RendererBase {
public function render() {
// Get data from source
$attributes = $this
->mergedAttributes();
$output = '';
// Determine data type
$include = @$attributes['src'];
// Reformat URL
@(list($url, $query_str) = @explode('?', $include));
$url = $this->frxReport
->replace($url, TRUE);
$report_url = $url;
$parts = @explode('/', $url);
$file = @$parts[count($parts) - 1];
$parts = explode('.', $file);
// Determine file extention
$ext = count($parts) > 1 ? $parts[count($parts) - 1] : '';
$query = array();
if ($query_str) {
parse_str($query_str, $query);
foreach ($query as $key => $value) {
$query[$key] = $this->frxReport
->replace($value, TRUE);
}
}
// Build URL
$options = array(
'query' => $query,
);
$url = url($url, $options);
if ($this->format == 'web') {
$output = $this
->render_reference($url, $ext, $attributes);
}
else {
$output = forena_report_include(str_replace('reports/', '', $report_url), $query);
}
return $output;
}
function render_reference($url, $ext, $attributes) {
$ext = strtolower($ext);
$attributes = $this->frxReport
->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();
}
/**
* Implement template generator.
* @see FrxRenderer::generate()
*/
public function generate($xml, &$config) {
$src = $this
->extract('src', $key);
$div = $this
->blockDiv($config);
$frx = array(
'src' => $src,
'renderer' => 'FrxInclude',
);
$this
->addNode($div, 4, 'div', NULL, $config, $frx);
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
FrxInclude:: |
public | function |
Implement template generator. Overrides RendererBase:: |
|
FrxInclude:: |
public | function |
Default Render action, which simply does normal forena rendering.
You can use renderDomNode at any time to generate the default forena
rendering methods. Overrides RendererBase:: |
|
FrxInclude:: |
function | |||
RendererBase:: |
public | property | ||
RendererBase:: |
public | property | ||
RendererBase:: |
public | property | ||
RendererBase:: |
public | property | ||
RendererBase:: |
public | property | ||
RendererBase:: |
public | property | ||
RendererBase:: |
public | property | ||
RendererBase:: |
public | property | ||
RendererBase:: |
public | property | ||
RendererBase:: |
public | property | ||
RendererBase:: |
public | property | ||
RendererBase:: |
public | property | ||
RendererBase:: |
public | property | ||
RendererBase:: |
public | property | ||
RendererBase:: |
public | property | ||
RendererBase:: |
public | property | ||
RendererBase:: |
public | property | ||
RendererBase:: |
public static | function | Helper function for convergint methods to a standard associated array. | |
RendererBase:: |
function | Append a textual XHTML fragment to the dom. We do not use the DOMDocumentFragment optioin because they don't properly import namespaces. . | ||
RendererBase:: |
function | Add a node to the existing dom element with attributes | ||
RendererBase:: |
function | Add a text node to the current dom node. | ||
RendererBase:: |
public | function | Puts attributes back in array format prior to rendering. | |
RendererBase:: |
public | function | Generate generic div tag. | |
RendererBase:: |
public | function | Extract a list of columns from the data context. | |
RendererBase:: |
public | function | Generate ajax configuration attributes for use in template configurtion forms. | |
RendererBase:: |
public | function | Returns the section Enter description here ... | 7 |
RendererBase:: |
public | function | Default configuration validator. Simply validates header and footer attributes. | 7 |
RendererBase:: |
public | function | Render a drupal form in a forena template | |
RendererBase:: |
public | function | Extract a configuration var removing it from the array | |
RendererBase:: |
public | function | Get the textual representations of html for the configuration engine. | |
RendererBase:: |
public | function | Get the textual representations of html for the configuration engine. | |
RendererBase:: |
public | function | Get the textual representations of html for the configuration engine. | |
RendererBase:: |
public | function | Extracts the inner html of all nodes that match a particular xpath expression. | |
RendererBase:: |
public | function | Extracts the inner html of all nodes that match a particular xpath expression. | |
RendererBase:: |
public | function | Simple function to get id from node. | |
RendererBase:: |
public | function | This function is called to give the renderer the current conetxt in report rendering. It makes sure the renderer has the current DOM nodes dom documnent, and other attributes. | |
RendererBase:: |
public | function | Return the inside xml of the current node | |
RendererBase:: |
public | function | Standard php array containing merged attributes Enter description here ... | |
RendererBase:: |
public | function | Rmove all the children of a dom node in the current report. | |
RendererBase:: |
public | function | Removes all chidren from the dome node expect those with a tagname specified by the the $tags argurment | |
RendererBase:: |
public | function | ||
RendererBase:: |
public | function | Recursive report renderer Walks the nodes rendering the report. | |
RendererBase:: |
public | function | Gives the token replaced attributes of a node. | |
RendererBase:: |
public | function | A helper function to allow replacement of tokens from inside a renderer wihout needing to understand the object | |
RendererBase:: |
public | function | Starting at the current report node, this function removes all child nodes. It aso removes any FRX attributes on the current as well. | |
RendererBase:: |
public | function | Default method for extracting configuration information from the template. This just scrapes teh current child html as the template. | 7 |
RendererBase:: |
public | function | Set FRX attributes. | |
RendererBase:: |
public | function | Sets the first child element to a node and returns it. IF the node | |
RendererBase:: |
public | function | Helper funciton for validating text_format type controls. | |
RendererBase:: |
public | function | Sort a column list by weight. | |
RendererBase:: |
public static | function | ||
RendererBase:: |
public | function | Convert XML to key value pairs. This is used in support of graping to get specific key/value pairs in an array format suitable for passing off to php libraries. | |
RendererBase:: |
public | function | 2 |