Test Failed
Branch devel (807472)
by Litera
06:16
created

ExportModel::mealTicket()   B

Complexity

Conditions 1
Paths 1

Size

Total Lines 37
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 3
nc 1
nop 0
dl 0
loc 37
rs 8.8571
c 0
b 0
f 0
1
<?php
2
3
namespace App\Models;
4
5
use Nette\Database\Context;
6
7
/**
8
 * Export Model
9
 *
10
 * class for exporting materials for printing
11
 *
12
 * @created 2012-09-21
13
 * @author Tomas Litera <[email protected]>
14
 */
15
class ExportModel extends BaseModel
16
{
17
18
	/** @var int graph height */
19
	private $graphHeight;
20
21
	/** @var CategoryModel categories */
22
	private $category;
23
24
	private static $connection;
25
26
	/**
27
	 * @param Context       $database
28
	 * @param CategoryModel $category
29
	 */
30
	public function __construct(Context $database, CategoryModel $category)
31
	{
32
		$this->setDatabase($database);
33
		$this->category = $category;
34
		self::$connection = $this->getDatabase();
35
	}
36
37
	public function setGraphHeight($height)
38
	{
39
		$this->graphHeight = $height;
40
	}
41
42
	public function getGraphHeight()
43
	{
44
		return $this->graphHeight;
45
	}
46
47
	/**
48
	 * Return data for meal tickets
49
	 *
50
	 * @param	void
51
	 * @return	array
52
	 */
53
	public function mealTicket()
54
	{
55
		return $this->database->query('SELECT	vis.id AS id,
56
				name,
57
				surname,
58
				nick,
59
				DATE_FORMAT(birthday, "%Y-%m-%d") AS birthday,
60
				street,
61
				city,
62
				postal_code,
63
				province,
64
				province_name,
65
				group_num,
66
				group_name,
67
				troop_name,
68
				comment,
69
				arrival,
70
				departure,
71
				question,
72
				question2,
73
				fry_dinner,
74
				sat_breakfast,
75
				sat_lunch,
76
				sat_dinner,
77
				sun_breakfast,
78
				sun_lunch,
79
				bill,
80
				place,
81
				DATE_FORMAT(start_date, "%d. -") AS start_date,
82
				DATE_FORMAT(end_date, "%d. %m. %Y") AS end_date
83
		FROM kk_visitors AS vis
84
		LEFT JOIN kk_meals AS meals ON meals.visitor = vis.id
85
		LEFT JOIN kk_provinces AS provs ON vis.province = provs.id
86
		LEFT JOIN kk_meetings AS meets ON meets.id = vis.meeting
87
		WHERE meeting = ? AND vis.deleted = ?
88
		', $this->meetingId, '0')->fetchAll();
89
	}
90
91
	/**
92
	 * Print Attendance into PDF file
93
	 *
94
	 * @param	void
95
	 * @return	file	PDF file
96
	 */
97
	public function attendance()
98
	{
99
		return $this->database->query('SELECT	vis.id AS id,
100
						name,
101
						surname,
102
						nick,
103
						DATE_FORMAT(birthday, "%d. %m. %Y") AS birthday,
104
						street,
105
						city,
106
						postal_code,
107
						group_num,
108
						group_name,
109
						place,
110
						DATE_FORMAT(start_date, "%Y") AS year
111
				FROM kk_visitors AS vis
112
				LEFT JOIN kk_meetings AS meets ON meets.id = vis.meeting
113
				WHERE meeting = ? AND vis.deleted = ?
114
				ORDER BY surname ASC',
115
				$this->meetingId, '0')->fetchAll();
116
	}
117
118
	/**
119
	 * Return data for name list
120
	 *
121
	 * @param	void
122
	 * @return	array    data
123
	 */
124
	public function nameList()
125
	{
126
		return $this->database->query('SELECT	vis.id AS id,
127
						name,
128
						surname,
129
						nick,
130
						DATE_FORMAT(birthday, "%d. %m. %Y") AS birthday,
131
						street,
132
						city,
133
						postal_code,
134
						group_num,
135
						group_name,
136
						place,
137
						DATE_FORMAT(start_date, "%Y") AS year
138
				FROM kk_visitors AS vis
139
				LEFT JOIN kk_meetings AS meets ON meets.id = vis.meeting
140
				WHERE meeting = ? AND vis.deleted = ?
141
				ORDER BY nick ASC
142
				', $this->meetingId, '0')->fetchAll();
143
	}
144
145
	/**
146
	 * Return data for evidence
147
	 *
148
	 * @param	int		$visitroId		ID of visitor
0 ignored issues
show
Bug introduced by
There is no parameter named $visitroId. Was it maybe removed?

This check looks for PHPDoc comments describing methods or function parameters that do not exist on the corresponding method or function.

Consider the following example. The parameter $italy is not defined by the method finale(...).

/**
 * @param array $germany
 * @param array $island
 * @param array $italy
 */
function finale($germany, $island) {
    return "2:1";
}

The most likely cause is that the parameter was removed, but the annotation was not.

Loading history...
149
	 * @return	array	data from database
150
	 */
151
	public function evidence($visitorId = null)
152
	{
153
		$evidenceLimit = '';
154
		$specificVisitor = '';
155
156
		if(isset($visitorId) && $visitorId != NULL){
157
			$evidenceLimit = 'LIMIT 1';
158
			$specificVisitor = "vis.id IN (" . $visitorId . ") AND";
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal vis.id IN ( does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
Coding Style Comprehensibility introduced by
The string literal ) AND does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
159
		}
160
161
162
163
		return $this->getDatabase()->query('SELECT	vis.id AS id,
164
					name,
165
					surname,
166
					street,
167
					city,
168
					postal_code,
169
					bill,
170
					place,
171
					UPPER(LEFT(place, 2)) AS abbr_place,
172
					DATE_FORMAT(start_date, "%d. %m. %Y") AS date,
173
					DATE_FORMAT(start_date, "%Y") AS year,
174
					vis.cost - bill AS balance,
175
					DATE_FORMAT(birthday, "%d. %m. %Y") AS birthday,
176
					group_num,
177
					numbering
178
			FROM kk_visitors AS vis
179
			LEFT JOIN kk_meetings AS meets ON meets.id = vis.meeting
180
			WHERE ' . $specificVisitor . ' meeting = ? AND vis.deleted = ?
181
			ORDER BY surname, name
182
			' . $evidenceLimit, $this->getMeetingId(), '0')->fetchAll();
183
	}
184
185
	public static function getPdfBlocks($vid, $database)
0 ignored issues
show
Unused Code introduced by
The parameter $database is not used and could be removed.

This check looks from parameters that have been defined for a function or method, but which are not used in the method body.

Loading history...
Coding Style introduced by
getPdfBlocks uses the super-global variable $_SESSION which is generally not recommended.

Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable:

// Bad
class Router
{
    public function generate($path)
    {
        return $_SERVER['HOST'].$path;
    }
}

// Better
class Router
{
    private $host;

    public function __construct($host)
    {
        $this->host = $host;
    }

    public function generate($path)
    {
        return $this->host.$path;
    }
}

class Controller
{
    public function myAction(Request $request)
    {
        // Instead of
        $page = isset($_GET['page']) ? intval($_GET['page']) : 1;

        // Better (assuming you use the Symfony2 request)
        $page = $request->query->get('page', 1);
    }
}
Loading history...
186
	{
187
		$programs = "<tr>";
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal <tr> does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
188
		$programs .= " <td class='progPart'>";
189
190
		$data = self::$connection->query('SELECT 	id,
191
							day,
192
							DATE_FORMAT(`from`, "%H:%i") AS `from`,
193
							DATE_FORMAT(`to`, "%H:%i") AS `to`,
194
							name,
195
							program
196
					FROM kk_blocks
197
					WHERE deleted = ? AND program = ? AND meeting = ?
198
					ORDER BY `day` ASC', '0', '1', $_SESSION['meetingID'])->fetchAll();
199
200
		if(!$data){
0 ignored issues
show
Bug Best Practice introduced by
The expression $data of type Nette\Database\IRow[] is implicitly converted to a boolean; are you sure this is intended? If so, consider using empty($expr) instead to make it clear that you intend to check for an array without elements.

This check marks implicit conversions of arrays to boolean values in a comparison. While in PHP an empty array is considered to be equal (but not identical) to false, this is not always apparent.

Consider making the comparison explicit by using empty(..) or ! empty(...) instead.

Loading history...
201
			$programs .= "<div class='emptyTable' style='width:400px;'>Nejsou žádná aktuální data.</div>\n";
202
		} else {
203
			foreach($data as $progData) {
204
				// zbaveni se predsnemovni diskuse
205
				if($progData['id'] == 63) $programs .= "";
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
206
				else {
207
					$programs .= "<div class='block'>".$progData['day'].", ".$progData['from']." - ".$progData['to']." : ".$progData['name']."</div>\n";
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal , does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
Coding Style Comprehensibility introduced by
The string literal - does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
Coding Style Comprehensibility introduced by
The string literal : does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
208
209
					if($progData['program'] == 1) $programs .= "<div>".ProgramModel::getPdfPrograms($progData['id'], $vid, self::$connection)."</div>";
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal <div> does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
Coding Style Comprehensibility introduced by
The string literal </div> does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
210
				}
211
			}
212
		}
213
214
		$programs .= "</td>";
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal </td> does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
215
		$programs .= "</tr>";
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal </tr> does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
216
217
		return $programs;
218
	}
219
220
	/**
221
	 * Return data for program cards
222
	 *
223
	 * @param	void
224
	 * @return	array	data
225
	 */
226
	public function programCards()
227
	{
228
		return $this->getDatabase()->query('SELECT	vis.id AS id,
229
						name,
230
						surname,
231
						nick,
232
						DATE_FORMAT(birthday, "%Y-%m-%d") AS birthday,
233
						street,
234
						city,
235
						postal_code,
236
						province,
237
						province_name,
238
						group_num,
239
						group_name,
240
						troop_name,
241
						comment,
242
						arrival,
243
						departure,
244
						question,
245
						question2,
246
						fry_dinner,
247
						sat_breakfast,
248
						sat_lunch,
249
						sat_dinner,
250
						sun_breakfast,
251
						sun_lunch,
252
						bill,
253
						place,
254
						DATE_FORMAT(start_date, "%d. -") AS start_date,
255
						DATE_FORMAT(end_date, "%d. %m. %Y") AS end_date,
256
						DATE_FORMAT(start_date, "%Y") AS year
257
				FROM kk_visitors AS vis
258
				LEFT JOIN kk_meals AS meals ON meals.visitor = vis.id
259
				LEFT JOIN kk_provinces AS provs ON vis.province = provs.id
260
				LEFT JOIN kk_meetings AS meets ON meets.id = vis.meeting
261
				WHERE meeting = ? AND vis.deleted = ?
262
				ORDER BY nick ASC
263
				', $this->meetingId, '0')->fetchAll();
264
	}
265
266
	public function getLargeProgramData($day)
267
	{
268
		return $this->database->query('SELECT 	blocks.id AS id,
269
						day,
270
						DATE_FORMAT(`from`, "%H:%i") AS `from`,
271
						DATE_FORMAT(`to`, "%H:%i") AS `to`,
272
						blocks.name AS name,
273
						program,
274
						display_progs,
275
						style
276
			FROM kk_blocks AS blocks
277
			LEFT JOIN kk_categories AS cat ON cat.id = blocks.category
278
			WHERE blocks.deleted = ? AND day = ? AND meeting = ?
279
			ORDER BY `from` ASC', '0', $day, $this->meetingId)->fetchAll();
280
	}
281
282
	/**
283
	 * Return data for large program
284
	 *
285
	 * @param	void
286
	 * @return	array	data
287
	 */
288
	public function largeProgram()
289
	{
290
		return $this->database->query('SELECT	id,
291
						place,
292
						DATE_FORMAT(start_date, "%Y") AS year,
293
						UNIX_TIMESTAMP(open_reg) AS open_reg,
294
						UNIX_TIMESTAMP(close_reg) as close_reg
295
				FROM kk_meetings
296
				WHERE id = ?
297
				ORDER BY id DESC
298
				LIMIT 1', $this->meetingId)->fetch();
299
	}
300
301
	/**
302
	 * Return data for public program
303
	 *
304
	 * @param	void
305
	 * @return	array	data
306
	 */
307
	public function publicProgram()
308
	{
309
		return $this->database->query('SELECT	id,
310
						place,
311
						DATE_FORMAT(start_date, "%Y") AS year,
312
						UNIX_TIMESTAMP(open_reg) AS open_reg,
313
						UNIX_TIMESTAMP(close_reg) as close_reg
314
				FROM kk_meetings
315
				WHERE id = ?
316
				ORDER BY id DESC
317
				LIMIT 1', $this->meetingId)->fetch();
318
	}
319
320
	/**
321
	 * Return data for program badges
322
	 *
323
	 * @param	void
324
	 * @return	array	data
325
	 */
326
	public function programBadges()
327
	{
328
		return $this->database->query('SELECT	*
329
			FROM kk_visitors AS vis
330
			WHERE meeting = ? AND vis.deleted = ?', $this->meetingId, '0')->fetchAll();
331
	}
332
333
	/**
334
	 * Return data for name badges
335
	 *
336
	 * @param	void
337
	 * @return	array	data
338
	 */
339
	public function nameBadges()
340
	{
341
		return $this->database->query('SELECT	vis.id AS id,
342
						nick
343
				FROM kk_visitors AS vis
344
				WHERE meeting = ? AND vis.deleted = ?', $this->meetingId, '0')->fetchAll();
345
	}
346
347
	/**
348
	 * Generate registration graph
349
	 *
350
	 * @return	mixed	html
351
	 */
352
	public function renderGraph()
353
	{
354
		$graph_width = 94;
355
356
		$graph = $this->database
357
			->query('SELECT DATE_FORMAT(reg_daytime, "%d. %m. %Y") AS day,
358
							   COUNT(reg_daytime) AS reg_count
359
						FROM `kk_visitors` AS vis
360
						LEFT JOIN kk_meetings AS meet ON meet.id = vis.meeting
361
						WHERE meet.id = ? AND vis.deleted = ?
362
						GROUP BY day
363
						ORDER BY reg_daytime ASC',
364
						$this->meetingId, '0')->fetchAll();
365
366
		$graphMax = $this->database
367
			->query('SELECT MAX( reg_count ) AS max
368
					  FROM (
369
						SELECT DATE_FORMAT( reg_daytime, "%d. %m. %Y" ) AS
370
							DAY , COUNT( reg_daytime ) AS reg_count
371
						FROM `kk_visitors` AS vis
372
						LEFT JOIN kk_meetings AS meet ON meet.id = vis.meeting
373
						WHERE meet.id = ?
374
							AND vis.deleted = ?
375
						GROUP BY DAY
376
					  ) AS cnt',
377
					  $this->meetingId, '0')->fetch();
378
379
		$reg_graph = "<table style='width:100%;'>";
380
381
		$graph_height = 0;
382
383
		foreach($graph as $graphRow) {
384
				// trojclenka pro zjisteni pomeru sirky grafu...(aby nam to nevylezlo mimo obrazovku)
385
		/*var_dump($max);
0 ignored issues
show
Unused Code Comprehensibility introduced by
68% of this comment could be valid code. Did you maybe forget this after debugging?

Sometimes obsolete code just ends up commented out instead of removed. In this case it is better to remove the code once you have checked you do not need it.

The code might also have been commented out for debugging purposes. In this case it is vital that someone uncomments it again or your project may behave in very unexpected ways in production.

This check looks for comments that seem to be mostly valid code and reports them.

Loading history...
386
		var_dump($graph_width);
387
		var_dump($graph_data['reg_count']);
388
		echo 	$width = ceil(($graph_width/$max)*$graph_data['reg_count'])."\n";*/
389
			$width = ceil($graph_width/$graphMax['max']*$graphRow['reg_count']);
390
			$reg_graph .= "<tr><td align='right' style='width:60px;'>".$graphRow['day']."</td><td><img src='".IMG_DIR."graph.png' alt='".$graphRow['reg_count']."' style='width:".$width."%;' height='12' border='0'>".$graphRow['reg_count']."</td>";
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal </td> does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
391
392
			$graph_height += 21.5;
393
		}
394
395
		$reg_graph .= "</table>";
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal </table> does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
396
397
		if($graph_height < 290) $graph_height = 290;
398
399
		$this->setGraphHeight($graph_height);
400
401
		return $reg_graph;
402
	}
403
404
	/**
405
	 * Get materials for each program
406
	 *
407
	 * @return	mixed	html
408
	 */
409
	public function getMaterial()
410
	{
411
		$data = $this->database
412
			->query('SELECT	progs.id AS id,
413
						progs.name AS name,
414
						progs.material AS material
415
				FROM `kk_programs` AS progs
416
				LEFT JOIN `kk_blocks` AS bls ON progs.block = bls.id
417
				WHERE progs.deleted = ?
418
					AND bls.meeting = ?
419
					AND bls.deleted = ?',
420
					'0', $this->meetingId, '0')->fetchAll();
421
422
		$html = "";
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
423
		foreach($data as $item){
424
			if($item['material'] == "") $material = "(žádný)";
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
Coding Style Comprehensibility introduced by
The string literal (žádný) does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
425
			else $material = $item['material'];
426
			$html .= "<div><a rel='programDetail' href='".PRJ_DIR."program/?id=".$item['id']."&cms=edit&page=export' title='".$item['name']."'>".$item['name']."</a>:\n</div>";
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal program/?id= does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
427
			$html .= "<div style='margin-left:10px;font-size:12px;font-weight:bold;'>".$material."</div>";
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal </div> does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
428
		}
429
430
		return $html;
431
	}
432
433
	/**
434
	 * Get materials for each program
435
	 *
436
	 * @param	string	type of money (account|balance|suma)
437
	 * @return	mixed	amount of money or false if error
438
	 */
439
	public function getMoney($type)
440
	{
441
		$data = $this->database
442
			->query('SELECT SUM(bill) AS account,
443
							COUNT(bill) * vis.cost AS suma,
444
							COUNT(bill) * vis.cost - SUM(bill) AS balance
445
					FROM kk_visitors AS vis
446
					LEFT JOIN kk_meetings AS meets ON vis.meeting = meets.id
447
					WHERE meeting = ? AND vis.deleted = ?',
448
					$this->meetingId, '0')->fetch();
449
450
		switch($type){
451
			case "account":
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal account does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
452
				return $data['account'];
453
				break;
0 ignored issues
show
Unused Code introduced by
break is not strictly necessary here and could be removed.

The break statement is not necessary if it is preceded for example by a return statement:

switch ($x) {
    case 1:
        return 'foo';
        break; // This break is not necessary and can be left off.
}

If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.

Loading history...
454
			case "balance":
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal balance does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
455
				return $data['balance'];
456
				break;
0 ignored issues
show
Unused Code introduced by
break is not strictly necessary here and could be removed.

The break statement is not necessary if it is preceded for example by a return statement:

switch ($x) {
    case 1:
        return 'foo';
        break; // This break is not necessary and can be left off.
}

If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.

Loading history...
457
			case "suma":
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal suma does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
458
				return $data['suma'];
459
				break;
0 ignored issues
show
Unused Code introduced by
break is not strictly necessary here and could be removed.

The break statement is not necessary if it is preceded for example by a return statement:

switch ($x) {
    case 1:
        return 'foo';
        break; // This break is not necessary and can be left off.
}

If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.

Loading history...
460
			default:
461
				return FALSE;
462
				break;
0 ignored issues
show
Unused Code introduced by
break is not strictly necessary here and could be removed.

The break statement is not necessary if it is preceded for example by a return statement:

switch ($x) {
    case 1:
        return 'foo';
        break; // This break is not necessary and can be left off.
}

If you would like to keep this construct to be consistent with other case statements, you can safely mark this issue as a false-positive.

Loading history...
463
		}
464
	}
465
466
	/**
467
	 * Get count of meals
468
	 *
469
	 * @param	string	name of meal
470
	 * @return	array	meal name => count
471
	 */
472
	public function getMealCount($meal)
0 ignored issues
show
Coding Style introduced by
getMealCount uses the super-global variable $_SESSION which is generally not recommended.

Instead of super-globals, we recommend to explicitly inject the dependencies of your class. This makes your code less dependent on global state and it becomes generally more testable:

// Bad
class Router
{
    public function generate($path)
    {
        return $_SERVER['HOST'].$path;
    }
}

// Better
class Router
{
    private $host;

    public function __construct($host)
    {
        $this->host = $host;
    }

    public function generate($path)
    {
        return $this->host.$path;
    }
}

class Controller
{
    public function myAction(Request $request)
    {
        // Instead of
        $page = isset($_GET['page']) ? intval($_GET['page']) : 1;

        // Better (assuming you use the Symfony2 request)
        $page = $request->query->get('page', 1);
    }
}
Loading history...
473
	{
474
		$data = $this->database
475
			->query('SELECT count(?) AS ?
476
				FROM `kk_meals` AS mls
477
				LEFT JOIN `kk_visitors` AS vis ON vis.id = mls.visitor
478
				WHERE vis.deleted = ?
479
					AND vis.meeting = ?
480
					AND ' . $meal . ' = ?',
481
					$meal, $meal, '0', $_SESSION['meetingID'], 'ano')->fetch();
482
483
		return $data[$meal];
484
	}
485
486
	/**
487
	 * Render data from getMealCount
488
	 *
489
	 * @return	mixed	html
490
	 */
491
	public function renderMealCount()
492
	{
493
		$mealsArr = array("fry_dinner" => "páteční večeře",
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal fry_dinner does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
Coding Style Comprehensibility introduced by
The string literal páteční večeře does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
494
						  "sat_breakfast" => "sobotní snídaně",
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal sat_breakfast does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
Coding Style Comprehensibility introduced by
The string literal sobotní snídaně does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
495
						  "sat_lunch" => "sobotní oběd",
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal sat_lunch does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
Coding Style Comprehensibility introduced by
The string literal sobotní oběd does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
496
						  "sat_dinner" => "sobotní večeře",
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal sat_dinner does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
Coding Style Comprehensibility introduced by
The string literal sobotní večeře does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
497
						  "sun_breakfast" => "nedělní snídaně",
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal sun_breakfast does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
Coding Style Comprehensibility introduced by
The string literal nedělní snídaně does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
498
						  "sun_lunch" => "nedělní oběd");
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal sun_lunch does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
Coding Style Comprehensibility introduced by
The string literal nedělní oběd does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
499
500
		$meals = "<table>";
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal <table> does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
501
502
		foreach($mealsArr as $mealsKey => $mealsVal){
503
			$mealCount = $this->getMealCount($mealsKey);
504
505
			$meals .= "<tr><td>".$mealsVal.":</td><td><span style='font-size:12px; font-weight:bold;'>".$mealCount."</span></td></tr>";
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal <tr><td> does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
Coding Style Comprehensibility introduced by
The string literal </span></td></tr> does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
506
		}
507
508
		$meals .= "</table>";
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal </table> does not require double quotes, as per coding-style, please use single quotes.

PHP provides two ways to mark string literals. Either with single quotes 'literal' or with double quotes "literal". The difference between these is that string literals in double quotes may contain variables with are evaluated at run-time as well as escape sequences.

String literals in single quotes on the other hand are evaluated very literally and the only two characters that needs escaping in the literal are the single quote itself (\') and the backslash (\\). Every other character is displayed as is.

Double quoted string literals may contain other variables or more complex escape sequences.

<?php

$singleQuoted = 'Value';
$doubleQuoted = "\tSingle is $singleQuoted";

print $doubleQuoted;

will print an indented: Single is Value

If your string literal does not contain variables or escape sequences, it should be defined using single quotes to make that fact clear.

For more information on PHP string literals and available escape sequences see the PHP core documentation.

Loading history...
509
510
		return $meals;
511
	}
512
513
	/**
514
	 * Return data for visitors's program
515
	 *
516
	 * @param	int		program id
517
	 * @return	file	PDF file
518
	 */
519
	public function programVisitors($programId)
520
	{
521
		return $this->database
522
			->query('SELECT vis.name AS name,
523
							vis.surname AS surname,
524
							vis.nick AS nick,
525
							prog.name AS program
526
					FROM kk_visitors AS vis
527
					LEFT JOIN `kk_visitor-program` AS visprog ON vis.id = visprog.visitor
528
					LEFT JOIN `kk_programs` AS prog ON prog.id = visprog.program
529
					WHERE visprog.program = ? AND vis.deleted = ?', $programId, '0')->fetchAll();
530
	}
531
532
	/**
533
	 * Return data for details of program
534
	 *
535
	 * @param	void
536
	 * @return	array	data
537
	 */
538
	public function programDetails()
539
	{
540
		return $this->database
541
			->query('SELECT prog.name AS name,
542
						 prog.description AS description,
543
						 prog.tutor AS tutor,
544
						 prog.email AS email
545
					FROM kk_programs AS prog
546
					LEFT JOIN `kk_blocks` AS block ON block.id = prog.block
547
					WHERE block.meeting = ?
548
						AND prog.deleted = ?
549
						AND block.deleted = ?', $this->meetingId, '0', '0')->fetchAll();
550
	}
551
552
	/**
553
	 * Return data for visitor excel
554
	 *
555
	 * @param   void
556
	 * @return	array	data
557
	 */
558
	public function visitorsExcel()
559
	{
560
		return $this->database
561
			->query('
562
		SELECT vis.id AS id,
563
			code,
564
			vis.name,
565
			surname,
566
			nick,
567
			DATE_FORMAT(birthday, "%d. %m. %Y") AS birthday,
568
			vis.email,
569
			street,
570
			city,
571
			postal_code,
572
			province_name AS province,
573
			group_num,
574
			group_name,
575
			troop_name,
576
			bill,
577
			`comment`,
578
			arrival,
579
			departure,
580
			question,
581
			question2,
582
			`all`,
583
			fry_dinner,
584
			sat_breakfast,
585
			sat_lunch,
586
			sat_dinner,
587
			sun_breakfast,
588
			sun_lunch,
589
			meeting
590
		FROM `kk_visitors` AS vis
591
		LEFT JOIN `kk_provinces` AS provs ON provs.id = vis.province
592
		/*LEFT JOIN `kk_visitor-program` AS visprog ON visprog.visitor = vis.id
593
		LEFT JOIN `kk_programs` AS progs ON visprog.program = progs.id*/
594
		LEFT JOIN `kk_meals` AS mls ON mls.visitor = vis.id
595
		WHERE vis.deleted = ? AND meeting = ?', '0', $this->meetingId)->fetchAll();
596
	}
597
598
}
599