From 8297d3ba41a4728a84aab5996fa6efe70b67093d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Philip=20H=C3=A4usler?= Date: Thu, 2 Jun 2011 17:30:17 +0200 Subject: [PATCH] begin angel types --- includes/pages/admin_angel_types.php | 138 +++++++++++++++++++++++++++ includes/sys_menu.php | 1 + templates/admin_angel_types.html | 41 ++++++++ www-ssl/index.php | 4 + 4 files changed, 184 insertions(+) create mode 100644 includes/pages/admin_angel_types.php create mode 100644 templates/admin_angel_types.html diff --git a/includes/pages/admin_angel_types.php b/includes/pages/admin_angel_types.php new file mode 100644 index 00000000..e5952d10 --- /dev/null +++ b/includes/pages/admin_angel_types.php @@ -0,0 +1,138 @@ +\nhier hast du die Möglichkeit, neue Engeltypen für die Schichtpläne einzutragen " . + "oder vorhandene abzuändern:

\n"; + + echo "- Neuen EngelType eintragen
\n"; + + echo "\n"; + echo "\n"; + + for ($i = 1; $i < mysql_num_fields($Erg); $i++) { + echo "\t"; + } + echo "\t"; + echo ""; + + for ($t = 0; $t < mysql_num_rows($Erg); $t++) { + echo "\t\n"; + for ($j = 1; $j < mysql_num_fields($Erg); $j++) { + echo "\t\t\n"; + } + echo "\t\t\n"; + echo "\t\n"; + } // ende Auflistung Raeume + echo "
" . mysql_field_name($Erg, $i) . "Ändern
" . mysql_result($Erg, $t, $j) . "###
"; + } else { + + switch ($_GET["action"]) { + + case 'new' : + echo "Neuen EngelType einrichten:
"; + echo "
\n"; + echo "\n"; + + for ($Uj = 1; $Uj < mysql_num_fields($Erg); $Uj++) { + echo "" . + "\n"; + } + echo "
" . mysql_field_name($Erg, $Uj) . "
\n"; + echo "\n"; + echo "\n"; + echo "
"; + break; + + case 'newsave' : + $vars = $_GET; + $count = count($vars) - 1; + $vars = array_splice($vars, 0, $count); + $Keys = ""; + $Values = ""; + foreach ($vars as $key => $value) { + $Keys .= ", `$key`"; + $Values .= ", '$value'"; + } + + if (runSQL_log("INSERT INTO `EngelType` (" . substr($Keys, 2) . ") VALUES (" . substr($Values, 2) . ")", "save new EngelType")) { + SetHeaderGo2Back(); + + $SQL2 = "SELECT * FROM `EngelType` WHERE `Name`='" . $_GET["Name"] . "'"; + $ERG = mysql_query($SQL2, $con); + + if (mysql_num_rows($ERG) == 1) + runSQL_log("ALTER TABLE `Room` ADD `DEFAULT_EID_" . mysql_result($ERG, 0, 0) . + "` INT DEFAULT '0' NOT NULL;", "add new EngelType in Romm Table"); + } + break; + + case 'change' : + if (!IsSet ($_GET["TID"])) + echo "Fehlerhafter Aufruf!"; + else { + echo "Raum abändern:\n"; + echo "Hier kannst du eintragen, den EngelType ändern."; + echo "
\n"; + echo "\n"; + + $SQL2 = "SELECT * FROM `EngelType` WHERE `TID`='" . $_GET["TID"] . "'"; + $ERG = mysql_query($SQL2, $con); + + for ($Uj = 1; $Uj < mysql_num_fields($ERG); $Uj++) + echo "" . + "\n"; + + echo "
" . mysql_field_name($ERG, $Uj) . "
\n"; + echo "\n"; + echo "\n"; + echo "\n"; + echo "
"; + echo "
\n"; + echo "\n"; + echo "\n"; + echo ""; + echo "
"; + } + break; + + case 'changesave' : + $vars = $_GET; + $count = count($vars) - 2; + $vars = array_splice($vars, 0, $count); + $keys = ""; + $sql = ""; + foreach ($vars as $key => $value) { + $keys = substr($key, 1); + $sql .= ", `" . $keys . "`='" . $value . "'"; + } + runSQL_log("UPDATE `EngelType` SET " . substr($sql, 2) . " WHERE `TID`='" . $_GET["eTID"] . "'", "Save Change EngelType"); + SetHeaderGo2Back(); + break; + + case 'delete' : + if (IsSet ($_GET["TID"])) { + if (runSQL_log("DELETE FROM `EngelType` WHERE `TID`='" . $_GET["TID"] . "'", "delete EngelType")) + runSQL_log("ALTER TABLE `Room` DROP `DEFAULT_EID_" . $_GET["TID"] . "`;", "delete EngelType in Room Table"); + } else + echo "Fehlerhafter Aufruf"; + SetHeaderGo2Back(); + break; + } + } + + include ("includes/footer.php"); +} +?> diff --git a/includes/sys_menu.php b/includes/sys_menu.php index 924d8e64..3b8847de 100644 --- a/includes/sys_menu.php +++ b/includes/sys_menu.php @@ -26,6 +26,7 @@ function make_navigation() { // Admin Navigation $menu .= make_navigation_for(Get_Text('admin/'), array ( + "admin_angel_types", "admin_rooms" )); return $menu; diff --git a/templates/admin_angel_types.html b/templates/admin_angel_types.html new file mode 100644 index 00000000..4ad8e9f1 --- /dev/null +++ b/templates/admin_angel_types.html @@ -0,0 +1,41 @@ +Angel types: + + + + + + + + + + %table% + +
+ Name + + Man + + Action +
+
+

Create new Angel type:

+
+ + + + + + + + + +
+ Name + + +
+ Man + + +
+
\ No newline at end of file diff --git a/www-ssl/index.php b/www-ssl/index.php index 184702c8..e8c900a5 100644 --- a/www-ssl/index.php +++ b/www-ssl/index.php @@ -45,6 +45,10 @@ if (in_array($p, $privileges)) { require_once ('includes/pages/guest_login.php'); $content = guest_logout(); } + elseif ($p == "admin_angel_types") { + require_once ('includes/pages/admin_angel_types.php'); + $content = admin_angel_types(); + } elseif ($p == "admin_rooms") { require_once ('includes/pages/admin_rooms.php'); $content = admin_rooms();