Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F12241570
HTMLOutput.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
2 KB
Referenced Files
None
Subscribers
None
HTMLOutput.php
View Options
<?php
namespace
Keruald\Reporting\Output
;
class
HTMLOutput
extends
Output
{
private
function
makeId
(
$name
)
:
string
{
return
urlencode
(
strtolower
(
str_replace
(
' '
,
'-'
,
$name
)));
}
private
static
function
encode
(
string
$text
)
:
string
{
return
htmlspecialchars
(
$text
);
}
public
function
render
()
:
string
{
$send
=
[];
if
(
$this
->
report
->
sections
||
$this
->
report
->
properties
||
$this
->
report
->
title
)
{
$title
=
$this
->
report
->
title
;
$send
[]
=
'<h1 id="'
.
$this
->
makeId
(
$title
)
.
'">'
.
self
::
encode
(
$title
)
.
'</h1>'
;
if
(
$this
->
report
->
sections
)
{
foreach
(
$this
->
report
->
sections
as
$section
)
{
$title
=
$section
->
title
;
$send
[]
=
'<h2 id="'
.
$this
->
makeId
(
$title
)
.
'">'
.
self
::
encode
(
$title
)
.
'</h2>'
;
foreach
(
$section
->
entries
as
$entry
)
{
$title
=
$entry
->
title
;
$send
[]
=
'<h3 id="'
.
$this
->
makeId
(
$title
)
.
'">'
.
self
::
encode
(
$title
)
.
'</h3>'
;
$text
=
explode
(
"
\n\n
"
,
$entry
->
text
);
foreach
(
$text
as
$value
)
{
$send
[]
=
'<p>'
.
self
::
encode
(
$value
)
.
'</p>'
;
}
}
}
if
(
$this
->
report
->
properties
&&
$this
->
report
->
sections
)
{
$send
[]
=
'<hr>'
;
}
}
if
(
$this
->
report
->
properties
)
{
$send
[]
=
'<h2 id="report-properties">Report properties</h2>'
;
$send
[]
=
'<table>'
;
$send
[]
=
str_repeat
(
" "
,
4
)
.
'<tbody>'
;
$properties
=
$this
->
report
->
properties
;
foreach
(
$properties
as
$key
=>
$value
)
{
$send
[]
=
str_repeat
(
" "
,
4
)
.
'<tr>'
;
$send
[]
=
str_repeat
(
" "
,
8
)
.
'<th>'
.
self
::
encode
(
$key
)
.
'</th>'
;
$send
[]
=
str_repeat
(
" "
,
8
)
.
'<td>'
.
self
::
encode
(
$value
)
.
'</td>'
;
$send
[]
=
str_repeat
(
" "
,
4
)
.
'</tr>'
;
}
$send
[]
=
str_repeat
(
" "
,
4
)
.
'</tbody>'
;
$send
[]
=
'</table>'
;
}
}
$send
[]
=
''
;
return
implode
(
"
\n
"
,
$send
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Sun, Oct 12, 05:23 (23 h, 26 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
3063846
Default Alt Text
HTMLOutput.php (2 KB)
Attached To
Mode
rKREPORT Keruald Report
Attached
Detach File
Event Timeline
Log In to Comment