class XMLDocument in Forena Reports 7.5
Hierarchy
- class \Drupal\forena\DocumentFormats\DocumentTypeBase
- class \Drupal\forena\DocumentFormats\XMLDocument
Expanded class hierarchy of XMLDocument
File
- src/
DocumentFormats/ XMLDocument.php, line 9 - HtmlDocument Straight XML document with no wrapping theme. @author davidmetzler
Namespace
Drupal\forena\DocumentFormatsView source
class XMLDocument extends DocumentTypeBase {
public $root_tag = 'div';
public $root_attributes = array();
public function __construct() {
$this->allowDirectOutput = TRUE;
$this->content_type = 'application/xml';
$skin = \Frx::Data()
->getContext('skin');
if (isset($skin['XMLDocument']['rootElementName'])) {
$this->root_tag = $skin['XMLDocument']['rootElementName'];
if ($this->root_tag == 'none') {
$this->root_tag = '';
}
}
if (isset($skin['XMLDocument']['rootElementAttributes'])) {
if (is_array($skin['XMLDocument']['rootElementAttributes'])) {
$this->root_attributes = $skin['XMLDocument']['rootElementAttributes'];
}
}
}
public function header($r, $print = TRUE) {
if ($print) {
header('Content-Type: ' . $this->content_type);
header('Cache-Control:');
header('Pragma:');
header('Cache-Control: must-revalidate');
}
$r->html = '<?xml version="1.0"?>' . "\n";
$opening_tag = $this
->_build_opening_root_tag_contents();
if ($this->root_tag) {
$r->html .= "<{$opening_tag}>";
}
}
public function render($r, $format, $options = array()) {
$ending_tag = $this->root_tag;
if ($ending_tag) {
$r->html .= "</{$ending_tag}>";
}
return $r->html;
}
private function _build_opening_root_tag_contents() {
$tag_contents = $this->root_tag;
if (isset($this->root_attributes) && is_array($this->root_attributes)) {
foreach ($this->root_attributes as $attr_key => $attr_val) {
if (!empty($attr_key) && (string) $attr_val !== '') {
$attr_val = addslashes($attr_val);
$tag_contents .= " " . $attr_key . "=" . "'{$attr_val}'";
}
}
}
return $tag_contents;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
DocumentTypeBase:: |
public | property | ||
DocumentTypeBase:: |
public | property | ||
DocumentTypeBase:: |
public | property | ||
DocumentTypeBase:: |
public | property | ||
DocumentTypeBase:: |
public | property | ||
DocumentTypeBase:: |
public | function | Wrapper function for check output to default the right type. | |
DocumentTypeBase:: |
public | function | ||
DocumentTypeBase:: |
public | function | ||
DocumentTypeBase:: |
public | function | 7 | |
XMLDocument:: |
public | property | ||
XMLDocument:: |
public | property | ||
XMLDocument:: |
public | function |
Overrides DocumentTypeBase:: |
|
XMLDocument:: |
public | function |
Overrides DocumentTypeBase:: |
|
XMLDocument:: |
private | function | ||
XMLDocument:: |
public | function |