engelsystem/includes/model/Settings_model.php

44 lines
1.5 KiB
PHP
Raw Normal View History

2016-07-14 10:19:38 +02:00
<?php
2016-09-27 17:24:18 +02:00
2016-07-14 10:19:38 +02:00
/**
2016-09-27 17:24:18 +02:00
* Get settings.
2016-07-14 10:19:38 +02:00
*/
2016-09-27 17:24:18 +02:00
function Settings() {
$settings = sql_select("SELECT * FROM `Settings` LIMIT 1");
if ($settings === false)
return false;
if (count($settings) > 0)
return $settings[0];
return null;
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:24:18 +02:00
* Update Settings.
2016-07-14 10:19:38 +02:00
*
* @param string $event_name
2016-09-27 17:24:18 +02:00
* @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
2016-07-14 10:19:38 +02:00
*/
2016-09-27 17:24:18 +02:00
function Settings_update($event_name, $buildup_start_date, $event_start_date, $event_end_date, $teardown_end_date, $event_welcome_msg) {
if (Settings() == null) {
return sql_query("INSERT INTO `Settings` SET
`event_name`=" . sql_null($event_name) . ",
`buildup_start_date`=" . sql_null($buildup_start_date) . ",
`event_start_date`=" . sql_null($event_start_date) . ",
`event_end_date`=" . sql_null($event_end_date) . ",
`teardown_end_date`=" . sql_null($teardown_end_date) . ",
`event_welcome_msg`=" . sql_null($event_welcome_msg));
}
return sql_query("UPDATE `Settings` SET
`event_name`=" . sql_null($event_name) . ",
`buildup_start_date`=" . sql_null($buildup_start_date) . ",
`event_start_date`=" . sql_null($event_start_date) . ",
`event_end_date`=" . sql_null($event_end_date) . ",
`teardown_end_date`=" . sql_null($teardown_end_date) . ",
`event_welcome_msg`=" . sql_null($event_welcome_msg));
2016-07-14 10:19:38 +02:00
}
?>