Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
project
forena
Commits
a0bc3d1a
Commit
a0bc3d1a
authored
May 27, 2014
by
David Metzler
Browse files
Write xml file as you go.
parent
4487de1f
Changes
7
Hide whitespace changes
Inline
Side-by-side
FrxDocument.inc
View file @
a0bc3d1a
...
...
@@ -9,6 +9,7 @@ class FrxDocument {
public
$format
;
public
$content_type
=
''
;
public
$charset
=
'UTF-8'
;
public
$allowDirectOutput
=
FALSE
;
public
function
loadCSSFiles
(
$format
)
{
...
...
FrxEditor.inc
View file @
a0bc3d1a
...
...
@@ -883,7 +883,7 @@ class FrxEditor {
*
* @return unknown
*/
function
report
(
$parms
=
array
(),
$print
=
FALSE
,
$no_cache
=
FALSE
)
{
function
report
(
$parms
=
array
(),
$print
=
FALSE
,
$no_cache
=
FALSE
,
$filename
=
''
)
{
global
$user
;
global
$language
;
$this
->
field_ids
=
array
();
...
...
@@ -910,6 +910,12 @@ class FrxEditor {
$cached_data
=
FALSE
;
$cache
=
array
();
$o
=
Frx
::
Document
(
$format
);
$this
->
frxReport
->
allowDirectWrite
=
$o
->
allowDirectOutput
;
if
(
$this
->
frxReport
->
allowDirectWrite
&&
$filename
)
{
$this
->
frxReport
->
file
=
fopen
(
$filename
,
'w'
);
}
/**
* Allow modules to alter the parameters of a report.
* @param unknown_type $report_name
...
...
@@ -967,9 +973,19 @@ class FrxEditor {
'links'
=>
$this
->
documentLinks
(),
'content'
=>
array
(
'#markup'
=>
$r
->
html
.
$links
),
);
$o
=
Frx
::
Document
(
$format
);
if
(
$this
->
frxReport
->
file
)
{
$this
->
frxReport
->
writeBuffer
();
fclose
(
$this
->
frxReport
->
file
);
return
''
;
}
if
(
$o
)
{
$output
=
$o
->
render
(
$r
,
$format
,
$content
);
if
(
$filename
)
{
file_put_contents
(
$filename
,
$output
);
return
''
;
}
if
(
$print
)
{
$printed
=
$o
->
output
(
$output
);
}
...
...
FrxReport.inc
View file @
a0bc3d1a
...
...
@@ -39,6 +39,8 @@ class FrxReport {
public
$link_mode
=
''
;
public
$xpathQuery
;
public
$frx_attributes
=
array
();
// Saved attributes from prior call.
public
$file
;
// File handle for the forena code
public
$allowDirectWrite
=
FALSE
;
//Determine whether we can output directly.
public
$preview_mode
=
FALSE
;
// This will make the report renderer put in editing controls when TRUE
...
...
@@ -706,6 +708,15 @@ class FrxReport {
return
$rows
;
}
public
function
writeBuffer
()
{
if
(
$this
->
allowDirectWrite
)
{
if
(
$this
->
file
)
{
fwrite
(
$this
->
file
,
$this
->
html
);
$this
->
html
=
''
;
}
}
}
}
docformats/FrxXMLDoc.inc
View file @
a0bc3d1a
...
...
@@ -10,6 +10,7 @@ class FrxXMLDoc extends FrxDocument {
public
$root_attributes
=
array
();
public
function
__construct
()
{
$this
->
allowDirectOutput
=
TRUE
;
$this
->
content_type
=
'application/xml'
;
$skin
=
Frx
::
Data
()
->
getContext
(
'skin'
);
if
(
isset
(
$skin
[
'FrxXMLDoc'
][
'rootElementName'
]))
{
...
...
forena.drush.inc
View file @
a0bc3d1a
...
...
@@ -53,7 +53,7 @@ function drush_forena_report($report_uri, $filename='') {
}
if
(
$filename
)
{
drupal_set_message
(
t
(
'Writing report %s to %f.'
,
array
(
'%s'
=>
$report_name
,
'%f'
=>
$filename
)));
file_put_contents
(
$filename
,
forena_report
(
$report_name
,
$parms
,
FALSE
)
);
forena_report
(
$report_name
,
$parms
,
FALSE
,
$filename
);
}
else
{
drupal_set_message
(
t
(
'Generating report %s.'
,
array
(
'%s'
=>
$report_name
)));
...
...
forena.module
View file @
a0bc3d1a
...
...
@@ -898,7 +898,7 @@ function forena_include_data_tables() {
*
* @return unknown
*/
function
forena_report
(
$name_in
,
$parms
=
NULL
,
$print
=
TRUE
)
{
function
forena_report
(
$name_in
,
$parms
=
NULL
,
$print
=
TRUE
,
$filename
=
''
)
{
require_once
(
'forena.common.inc'
);
$desc
=
Frx
::
Menu
()
->
parseURL
(
$name_in
);
$time
=
@
new
DateTime
(
$value
);
...
...
@@ -918,7 +918,7 @@ function forena_report($name_in, $parms = NULL, $print = TRUE) {
$report_name
=
$desc
[
'name'
];
// Load dataTable plugin if possible.
//forena_include_data_tables();
$content
=
Frx
::
Editor
(
$name_in
,
FALSE
)
->
report
(
$parms
,
$print
,
FALSE
);
$content
=
Frx
::
Editor
(
$name_in
,
FALSE
)
->
report
(
$parms
,
$print
,
FALSE
,
$filename
);
$m_path
=
drupal_get_path
(
'module'
,
'forena'
);
if
(
$content
)
{
...
...
renderers/FrxRenderer.inc
View file @
a0bc3d1a
...
...
@@ -68,6 +68,8 @@ class FrxRenderer {
* Walks the nodes rendering the report.
*/
public
function
renderDomNode
(
DOMNode
$dom_node
,
&
$o
)
{
// Write out buffer if we've gotten too big
if
(
$this
->
frxReport
->
allowDirectWrite
&&
strlen
(
$this
->
frxReport
->
html
)
>
100000
)
$this
->
frxReport
->
writeBuffer
();
$continue
=
TRUE
;
$is_data_block
=
FALSE
;
//$o = '';
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment