Subversion-Projekte lars-tiefland.em_wm

Revision

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

Revision 16 Revision 18
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_namme=addslashes(isset($_POST["g_name"])?$_POST["name"]:"");
-
 
11
	switch ($mode)
-
 
12
	{
-
 
13
		case "edit":
-
 
14
			$title="Spiel $id ändern";
-
 
15
			$new_mode="update";
-
 
16
			break;
-
 
17
		case "new":
-
 
18
			$title="neues Spiel eingeben";
-
 
19
			$new_mode="save";
-
 
20
			break;
-
 
21
		case "del":
-
 
22
		case "ask":
-
 
23
			$title="Spiel $id löschen";
-
 
24
			$new_mode="update";
-
 
25
			break;
-
 
26
		case "save":
-
 
27
			$title="neues Spiel speichern";
-
 
28
			$new_mode="update";
-
 
29
			break;
-
 
30
		case "update":
-
 
31
			$title="Spiel $id speichern";
-
 
32
			$new_mode="update";
-
 
33
			break;
-
 
34
	}
6
	if ($mode=="edit" OR $mode=="new")
35
	if ($mode=="edit" OR $mode=="new")
7
	{
36
	{
8
		$t_namen[]="Bitte wählen!";
37
		$t_namen[]="Bitte wählen!";
9
		$t_ids[]=-1;
38
		$t_ids[]=-1;
-
 
39
		$typ_namen[]="Bitte wählen!";
-
 
40
		$typ_ids[]=-1;
10
		$l_namen[]="Bitte wählen!";
41
		$l_namen[]="Bitte wählen!";
11
		$l_ids[]=-1;
42
		$l_ids[]=-1;
12
		$g_l=Gruppe::listeGruppe(0,0);
43
		$g_l=Gruppe::listeGruppe(0,0);
13
		while($row_g=$g_l->fetchRow(DB_FETCHMODE_ASSOC))
44
		while($row_g=$g_l->fetchRow(DB_FETCHMODE_ASSOC))
14
		{
45
		{
Zeile 24... Zeile 55...
24
				$t_id=$row_t["t_id"];
55
				$t_id=$row_t["t_id"];
25
				$t_namen[]=$t_name;
56
				$t_namen[]=$t_name;
26
				$t_ids[]=$t_id;
57
				$t_ids[]=$t_id;
27
  			}
58
  			}
28
		}
59
		}
29
		$sql_l="SELECT * FROM locations";
-
 
30
		$l_l=$db->query($sql_l);
60
		$l_l=Ort::listeOrt(0,0);
31
		while ($row_l=$l_l->fetchRow(DB_FETCHMODE_ASSOC))
61
		while ($row_l=$l_l->fetchRow(DB_FETCHMODE_ASSOC))
32
		{
62
		{
33
			$l_name=$row_l["l_name"];
63
			$l_name=$row_l["l_name"];
34
			$l_id=$row_l["l_id"];
64
			$l_id=$row_l["l_id"];
35
			$l_namen[]=$l_name;
65
			$l_namen[]=$l_name;
36
			$l_ids[]=$l_id;
66
			$l_ids[]=$l_id;
37
  		}
67
  		}
-
 
68
		$typ_l=Typ::listeTyp(0,0);
-
 
69
		while ($row_typ=$typ_l->fetchRow(DB_FETCHMODE_ASSOC))
-
 
70
		{
-
 
71
			$typ_name=$row_typ["t_name"];
-
 
72
			$typ_id=$row_typ["t_id"];
-
 
73
			$typ_namen[]=$typ_name;
-
 
74
			$typ_ids[]=$typ_id;
-
 
75
		}
38
  		$game=new Spiele($id);
76
		$game=new Spiele($id);
39
  		$smarty->assign("s_name", $game->g_name);
77
		$smarty->assign("s_name", $game->g_name);
-
 
78
		$smarty->assign("akt_typ_id", $game->g_type);
40
  		$smarty->assign("akt_m1_id", $game->g_m1);
79
		$smarty->assign("akt_m1_id", $game->g_m1);
41
  		$smarty->assign("akt_m2_id", $game->g_m2);
80
		$smarty->assign("akt_m2_id", $game->g_m2);
42
  		$smarty->assign("akt_l_id", $game->g_location);
81
		$smarty->assign("akt_l_id", $game->g_location);
43
  		$smarty->assign("s_g1", $game->g_g1);
82
		$smarty->assign("s_g1", $game->g_g1);
44
  		$smarty->assign("s_g2", $game->g_g2);
83
		$smarty->assign("s_g2", $game->g_g2);
45
  		$smarty->assign("t_namen", $t_namen);
84
		$smarty->assign("t_namen", $t_namen);
46
  		$smarty->assign("t_ids", $t_ids);
85
		$smarty->assign("t_ids", $t_ids);
-
 
86
		$smarty->assign("typ_namen", $typ_namen);
-
 
87
		$smarty->assign("typ_ids", $typ_ids);
47
  		$smarty->assign("l_ids", $l_ids);
88
		$smarty->assign("l_ids", $l_ids);
48
  		$smarty->assign("l_namen", $l_namen);
89
		$smarty->assign("l_namen", $l_namen);
-
 
90
		$smarty->assign("mode", $new_mode);
-
 
91
		$smarty->assign("title", $title);
49
		$smarty->display("edit_games.tpl");
92
		$smarty->display("edit_games.tpl");
50
	}
93
	}
-
 
94
	else
-
 
95
	{
-
 
96
		switch ($mode)
-
 
97
		{
-
 
98
			case "save":
-
 
99
				$sql="INSERT INTO games (g_name, g_m1, g_m2, g_g1, g_g2, g_location, g_date, g_time, g_type)
-
 
100
					VALUES ('$g_name', $g_m1, $g_m2, $g_g1, $g_g2, $g_location, $g_date, $g_time, $g_type)";
-
 
101
				break;
-
 
102
				
-
 
103
		}
-
 
104
	}
51
?>
105
?>