summaryrefslogtreecommitdiff
path: root/includes/model/EventConfig_model.php
diff options
context:
space:
mode:
authormsquare <msquare@notrademark.de>2016-09-27 17:49:13 +0200
committermsquare <msquare@notrademark.de>2016-09-27 17:49:39 +0200
commit031fc3057c46245cd62fc39f2d11ee3f0a393e06 (patch)
treeba0b4fbf68e7bc8e706d1ee6dd8b9d2987dd9c65 /includes/model/EventConfig_model.php
parent45bbf95972777e9499996d56a873c2a304815b3f (diff)
rename settings to event config and implement mvc pattern on it
Diffstat (limited to 'includes/model/EventConfig_model.php')
-rw-r--r--includes/model/EventConfig_model.php43
1 files changed, 43 insertions, 0 deletions
diff --git a/includes/model/EventConfig_model.php b/includes/model/EventConfig_model.php
new file mode 100644
index 00000000..57ba1d0f
--- /dev/null
+++ b/includes/model/EventConfig_model.php
@@ -0,0 +1,43 @@
+<?php
+
+/**
+ * Get settings.
+ */
+function EventConfig() {
+ $settings = sql_select("SELECT * FROM `EventConfig` LIMIT 1");
+ if ($settings === false)
+ return false;
+ if (count($settings) > 0)
+ return $settings[0];
+ return null;
+}
+
+/**
+ * Update Settings.
+ *
+ * @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
+ */
+function EventConfig_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 `EventConfig` 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 `EventConfig` 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));
+}
+?>