2026-10-04 17:34:43 +02:00
< ? php
$pageTitle = 'Benutzer verwalten' ;
require __DIR__ . '/../partials/header.php' ;
?>
< h1 > Benutzer verwalten </ h1 >
< ? php if ( ! empty ( $message )) : ?>
< p style = " color: green; " >< ? php echo htmlspecialchars ( $message ); ?> </p>
< ? php endif ; ?>
< ? php if ( ! empty ( $error )) : ?>
< p style = " color: red; " >< ? php echo htmlspecialchars ( $error ); ?> </p>
< ? php endif ; ?>
2026-10-18 21:40:43 +02:00
<!-- Form for editing a user -->
< ? php if ( $editUser ) : ?>
< h2 > Benutzer bearbeiten </ h2 >
2026-10-04 17:34:43 +02:00
< form action = " /index.php?page=admin_users " method = " post " >
2026-10-18 21:40:43 +02:00
< input type = " hidden " name = " action " value = " update " >
< input type = " hidden " name = " id " value = " <?php echo htmlspecialchars( $editUser['id'] ); ?> " >
2026-10-04 17:34:43 +02:00
< div class = " form-group " >
< label for = " firstname " > Vorname :</ label >
2026-10-18 21:40:43 +02:00
< input type = " text " id = " firstname " name = " firstname " value = " <?php echo htmlspecialchars( $editUser['firstname'] ); ?> " required >
2026-10-04 17:34:43 +02:00
</ div >
< div class = " form-group " >
< label for = " lastname " > Nachname :</ label >
2026-10-18 21:40:43 +02:00
< input type = " text " id = " lastname " name = " lastname " value = " <?php echo htmlspecialchars( $editUser['lastname'] ); ?> " required >
2026-10-04 17:34:43 +02:00
</ div >
< div class = " form-group " >
< label for = " email " > E - Mail :</ label >
2026-10-18 21:40:43 +02:00
< input type = " email " id = " email " name = " email " value = " <?php echo htmlspecialchars( $editUser['email'] ); ?> " required >
2026-10-04 17:34:43 +02:00
</ div >
2026-10-27 12:59:45 +01:00
< div class = " form-group " >
< label for = " mobile " > Handynummer :</ label >
< input type = " tel " id = " mobile " name = " mobile " value = " <?php echo htmlspecialchars((string) $editUser['mobile'] ); ?> " >
</ div >
< div class = " form-group " >
< label for = " iban " > IBAN :</ label >
< input type = " text " id = " iban " name = " iban " maxlength = " 34 " value = " <?php echo htmlspecialchars((string) $editUser['iban'] ); ?> " >
</ div >
< div class = " form-group " >
< label for = " paypal " > PayPal :</ label >
< input type = " text " id = " paypal " name = " paypal " maxlength = " 255 " placeholder = " E-Mail oder PayPal.Me-Link " value = " <?php echo htmlspecialchars((string) $editUser['paypal'] ); ?> " >
</ div >
2026-10-04 17:34:43 +02:00
< div class = " form-group " >
2026-10-30 06:31:10 +01:00
< label for = " change_password " > Passwort ändern :</ label >
< input type = " checkbox " id = " change_password " name = " change_password " value = " 1 " >
</ div >
< div class = " form-group " >
< label for = " password " > Neues Passwort :</ label >
< input type = " password " id = " password " name = " password " autocomplete = " new-password "
placeholder = " Nur ausfüllen, wenn das Passwort geändert werden soll " disabled >
2026-10-04 17:34:43 +02:00
</ div >
< div class = " form-group " >
< label for = " admin " > Admin :</ label >
< input type = " checkbox " id = " admin " name = " admin " value = " 1 " < ? php echo ! empty ( $editUser [ 'admin' ]) ? 'checked' : '' ; ?> >
</ div >
2026-10-04 17:40:59 +02:00
2026-10-18 21:40:43 +02:00
< ? php if ( ! empty ( $currentSeason )) : ?>
2026-10-04 17:40:59 +02:00
< div class = " form-group " >
< label for = " has_paid " > Bezahlt ( < ? php echo htmlspecialchars ( $currentSeason [ 'name' ]); ?> ):</label>
< input type = " checkbox " id = " has_paid " name = " has_paid " value = " 1 " < ? php echo isset ( $payments [ $editUser [ 'id' ]]) ? 'checked' : '' ; ?> >
</ div >
< ? php endif ; ?>
2026-10-04 17:34:43 +02:00
< div class = " form-group " >
2026-10-18 21:40:43 +02:00
< button type = " submit " > Speichern </ button >
< a href = " /index.php?page=admin_users " > Abbrechen </ a >
2026-10-04 17:34:43 +02:00
</ div >
</ form >
< hr >
2026-10-18 21:40:43 +02:00
< ? php endif ; ?>
2026-10-04 17:34:43 +02:00
<!-- User List -->
< h2 > Benutzerliste </ h2 >
< table >
< thead >
< tr >
< th > Name </ th >
< th > E - Mail </ th >
< th > Admin </ th >
2026-10-04 17:40:59 +02:00
< ? php if ( ! empty ( $currentSeason )) : ?>
< th > Bezahlt ( < ? php echo htmlspecialchars ( $currentSeason [ 'name' ]); ?> )</th>
< ? php endif ; ?>
2026-11-03 20:55:25 +01:00
< ? php if ( $tippableRound ) : ?>
< th > Tipps ( < ? php echo htmlspecialchars ( $tippableRound [ 'name' ]); ?> )</th>
< th > Joker ( < ? php echo htmlspecialchars ( $tippableRound [ 'name' ]); ?> )</th>
< ? php endif ; ?>
2026-10-04 17:34:43 +02:00
< th > Aktionen </ th >
</ tr >
</ thead >
< tbody >
< ? php foreach ( $users as $user ) : ?>
< tr >
< td >< ? php echo htmlspecialchars ( $user [ 'name' ]); ?> </td>
< td >< ? php echo htmlspecialchars ( $user [ 'email' ]); ?> </td>
< td >< ? php echo $user [ 'admin' ] ? 'Ja' : 'Nein' ; ?> </td>
2026-10-04 17:40:59 +02:00
< ? php if ( ! empty ( $currentSeason )) : ?>
< td >
< ? php if ( isset ( $payments [ $user [ 'id' ]])) : ?>
Ja ( < ? php echo date ( 'd.m.Y' , strtotime ( $payments [ $user [ 'id' ]])); ?> )
< ? php else : ?>
Nein
< ? php endif ; ?>
</ td >
< ? php endif ; ?>
2026-11-03 20:55:25 +01:00
< ? php if ( $tippableRound ) : ?>
< td class = " text-center " >
< ? php if ( isset ( $missingTipps [ $user [ 'id' ]])) : ?>
< span class = " status-no " title = " Tipps fehlen " aria - label = " Tipps fehlen " > ✘ </ span >
< ? php else : ?>
< span class = " status-yes " title = " Runde komplett getippt " aria - label = " Runde komplett getippt " > ✔ </ span >
< ? php endif ; ?>
</ td >
< td class = " text-center " >
< ? php if ( isset ( $missingJoker [ $user [ 'id' ]])) : ?>
< span class = " status-no " title = " Joker fehlt " aria - label = " Joker fehlt " > ✘ </ span >
< ? php else : ?>
< span class = " status-yes " title = " Joker gesetzt " aria - label = " Joker gesetzt " > ✔ </ span >
< ? php endif ; ?>
</ td >
< ? php endif ; ?>
2026-10-04 17:34:43 +02:00
< td >
< a href = " /index.php?page=admin_users&edit_id=<?php echo $user['id'] ; ?> " > Bearbeiten </ a >
< form action = " /index.php?page=admin_users " method = " post " style = " display: inline; " onsubmit = " return confirm('Sicher, dass du diesen Benutzer löschen willst?'); " >
< input type = " hidden " name = " action " value = " delete " >
< input type = " hidden " name = " id " value = " <?php echo $user['id'] ; ?> " >
< button type = " submit " class = " link-button " > Löschen </ button >
</ form >
</ td >
</ tr >
< ? php endforeach ; ?>
</ tbody >
</ table >
< style >
/* From login.php, for consistency */
. form - group {
margin - bottom : 1 rem ;
}
. form - group label {
display : inline - block ;
width : 150 px ;
text - align : right ;
margin - right : 10 px ;
}
. form - group button , . form - group a {
margin - left : calc ( 150 px + 10 px );
}
. link - button {
background : none ;
border : none ;
2026-10-04 23:38:41 +02:00
color : var ( -- link );
2026-10-04 17:34:43 +02:00
cursor : pointer ;
padding : 0 ;
font - size : inherit ;
text - decoration : underline ;
font - family : inherit ;
}
2026-11-03 20:55:25 +01:00
. status - yes ,
. status - no {
font - weight : 900 ;
font - size : 1.35 em ;
line - height : 1 ;
}
. status - yes { color : var ( -- pitch ); }
. status - no { color : var ( -- col - joker - exact ); }
2026-10-04 17:34:43 +02:00
</ style >
2026-10-30 06:31:10 +01:00
< script >
( function () {
var checkbox = document . getElementById ( 'change_password' );
var password = document . getElementById ( 'password' );
if ( ! checkbox || ! password ) {
return ;
}
function syncPasswordField () {
password . disabled = ! checkbox . checked ;
if ( ! checkbox . checked ) {
password . value = '' ;
}
}
checkbox . addEventListener ( 'change' , syncPasswordField );
syncPasswordField ();
})();
</ script >
2026-10-04 17:34:43 +02:00
< ? php require __DIR__ . '/../partials/footer.php' ; ?>