gottesdienst/admin/sitz_koord.php
2023-03-14 07:16:04 +01:00

112 lines
3.1 KiB
PHP

<?php
if(!isset($_SESSION)) { session_start(); }
include_once '../classes/TestProjektSmarty.class_subdir.php';
require_once("../config.inc.php");
$templatename = substr(basename($_SERVER['PHP_SELF']),0,-3)."html";
$smarty = new SmartyAdmin();
require_once "../language/german.inc.php";
if (isset($_GET['action'])) {
$action = $_GET['action'];
} else {
$action = '';
}
if ($action == '') {
if (isset($_GET['reihe'])) {
$reihe = $_GET['reihe'];
} else {
$reihe = '';
}
if (isset($_GET['platz'])) {
$platz = $_GET['platz'];
} else {
$platz = '';
}
if (isset($_GET['tid'])) {
$tid = $_GET['tid'];
} else {
$tid = '';
}
$german = $db->query("SET lc_time_names = 'de_DE';");
$query1 = "SELECT bid, vorname, nachname
FROM gd_buchung
WHERE reihe = '$reihe'
AND platz = '$platz'
AND tid = $tid
ORDER BY nachname, vorname ASC";
$result1 = $db->query($query1) or die("Cannot execute query1");
while ($row_tn = $result1->fetch_array()) {
$query_fav = $db->query("SELECT count(*) Anz
FROM gd_standardsitzplatz
WHERE nachname = '$row_tn[nachname]'
AND vorname = '$row_tn[vorname]'
AND reihe = '$reihe'
AND platz = '$platz'
");
$row_fav = $query_fav->fetch_array();
if($row_fav['Anz'] > 0){
# Favorit vorhanden, kann gelöscht werden
$favorit = 0;
}else{
# Favorit NICHT vorhanden, kann gesetzt werden
$favorit = 1;
}
$row_tn['favorit'] = $favorit;
$table_data1[] = $row_tn;
}
$smarty->assign('table_data1', $table_data1);
$smarty->assign('koord_reihe', $reihe);
$smarty->assign('koord_platz', $platz);
$smarty->assign('koord_tid', $tid);
}
if ($action == 'del') {
$bid = $_GET['bid'];
$reihe = $_GET['reihe'];
$platz = $_GET['platz'];
$tid = $_GET['tid'];
$del1 = $db->query("UPDATE gd_buchung SET reihe='', platz='' WHERE bid = $bid");
echo "<meta http-equiv=\"refresh\" content=\"0; URL=" . $_SERVER['PHP_SELF'] . "?reihe=$reihe&platz=$platz&tid=$tid\">";
}
if ($action == 'fav') {
$status = $_GET['status'];
$vorname = $_GET['vorname'];
$nachname = $_GET['nachname'];
$tid = $_GET['tid'];
if (isset($_GET['reihe'])) {
$reihe = $_GET['reihe'];
} else {
$reihe = '';
}
if (isset($_GET['platz'])) {
$platz = $_GET['platz'];
} else {
$platz = '';
}
$del1 = $db->query("DELETE FROM gd_standardsitzplatz WHERE vorname='$vorname' AND nachname='$nachname'");
if($status == 1){
$ins1 = $db->query("INSERT INTO gd_standardsitzplatz (nachname, vorname, reihe, platz) VALUES ('$nachname', '$vorname', '$reihe', '$platz')");
}
echo $tid;
echo "<meta http-equiv=\"refresh\" content=\"0; URL=" . $_SERVER['PHP_SELF'] . "?reihe=$reihe&platz=$platz&tid=$tid\">";
}
$smarty->assign('action', "$action");
$smarty->display("$template/admin/$templatename");
?>