Completed
Pull Request — master (#102)
by Litera
11:03
created

MeetingModel::renderData()   B

Complexity

Conditions 3
Paths 2

Size

Total Lines 76
Code Lines 55

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 3
eloc 55
nc 2
nop 0
dl 0
loc 76
rs 8.9667
c 0
b 0
f 0

How to fix   Long Method   

Long Method

Small methods make your code easier to understand, in particular if combined with a good name. Besides, if your method is small, finding a good name is usually much easier.

For example, if you find yourself adding comments to a method's body, this is usually a good sign to extract the commented part to a new method, and use the comment as a starting point when coming up with a good name for this new method.

Commonly applied refactorings include:

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 $program;
39
	private $httpEncoding;
40
	private $dbTable;
41
42
	protected $table = 'kk_meetings';
43
44
	/** Constructor */
45
	public function __construct(Context $database, ProgramModel $program)
46
	{
47
		$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...
48
		$this->form_names = array(
49
			"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...
50
			"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...
51
			"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...
52
			"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...
53
			"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...
54
			"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...
55
			"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...
56
			"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...
57
			"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...
58
			"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...
59
			"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...
60
		);
61
		$this->dbColumns = array(
62
			"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...
63
			"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...
64
			"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...
65
			"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...
66
			"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...
67
			"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...
68
			"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...
69
			"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...
70
			"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...
71
			"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...
72
			"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...
73
		);
74
		$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...
75
		$this->setDatabase($database);
76
		$this->program = $program;
77
	}
78
79
	public function setHttpEncoding($encoding)
80
	{
81
		$this->httpEncoding = $encoding;
82
	}
83
84
	/**
85
	 * Create new or return existing instance of class
86
	 *
87
	 * @return	mixed	instance of class
88
	 */
89
	public static function getInstance()
90
	{
91
		if(self::$instance === false) {
92
			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...
93
		}
94
		return self::$instance;
95
	}
96
97
	/**
98
	 * Create a new record
99
	 *
100
	 * @param	mixed	array of data
101
	 * @return	boolean
102
	 */
103
	public function create(array $data)
104
	{
105
		$data['guid'] = md5(uniqid());
106
		$result = $this->getDatabase()->query('INSERT INTO ' . $this->getTable(), $data);
107
108
		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...
109
	}
110
111
	/**
112
	 * Modify record
113
	 *
114
	 * @param	int		$id			ID of record
115
	 * @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...
116
	 * @return	bool
117
	 */
118
	public function update($id, array $data)
119
	{
120
		$result = $this->getDatabase()->table($this->getTable())->where('id', $id)->update($data);
121
122
		return $result;
123
	}
124
125
	/**
126
	 * Delete one or multiple record/s
127
	 *
128
	 * @param	int		ID/s of record
129
	 * @return	boolean
130
	 */
131 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...
132
	{
133
		$data = array('deleted' => '1');
134
		$result = $this->getDatabase()->table($this->getTable())->where('id', $ids)->update($data);
135
136
		return $result;
137
	}
138
139
	/**
140
	 * Return meeting data
141
	 *
142
	 * @return	string	html table
143
	 */
144
	public function getData($meetingId = null)
145
	{
146
		if(isset($meetingId)) {
147
			$data = $this->getDatabase()
148
				->table($this->getTable())
149
				->where('deleted ? AND id ?', '0', $meetingId)
150
				->fetch();
151
		} else {
152
			$data = $this->getDatabase()
153
				->table($this->getTable())
154
				->where('deleted', '0')
155
				->fetchAll();
156
		}
157
158
		if(!$data) {
159
			return 0;
160
		} else {
161
			return $data;
162
		}
163
	}
164
165
	/**
166
	 * @param  string $priceType cost|advance
167
	 * @return integer
168
	 */
169
	public function getPrice($priceType)
170
	{
171
		return $this->getDatabase()
172
			->table($this->getTable())
173
			->select($priceType)
174
			->where('id', $this->getMeetingId())
175
			->limit(1)
176
			->fetchField();
177
	}
178
179
	/**
180
	 * Render HTML Provinces <select>
181
	 *
182
	 * @param	int	ID of selected province
183
	 * @return	string	html <select>
184
	 */
185
	public function renderHtmlProvinceSelect($selectedProvince)
186
	{
187
		$html_select = "<select style='width: 195px; font-size: 10px' name='province'>\n";
188
189
		$result = $this->getDatabase()
190
			->table('kk_provinces')
191
			->fetchAll();
192
193
		foreach($result as $data) {
194
			if($data['id'] == $selectedProvince) {
195
				$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...
196
			}
197
			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...
198
			$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...
199
		}
200
201
		$html_select .= "</select>\n";
202
203
		return $html_select;
204
	}
205
206
	/** Public program same as getPrograms*/
207
	public function getPublicPrograms($blockId)
208
	{
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
				$blockId, '0')
218
			->fetchAll();
219
220
		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...
221
			$html = '';
222
		} else {
223
			$html = "<table>\n";
224
			$html .= " <tr>\n";
225
			foreach($result as $data) {
226
				$html .= "<td class='category cat-".$data['style']."' style='text-align:center;'>\n";
227
				$html .= "<a class='programLink' rel='programDetail' href='#' rel='programDetail' title='" . $this->program->getDetail($data['id'], 'program', $this->httpEncoding) . "'>" . $data['name'] . "</a>\n";
228
				$html .= "</td>\n";
229
			}
230
			$html .= " </tr>\n";
231
			$html .= "</table>\n";
232
		}
233
		return $html;
234
	}
235
236
	public function renderPublicProgramOverview($meetingId)
237
	{
238
		$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...
239
		$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...
240
241
		foreach($days as $dayKey => $dayVal) {
242
			$html .= "<table>\n";
243
			$html .= " <tr>\n";
244
			$html .= "  <td class='day' colspan='2' >" . $dayVal . "</td>\n";
245
			$html .= " </tr>\n";
246
247
			$result = $this->getDatabase()
248
				->query('SELECT	blocks.id AS id,
249
							day,
250
							DATE_FORMAT(`from`, "%H:%i") AS `from`,
251
							DATE_FORMAT(`to`, "%H:%i") AS `to`,
252
							blocks.name AS name,
253
							program,
254
							display_progs,
255
							style
256
					FROM kk_blocks AS blocks
257
					LEFT JOIN kk_categories AS cat ON cat.id = blocks.category
258
					WHERE blocks.deleted = ? AND day = ? AND meeting = ?
259
					ORDER BY `from` ASC',
260
					'0', $dayVal, $meetingId)
261
				->fetchAll();
262
263
			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...
264
				$html .= "<td class='emptyTable' style='width:400px;'>Nejsou žádná aktuální data.</td>\n";
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
					} else {
277
						$html .= "<td class='category cat-" . $data['style'] . "'>";
278
						$html .= "<a class='programLink rel='programDetail' href='#' rel='programDetail' title='" . $this->program->getDetail($data['id'], 'block', $this->httpEncoding) . "'>" . $data['name'] . "</a>\n";
279
						$html .= "</td>\n";
280
					}
281
					$html .= "</tr>\n";
282
				}
283
			}
284
			$html .= "</table>\n";
285
		}
286
287
		return $html;
288
	}
289
290
	/**
291
	 * @deprecated
292
	 *
293
	 * Render data in a table
294
	 *
295
	 * @return	string	html of a table
296
	 */
297
	public function renderData()
298
	{
299
		$result = $this->database
300
			->table($this->dbTable)
301
			->select('id,
302
					place,
303
					DATE_FORMAT(start_date, "%d. %m. %Y") AS start_date,
304
					DATE_FORMAT(end_date, "%d. %m. %Y") AS end_date,
305
					DATE_FORMAT(open_reg, "%d. %m. %Y %H:%i:%s") AS open_reg,
306
					DATE_FORMAT(close_reg, "%d. %m. %Y %H:%i:%s") AS close_reg,
307
					contact,
308
					email,
309
					gsm')
310
			->where('deleted', '0')
311
			->limit(30)
312
			->fetchAll();
313
314
		$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...
315
316
		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...
317
			$html_row .= "<tr class='radek1'>";
318
			$html_row .= "<td><img class='edit' src='" . IMG_DIR . "icons/edit2.gif' /></td>\n";
319
			$html_row .= "<td><img class='edit' src='" . IMG_DIR . "icons/delete2.gif' /></td>\n";
320
			$html_row .= "<td colspan='11' class='emptyTable'>Nejsou k dispozici žádné položky.</td>";
321
			$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...
322
		} else {
323
			foreach($result as $data) {
324
				$html_row .= "<tr class='radek1'>";
325
				$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";
326
				$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...
327
				$html_row .= "\t\t\t<td class='text'>".$data['id']."</td>\n";
328
				$html_row .= "\t\t\t<td class='text'>".$data['place']."</td>\n";
329
				$html_row .= "\t\t\t<td class='text'>".$data['start_date']."</td>\n";
330
				$html_row .= "\t\t\t<td class='text'>".$data['end_date']."</td>\n";
331
				$html_row .= "\t\t\t<td class='text'>".$data['open_reg']."</td>\n";
332
				$html_row .= "\t\t\t<td class='text'>".$data['close_reg']."</td>\n";
333
				$html_row .= "\t\t\t<td class='text'>".$data['contact']."</td>\n";
334
				$html_row .= "\t\t\t<td class='text'>".$data['email']."</td>\n";
335
				$html_row .= "\t\t\t<td class='text'>".$data['gsm']."</td>\n";
336
				$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...
337
			}
338
		}
339
340
		// table head
341
		$html_thead = "\t<tr>\n";
342
		$html_thead .= "\t\t<th></th>\n";
343
		$html_thead .= "\t\t<th></th>\n";
344
		$html_thead .= "\t\t<th class='tab1'>id</th>\n";
345
		$html_thead .= "\t\t<th class='tab1'>místo</th>\n";
346
		$html_thead .= "\t\t<th class='tab1'>začátek</th>\n";
347
		$html_thead .= "\t\t<th class='tab1'>konec</th>\n";
348
		$html_thead .= "\t\t<th class='tab1'>otevření registrace</th>\n";
349
		$html_thead .= "\t\t<th class='tab1'>uzavření registrace</th>\n";
350
		$html_thead .= "\t\t<th class='tab1'>kontakt</th>\n";
351
		$html_thead .= "\t\t<th class='tab1'>e-mail</th>\n";
352
		$html_thead .= "\t\t<th class='tab1'>telefon</th>\n";
353
		$html_thead .= "\t</tr>\n";
354
355
		// table foot
356
		$html_tfoot = $html_thead;
357
358
		// table
359
		$html_table = "<table id='MeetingsTable' class='list tablesorter'>\n";
360
		$html_table .= "\t<thead>\n";
361
		$html_table .= $html_thead;
362
		$html_table .= "\t</thead>\n";
363
		$html_table .= "\t<tfoot>\n";
364
		$html_table .= $html_tfoot;
365
		$html_table .= "\t</tfoot>\n";
366
		$html_table .= "\t<tbody>\n";
367
		$html_table .= $html_row;
368
		$html_table .= "\t</tbody>\n";
369
		$html_table .= "</table>\n";
370
371
		return $html_table;
372
	}
373
374
	/**
375
	 * @param  integer $meetingId
376
	 * @return $this
377
	 */
378
	public function setRegistrationHandlers($meetingId = 1)
379
	{
380
		$meeting = $this->getDatabase()
381
			->table($this->getTable())
382
			->select('id')
383
			->select('place')
384
			->select('DATE_FORMAT(start_date, "%Y") AS year')
385
			->select('UNIX_TIMESTAMP(open_reg) AS open_reg')
386
			->select('UNIX_TIMESTAMP(close_reg) AS close_reg')
387
			->where('id', $meetingId)
388
			->order('id DESC')
389
			->limit(1)
390
			->fetch();
391
392
		$this->setRegHeading($meeting->place . ' ' . $meeting->year);
393
		$this->setRegClosing($meeting->close_reg);
394
		$this->setRegOpening($meeting->open_reg);
395
396
		return $this;
397
	}
398
399
	/**
400
	 * @return string
401
	 */
402
	public function getRegOpening()
403
	{
404
		return $this->regOpening;
405
	}
406
407
	/**
408
	 * @param  string $value
409
	 * @return $this
410
	 */
411
	public function setRegOpening($value = '')
412
	{
413
		$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...
414
415
		return $this;
416
	}
417
418
	/**
419
	 * @return string
420
	 */
421
	public function getRegClosing()
422
	{
423
		return $this->regClosing;
424
	}
425
426
	/**
427
	 * @param  string $value
428
	 * @return $this
429
	 */
430
	public function setRegClosing($value = '')
431
	{
432
		$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...
433
434
		return $this;
435
	}
436
437
	/**
438
	 * @return string
439
	 */
440
	public function getRegHeading()
441
	{
442
		return $this->regHeading;
443
	}
444
445
	/**
446
	 * @param  string $value
447
	 * @return $this
448
	 */
449
	public function setRegHeading($value = '')
450
	{
451
		$this->regHeading = $value;
452
453
		return $this;
454
	}
455
456
	/**
457
	 * Is registration open?
458
	 *
459
	 * @return 	boolean
460
	 */
461
	public function isRegOpen($debug = false)
462
	{
463
		return (($this->getRegOpening() < time()) && (time() < $this->getRegClosing()) || $debug);
464
	}
465
466
	/**
467
	 * @param  integer $id
468
	 * @return string
469
	 */
470
	public function getProvinceNameById($id)
471
	{
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