Issues (1686)

themes/default/Reports.template.php (2 issues)

Labels
Severity
1
<?php
2
3
/**
4
 * @package   ElkArte Forum
5
 * @copyright ElkArte Forum contributors
6
 * @license   BSD http://opensource.org/licenses/BSD-3-Clause (see accompanying LICENSE.txt file)
7
 *
8
 * This file contains code covered by:
9
 * copyright: 2011 Simple Machines (http://www.simplemachines.org)
10
 *
11
 * @version 2.0 dev
12
 *
13
 */
14
15
/**
16
 * Interface to allow to choose which type of report to run.
17
 */
18
function template_report_type()
19
{
20
	global $context, $scripturl, $txt;
21
22
	echo '
23
	<div id="admincenter">
24
		<form class="admin_form_wrapper" action="', $scripturl, '?action=admin;area=reports" method="post" accept-charset="UTF-8">
25
			<h2 class="category_header">', $txt['generate_reports_type'], '</h2>
26
			<div class="content">
27
				<dl class="settings">';
28
29
	// Go through each type of report they can run.
30
	foreach ($context['report_types'] as $type)
31
	{
32
		echo '
33
					<dt>
34
						<input type="radio" id="rt_', $type['id'], '" name="rt" value="', $type['id'], '"', $type['is_first'] ? ' checked="checked"' : '', ' />
35
						<label for="rt_', $type['id'], '">', $type['title'], '</label>
36
					</dt>';
37
38
		if (isset($type['description']))
39
		{
40
			echo '
41
					<dd>', $type['description'], '</dd>';
42
		}
43
	}
44
45
	echo '
46
				</dl>
47
				<div class="submitbutton">
48
					<input type="submit" name="continue" value="', $txt['generate_reports_continue'], '" />
49
					<input type="hidden" name="', $context['session_var'], '" value="', $context['session_id'], '" />
50
				</div>
51
			</div>
52
		</form>
53
	</div>';
54
}
55
56
/**
57
 * This is the standard template for showing reports in.
58
 */
59
function template_generate_report()
60
{
61
	global $context, $txt;
62
63
	echo '
64
	<div id="admincenter">
65
		<h2 class="category_header">', $txt['results'], '</h2>
66
		<div id="report_buttons">';
67
68
	if (!empty($context['report_buttons']))
69
	{
70
		template_button_strip($context['report_buttons']);
71
	}
72
73
	echo '
74
		</div>
75
		<div class="generic_list_wrapper">';
76
77
	// Go through each table!
78
	foreach ($context['tables'] as $table)
79
	{
80
		echo '
81
		<table class="table_grid report_results">';
82
83
		if (!empty($table['title']))
84
		{
85
			echo '
86
			<thead>
87
				<tr class="table_head">
88
					<th scope="col" colspan="', $table['column_count'], '">', $table['title'], '</th>
89
				</tr>
90
			</thead>
91
			<tbody>';
92
		}
93
94
		// Now do each row!
95
		$row_number = 0;
96
		foreach ($table['data'] as $row)
97
		{
98
			if ($row_number == 0 && !empty($table['shading']['top']))
99
			{
100
				echo '
101
				<tr class="table_caption">';
102
			}
103
			else
104
			{
105
				echo '
106
				<tr class="', empty($row[0]['separator']) ? '' : 'category_header', '">';
107
			}
108
109
			// Now do each column.
110
			$column_number = 0;
111
112
			foreach ($row as $data)
113
			{
114
				// If this is a special separator, skip over!
115
				if (!empty($data['separator']) && $column_number == 0)
116
				{
117
					echo '
118
					<td colspan="', $table['column_count'], '">
119
						', $data['v'], ':
120
					</td>';
121
					break;
122
				}
123
124
				// Shaded?
125
				if ($column_number == 0 && !empty($table['shading']['left']))
126
				{
127
					echo '
128
					<td class="table_caption ', $table['align']['shaded'], 'text" style="', $table['width']['shaded'] !== 'auto' ? 'width:' . $table['width']['shaded'] . 'px;"' : '"', '>
129
						', $data['v'] == $table['default_value'] ? '' : ($data['v'] . (empty($data['v']) ? '' : ':')), '
130
					</td>';
131
				}
132
				else
133
				{
134
					echo '
135
					<td class="', $table['align']['normal'], 'text" style="', $table['width']['normal'] !== 'auto' ? 'width:' . $table['width']['normal'] . 'px' : '', empty($data['style']) ? '"' : ';' . $data['style'] . '"', '>
136
						', $data['v'], '
137
					</td>';
138
				}
139
140
				$column_number++;
141
			}
142
143
			echo '
144
				</tr>';
145
146
			$row_number++;
147
		}
148
149
		echo '
150
			</tbody>
151
		</table>
152
		<br />';
153
	}
154
155
	echo '
156
		</div>
157
	</div>';
158
}
159
160
/**
161
 * Header of the print page.
162
 */
163
function template_print_above()
164
{
165
	global $context, $settings;
166
167
	echo '<!DOCTYPE html>
168
<html ', $context['right_to_left'] ? 'dir="rtl"' : '', '>
169
	<head>
170
		<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
171
		<title>', $context['page_title'], '</title>
172
		<link rel="stylesheet" href="', $settings['default_theme_url'], '/css/report.css" />
173
	</head>
174
	<body>';
175
}
176
177
/**
178
 * Print a report.
179
 */
180
function template_print()
181
{
182
	global $context;
183
184
	// Go through each table!
185
	foreach ($context['tables'] as $table)
186
	{
187
		echo '
188
		<div style="overflow: visible;', $table['max_width'] !== 'auto' ? ' width:' . $table['max_width'] . 'px;' : '', '">
189
			<table class="table_grid">';
190
191
		if (!empty($table['title']))
192
		{
193
			echo '
194
				<tr class="table_head">
195
					<td colspan="', $table['column_count'], '">
196
						', $table['title'], '
197
					</td>
198
				</tr>';
199
		}
200
201
		// Now do each row!
202
		$row_number = 0;
203
		foreach ($table['data'] as $row)
204
		{
205
			if ($row_number === 0 && !empty($table['shading']['top']))
206
			{
207
				echo '
208
				<tr class="secondary_header">';
209
			}
210
			else
211
			{
212
				echo '
213
				<tr>';
214
			}
215
216
			// Now do each column!!
217
			$column_number = 0;
218
			foreach ($row as $data)
219
			{
220
				// If this is a special separator, skip over!
221
				if (!empty($data['separator']) && $column_number == 0)
222
				{
223
					echo '
224
					<td class="category_header" colspan="', $table['column_count'], '">
225
						<strong>', $data['v'], ':</strong>
226
					</td>';
227
					break;
228
				}
229
230
				// Shaded?
231
				if ($column_number === 0 && !empty($table['shading']['left']))
232
				{
233
					echo '
234
					<td class="secondary_header ', $table['align']['shaded'], 'text" style="', $table['width']['shaded'] !== 'auto' ? 'width:' . $table['width']['shaded'] . 'px"' : '"', '>
235
						', $data['v'] === $table['default_value'] ? '' : ($data['v'] . (empty($data['v']) ? '' : ':')), '
236
					</td>';
237
				}
238
				else
239
				{
240
					echo '
241
					<td class="', $table['align']['normal'], 'text" style="', $table['width']['normal'] !== 'auto' ? 'width:' . $table['width']['normal'] . 'px' : '', empty($data['style']) ? '"' : ';' . $data['style'] . '"', '>
242
						', $data['v'], '
243
					</td>';
244
				}
245
246
				$column_number++;
247
			}
248
249
			echo '
250
				</tr>';
251
252
			$row_number++;
253
		}
254
255
		echo '
256
			</table>
257
		</div>';
258
	}
259
}
260
261
/**
262
 * Footer of the print page.
263
 */
264
function template_print_below()
265
{
266
	echo '
267
		<div class="copyright">', theme_copyright(), '</div>
0 ignored issues
show
Are you sure the usage of theme_copyright() is correct as it seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
Are you sure theme_copyright() of type void can be used in echo? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-type  annotation

267
		<div class="copyright">', /** @scrutinizer ignore-type */ theme_copyright(), '</div>
Loading history...
268
	</body>
269
</html>';
270
}
271