...
This commit is contained in:
parent
c707c09460
commit
9e6b96fb0d
17 changed files with 290 additions and 53 deletions
|
|
@ -423,7 +423,7 @@ class Ranking {
|
|||
* @param array $result Ergebnis von compute()
|
||||
* @param bool $withBankData Bankdaten (IBAN etc.) nur für Admins mitliefern/entschlüsseln
|
||||
* @return array Liste von ['user_id', 'name', 'amount'] und optional
|
||||
* ['iban', 'iban_masked', 'bankname', 'blz', 'kontonr']
|
||||
* ['iban', 'iban_masked', 'paypal']
|
||||
*/
|
||||
public static function moneyRanking(array $result, $withBankData = false) {
|
||||
$list = [];
|
||||
|
|
@ -439,9 +439,7 @@ class Ranking {
|
|||
$iban = self::readableIban($user['iban']);
|
||||
$row['iban'] = $iban;
|
||||
$row['iban_masked'] = Crypto::maskIban($iban);
|
||||
$row['bankname'] = $user['bankname'];
|
||||
$row['blz'] = $user['blz'];
|
||||
$row['kontonr'] = $user['kontonr'];
|
||||
$row['paypal'] = $user['paypal'];
|
||||
}
|
||||
|
||||
$list[] = $row;
|
||||
|
|
|
|||
|
|
@ -152,13 +152,20 @@ class Round {
|
|||
}
|
||||
|
||||
$missing = Tipp::getMissing((int)$round['id'], [(int)$userId]);
|
||||
$user = User::findById((int)$userId);
|
||||
|
||||
return [
|
||||
'round_id' => (int)$round['id'],
|
||||
'name' => (string)$round['name'],
|
||||
'lock_time' => $lockTime,
|
||||
'remaining' => self::formatRemainingTime($secondsLeft),
|
||||
'missing_tipps' => in_array((int)$userId, $missing['tipps'], true),
|
||||
'missing_joker' => in_array((int)$userId, $missing['joker'], true),
|
||||
'missing_payment' => $user
|
||||
? trim((string)$user['iban']) === '' && trim((string)$user['paypal']) === ''
|
||||
: false,
|
||||
'missing_email' => $user ? trim((string)$user['email']) === '' : false,
|
||||
'missing_mobile' => $user ? trim((string)$user['mobile']) === '' : false,
|
||||
];
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -10,7 +10,7 @@ class User {
|
|||
/**
|
||||
* Felder, die ein Admin bzw. der Benutzer selbst optional ändern darf.
|
||||
*/
|
||||
const BANK_FIELDS = ['iban', 'bankname', 'blz', 'kontonr', 'mobile'];
|
||||
const BANK_FIELDS = ['iban', 'paypal', 'mobile'];
|
||||
|
||||
/**
|
||||
* Findet einen Benutzer anhand seiner E-Mail-Adresse.
|
||||
|
|
@ -172,7 +172,7 @@ class User {
|
|||
/**
|
||||
* Erstellt einen neuen Benutzer.
|
||||
*
|
||||
* @param array $data ['firstname', 'lastname', 'email', 'password', optional 'admin']
|
||||
* @param array $data ['firstname', 'lastname', 'email', 'password', 'iban', 'paypal', 'mobile', optional 'admin']
|
||||
* @return int|false Die ID des neuen Benutzers oder false bei einem Fehler.
|
||||
*/
|
||||
public static function create($data) {
|
||||
|
|
@ -181,8 +181,10 @@ class User {
|
|||
$lastname = trim($data['lastname'] ?? '');
|
||||
|
||||
$stmt = $db->prepare(
|
||||
"INSERT INTO users (firstname, lastname, name, email, password, admin, created_at, updated_at)
|
||||
VALUES (:firstname, :lastname, :name, :email, :password, :admin, NOW(), NOW())"
|
||||
"INSERT INTO users
|
||||
(firstname, lastname, name, email, password, iban, paypal, mobile, admin, created_at, updated_at)
|
||||
VALUES
|
||||
(:firstname, :lastname, :name, :email, :password, :iban, :paypal, :mobile, :admin, NOW(), NOW())"
|
||||
);
|
||||
|
||||
$ok = $stmt->execute([
|
||||
|
|
@ -191,6 +193,9 @@ class User {
|
|||
':name' => $firstname . ' ' . $lastname,
|
||||
':email' => trim($data['email']),
|
||||
':password' => password_hash($data['password'], PASSWORD_DEFAULT),
|
||||
':iban' => self::prepareBankValue('iban', $data['iban'] ?? ''),
|
||||
':paypal' => trim((string)($data['paypal'] ?? '')),
|
||||
':mobile' => trim((string)($data['mobile'] ?? '')),
|
||||
':admin' => !empty($data['admin']) ? 1 : 0,
|
||||
]);
|
||||
|
||||
|
|
@ -243,7 +248,7 @@ class User {
|
|||
* (Legacy: UsersController::storeUserEdit). Name ist dort nicht änderbar.
|
||||
*
|
||||
* @param int $id
|
||||
* @param array $data ['email', 'iban', 'bankname', 'blz', 'kontonr', 'mobile', 'gets_reminders']
|
||||
* @param array $data ['email', 'iban', 'paypal', 'mobile', 'gets_reminders']
|
||||
* @return bool
|
||||
*/
|
||||
public static function updateProfile($id, $data) {
|
||||
|
|
|
|||
|
|
@ -33,22 +33,22 @@ $euro = fn($amount) => number_format($amount, 2, ',', '.') . ' €';
|
|||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Ausschüttung</th>
|
||||
<th>Bankname</th>
|
||||
<th class="amount">Ausschüttung</th>
|
||||
<th>PayPal</th>
|
||||
<th>IBAN</th>
|
||||
<th>BLZ</th>
|
||||
<th>Kontonummer</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($moneyRanking as $entry):
|
||||
$hasPayout = $entry['amount'] > 0;
|
||||
$missingAccount = $hasPayout && empty($entry['iban']) && empty($entry['kontonr']);
|
||||
$missingAccount = $hasPayout
|
||||
&& empty($entry['iban'])
|
||||
&& empty($entry['paypal']);
|
||||
?>
|
||||
<tr <?php if (!$hasPayout) echo 'class="no-payout"'; ?>>
|
||||
<td><a href="/index.php?page=money_ranking&user_id=<?php echo (int)$entry['user_id']; ?>"><?php echo htmlspecialchars($entry['name']); ?></a></td>
|
||||
<td class="amount"><?php echo $euro($entry['amount']); ?></td>
|
||||
<td><?php echo htmlspecialchars((string)$entry['bankname']); ?></td>
|
||||
<td><?php echo htmlspecialchars((string)$entry['paypal']); ?></td>
|
||||
<td class="iban <?php if ($missingAccount) echo 'missing'; ?>">
|
||||
<?php if ($missingAccount): ?>
|
||||
fehlt
|
||||
|
|
@ -59,8 +59,6 @@ $euro = fn($amount) => number_format($amount, 2, ',', '.') . ' €';
|
|||
<?php endif; ?>
|
||||
<?php endif; ?>
|
||||
</td>
|
||||
<td><?php echo htmlspecialchars((string)$entry['blz']); ?></td>
|
||||
<td><?php echo htmlspecialchars((string)$entry['kontonr']); ?></td>
|
||||
</tr>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
|
|
@ -68,7 +66,7 @@ $euro = fn($amount) => number_format($amount, 2, ',', '.') . ' €';
|
|||
<tr>
|
||||
<th>Summe</th>
|
||||
<th class="amount"><?php echo $euro(array_sum(array_column($moneyRanking, 'amount'))); ?></th>
|
||||
<th colspan="4"></th>
|
||||
<th colspan="2"></th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
|
|
@ -76,7 +74,14 @@ $euro = fn($amount) => number_format($amount, 2, ',', '.') . ' €';
|
|||
<?php endif; ?>
|
||||
|
||||
<style>
|
||||
.accounts-table td.amount, .accounts-table th.amount { text-align: right; white-space: nowrap; }
|
||||
.accounts-table td.amount, .accounts-table th.amount {
|
||||
/* Spalte fest auf Platz für max. vier Vorkommastellen begrenzen (z. B. 9.999,99 €) */
|
||||
width: 1%;
|
||||
min-width: 8em;
|
||||
text-align: right;
|
||||
white-space: nowrap;
|
||||
font-variant-numeric: tabular-nums;
|
||||
}
|
||||
.accounts-table td.iban { font-family: monospace; white-space: nowrap; }
|
||||
.accounts-table td.missing { color: #c00; font-family: inherit; font-weight: bold; }
|
||||
.accounts-table tr.no-payout td { color: #999; }
|
||||
|
|
|
|||
|
|
@ -31,6 +31,18 @@ require __DIR__ . '/../partials/header.php';
|
|||
<label for="email">E-Mail:</label>
|
||||
<input type="email" id="email" name="email" value="<?php echo htmlspecialchars($editUser['email']); ?>" required>
|
||||
</div>
|
||||
<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>
|
||||
<div class="form-group">
|
||||
<label for="password">Passwort:</label>
|
||||
<input type="password" id="password" name="password" placeholder="Leer lassen, um nicht zu ändern">
|
||||
|
|
|
|||
|
|
@ -14,11 +14,23 @@ require __DIR__ . '/partials/header.php';
|
|||
<?php if ($lockWarning['missing_joker']): ?>
|
||||
<p>Fehlender Joker für <?php echo htmlspecialchars($lockWarning['name']); ?></p>
|
||||
<?php endif; ?>
|
||||
<?php if ($lockWarning['missing_payment']): ?>
|
||||
<p>Fehlende Zahlungsmöglichkeit (IBAN oder PayPal)</p>
|
||||
<?php endif; ?>
|
||||
<?php if ($lockWarning['missing_email']): ?>
|
||||
<p>Fehlende E-Mail-Adresse</p>
|
||||
<?php endif; ?>
|
||||
<?php if ($lockWarning['missing_mobile']): ?>
|
||||
<p>Fehlende Handynummer</p>
|
||||
<?php endif; ?>
|
||||
<p>
|
||||
<?php echo htmlspecialchars($lockWarning['name']); ?> sperrt sich:
|
||||
<?php echo $lockWarning['lock_time']->format('Y-m-d H:i:s'); ?>
|
||||
( noch <?php echo htmlspecialchars($lockWarning['remaining']); ?> )
|
||||
</p>
|
||||
<p>
|
||||
<a class="lock-warning-link" href="/index.php?page=tipp_round&id=<?php echo (int)$lockWarning['round_id']; ?>">Jetzt tippen</a>
|
||||
</p>
|
||||
</div>
|
||||
<?php endif; ?>
|
||||
|
||||
|
|
|
|||
|
|
@ -203,6 +203,13 @@ if (!isset($currentSeason) || !isset($ranking) || !isset($games) || !isset($allR
|
|||
|
||||
<?php if ($selectedRound): ?>
|
||||
<?php if (!empty($ranking)): ?>
|
||||
<?php
|
||||
// Spaltenzahl für die Abstandszeile zwischen Top 10 und Rest
|
||||
$rankingColumnCount = 5 + count($games) * 3
|
||||
+ ($roundCompleted ? 1 : 0)
|
||||
+ ($roundHasJackpot ? 1 : 0)
|
||||
+ ($isFinalRound ? 1 : 0);
|
||||
?>
|
||||
<table class="ranking-table">
|
||||
<thead>
|
||||
<tr>
|
||||
|
|
@ -243,9 +250,21 @@ if (!isset($currentSeason) || !isset($ranking) || !isset($games) || !isset($allR
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<?php foreach ($ranking as $entry):
|
||||
<?php foreach ($ranking as $entryIndex => $entry):
|
||||
$nextEntry = $ranking[$entryIndex + 1] ?? null;
|
||||
$prevEntry = $entryIndex > 0 ? ($ranking[$entryIndex - 1] ?? null) : null;
|
||||
$isLastTop10 = $entry['rank'] <= 10
|
||||
&& $nextEntry !== null
|
||||
&& (int)$nextEntry['rank'] > 10;
|
||||
$isFirstRest = $prevEntry !== null
|
||||
&& (int)$prevEntry['rank'] <= 10
|
||||
&& (int)$entry['rank'] > 10;
|
||||
|
||||
$rowClasses = [];
|
||||
if ($entry['rank'] <= 3) $rowClasses[] = 'rank-' . $entry['rank'];
|
||||
if ($entry['rank'] <= 10) $rowClasses[] = 'rank-top10';
|
||||
if ($isLastTop10) $rowClasses[] = 'rank-top10-last';
|
||||
if ($isFirstRest) $rowClasses[] = 'rank-rest-first';
|
||||
if ((int)$entry['user_id'] === (int)App\Core\Auth::id()) $rowClasses[] = 'me';
|
||||
|
||||
// Aufschlüsselung der Rundenpunkte für den Popup
|
||||
|
|
@ -307,6 +326,11 @@ if (!isset($currentSeason) || !isset($ranking) || !isset($games) || !isset($allR
|
|||
<td class="text-center"><?php echo $entry['ranking_payout'] > 0 ? number_format($entry['ranking_payout'], 2, ',', '.') . ' €' : ''; ?></td>
|
||||
<?php endif; ?>
|
||||
</tr>
|
||||
<?php if ($isLastTop10): ?>
|
||||
<tr class="rank-gap" aria-hidden="true">
|
||||
<td colspan="<?php echo (int)$rankingColumnCount; ?>"></td>
|
||||
</tr>
|
||||
<?php endif; ?>
|
||||
<?php endforeach; ?>
|
||||
</tbody>
|
||||
<tfoot>
|
||||
|
|
|
|||
|
|
@ -28,6 +28,11 @@ require __DIR__ . '/partials/header.php';
|
|||
.form-group button {
|
||||
margin-left: calc(200px + 10px);
|
||||
}
|
||||
.form-hint {
|
||||
margin: 0 0 1rem calc(200px + 10px);
|
||||
color: var(--muted);
|
||||
font-size: 0.9em;
|
||||
}
|
||||
</style>
|
||||
<form action="/index.php?page=register" method="post">
|
||||
<div class="form-group">
|
||||
|
|
@ -42,6 +47,19 @@ require __DIR__ . '/partials/header.php';
|
|||
<label for="email">E-Mail:</label>
|
||||
<input type="email" id="email" name="email" value="<?php echo htmlspecialchars($_POST['email'] ?? ''); ?>" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="mobile">Handynummer:</label>
|
||||
<input type="tel" id="mobile" name="mobile" value="<?php echo htmlspecialchars($_POST['mobile'] ?? ''); ?>" required>
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="iban">IBAN (oder PayPal):</label>
|
||||
<input type="text" id="iban" name="iban" maxlength="34" value="<?php echo htmlspecialchars($_POST['iban'] ?? ''); ?>">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="paypal">PayPal (oder IBAN):</label>
|
||||
<input type="text" id="paypal" name="paypal" maxlength="255" placeholder="E-Mail oder PayPal.Me-Link" value="<?php echo htmlspecialchars($_POST['paypal'] ?? ''); ?>">
|
||||
</div>
|
||||
<p class="form-hint">Bitte mindestens eine Zahlungsmöglichkeit angeben: IBAN oder PayPal.</p>
|
||||
<div class="form-group">
|
||||
<label for="password">Passwort:</label>
|
||||
<input type="password" id="password" name="password" required>
|
||||
|
|
|
|||
|
|
@ -31,16 +31,8 @@ require __DIR__ . '/partials/header.php';
|
|||
<input type="text" id="iban" name="iban" maxlength="34" value="<?php echo htmlspecialchars((string)$user['iban']); ?>">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="bankname">Bankname:</label>
|
||||
<input type="text" id="bankname" name="bankname" value="<?php echo htmlspecialchars((string)$user['bankname']); ?>">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="blz">BLZ:</label>
|
||||
<input type="text" id="blz" name="blz" value="<?php echo htmlspecialchars((string)$user['blz']); ?>">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="kontonr">Kontonummer:</label>
|
||||
<input type="text" id="kontonr" name="kontonr" value="<?php echo htmlspecialchars((string)$user['kontonr']); ?>">
|
||||
<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)$user['paypal']); ?>">
|
||||
</div>
|
||||
<div class="form-group">
|
||||
<label for="mobile">Handynummer:</label>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue