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

MeetingModel::getProvinceNameById()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 8
Code Lines 7

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 1
eloc 7
nc 1
nop 1
dl 0
loc 8
rs 9.4285
c 0
b 0
f 0
1
<?php
2
3
namespace App\Models;
4
5
use Nette\Database\Context;
6
use App\Models\ProgramModel;
7
use App\Models\BaseModel;
8
9
/**
10
 * Meeting
11
 *
12
 * class for handling meeting
13
 *
14
 * @created 2012-11-09
15
 * @author Tomas Litera <[email protected]>
16
 */
17
class MeetingModel extends BaseModel
0 ignored issues
show
Coding Style introduced by
The property $form_names is not named in camelCase.

This check marks property names that have not been written in camelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. Thus the name database connection string becomes databaseConnectionString.

Loading history...
18
{
19
20
	/** @var array days of weekend */
21
	private $weekendDays = array();
22
23
	/** @var array of form names */
24
	public $form_names = array();
25
26
	/** @var array of database programs table columns */
27
	public $dbColumns = array();
28
29
	/** @var datetime at what registration opens */
30
	public $regOpening = NULL;
31
32
	/** @var datetime at what registration ends*/
33
	public $regClosing = NULL;
34
35
	/** @var string registration heading text */
36
	public $regHeading = '';
37
38
	private $configuration;
0 ignored issues
show
Unused Code introduced by
The property $configuration is not used and could be removed.

This check marks private properties in classes that are never used. Those properties can be removed.

Loading history...
39
	private $program;
40
	private $httpEncoding;
41
	private $dbTable;
42
43
	protected $table = 'kk_meetings';
44
45
	/** Constructor */
46
	public function __construct(Context $database, ProgramModel $program)
47
	{
48
		$this->weekendDays = array("pátek", "sobota", "neděle");
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal pátek 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 sobota 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ěle 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...
49
		$this->form_names = array(
50
			"place",
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal place 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...
51
			"start_date",
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal start_date 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...
52
			"end_date",
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal end_date 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...
53
			"open_reg",
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal open_reg 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...
54
			"close_reg",
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal close_reg 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...
55
			"contact",
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal contact 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...
56
			"email",
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal email 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...
57
			"gsm",
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal gsm 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...
58
			"cost",
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal cost 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...
59
			"advance",
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal advance 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...
60
			"numbering"
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal numbering 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...
61
		);
62
		$this->dbColumns = array(
63
			"place",
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal place 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...
64
			"start_date",
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal start_date 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...
65
			"end_date",
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal end_date 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...
66
			"open_reg",
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal open_reg 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...
67
			"close_reg",
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal close_reg 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...
68
			"contact",
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal contact 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...
69
			"email",
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal email 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...
70
			"gsm",
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal gsm 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...
71
			"cost",
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal cost 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...
72
			"advance",
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal advance 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...
73
			"numbering"
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal numbering 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...
74
		);
75
		$this->dbTable = "kk_meetings";
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal kk_meetings 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...
76
		$this->setDatabase($database);
77
		$this->program = $program;
78
	}
79
80
	public function setHttpEncoding($encoding)
81
	{
82
		$this->httpEncoding = $encoding;
83
	}
84
85
	/**
86
	 * Create new or return existing instance of class
87
	 *
88
	 * @return	mixed	instance of class
89
	 */
90
	public static function getInstance()
91
	{
92
		if(self::$instance === false) {
93
			self::$instance = new self();
0 ignored issues
show
Bug introduced by
The call to MeetingModel::__construct() misses some required arguments starting with $database.
Loading history...
94
		}
95
		return self::$instance;
96
	}
97
98
	/**
99
	 * Create a new record
100
	 *
101
	 * @param	mixed	array of data
102
	 * @return	boolean
103
	 */
104
	public function create(array $data)
105
	{
106
		$data['guid'] = md5(uniqid());
107
		$result = $this->getDatabase()->query('INSERT INTO ' . $this->getTable(), $data);
108
109
		return $result;
0 ignored issues
show
Bug Best Practice introduced by
The return type of return $result; (Nette\Database\ResultSet) is incompatible with the return type of the parent method App\Models\BaseModel::create of type Nette\Database\Table\IRow|integer|boolean.

If you return a value from a function or method, it should be a sub-type of the type that is given by the parent type f.e. an interface, or abstract method. This is more formally defined by the Lizkov substitution principle, and guarantees that classes that depend on the parent type can use any instance of a child type interchangably. This principle also belongs to the SOLID principles for object oriented design.

Let’s take a look at an example:

class Author {
    private $name;

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

    public function getName() {
        return $this->name;
    }
}

abstract class Post {
    public function getAuthor() {
        return 'Johannes';
    }
}

class BlogPost extends Post {
    public function getAuthor() {
        return new Author('Johannes');
    }
}

class ForumPost extends Post { /* ... */ }

function my_function(Post $post) {
    echo strtoupper($post->getAuthor());
}

Our function my_function expects a Post object, and outputs the author of the post. The base class Post returns a simple string and outputting a simple string will work just fine. However, the child class BlogPost which is a sub-type of Post instead decided to return an object, and is therefore violating the SOLID principles. If a BlogPost were passed to my_function, PHP would not complain, but ultimately fail when executing the strtoupper call in its body.

Loading history...
110
	}
111
112
	/**
113
	 * Modify record
114
	 *
115
	 * @param	int		$id			ID of record
116
	 * @param	array	$db_data	array of data
0 ignored issues
show
Bug introduced by
There is no parameter named $db_data. 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...
117
	 * @return	bool
118
	 */
119
	public function update($id, array $data)
120
	{
121
		$result = $this->getDatabase()->table($this->getTable())->where('id', $id)->update($data);
122
123
		return $result;
124
	}
125
126
	/**
127
	 * Delete one or multiple record/s
128
	 *
129
	 * @param	int		ID/s of record
130
	 * @return	boolean
131
	 */
132 View Code Duplication
	public function delete($ids)
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
133
	{
134
		$data = array('deleted' => '1');
135
		$result = $this->getDatabase()->table($this->getTable())->where('id', $ids)->update($data);
136
137
		return $result;
138
	}
139
140
	/**
141
	 * Return meeting data
142
	 *
143
	 * @return	string	html table
144
	 */
145
	public function getData($meeting_id = NULL)
0 ignored issues
show
Coding Style Naming introduced by
The parameter $meeting_id is not named in camelCase.

This check marks parameter names that have not been written in camelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. Thus the name database connection string becomes databaseConnectionString.

Loading history...
146
	{
147
		if(isset($meeting_id)) {
148
			$data = $this->getDatabase()
149
				->table($this->getTable())
150
				->where('deleted ? AND id ?',  '0', $meeting_id)
151
				->fetch();
152
		} else {
153
			$data = $this->getDatabase()
154
				->table($this->getTable())
155
				->where('deleted',  '0')
156
				->fetchAll();
157
		}
158
159
		if(!$data) {
160
			return 0;
161
		} else {
162
			return $data;
163
		}
164
	}
165
166
	/**
167
	 * @param  string $priceType cost|advance
168
	 * @return integer
169
	 */
170
	public function getPrice($priceType)
171
	{
172
		return $this->getDatabase()
173
			->table($this->getTable())
174
			->select($priceType)
175
			->where('id', $this->getMeetingId())
176
			->limit(1)
177
			->fetchField();
178
	}
179
180
	/**
181
	 * Render HTML Provinces <select>
182
	 *
183
	 * @param	int	ID of selected province
184
	 * @return	string	html <select>
185
	 */
186
	public function renderHtmlProvinceSelect($selected_province)
0 ignored issues
show
Coding Style Naming introduced by
The parameter $selected_province is not named in camelCase.

This check marks parameter names that have not been written in camelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. Thus the name database connection string becomes databaseConnectionString.

Loading history...
187
	{
188
		$html_select = "<select style='width: 195px; font-size: 10px' name='province'>\n";
189
190
		$result = $this->getDatabase()
191
			->table('kk_provinces')
192
			->fetchAll();
193
194
		foreach($result as $data){
195
			if($data['id'] == $selected_province){
196
				$sel = "selected";
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal selected 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...
197
			}
198
			else $sel = "";
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...
199
			$html_select .= "<option value='".$data['id']."' ".$sel.">".$data['province_name']."</option>";
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 </option> 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...
200
		}
201
202
		$html_select .= "</select>\n";
203
204
		return $html_select;
205
	}
206
207
	/** Public program same as getPrograms*/
208
	public function getPublicPrograms($block_id){
0 ignored issues
show
Coding Style Naming introduced by
The parameter $block_id is not named in camelCase.

This check marks parameter names that have not been written in camelCase.

In camelCase names are written without any punctuation, the start of each new word being marked by a capital letter. Thus the name database connection string becomes databaseConnectionString.

Loading history...
209
		$result = $this->getDatabase()
210
			->query('SELECT progs.id AS id,
211
						progs.name AS name,
212
						style
213
				FROM kk_programs AS progs
214
				LEFT JOIN kk_categories AS cat ON cat.id = progs.category
215
				WHERE block = ? AND progs.deleted = ?
216
				LIMIT 10',
217
				$block_id, '0')
218
			->fetchAll();
219
220
		if(!$result) $html = "";
0 ignored issues
show
Bug Best Practice introduced by
The expression $result 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...
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...
221
		else {
222
			$html = "<table>\n";
223
			$html .= " <tr>\n";
224
			foreach($result as $data){
225
				$html .= "<td class='category cat-".$data['style']."' style='text-align:center;'>\n";
226
				$html .= "<a class='programLink' rel='programDetail' href='#' rel='programDetail' title='".$this->program->getDetail($data['id'], 'program', $this->httpEncoding)."'>".$data['name']."</a>\n";
227
				$html .= "</td>\n";
228
			}
229
			$html .= " </tr>\n";
230
			$html .= "</table>\n";
231
		}
232
		return $html;
233
	}
234
235
	public function renderPublicProgramOverview()
236
	{
237
		$days = array("pátek", "sobota", "neděle");
0 ignored issues
show
Coding Style Comprehensibility introduced by
The string literal pátek 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 sobota 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ěle 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...
238
		$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...
239
240
		foreach($days as $dayKey => $dayVal){
241
			$html .= "<table>\n";
242
			$html .= " <tr>\n";
243
			$html .= "  <td class='day' colspan='2' >".$dayVal."</td>\n";
244
			$html .= " </tr>\n";
245
246
			$result = $this->database
247
				->query('SELECT	blocks.id AS id,
248
							day,
249
							DATE_FORMAT(`from`, "%H:%i") AS `from`,
250
							DATE_FORMAT(`to`, "%H:%i") AS `to`,
251
							blocks.name AS name,
252
							program,
253
							display_progs,
254
							style
255
					FROM kk_blocks AS blocks
256
					LEFT JOIN kk_categories AS cat ON cat.id = blocks.category
257
					WHERE blocks.deleted = ? AND day = ? AND meeting = ?
258
					ORDER BY `from` ASC',
259
					'0', $dayVal, $this->meetingId)
260
				->fetchAll();
261
262
			if(!$result){
0 ignored issues
show
Bug Best Practice introduced by
The expression $result 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...
263
				$html .= "<td class='emptyTable' style='width:400px;'>Nejsou žádná aktuální data.</td>\n";
264
			}
265
			else{
266
				foreach($result as $data){
267
					$html .= "<tr>\n";
268
					$html .= "<td class='time'>".$data['from']." - ".$data['to']."</td>\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...
269
					if(($data['program'] == 1) && ($data['display_progs'] == 1)){
270
						$html .= "<td class='category cat-".$data['style']."' class='daytime'>\n";
271
						$html .= "<div>\n";
272
						$html .= "<a class='programLink rel='programDetail' href='#' rel='programDetail' title='".$this->program->getDetail($data['id'], 'block', $this->httpEncoding)."'>".$data['name']."</a>\n";
273
						$html .= "</div>\n";
274
						$html .= $this->getPublicPrograms($data['id']);
275
						$html .= "</td>\n";
276
					}
277
					else {
278
						$html .= "<td class='category cat-".$data['style']."'>";
279
						$html .= "<a class='programLink rel='programDetail' href='#' rel='programDetail' title='".$this->program->getDetail($data['id'], 'block', $this->httpEncoding)."'>".$data['name']."</a>\n";
280
						$html .= "</td>\n";
281
					}
282
					$html .= "</tr>\n";
283
				}
284
			}
285
			$html .= "</table>\n";
286
		}
287
288
		return $html;
289
	}
290
291
	/**
292
	 * @deprecated
293
	 *
294
	 * Render data in a table
295
	 *
296
	 * @return	string	html of a table
297
	 */
298
	public function renderData()
299
	{
300
		$result = $this->database
301
			->table($this->dbTable)
302
			->select('id,
303
					place,
304
					DATE_FORMAT(start_date, "%d. %m. %Y") AS start_date,
305
					DATE_FORMAT(end_date, "%d. %m. %Y") AS end_date,
306
					DATE_FORMAT(open_reg, "%d. %m. %Y %H:%i:%s") AS open_reg,
307
					DATE_FORMAT(close_reg, "%d. %m. %Y %H:%i:%s") AS close_reg,
308
					contact,
309
					email,
310
					gsm')
311
			->where('deleted', '0')
312
			->limit(30)
313
			->fetchAll();
314
315
		$html_row = "";
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...
316
317
		if(!$result){
0 ignored issues
show
Bug Best Practice introduced by
The expression $result 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...
318
			$html_row .= "<tr class='radek1'>";
319
			$html_row .= "<td><img class='edit' src='".IMG_DIR."icons/edit2.gif' /></td>\n";
320
			$html_row .= "<td><img class='edit' src='".IMG_DIR."icons/delete2.gif' /></td>\n";
321
			$html_row .= "<td colspan='11' class='emptyTable'>Nejsou k dispozici žádné položky.</td>";
322
			$html_row .= "</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...
323
		} else {
324
			foreach($result as $data){
325
				$html_row .= "<tr class='radek1'>";
326
				$html_row .= "\t\t\t<td><a href='process.php?id=".$data['id']."&cms=edit&page=meetings' title='Upravit'><img class='edit' src='".IMG_DIR."icons/edit.gif' /></a></td>\n";
327
				$html_row .= "\t\t\t<td><a href=\"javascript:confirmation('?id=".$data['id']."&amp;cms=del', 'sraz: ".$data['place']." ".$data['start_date']." -> Opravdu SMAZAT tento sraz? Jste si jisti?')\" title='Odstranit'><img class='edit' src='".IMG_DIR."icons/delete.gif' /></a></td>\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...
328
				$html_row .= "\t\t\t<td class='text'>".$data['id']."</td>\n";
329
				$html_row .= "\t\t\t<td class='text'>".$data['place']."</td>\n";
330
				$html_row .= "\t\t\t<td class='text'>".$data['start_date']."</td>\n";
331
				$html_row .= "\t\t\t<td class='text'>".$data['end_date']."</td>\n";
332
				$html_row .= "\t\t\t<td class='text'>".$data['open_reg']."</td>\n";
333
				$html_row .= "\t\t\t<td class='text'>".$data['close_reg']."</td>\n";
334
				$html_row .= "\t\t\t<td class='text'>".$data['contact']."</td>\n";
335
				$html_row .= "\t\t\t<td class='text'>".$data['email']."</td>\n";
336
				$html_row .= "\t\t\t<td class='text'>".$data['gsm']."</td>\n";
337
				$html_row .= "</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...
338
			}
339
		}
340
341
		// table head
342
		$html_thead = "\t<tr>\n";
343
		$html_thead .= "\t\t<th></th>\n";
344
		$html_thead .= "\t\t<th></th>\n";
345
		$html_thead .= "\t\t<th class='tab1'>id</th>\n";
346
		$html_thead .= "\t\t<th class='tab1'>místo</th>\n";
347
		$html_thead .= "\t\t<th class='tab1'>začátek</th>\n";
348
		$html_thead .= "\t\t<th class='tab1'>konec</th>\n";
349
		$html_thead .= "\t\t<th class='tab1'>otevření registrace</th>\n";
350
		$html_thead .= "\t\t<th class='tab1'>uzavření registrace</th>\n";
351
		$html_thead .= "\t\t<th class='tab1'>kontakt</th>\n";
352
		$html_thead .= "\t\t<th class='tab1'>e-mail</th>\n";
353
		$html_thead .= "\t\t<th class='tab1'>telefon</th>\n";
354
		$html_thead .= "\t</tr>\n";
355
356
		// table foot
357
		$html_tfoot = $html_thead;
358
359
		// table
360
		$html_table = "<table id='MeetingsTable' class='list tablesorter'>\n";
361
		$html_table .= "\t<thead>\n";
362
		$html_table .= $html_thead;
363
		$html_table .= "\t</thead>\n";
364
		$html_table .= "\t<tfoot>\n";
365
		$html_table .= $html_tfoot;
366
		$html_table .= "\t</tfoot>\n";
367
		$html_table .= "\t<tbody>\n";
368
		$html_table .= $html_row;
369
		$html_table .= "\t</tbody>\n";
370
		$html_table .= "</table>\n";
371
372
		return $html_table;
373
	}
374
375
	/**
376
	 * @param  integer $meetingId
377
	 * @return $this
378
	 */
379
	public function setRegistrationHandlers($meetingId = 1)
380
	{
381
		$meeting = $this->getDatabase()
382
			->table($this->getTable())
383
			->select('id')
384
			->select('place')
385
			->select('DATE_FORMAT(start_date, "%Y") AS year')
386
			->select('UNIX_TIMESTAMP(open_reg) AS open_reg')
387
			->select('UNIX_TIMESTAMP(close_reg) AS close_reg')
388
			->where('id', $meetingId)
389
			->order('id DESC')
390
			->limit(1)
391
			->fetch();
392
393
		$this->setRegHeading($meeting->place . ' ' . $meeting->year);
394
		$this->setRegClosing($meeting->close_reg);
395
		$this->setRegOpening($meeting->open_reg);
396
397
		return $this;
398
	}
399
400
	/**
401
	 * @return string
402
	 */
403
	public function getRegOpening()
404
	{
405
		return $this->regOpening;
406
	}
407
408
	/**
409
	 * @param  string $value
410
	 * @return $this
411
	 */
412
	public function setRegOpening($value = '')
413
	{
414
		$this->regOpening = $value;
0 ignored issues
show
Documentation Bug introduced by
It seems like $value of type string is incompatible with the declared type object<App\Models\datetime> of property $regOpening.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
415
416
		return $this;
417
	}
418
419
	/**
420
	 * @return string
421
	 */
422
	public function getRegClosing()
423
	{
424
		return $this->regClosing;
425
	}
426
427
	/**
428
	 * @param  string $value
429
	 * @return $this
430
	 */
431
	public function setRegClosing($value = '')
432
	{
433
		$this->regClosing = $value;
0 ignored issues
show
Documentation Bug introduced by
It seems like $value of type string is incompatible with the declared type object<App\Models\datetime> of property $regClosing.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
434
435
		return $this;
436
	}
437
438
	/**
439
	 * @return string
440
	 */
441
	public function getRegHeading()
442
	{
443
		return $this->regHeading;
444
	}
445
446
	/**
447
	 * @param  string $value
448
	 * @return $this
449
	 */
450
	public function setRegHeading($value = '')
451
	{
452
		$this->regHeading = $value;
453
454
		return $this;
455
	}
456
457
	/**
458
	 * Is registration open?
459
	 *
460
	 * @return 	boolean
461
	 */
462
	public function isRegOpen($debug = false)
463
	{
464
		return (($this->getRegOpening() < time()) && (time() < $this->getRegClosing()) || $debug);
465
	}
466
467
	/**
468
	 * @param  integer $id
469
	 * @return string
470
	 */
471
	public function getProvinceNameById($id) {
472
		return $this->getDatabase()
473
			->table('kk_provinces')
474
			->select('province_name')
475
			->where('id', $id)
476
			->limit(1)
477
			->fetchField('province_name');
478
	}
479
480
	/**
481
	 * @param  integer|string $meetingId
482
	 * @return ActiveRow
483
	 */
484
	public function getPlaceAndYear($meetingId)
485
	{
486
		return $this->getDatabase()
487
			->table($this->getTable())
488
			->select('place')
489
			->select('DATE_FORMAT(start_date, "%Y") AS year')
490
			->where('id = ? AND deleted = ?', $meetingId, '0')
491
			->limit(1)
492
			->fetch();
493
	}
494
495
	/**
496
	 * @return ActiveRow
497
	 */
498
	public function getMenuItems()
499
	{
500
		return $this->getDatabase()
501
			->table($this->getTable())
502
			->select('id AS mid')
503
			->select('place')
504
			->select('DATE_FORMAT(start_date, "%Y") AS year')
505
			->where('deleted', '0')
506
			->order('id DESC')
507
			->fetchAll();
508
	}
509
510
	/**
511
	 * @return integer
512
	 */
513
	public function getLastMeetingId()
514
	{
515
		return $this->getDatabase()
516
			->table($this->getTable())
517
			->select('id')
518
			->order('id DESC')
519
			->limit(1)
520
			->fetchField();
521
	}
522
523
}
524