Web: Online demo report use now a table for the results
This commit is contained in:
parent
ca9acc7ede
commit
a2b0f77310
|
@ -69,10 +69,11 @@
|
||||||
$parsed = array();
|
$parsed = array();
|
||||||
$xml = simplexml_load_string($output);
|
$xml = simplexml_load_string($output);
|
||||||
foreach ($xml->errors->error as $error) { //for all errors...
|
foreach ($xml->errors->error as $error) { //for all errors...
|
||||||
|
$severity = (string)$error->attributes()->severity;
|
||||||
$msg = (string)$error->attributes()->msg;
|
$msg = (string)$error->attributes()->msg;
|
||||||
$line = (string)$error->location->attributes()->line;
|
$line = (string)$error->location->attributes()->line;
|
||||||
if (!empty($msg) && !empty($line)) { //if complete error...
|
if (!empty($severity) && !empty($msg) && !empty($line)) { //if complete error...
|
||||||
$parsed[$line][] = $msg;
|
$parsed[] = array('severity' => $severity, 'msg' => $msg, 'line' => $line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return $parsed;
|
return $parsed;
|
||||||
|
@ -106,16 +107,23 @@
|
||||||
echo "<h3>Output</h3>\n";
|
echo "<h3>Output</h3>\n";
|
||||||
|
|
||||||
$output = get_democlient_output($code);
|
$output = get_democlient_output($code);
|
||||||
$report = parse_democlient_output($output);
|
$results = parse_democlient_output($output);
|
||||||
|
|
||||||
echo "<dl>\n";
|
if (!empty($results)) {
|
||||||
foreach ($report as $lineNumber => $results) { //for each line results...
|
echo "<table class=\"results\">\n";
|
||||||
echo " <dt>Line $lineNumber:</dt>\n";
|
echo "<thead>\n";
|
||||||
foreach ($results as $result) { //for each results...
|
echo " <tr><th class=\"center\">Line</th><th class=\"center\">Severity</th><th>Message</th></tr>\n";
|
||||||
echo " <dd>" . htmlspecialchars($result) . "</dd>\n";
|
echo "</thead>\n";
|
||||||
|
echo "<tbody>\n";
|
||||||
|
foreach ($results as $result) { //for each result...
|
||||||
|
echo " <tr><td class=\"center\">" . htmlspecialchars($result['line']) . "</td><td class=\"center\">" . htmlspecialchars($result['severity']) . "</td><td>" . htmlspecialchars($result['msg']) . "</td></tr>\n";
|
||||||
}
|
}
|
||||||
|
echo "</tbody>\n";
|
||||||
|
echo "</table>\n";
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
echo "<p>No errors found.</p>\n";
|
||||||
}
|
}
|
||||||
echo "</dl>\n";
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
echo "<p>Use the <a href=\"/demo/\">online demo</a> page to create the report.</p>\n";
|
echo "<p>Use the <a href=\"/demo/\">online demo</a> page to create the report.</p>\n";
|
||||||
|
|
|
@ -136,8 +136,29 @@ pre.code em {
|
||||||
border: 1px solid #e2e2e2;
|
border: 1px solid #e2e2e2;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/* Results table */
|
||||||
|
table.results {
|
||||||
|
border-collapse: collapse;
|
||||||
|
}
|
||||||
|
table.results th {
|
||||||
|
padding: .25em;
|
||||||
|
text-align: left;
|
||||||
|
background: #e2e2e2;
|
||||||
|
border: 1px solid #e2e2e2;
|
||||||
|
}
|
||||||
|
table.results td {
|
||||||
|
padding: .25em;
|
||||||
|
background: #f7f7f7;
|
||||||
|
border: 1px solid #e2e2e2;
|
||||||
|
}
|
||||||
|
table.results .center {
|
||||||
|
text-align: center;
|
||||||
|
}
|
||||||
|
|
||||||
/* Printing */
|
/* Printing */
|
||||||
@media print {
|
@media print {
|
||||||
#header { color: black; border-bottom: 1px solid black; }
|
#header { color: black; border-bottom: 1px solid black; }
|
||||||
#tabs { display: none; }
|
#tabs { display: none; }
|
||||||
|
table.results th { background: white; border: 1px solid black; }
|
||||||
|
table.results td { background: white; border: 1px solid black; }
|
||||||
}
|
}
|
Loading…
Reference in New Issue