24 include(
"inc/common.php");
37 $displayProductionFacility = FALSE;
38 $displayStatus = FALSE;
39 $displayCategory = FALSE;
41 $smarty->assign(
'displayProductionFacility', $displayProductionFacility);
42 $smarty->assign(
'displayStatus', $displayStatus);
43 $smarty->assign(
'displayCategory', $displayCategory);
44 $smarty->assign(
'displayCar', $displayCar);
48 if(isset($_GET[
'production_facility_id']) && ctype_digit($_GET[
'production_facility_id'])) {
50 $productionFacilityId = $_GET[
'production_facility_id'];
53 if(isset($_GET[
'ajax']) && ctype_digit($_GET[
'ajax'])) {
54 if ($_GET[
'ajax'] == 1) {
55 if(isset($_GET[
'unlock']) && ctype_digit($_GET[
'unlock'])) {
56 if ($_GET[
'unlock'] == 1) {
70 $errors [] =
'Dieser Eintrag wird gerade von einem anderen Benutzer bearbeitet und ist gesperrt!';
83 if(isset($_POST[
'delete']) && ctype_digit($_POST[
'delete'])) {
84 if($_POST[
'delete'] == $productionFacilityId){
86 $successes[] =
"Die Fertigungsmöglichkeit wurde erfolgreich gelöscht.";
90 $errors [] =
"Ein Datenbankfehler ist aufgetreten (eventuell wird die Fertigungsmöglichkeit noch benutzt).";
96 $update = htmlSpecialChars(trim($_POST[
'update']), ENT_QUOTES);
98 if(strcmp($productionFacilityDetails[
'name'], $update) != 0) {
101 $successes[] =
"Der 'Name' wurde erfolgreich aktualisiert.";
106 $errors[] =
"Geben Sie einen gültigen 'Namen'.";
107 $productionFacilityDetails[
'name'] = $update;
111 $displayProductionFacility = TRUE;
113 $smarty->assign(
'production_facilities', $productionFacilityDetails);
114 $smarty->assign(
'displayProductionFacility',$displayProductionFacility);
117 else if(isset($_GET[
'status_id']) && ctype_digit($_GET[
'status_id'])) {
120 $statusId = $_GET[
'status_id'];
123 if(isset($_GET[
'ajax']) && ctype_digit($_GET[
'ajax'])) {
124 if ($_GET[
'ajax'] == 1) {
125 if(isset($_GET[
'unlock']) && ctype_digit($_GET[
'unlock'])) {
126 if ($_GET[
'unlock'] == 1) {
140 $errors [] =
'Dieser Eintrag wird gerade von einem anderen Benutzer bearbeitet und ist gesperrt!';
149 if (!empty($_POST)) {
152 if(isset($_POST[
'delete']) && ctype_digit($_POST[
'delete'])) {
153 if($_POST[
'delete'] == $statusId){
155 $successes[] =
"Der Status wurde erfolgreich gelöscht.";
158 $errors [] =
"Ein Datenbankfehler ist aufgetreten (eventuell wird der Status noch benutzt).";
164 $update = htmlSpecialChars(trim($_POST[
'update']), ENT_QUOTES);
165 if(!empty($update)) {
166 if(strcmp($statusDetails[
'name'], $update) != 0) {
169 $successes[] =
"Der 'Name' wurde erfolgreich aktualisiert.";
174 $errors[] =
"Geben Sie einen gültigen 'Namen'.";
175 $statusDetails[
'name'] = $update;
179 $displayStatus = TRUE;
181 $smarty->assign(
'status', $statusDetails);
182 $smarty->assign(
'displayStatus',$displayStatus);
185 else if(isset($_GET[
'category_id']) && ctype_digit($_GET[
'category_id'])) {
187 $categoryId = $_GET[
'category_id'];
190 if(isset($_GET[
'ajax']) && ctype_digit($_GET[
'ajax'])) {
191 if ($_GET[
'ajax'] == 1) {
192 if(isset($_GET[
'unlock']) && ctype_digit($_GET[
'unlock'])) {
193 if ($_GET[
'unlock'] == 1) {
207 $errors [] =
'Dieser Eintrag wird gerade von einem anderen Benutzer bearbeitet und ist gesperrt!';
216 if (!empty($_POST)) {
219 if(isset($_POST[
'delete']) && ctype_digit($_POST[
'delete'])) {
220 if($_POST[
'delete'] == $categoryId){
222 $successes[] =
"Die Kategorie wurde erfolgreich gelöscht.";
226 $errors [] =
"Ein Datenbankfehler ist aufgetreten (eventuell wird die Kategorie noch benutzt).";
232 $update = htmlSpecialChars(trim($_POST[
'update']), ENT_QUOTES);
233 if(!empty($update)) {
234 if(strcmp($categoryDetails[
'name'], $update) != 0) {
237 $successes[] =
"Der 'Name' wurde erfolgreich aktualisiert.";
242 $errors[] =
"Geben Sie einen gültigen 'Namen' an.";
243 $categoryDetails[
'name'] = $update;
247 $displayCategory = TRUE;
249 $smarty->assign(
'category', $categoryDetails);
250 $smarty->assign(
'displayCategory',$displayCategory);
253 else if(isset($_GET[
'car_id']) && ctype_digit($_GET[
'car_id'])) {
256 $carId = $_GET[
'car_id'];
259 if(isset($_GET[
'ajax']) && ctype_digit($_GET[
'ajax'])) {
260 if ($_GET[
'ajax'] == 1) {
261 if(isset($_GET[
'unlock']) && ctype_digit($_GET[
'unlock'])) {
262 if ($_GET[
'unlock'] == 1) {
276 $errors [] =
'Dieser Eintrag wird gerade von einem anderen Benutzer bearbeitet und ist gesperrt!';
285 if (!empty($_POST)) {
288 if(isset($_POST[
'delete']) && ctype_digit($_POST[
'delete'])) {
289 if($_POST[
'delete'] == $carId){
291 $successes[] =
"Das Fahrzeug wurde erfolgreich gelöscht.";
295 $errors [] =
"Ein Datenbankfehler ist aufgetreten (eventuell wird der Fahrzeugname noch benutzt).";
301 $update = htmlSpecialChars(trim($_POST[
'update']), ENT_QUOTES);
302 if(!empty($update)) {
303 if(strcmp($carDetails[
'name'], $update) != 0) {
306 $successes[] =
"Der 'Name' wurde erfolgreich aktualisiert.";
311 $errors[] =
"Geben Sie einen gültigen 'Namen' an.";
312 $carDetails[
'name'] = $update;
318 $smarty->assign(
'car', $carDetails);
319 $smarty->assign(
'displayCar',$displayCar);
323 if (!empty($_POST)) {
326 if (isset($_POST[
"newProductionFacility"])) {
327 if(!empty($_POST[
"newProductionFacility"])) {
328 $newProductionFacility = htmlSpecialChars(trim($_POST[
'newProductionFacility']), ENT_QUOTES);
330 $successes[] =
"Fertigungsmöglichkeit wurde hinzugefügt.";
333 $errors[] =
'Geben Sie einen gültigen Namen für die Fertigungsmöglichkeit an.';
338 if (isset($_POST[
"newStatus"])) {
339 if(!empty($_POST[
"newStatus"])) {
340 $newStatus = htmlSpecialChars(trim($_POST[
'newStatus']), ENT_QUOTES);
345 $errors[] =
'Geben Sie einen gültigen Namen für den Status an.';
350 if (isset($_POST[
"newCategory"])) {
351 if(!empty($_POST[
"newCategory"])) {
352 $newCategory = htmlSpecialChars(trim($_POST[
'newCategory']), ENT_QUOTES);
354 $successes[] =
"Fahrzeugkategorie wurde hinzugefügt.";
357 $errors[] =
'Geben Sie einen gültigen Namen für die Fahrzeugkategorie an.';
362 if (isset($_POST[
"newCar"])) {
363 if(!empty($_POST[
"newCar"])) {
364 $newCar = htmlSpecialChars(trim($_POST[
'newCar']), ENT_QUOTES);
369 $errors[] =
'Geben Sie einen gültigen Namen für das Fahrzeug an.';
385 if(isset($_GET[
'dir0']) && ctype_digit($_GET[
'dir0'])) {
386 $direction = ($_GET[
'dir0'] == 0) ? SORT_ASC : SORT_DESC;
387 kdsort($productionFacilities, 1, $direction);
388 $sort[] = array(
'colIdx' => 1,
389 'direction' => $_GET[
'dir0']);
392 $sort[] = array(
'colIdx' => 1,
396 if(isset($_GET[
'dir1']) && ctype_digit($_GET[
'dir1'])) {
397 $direction = ($_GET[
'dir1'] == 0) ? SORT_ASC : SORT_DESC;
398 kdsort($status, 1, $direction);
399 $sort[] = array(
'colIdx' => 1,
400 'direction' => $_GET[
'dir1']);
404 $sort[] = array(
'colIdx' => 1,
407 if(isset($_GET[
'dir2']) && ctype_digit($_GET[
'dir2'])) {
408 $direction = ($_GET[
'dir2'] == 0) ? SORT_ASC : SORT_DESC;
409 kdsort($categories, 1, $direction);
410 $sort[] = array(
'colIdx' => 1,
411 'direction' => $_GET[
'dir2']);
415 $sort[] = array(
'colIdx' => 1,
419 if(isset($_GET[
'dir3']) && ctype_digit($_GET[
'dir3'])) {
420 $direction = ($_GET[
'dir3'] == 0) ? SORT_ASC : SORT_DESC;
421 kdsort($cars, 1, $direction);
422 $sort[] = array(
'colIdx' => 1,
423 'direction' => $_GET[
'dir3']);
427 $sort[] = array(
'colIdx' => 1,
432 if(isset($_GET[
'show']) && ctype_digit($_GET[
'show'])) {
433 $section = $_GET[
'show'];
439 $smarty->assign(
'section', $section);
442 $smarty->assign(
'sort', $sort);
443 $smarty->assign(
'production_facilities', $productionFacilities);
444 $smarty->assign(
'status', $status);
445 $smarty->assign(
'categories', $categories);
446 $smarty->assign(
'cars', $cars);