-
Notifications
You must be signed in to change notification settings - Fork 315
/
Copy pathreport_result.php
executable file
·70 lines (65 loc) · 2.17 KB
/
report_result.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
<script>
$( function () {
$('#raw').on('hidden', function () {
el = document.getElementById('raw-btn');
el.innerHTML = '<i class="icon-plus"></i> Show Raw SQL'
});
$('#raw').on('show', function () {
el = document.getElementById('raw-btn');
el.innerHTML = '<i class="icon-minus"></i> Hide Raw SQL'
});
});
</script>
<div class="row">
<div class="span12">
<a href="javascript:void(0);" class="btn" data-toggle="collapse" data-target="#raw" id="raw-btn"><i class="icon-plus"></i> Show Raw SQL</a>
<!--
<a href="javascript:void(0);" class="btn"><i class="icon-list-alt"></i> Show Table</a>
<a href="javascript:void(0);" class="btn"><i class="icon-picture"></i> Show Graph</a>
-->
<a href="<?php echo $permalink ?>" class="btn"><i class="icon-magnet"></i> Permalink</a>
<a href="<?php echo $jsonlink ?>" class="btn"><i class="icon-cog"></i> JSON</a>
<div class="collapse out" id="raw">
<pre class="prettyprint lang-sql"><?php echo $sql ?></pre>
</div>
</div>
</div>
</div>
</div>
<div style="margin: 20px">
Showing <b><?php echo count($result); ?></b> results
<table class="table table-striped table-bordered table-condensed">
<thead>
<tr>
<?php foreach ($columns as $c ) { ?>
<th><?php echo $c ?></th>
<?php } ?>
</tr>
</thead>
<?php foreach ($result as $row) { ?>
<?php
$row_class = array();
if (isset($callbacks)) {
foreach ($callbacks as $fxname => $fx) {
if (array_key_exists($fxname, $row)) {
$result = $fx($row[$fxname]);
$row[$fxname] = $result[0];
$row_class[] = $result[1];
}
}
}
?>
<tr class="<?php echo join(" ", $row_class); ?>">
<?php foreach ($columns as $c ) { ?>
<?php if ($c == 'checksum') { ?>
<td><a href="<?php echo site_url()."?action=show_query&datasource={$datasource}&checksum=".$row[$c]; ?>"><?php echo $row[$c]; ?></a></td>
<?php } else if ($c == 'DIGEST') { ?>
<td><a href="<?php echo site_url()."?action=show_query&datasource={$datasource}&checksum=".$row[$c]; ?>"><?php echo $row[$c]; ?></a></td>
<?php } else { ?>
<td><?php echo $row[$c]; ?></td>
<?php } ?>
<?php } ?>
</tr>
<?php } ?>
</table>
</div>