Skip to content
Permalink
master
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
<!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<title>timerec | Brückentage</title>
<link rel="stylesheet" type="text/css" href="style.css">
<link rel="shortcut icon" href="favicon.ico">
<link rel="stylesheet" href="DatePickerX.css">
<script src="DatePickerX.js"></script>
<script>
window.addEventListener('DOMContentLoaded', function(){
for(input of document.querySelectorAll('[type="date"]')){
input.DatePickerX.init({
// options here
format : 'yyyy-mm-dd',
weekDayLabels : ['Mo', 'Di', 'Mi', 'Do', 'Fr', 'Sa', 'So'],
shortMonthLabels : ['Jan', 'Feb', 'Mär', 'Apr', 'Mai', 'Jun', 'Jul', 'Aug', 'Sep', 'Okt', 'Nov', 'Dez'],
singleMonthLabels: ['Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'],
todayButtonLabel : 'Heute',
clearButton: false
});
}
});
</script>
</head>
<body>
<?php
session_start();
if(!$_SESSION['userid']){
session_destroy();
include('login.php');
exit;
}
include('dbconnect.php');
if(!$_SESSION['userarray']['admin']){
echo "<h3>keine Rechte, diese Seite einzusehen!</h3>";
exit;
}
$infoarray = $_SESSION['infoarray'];
if(isset($_POST['daymon'])){
var_dump($_POST);
foreach($_POST['daymon'] as $key=>$datumstr){
if($datumstr != ''){
$datum = new DateTime($datumstr);
$jahr = $datum->format('Y');
$daymon = $datum->format('dm');
if($key == 'new') $key = 'NULL';
$upsert = "insert into feiertag values ($key, '$daymon', '$jahr')
on duplicate key update daymon='$daymon', year='$jahr';";
echo "<br>$upsert";
$dbc->query($upsert);
if($dbc->error){
echo "<h3 class='red'>ERROR: ".$dbc->error."</h3>";
exit;
}
}
}
if(!empty($_POST['del'])){
foreach($_POST['del'] as $del){
$delete = "delete from feiertag where f_id = $del";
$dbc->query($delete);
if($dbc->error){
echo "<h3 class='red'>ERROR: ".$dbc->error."</h3>";
exit;
}
}
}
header('Location: feiertag.php');
}
$jahrwahl = "<select form='wahl' name='y' onchange='this.form.submit()'>";
if(!$_GET['y']){
$jahr = date('Y');
}else{
$jahr = $_GET['y'];
}
$davor = $jahr-1;
$davor2 = $jahr-2;
$danach = $jahr+1;
$danach2 = $jahr+2;
$jahrwahl .= "<option value='$davor2'>$davor2</option>
<option value='$davor'>$davor</option>
<option selected value='$jahr'>$jahr</option>
<option value='$danach'>$danach</option>
<option value='$danach2'>$danach2</option>
</select>";
echo "<div id='content'>
<div id='home'>
<a href='index.php?ma=".$infoarray['maID']."'><button><< Menü</button></a>
</div>
<form id='wahl' action='' method='get'></form>
<form id='centered_form' action='".$_SERVER['REQUEST_URI']."' method='post'>
<h3>Brückentage am FHI einstellen: [ $jahrwahl ]</h3>
<table>";
$getfeiertag = $dbc->query("select * from feiertag where year = $jahr;");
foreach($getfeiertag as $i=>$feiertag){
$i++;
$key = $feiertag['f_id'];
$mon = substr($feiertag['daymon'], 2,2);
$day = substr($feiertag['daymon'], 0,2);
echo "<tr>";
echo "<th class='rechts'>$i. Tag</th>";
echo "<td class='links'>
<input type='date' name='daymon[$key]' value='$jahr-$mon-$day'>
</td>
<td>
<label>
<input id='deletebox$key' class='checkbox' type='checkbox' name='del[]' value='$key'>
Löschen? <label for='deletebox$key'></label>
</label>
</td>";
echo "</tr>";
}
echo "<tr><td>neues Datum</td><td><input type='date' name='daymon[new]'></td></tr>
<th></th><td><button id='knopf' type='submit' onclick='return confirm(\"Wirklich?\")'>aktualisieren</button></td>
</table>
</form>
</div>";
?>
</body>
</html>