forked from glpunzi/nuBuilderPro
-
Notifications
You must be signed in to change notification settings - Fork 0
/
nurunprintbrowse.php
108 lines (65 loc) · 2.24 KB
/
nurunprintbrowse.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
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
<?php require_once('nucommon.php'); ?>
<?php
$jsonID = $_GET['i'];
$t = nuRunQuery("SELECT deb_message AS json FROM zzzsys_debug WHERE zzzsys_debug_id = ? ", array($jsonID));
$r = db_fetch_object($t);
$JSON = json_decode($r->json);
$style = nuBuildStyle($JSON);
$table = nuBuildTable($JSON);
$h .= "
<html>
<style>
table {border-width:1px;border-style:solid;border-color:grey}
tr {border-width:1px;border-style:solid;border-color:grey}
th {border-width:1px;border-style:solid;border-color:grey;background-color:lightgrey}
td {border-width:1px;border-style:solid;border-color:grey}
.id {border-width:0px;border-style:none;width:1px;font-size:0px}
$style
</style>
<body>
$table
</body>
</html>
";
print $h;
nuRunQuery("DROP TABLE $JSON->records");
function nuBuildStyle($J){
$h = '';
$a['l'] = 'left';
$a['r'] = 'right';
$a['c'] = 'center';
for($i = 0 ; $i < count($J->objects) ; $i++){
$A = $a[$J->objects[$i]->align];
$W = $J->objects[$i]->width . 'px';
$h .= ".s$i {text-align:$A;width:$W}\n";
}
return $h;
}
function nuBuildTable($J){
$h = '';
$h .= "<table>";
$h .= "<tr>";
$h .= "<th class='id'>ID</th>";
for($i = 0 ; $i < count($J->objects) ; $i++){
$w = $J->objects[$i]->width . 'px';
$v = $J->objects[$i]->title;
$h .= "<th class='s$i'>$v</th>";
}
$h .= "</tr>";
$T = nuRunQuery("SELECT * FROM $J->records");
while($R = db_fetch_row($T)){
$h .= "<tr>";
$h .= "<td class='id'>".$R[0]."</td>";
for($i = 0 ; $i < count($J->objects) ; $i++){
$w = $J->objects[$i]->width . 'px';
$v = $R[$i+1];
$h .= "<td class='s$i'>$v</td>";
}
$h .= "</td>";
$h .= "</tr>";
}
$h .= "</table>";
return $h;
}
nuRunQuery("DELETE FROM zzzsys_debug WHERE zzzsys_debug_id = ? ", array($jsonID));
?>