summaryrefslogtreecommitdiff
path: root/includes/model/EventConfig_model.php
blob: ac8d5e7252e315c92271f5ad8a9c74e64cca0994 (plain)
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
<?php

/**
 * Get event config.
 */
function EventConfig() {
  $event_config = sql_select("SELECT * FROM `EventConfig` LIMIT 1");
  if ($event_config === false) {
    return false;
  }
  if (count($event_config) > 0) {
    return $event_config[0];
  }
  return null;
}

/**
 * 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          
 */
function EventConfig_update($event_name, $buildup_start_date, $event_start_date, $event_end_date, $teardown_end_date, $event_welcome_msg) {
  if (EventConfig() == 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));
}
?>