getMessage()); } if (($_POST['action'] ?? '') !== 'complete_training') { http_response_code(400); exit('Ungültige Aktion.'); } if ((int) ($groups['Brandschutz'] ?? 0) !== 1) { http_response_code(403); exit('Keine Berechtigung für diese Aktion.'); } $userId = (int) $_SESSION['user_id']; $today = brandschutz_today(); $trainingDate = $today->format('Y-m-d'); $trainingDateDisplay = $today->format('d.m.Y'); $dueDateDisplay = $today->modify('+' . BRANDSCHUTZ_VALIDITY_DAYS . ' days')->format('d.m.Y'); $userName = brandschutz_display_name(is_array($user) ? $user : []); $senderMail = trim((string) ($user['mail'] ?? '')); $pdo->beginTransaction(); try { brandschutz_store_training_date($pdo, $userId, $trainingDate, true); brandschutz_log_admin_message( $pdo, $userName, $senderMail, 'Brandschutzschulung absolviert: ' . $userName, $userName . ' hat die Brandschutzunterweisung am ' . $trainingDateDisplay . ' erfolgreich absolviert.' ); $pdo->commit(); } catch (Throwable $exception) { if ($pdo->inTransaction()) $pdo->rollBack(); throw $exception; } if ($senderMail !== '') { require_once $_SERVER['DOCUMENT_ROOT'] . '/intranet_repo/general_files/ini/send_mail.php'; $mailSubject = 'Brandschutzunterweisung erfolgreich absolviert'; $mailMessage = brandschutz_greeting(is_array($user) ? $user : []) . ",\n\nSie haben die Brandschutzunterweisung am {$trainingDateDisplay} erfolgreich absolviert." . "\n\nIhre nächste Unterweisung ist bis zum {$dueDateDisplay} fällig." . "\n\nVielen Dank für Ihre Teilnahme!"; if (!send_intranet_mail($senderMail, $mailSubject, $mailMessage)) { error_log('Brandschutz: Bestätigungsmail an ' . $senderMail . ' konnte nicht gesendet werden.'); } } header('Location: /intranet_repo/projects/intranet/index.php?message=8', true, 303); exit(); } $courseError = null; $course = ['title' => 'Brandschutzunterweisung', 'settings' => [], 'chapters' => []]; try { $course = brandschutz_course_load($pdo)['config']; } catch (Throwable $exception) { error_log('Brandschutz-Konfiguration: ' . $exception->getMessage()); $courseError = 'Die Schulung konnte momentan nicht geladen werden. Bitte versuchen Sie es später erneut.'; } $clientSettings = [ 'passingScore' => (int) ($course['settings']['passing_score'] ?? 70), 'maxAttempts' => (int) ($course['settings']['max_attempts'] ?? 3), 'successTitle' => (string) ($course['settings']['success_title'] ?? 'Schulung bestanden!'), 'successText' => brandschutz_course_sanitize_html($course['settings']['success_text'] ?? ''), 'failureTitle' => (string) ($course['settings']['failure_title'] ?? 'Schulung nicht bestanden'), 'failureText' => brandschutz_course_sanitize_html($course['settings']['failure_text'] ?? ''), 'confirmationText' => brandschutz_course_sanitize_html($course['settings']['confirmation_text'] ?? ''), ]; ?> <?= brandschutz_h((string) $course['title']) ?>
Schulung nicht verfügbar
Noch keine Inhalte
Für diese Schulung wurden noch keine Kapitel angelegt.
$chapter): ?> 0): ?>
$chapter): ?>
0 ? ' hidden' : '' ?>> 0 || count($course['chapters']) === 1): ?>
Leeres Kapitel
Dieses Kapitel enthält noch keine Seiten.
$page): ?>
0 ? ' hidden' : '' ?>>
Diese Seite enthält noch keine Elemente.