2016-07-14 10:19:38 +02:00
|
|
|
<?php
|
2016-09-27 17:24:18 +02:00
|
|
|
|
2017-01-21 13:58:53 +01:00
|
|
|
use Engelsystem\Database\DB;
|
|
|
|
|
2016-07-14 10:19:38 +02:00
|
|
|
/**
|
2016-09-27 17:59:28 +02:00
|
|
|
* Get event config.
|
2017-01-03 03:22:48 +01:00
|
|
|
*
|
2017-01-21 13:58:53 +01:00
|
|
|
* @return array|null
|
2016-07-14 10:19:38 +02:00
|
|
|
*/
|
2017-01-02 03:57:23 +01:00
|
|
|
function EventConfig()
|
|
|
|
{
|
2017-01-21 13:58:53 +01:00
|
|
|
$event_config = DB::select('SELECT * FROM `EventConfig` LIMIT 1');
|
|
|
|
|
|
|
|
if (empty($event_config)) {
|
|
|
|
return null;
|
2017-01-02 03:57:23 +01:00
|
|
|
}
|
2017-01-21 13:58:53 +01:00
|
|
|
|
|
|
|
return array_shift($event_config);
|
2016-07-14 10:19:38 +02:00
|
|
|
}
|
2016-09-27 17:24:18 +02:00
|
|
|
|
2016-07-14 10:19:38 +02:00
|
|
|
/**
|
2016-09-27 17:59:28 +02:00
|
|
|
* Update event config.
|
2016-07-14 10:19:38 +02:00
|
|
|
*
|
2017-01-02 03:57:23 +01:00
|
|
|
* @param string $event_name
|
2017-01-02 15:43:36 +01:00
|
|
|
* @param int $buildup_start_date
|
|
|
|
* @param int $event_start_date
|
|
|
|
* @param int $event_end_date
|
|
|
|
* @param int $teardown_end_date
|
2017-01-02 03:57:23 +01:00
|
|
|
* @param string $event_welcome_msg
|
2017-07-23 11:46:54 +02:00
|
|
|
* @return int Rows updated
|
2016-07-14 10:19:38 +02:00
|
|
|
*/
|
2017-01-02 15:43:36 +01:00
|
|
|
function EventConfig_update(
|
|
|
|
$event_name,
|
|
|
|
$buildup_start_date,
|
|
|
|
$event_start_date,
|
|
|
|
$event_end_date,
|
|
|
|
$teardown_end_date,
|
|
|
|
$event_welcome_msg
|
|
|
|
) {
|
2017-01-02 03:57:23 +01:00
|
|
|
if (EventConfig() == null) {
|
2017-01-21 13:58:53 +01:00
|
|
|
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
|
|
|
|
]
|
|
|
|
);
|
2017-01-02 03:57:23 +01:00
|
|
|
}
|
2017-01-03 03:22:48 +01:00
|
|
|
|
2017-07-19 21:28:26 +02:00
|
|
|
return DB::update('
|
2017-01-21 13:58:53 +01:00
|
|
|
UPDATE `EventConfig` SET
|
|
|
|
`event_name` = ?,
|
|
|
|
`buildup_start_date` = ?,
|
|
|
|
`event_start_date` = ?,
|
|
|
|
`event_end_date` = ?,
|
2017-01-22 01:02:52 +01:00
|
|
|
`teardown_end_date` = ?,
|
2017-01-21 13:58:53 +01:00
|
|
|
`event_welcome_msg` = ?
|
|
|
|
',
|
|
|
|
[
|
|
|
|
$event_name,
|
|
|
|
$buildup_start_date,
|
|
|
|
$event_start_date,
|
|
|
|
$event_end_date,
|
|
|
|
$teardown_end_date,
|
|
|
|
$event_welcome_msg,
|
|
|
|
]
|
|
|
|
);
|
2016-07-14 10:19:38 +02:00
|
|
|
}
|