Subversion-Projekte lars-tiefland.em_wm

Revision

Revision 30 | Revision 32 | Zur aktuellen Revision | Ganze Datei anzeigen | Leerzeichen ignorieren | Details | Blame | Letzte Änderung | Log anzeigen | RSS feed

Revision 30 Revision 31
Zeile 1... Zeile 1...
1
<?
1
<?
2
	define("IN_ADMIN", true);
2
	define("IN_ADMIN", true);
3
	require("include/common.php");
3
	require("include/common.php");
4
	$mode=isset($_POST["mode"])?$_POST["mode"]:"";
4
	$mode=isset($_POST["mode"])?$_POST["mode"]:"";
5
	$id=intval(isset($_POST["id"])?$_POST["id"]:0);
5
	$id=intval(isset($_POST["id"])?$_POST["id"]:0);
6
	$g_m1=intval(isset($_POST["g_m1"])?$_POST["g_m1"]:-1);
-
 
7
	$g_m2=intval(isset($_POST["g_m2"])?$_POST["g_m2"]:-1);
-
 
8
	$g_g1=intval(isset($_POST["g_g1"])?$_POST["g_g1"]:-1);
-
 
9
	$g_g2=intval(isset($_POST["g_g2"])?$_POST["g_g2"]:-1);
-
 
10
	$g_location=intval(isset($_POST["g_location"])?$_POST["g_location"]:-1);
-
 
11
	$g_type=intval(isset($_POST["g_typ"])?$_POST["g_typ"]:-1);
-
 
12
	$g_name=addslashes(isset($_POST["g_name"])?$_POST["g_name"]:"");
-
 
13
	$month=intval(isset($_POST["Month"])?$_POST["Month"]:-1);
-
 
14
	$day=intval(isset($_POST["Day"])?$_POST["Day"]:-1);
-
 
15
	$hour=intval(isset($_POST["Hour"])?$_POST["Hour"]:-1);
-
 
16
	$g_date=mktime($hour, 0, 0, $month, $day, 2006);
-
 
17
	switch ($mode)
6
	function fill_form()
18
	{
-
 
19
		case "edit":
-
 
20
			$title="Spiel $id ändern";
-
 
21
			$new_mode="update";
-
 
22
			break;
-
 
23
		case "new":
-
 
24
			$title="neues Spiel eingeben";
-
 
25
			$new_mode="save";
-
 
26
			break;
-
 
27
		case "del":
-
 
28
		case "ask":
-
 
29
			$title="Spiel $id löschen";
-
 
30
			$new_mode="update";
-
 
31
			break;
-
 
32
		case "save":
-
 
33
			$title="neues Spiel speichern";
-
 
34
			$new_mode="update";
-
 
35
			break;
-
 
36
		case "update":
-
 
37
			$title="Spiel $id speichern";
-
 
38
			$new_mode="update";
-
 
39
			break;
-
 
40
	}
-
 
41
	if ($mode=="edit" OR $mode=="new")
-
 
42
	{
7
	{
-
 
8
		global $db, $smarty, $id, $new_mode, $g_date;
43
		$t_namen[]="Bitte wählen!";
9
		$t_namen[]="Bitte wählen!";
44
		$t_ids[]=-1;
10
		$t_ids[]=-1;
45
		$typ_namen[]="Bitte wählen!";
11
		$typ_namen[]="Bitte wählen!";
46
		$typ_ids[]=-1;
12
		$typ_ids[]=-1;
47
		$l_namen[]="Bitte wählen!";
13
		$l_namen[]="Bitte wählen!";
Zeile 80... Zeile 46...
80
			$typ_ids[]=$typ_id;
46
			$typ_ids[]=$typ_id;
81
		}
47
		}
82
		$game=new Spiele($id);
48
		$game=new Spiele($id);
83
		$smarty->assign("id", $id);
49
		$smarty->assign("id", $id);
84
		$smarty->assign("g_name", $game->g_name);
50
		$smarty->assign("g_name", $game->g_name);
85
		$smarty->assign("g_date", $game->g_date);
51
		$smarty->assign("g_date", (!isset($g_date)?$game->g_date:$g_date));
86
		$smarty->assign("akt_typ_id", $game->g_type);
52
		$smarty->assign("akt_typ_id", $game->g_type);
87
		$smarty->assign("akt_m1_id", $game->g_m1);
53
		$smarty->assign("akt_m1_id", $game->g_m1);
88
		$smarty->assign("akt_m2_id", $game->g_m2);
54
		$smarty->assign("akt_m2_id", $game->g_m2);
89
		$smarty->assign("akt_l_id", $game->g_location);
55
		$smarty->assign("akt_l_id", $game->g_location);
90
		$smarty->assign("g_g1", $game->g_g1);
56
		$smarty->assign("g_g1", $game->g_g1);
Zeile 97... Zeile 63...
97
		$smarty->assign("l_namen", $l_namen);
63
		$smarty->assign("l_namen", $l_namen);
98
		$smarty->assign("mode", $new_mode);
64
		$smarty->assign("mode", $new_mode);
99
		$smarty->assign("title", $title);
65
		$smarty->assign("title", $title);
100
		$smarty->display("edit_games.tpl");
66
		$smarty->display("edit_games.tpl");
101
	}
67
	}
-
 
68
	
-
 
69
	$g_m1=intval(isset($_POST["g_m1"])?$_POST["g_m1"]:-1);
-
 
70
	$g_m2=intval(isset($_POST["g_m2"])?$_POST["g_m2"]:-1);
-
 
71
	$g_g1=intval(isset($_POST["g_g1"])?$_POST["g_g1"]:-1);
-
 
72
	$g_g2=intval(isset($_POST["g_g2"])?$_POST["g_g2"]:-1);
-
 
73
	$g_location=intval(isset($_POST["g_location"])?$_POST["g_location"]:-1);
-
 
74
	$g_type=intval(isset($_POST["g_typ"])?$_POST["g_typ"]:-1);
-
 
75
	$g_name=addslashes(isset($_POST["g_name"])?$_POST["g_name"]:"");
-
 
76
	$month=intval(isset($_POST["Month"])?$_POST["Month"]:-1);
-
 
77
	$day=intval(isset($_POST["Day"])?$_POST["Day"]:-1);
-
 
78
	$hour=intval(isset($_POST["Hour"])?$_POST["Hour"]:-1);
-
 
79
	$g_date=mktime($hour, 0, 0, $month, $day, 2006);
-
 
80
	switch ($mode)
-
 
81
	{
-
 
82
		case "edit":
-
 
83
			$title="Spiel $id ändern";
-
 
84
			$new_mode="update";
-
 
85
			break;
-
 
86
		case "new":
-
 
87
			$title="neues Spiel eingeben";
-
 
88
			$new_mode="save";
-
 
89
			break;
-
 
90
		case "del":
-
 
91
		case "ask":
-
 
92
			$title="Spiel $id löschen";
-
 
93
			$new_mode="update";
-
 
94
			break;
-
 
95
		case "save":
-
 
96
			$title="neues Spiel speichern";
-
 
97
			$new_mode="update";
-
 
98
			break;
-
 
99
		case "update":
-
 
100
			$title="Spiel $id speichern";
-
 
101
			$new_mode="update";
-
 
102
			break;
-
 
103
	}
-
 
104
	if ($mode=="edit" OR $mode=="new")
-
 
105
	{
-
 
106
		fill_form();
-
 
107
	}
102
	else
108
	else
103
	{
109
	{
104
		switch ($mode)
110
		switch ($mode)
105
		{
111
		{
106
			case "save":
112
			case "save":
107
			case "del":
113
			case "del":
108
			case "update":
114
			case "update":
109
				$g=new Spiele($id);
-
 
110
				$g->update($g_name, $g_m1, $g_m2, $g_g1, $g_g2, $g_location, $g_date, $g_type);
-
 
111
				$res=$g->save($mode);
-
 
112
				if (true == DB::isError($res))
115
				if (!checkdate($month, $day, $config->year))
113
				{
116
				{
114
					$smarty->assign("meld", "Ein Fehler ist aufgetreten!");
117
					$meld="Ein Fehler ist aufgetreten!";
-
 
118
					$db_meld="$day.$month.$config->year ist kein gültiges Datum!";
-
 
119
						$error=true;
115
					$smarty->assign("db_meld", $res->getUserInfo());
120
					$smarty->assign("db_meld", $db_meld);
116
					$smarty->assign("error", true);
121
					$smarty->assign("error", $error);
-
 
122
					$smarty->assign("meld", $meld);
-
 
123
					fill_form();
117
				}
124
				}
118
				else
125
				else
119
				{
126
				{
-
 
127
					$g=new Spiele($id);
-
 
128
					$g->update($g_name, $g_m1, $g_m2, $g_g1, $g_g2, $g_location, $g_date, $g_type);
-
 
129
					$res=$g->save($mode);
120
					if ($mode=="save")
130
					if (true == DB::isError($res))
121
					{
131
					{
122
						$akt="hinzugefügt";
132
						$smarty->assign("meld", "Ein Fehler ist aufgetreten!");
123
					}
-
 
124
					elseif ($mode=="update")
133
						$smarty->assign("db_meld", $res->getUserInfo());
125
					{
-
 
126
						$akt="geändert";
134
						$smarty->assign("error", true);
127
					}
135
					}
128
					else
136
					else
129
					{
137
					{
-
 
138
						if ($mode=="save")
-
 
139
						{
-
 
140
							$akt="hinzugefügt";
-
 
141
						}
-
 
142
						elseif ($mode=="update")
-
 
143
						{
-
 
144
							$akt="geändert";
-
 
145
						}
-
 
146
						else
-
 
147
						{
130
						$akt="gelöscht";
148
							$akt="gelöscht";
-
 
149
						}
-
 
150
						$smarty->assign("meld", "Datensatz erfolgreich $akt!");
-
 
151
						$smarty->assign("db_meld", "");
-
 
152
						$smarty->assign("error", false);
131
					}
153
					}
132
					$smarty->assign("meld", "Datensatz erfolgreich $akt!");
-
 
133
					$smarty->assign("db_meld", "");
154
					$smarty->display("meld.tpl");
134
					$smarty->assign("error", false);
-
 
135
				}
155
				}
136
				$smarty->display("meld.tpl");
-
 
137
				break;
156
				break;
138
			case "ask":
157
			case "ask":
139
				break;
158
				break;
140
			default:
159
			default:
141
				$smarty->assign("meld","Ein Fehler ist aufgetreten!");
160
				$smarty->assign("meld","Ein Fehler ist aufgetreten!");
142
				$smarty->assign("db_meld", "Ungültiger Modsu!");
161
				$smarty->assign("db_meld", "Ungültiger Modsu!");
143
				$smarty->assign("error", true);
162
				$smarty->assign("error", true);
144
				$smrty->display("meld.tpl");
163
				$smarty->display("meld.tpl");
145
		}
164
		}
146
	}
165
	}
147
?>
166
?>