1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
|
<?php
use Engelsystem\Database\DB;
/**
* Get event config.
*
* @return array|null
*/
function EventConfig()
{
return DB::selectOne('SELECT * FROM `EventConfig` LIMIT 1');
}
/**
* Update event config.
*
* @param string $event_name
* @param int $buildup_start_date
* @param int $event_start_date
* @param int $event_end_date
* @param int $teardown_end_date
* @param string $event_welcome_msg
* @return int Rows updated
*/
function EventConfig_update(
$event_name,
$buildup_start_date,
$event_start_date,
$event_end_date,
$teardown_end_date,
$event_welcome_msg
) {
if (EventConfig() == null) {
return DB::insert('
INSERT INTO `EventConfig` (
`event_name`,
`buildup_start_date`,
`event_start_date`,
`event_end_date`,
`teardown_end_date`,
`event_welcome_msg`
)
VALUES (?, ?, ?, ?, ?, ?)
',
[
$event_name,
$buildup_start_date,
$event_start_date,
$event_end_date,
$teardown_end_date,
$event_welcome_msg
]
);
}
return DB::update('
UPDATE `EventConfig` SET
`event_name` = ?,
`buildup_start_date` = ?,
`event_start_date` = ?,
`event_end_date` = ?,
`teardown_end_date` = ?,
`event_welcome_msg` = ?
',
[
$event_name,
$buildup_start_date,
$event_start_date,
$event_end_date,
$teardown_end_date,
$event_welcome_msg,
]
);
}
|