Commit 93dd394a authored by metzlerd's avatar metzlerd
Browse files

#2129595 Optional Helper classes

Root element XML specification. 
parent 11d279d9
......@@ -149,6 +149,8 @@ class FrxReport {
* Walks the nodes rendering the report.
*/
public function render_section(DOMNode $dom_node) {
$skin = Frx::Data()->getContext('skin');
$settings = isset($skin['FrxReport']) ? $skin['FrxReport'] : array();
$continue = TRUE;
$is_data_block = FALSE;
$node_type = $dom_node->nodeType;
......@@ -254,13 +256,26 @@ class FrxReport {
$i++;
$odd = $i & 1;
$row_class = $odd ? 'odd' : 'even';
unset($tmp_attrs['id']);
$tmp_attrs['class'] = trim($attrs['class'] . ' ' . $row_class);
$r_attr_text = '';
if (isset($attrs['id'])) {
if (strpos($attrs['id'],'{')!== FALSE) {
$id = $this->teng->replace($attrs['id']);
}
else {
$id = $attrs['id'] . '-' . $i;
}
$tmp_attrs['id'] = $id;
}
if (@!$settings['noHelperClasses']) {
$tmp_attrs['class'] = trim($attrs['class'] . ' ' . $row_class);
}
foreach ($tmp_attrs as $key => $value) {
$r_attr_text .= ' ' . $key . '="' . (string)$value . '"';
}
if ($include_root) $o .= $this->teng->replace('<' . $tag . $r_attr_text . '>');
foreach ($dom_node->childNodes as $child) {
$o .= $this->render_section($child);
......
......@@ -6,15 +6,21 @@
*
*/
class FrxXMLDoc extends FrxDocument {
public $root_tag = 'div';
public function __construct() {
$this->content_type = 'application/xml';
$skin = Frx::Data()->getContext('skin');
if (isset($skin['FrxXMLDoc']['rootElementName'])) {
$this->root_tag = $skin['FrxXMLDoc']['rootElementName'];
}
}
public function render($r, $format, $options = array()) {
$body = $this->check_markup($r->html);
$tag = $this->root_tag;
$output = '<?xml version="1.0"?>' . "\n";
$output .= '<div>' . $body . "</div>\n";
$output .= "<$tag>\n $body\n</$tag>";
return $output;
}
......
......@@ -25,6 +25,16 @@ stylesheets[all][] = table_padding.css
;
; FrxSVGGraph[colors][] = red
; FrxSVGGraph[colors][] = blue
;---------------------------
; Settings for Forena Classes
;
; The following settings can be used to further control how forena renders reprots
;
; Disable helper classes such as even and odd
; FrxReport[noHelperClasses] = true
;
; Control the root element taga name using teh following.
; FrxXMLDoc[rootElementName] = node
; ---------------------------------------------------------
; Arbitrary values may be added and referenced in the report as
; using the skin data context. For exmaple if you uncomment the following:
......@@ -32,3 +42,4 @@ stylesheets[all][] = table_padding.css
; company_name = My Cool Company
;
; Then you could reference {skin.company_name} anywhere in your report.
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment