Überarbeitete Version der 1. Version. Es bestehen noch grosse Feher in einzelnen Skripten.
This commit is contained in:
@@ -2,26 +2,19 @@
|
||||
|
||||
header('Content-Type: application/json');
|
||||
|
||||
ini_set('display_errors', 1);
|
||||
error_reporting(E_ALL);
|
||||
|
||||
session_start();
|
||||
|
||||
if (
|
||||
empty($_SESSION['access_granted_kampfrichter']) ||
|
||||
$_SESSION['access_granted_kampfrichter'] !== true ||
|
||||
empty($_SESSION['passcodekampfrichter_id']) ||
|
||||
intval($_SESSION['passcodekampfrichter_id']) < 1
|
||||
) {
|
||||
http_response_code(403);
|
||||
exit;
|
||||
}
|
||||
|
||||
if (!isset($baseDir)) {
|
||||
$baseDir = $_SERVER['DOCUMENT_ROOT'];
|
||||
$baseDir = $_SERVER['DOCUMENT_ROOT'];
|
||||
}
|
||||
|
||||
require $baseDir . '/../scripts/csrf_functions.php';
|
||||
require_once $baseDir . '/../scripts/session_functions.php';
|
||||
|
||||
ini_wkvs_session();
|
||||
|
||||
check_user_permission('kampfrichter');
|
||||
|
||||
verify_csrf();
|
||||
|
||||
|
||||
|
||||
if (!verify_csrf()) {
|
||||
echo json_encode(['success' => false, 'message' => 'Forbidden']);
|
||||
@@ -158,6 +151,14 @@ $notenConfig = $result->fetch_all(MYSQLI_ASSOC);
|
||||
|
||||
$stmt->close();
|
||||
|
||||
$displayIdNoteL = intval(db_get_var($mysqli, "SELECT `value` FROM $tableVar WHERE `name` = ?", ['displayIdNoteL'])) ?? 0;
|
||||
$displayIdNoteR = intval(db_get_var($mysqli, "SELECT `value` FROM $tableVar WHERE `name` = ?", ['displayIdNoteR'])) ?? 0;
|
||||
|
||||
if ($displayIdNoteL !== 0 && $displayIdNoteR !== 0) {
|
||||
$displayNoten = [$displayIdNoteR => 0, $displayIdNoteL => 0];
|
||||
}
|
||||
|
||||
|
||||
$noten = [];
|
||||
|
||||
$row = $dbresult[0];
|
||||
@@ -176,15 +177,25 @@ foreach ($disciplines as $d) {
|
||||
// Determine number of runs for this program
|
||||
$anzRunsConfig = !empty($snC['anzahl_laeufe_json']) ? json_decode($snC['anzahl_laeufe_json'], true) : [];
|
||||
|
||||
$runs = $anzRunsConfig[$programm_id] ?? $anzRunsConfig['default'] ?? 1;
|
||||
$runs = $anzRunsConfig[$d][$programm_id] ?? $anzRunsConfig['default'] ?? 1;
|
||||
|
||||
if (isset($displayNoten) && array_key_exists($snC['id'], $displayNoten)) {
|
||||
$displayNoten[$snC['id']] = $runs;
|
||||
}
|
||||
|
||||
for ($r = 1; $r <= $runs; $r++) {
|
||||
$value = $indexedNotenDB[$d][$snC['id']][$r] ?? $snC['default_value'] ?? 0;
|
||||
$noten[$d][$snC['id']][$r] = number_format($value, $snC['nullstellen'] ?? 2);
|
||||
$noten[$d][$r][$snC['id']] = number_format($value, $snC['nullstellen'] ?? 2);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$countBtn = 1;
|
||||
|
||||
if (isset($displayNoten)) {
|
||||
$countBtn = min($displayNoten);
|
||||
}
|
||||
|
||||
|
||||
$titel = $row['vorname'].' '.$row['name'].', '.$row['programm'];
|
||||
|
||||
@@ -305,7 +316,8 @@ if ($isAdmin) {
|
||||
'id' => $editId,
|
||||
'programm_id' => $programm_id,
|
||||
'titel' => $titel,
|
||||
'noten' => $noten
|
||||
'noten' => $noten,
|
||||
'countBtn' => $countBtn
|
||||
]);
|
||||
} else {
|
||||
echo json_encode([
|
||||
@@ -314,7 +326,8 @@ if ($isAdmin) {
|
||||
'programm_id' => $programm_id,
|
||||
'titel' => $titel,
|
||||
'noten' => $noten,
|
||||
'nturnerin' => $nturnerin
|
||||
'nturnerin' => $nturnerin,
|
||||
'countBtn' => $countBtn
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user