155 lines
5.7 KiB
PHP
155 lines
5.7 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";
|
|
require_once("../func_get_parameter.php");
|
|
|
|
if (isset($_GET['action'])) {
|
|
$action = $_GET['action'];
|
|
} else {
|
|
$action = '';
|
|
}
|
|
|
|
$termin = $_GET['tid'];
|
|
if ($action == '') {
|
|
|
|
$query1 = "SELECT lfd_haushalt, count(*) Anz
|
|
FROM gd_buchung
|
|
WHERE reihe = ''
|
|
AND tid = $termin
|
|
AND warteliste = 'Y'
|
|
GROUP BY lfd_haushalt
|
|
ORDER BY save_date ASC";
|
|
|
|
$result1 = $db->query($query1) or die("Cannot execute query1");
|
|
|
|
|
|
while ($row1 = $result1->fetch_array()) {
|
|
$value2 = '';
|
|
$mehrfachbelegung = trim(get_parameter(6));
|
|
if($mehrfachbelegung == 0){
|
|
$query2 = "SELECT reihe, platz
|
|
FROM gd_verfplaetze
|
|
WHERE concat(reihe,platz) not in (select concat(reihe,platz) from gd_buchung where tid=$termin and lfd_haushalt!=$row1[lfd_haushalt])
|
|
AND reihe not in ('Sonntagschule', 'Vorsonntagschule')
|
|
order by reihe, platz
|
|
";
|
|
}else{
|
|
$query2 = "SELECT reihe, platz
|
|
FROM gd_verfplaetze
|
|
WHERE reihe not in ('Sonntagschule', 'Vorsonntagschule')
|
|
order by reihe, platz
|
|
";
|
|
}
|
|
$result2 = $db->query( $query2)
|
|
or die ("Cannot execute query2");
|
|
|
|
|
|
|
|
$ln2 = 0;
|
|
while ($row2 = $result2->fetch_array()){
|
|
$inner1[$ln2]['reihe'] = $row2['reihe'];
|
|
$inner1[$ln2]['platz'] = $row2['platz'];
|
|
$value2 = $inner1;
|
|
$ln2++;
|
|
}
|
|
|
|
$query_name = $db->query("SELECT bid, vorname, nachname, date_format(save_date, '%d.%m.%Y - %H:%i') save_date, date_format(warteliste_confirm, '%d.%m.%Y - %H:%i') warteliste_confirm, warteliste_grund
|
|
FROM gd_buchung
|
|
WHERE reihe = ''
|
|
AND lfd_haushalt= $row1[lfd_haushalt]
|
|
AND tid = $termin
|
|
AND warteliste='Y'
|
|
ORDER BY bid
|
|
LIMIT 1");
|
|
$row_name = $query_name->fetch_array();
|
|
|
|
$row1['inner'] = $value2;
|
|
$row1['tid'] = $termin;
|
|
$row1['warteliste_grund'] = $row_name['warteliste_grund'];
|
|
$row1['vorname'] = $row_name['vorname'];
|
|
$row1['nachname'] = $row_name['nachname'];
|
|
$row1['warteliste_confirm'] = $row_name['warteliste_confirm'];
|
|
$row1['save_date'] = $row_name['save_date'];
|
|
$table_data1[] = $row1;
|
|
}
|
|
$smarty->assign('table_data1', $table_data1);
|
|
|
|
$query2 = "SELECT tid, lfd_haushalt, vorname, nachname, date_format(save_date, '%d.%m.%Y - %H:%i') save_date, date_format(warteliste_confirm, '%d.%m.%Y - %H:%i') warteliste_confirm, mail, warteliste_grund, reihe, platz
|
|
FROM gd_buchung
|
|
WHERE reihe != ''
|
|
AND tid = $termin
|
|
AND warteliste = 'Y'
|
|
ORDER BY save_date ASC";
|
|
|
|
$result2 = $db->query($query2) or die("Cannot execute query2");
|
|
|
|
|
|
while ($row2 = $result2->fetch_array()) {
|
|
$table_data2[] = $row2;
|
|
}
|
|
$smarty->assign('table_data2', $table_data2);
|
|
}
|
|
|
|
|
|
if ($action == 'mail') {
|
|
$lfd_haushalt = $_GET['lfd_haushalt'];
|
|
$termin = $_GET['tid'];
|
|
|
|
$query_mail = $db->query("SELECT mail, date_format(b.datum, '%d.%m.%Y') datum_form
|
|
FROM gd_buchung a, gd_termine b
|
|
WHERE a.tid=b.tid
|
|
AND lfd_haushalt = '$lfd_haushalt'
|
|
AND a.tid = $termin
|
|
AND warteliste='Y'
|
|
GROUP BY mail, datum
|
|
LIMIT 1");
|
|
$row_mail = $query_mail->fetch_array();
|
|
|
|
|
|
$to = $row_mail['mail']; // addresses to email pdf to
|
|
$from = "NAK Beutelsbach <service@nak-btb.de>"; // address message is sent from
|
|
$subject = "Zusage zum Gottesdienst am ".$row_mail['datum_form']; // email subject
|
|
$body = "<html>
|
|
<head>
|
|
<title>Zusage zum Gottesdienst</title>
|
|
</head>
|
|
<body>
|
|
<font face='Arial' size='2'>
|
|
Guten Tag!<br><br>
|
|
Sie sind verbindlich zum Gottesdienst am $row_mail[datum_form] angemeldet.
|
|
<br>
|
|
Sollten Sie nicht kommen können melden Sie sich mit dem Abmeldelink aus der Registrierungsmail ab!
|
|
<br>
|
|
<br>
|
|
<p>
|
|
Diese Mail wurde automatisch generiert!<br>
|
|
Antworten Sie daher nicht auf diese Mail<br>
|
|
<br>
|
|
Vielen Dank
|
|
</body>
|
|
</html>";
|
|
|
|
$headers = "MIME-Version: 1.0\r\n";
|
|
$headers .= "Content-type: text/html; charset=utf-8\r\n";
|
|
$headers .= "From: $from\r\n";
|
|
$return = @mail($to, $subject, $body, $headers);
|
|
|
|
if($return){
|
|
$datum_db = date("Y-m-d H:i:s");
|
|
$sql2 = $db->query("UPDATE gd_buchung SET warteliste_confirm = '$datum_db' WHERE tid='$termin' AND lfd_haushalt='$lfd_haushalt'");
|
|
}
|
|
echo "<meta http-equiv=\"refresh\" content=\"0; URL=" . $_SERVER['PHP_SELF'] . "?tid=$termin\">";
|
|
|
|
}
|
|
|
|
|
|
$smarty->assign('action', "$action");
|
|
$smarty->display("$template/admin/$templatename");
|
|
|
|
?>
|
|
|