-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathReports.template.php
255 lines (221 loc) · 6.32 KB
/
Reports.template.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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
<?php
/**
* @name ElkArte Forum
* @copyright ElkArte Forum contributors
* @license BSD http://opensource.org/licenses/BSD-3-Clause
*
* This software is a derived product, based on:
*
* Simple Machines Forum (SMF)
* copyright: 2011 Simple Machines (http://www.simplemachines.org)
* license: BSD, See included LICENSE.TXT for terms and conditions.
*
* @version 1.0
*
*/
/**
* Interface to allow to choose which type of report to run.
*/
function template_report_type()
{
global $context, $scripturl, $txt;
echo '
<div id="admincenter">
<form action="', $scripturl, '?action=admin;area=reports" method="post" accept-charset="UTF-8">
<div id="generate_reports_type">
<h2 class="category_header">', $txt['generate_reports_type'], '</h2>
<div class="windowbg">
<div class="content">
<dl class="generate_report">';
// Go through each type of report they can run.
foreach ($context['report_types'] as $type)
{
echo '
<dt>
<input type="radio" id="rt_', $type['id'], '" name="rt" value="', $type['id'], '"', $type['is_first'] ? ' checked="checked"' : '', ' class="input_radio" />
<strong><label for="rt_', $type['id'], '">', $type['title'], '</label></strong>
</dt>';
if (isset($type['description']))
echo '
<dd>', $type['description'], '</dd>';
}
echo '
</dl>
<input type="submit" name="continue" value="', $txt['generate_reports_continue'], '" class="right_submit" />
<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
</div>
</div>
</div>
</form>
</div>';
}
/**
* This is the standard template for showing reports in.
*/
function template_generate_report()
{
global $context, $txt;
echo '
<div id="admincenter">
<h2 class="category_header">', $txt['results'], '</h2>
<div id="report_buttons">';
if (!empty($context['report_buttons']))
template_button_strip($context['report_buttons'], 'right');
echo '
</div>
<div class="generic_list_wrapper">';
// Go through each table!
foreach ($context['tables'] as $table)
{
echo '
<table class="table_grid report_results">';
if (!empty($table['title']))
echo '
<thead>
<tr class="table_head">
<th scope="col" colspan="', $table['column_count'], '">', $table['title'], '</th>
</tr>
</thead>
<tbody>';
// Now do each row!
$row_number = 0;
$alternate = false;
foreach ($table['data'] as $row)
{
if ($row_number == 0 && !empty($table['shading']['top']))
echo '
<tr class="windowbg table_caption">';
else
echo '
<tr class="', !empty($row[0]['separator']) ? 'category_header' : ($alternate ? 'windowbg' : 'windowbg2'), '" style="vertical-align: top;">';
// Now do each column.
$column_number = 0;
foreach ($row as $key => $data)
{
// If this is a special separator, skip over!
if (!empty($data['separator']) && $column_number == 0)
{
echo '
<td colspan="', $table['column_count'], '" class="smalltext">
', $data['v'], ':
</td>';
break;
}
// Shaded?
if ($column_number == 0 && !empty($table['shading']['left']))
echo '
<td class="table_caption" style="text-align:', $table['align']['shaded'], $table['width']['shaded'] != 'auto' ? ';width:' . $table['width']['shaded'] . 'px;"' : '"', '>
', $data['v'] == $table['default_value'] ? '' : ($data['v'] . (empty($data['v']) ? '' : ':')), '
</td>';
else
echo '
<td style="text-align:', $table['align']['normal'], $table['width']['normal'] != 'auto' ? ';width:' . $table['width']['normal'] . '' : '', !empty($data['style']) ? ';' . $data['style'] . '"' : '"', '>
', $data['v'], '
</td>';
$column_number++;
}
echo '
</tr>';
$row_number++;
$alternate = !$alternate;
}
echo '
</tbody>
</table>
<br />';
}
echo '
</div>
</div>';
}
/**
* Header of the print page.
*/
function template_print_above()
{
global $context, $settings;
echo '<!DOCTYPE html>
<html ', $context['right_to_left'] ? 'dir="rtl"' : '', '>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<title>', $context['page_title'], '</title>
<link rel="stylesheet" href="', $settings['default_theme_url'], '/css/report.css" />
</head>
<body>';
}
/**
* Print a report.
*/
function template_print()
{
global $context;
// Go through each table!
foreach ($context['tables'] as $table)
{
echo '
<div style="overflow: visible;', $table['max_width'] != 'auto' ? ' width:' . $table['max_width'] . 'px;' : '', '">
<table class="table_grid">';
if (!empty($table['title']))
echo '
<tr class="table_head">
<td colspan="', $table['column_count'], '">
', $table['title'], '
</td>
</tr>';
// Now do each row!
$alternate = false;
$row_number = 0;
foreach ($table['data'] as $row)
{
if ($row_number == 0 && !empty($table['shading']['top']))
echo '
<tr class="secondary_header" style="vertical-align: top;">';
else
echo '
<tr class="', $alternate ? 'windowbg' : 'windowbg2', '" style="vertical-align: top;">';
// Now do each column!!
$column_number = 0;
foreach ($row as $key => $data)
{
// If this is a special separator, skip over!
if (!empty($data['separator']) && $column_number == 0)
{
echo '
<td colspan="', $table['column_count'], '" class="category_header">
<strong>', $data['v'], ':</strong>
</td>';
break;
}
// Shaded?
if ($column_number == 0 && !empty($table['shading']['left']))
echo '
<td class="secondary_header" style="text-align:', $table['align']['shaded'], $table['width']['shaded'] != 'auto' ? ';width:' . $table['width']['shaded'] . '"' : '"', '>
', $data['v'] == $table['default_value'] ? '' : ($data['v'] . (empty($data['v']) ? '' : ':')), '
</td>';
else
echo '
<td style="text-align:', $table['align']['normal'], $table['width']['normal'] != 'auto' ? ';width:' . $table['width']['normal'] : '', !empty($data['style']) ? ';' . $data['style'] . '"' : '"', '>
', $data['v'], '
</td>';
$column_number++;
}
echo '
</tr>';
$row_number++;
$alternate = !$alternate;
}
echo '
</table>
</div><br />';
}
}
/**
* Footer of the print page.
*/
function template_print_below()
{
echo '
<div class="copyright">', theme_copyright(), '</div>
</body>
</html>';
}