Files
intranet/web/intranet_repo/projects/seelsorge/seelsorge.php
T

104 lines
4.2 KiB
PHP
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
<?php /* Name: seelsorge.php
Beschreibung: Seelsorge Hauptseite
- Übersicht und Kalenderblätter */
// Initialisierung
require_once $_SERVER['DOCUMENT_ROOT'].'/intranet_repo/general_files/initialise.php';
require_once __DIR__ . '/util/seelsorge_helpers.php';
$seelsorgeCsrfToken = seelsorge_csrf_token();
$activeTab = ($_GET['tab'] ?? '') === 'visit' ? 'visit' : 'calendar';
$visitFormError = $_SESSION['seelsorge_visit_form_error'] ?? null;
unset($_SESSION['seelsorge_visit_form_error']);
if ($_SERVER['REQUEST_METHOD'] === 'POST' && isset($_POST['visit_command'])) {
$isVisitSave = $_POST['visit_command'] === 'save';
$submittedVisitForm = $isVisitSave ? array_diff_key($_POST, ['visit_command' => true, 'csrf_token' => true]) : null;
try {
seelsorge_verify_csrf($_POST);
seelsorge_process_visit_command($pdo, $_POST, (int) $_SESSION['user_id']);
} catch (InvalidArgumentException | RuntimeException $e) {
$_SESSION['seelsorge_visit_form_error'] = [
'message' => $e->getMessage(),
'form' => $submittedVisitForm,
];
} catch (Throwable $e) {
error_log('Seelsorge visit command failed: ' . $e->getMessage());
$_SESSION['seelsorge_visit_form_error'] = [
'message' => 'Aktion fehlgeschlagen.',
'form' => $submittedVisitForm,
];
}
header('Location: /intranet_repo/projects/seelsorge/seelsorge.php?tab=visit', true, 303);
exit;
}
?>
<!DOCTYPE html>
<html lang="de" dir="ltr">
<head>
<?php require_once $_SERVER['DOCUMENT_ROOT'].'/intranet_repo/projects/_central/php/html_head.php'; ?>
<script src="/intranet_repo/projects/_central/scripts/seelsorge.js"></script>
<link rel="stylesheet" href="/intranet_repo/projects/_central/layouts/seelsorge.css">
</head>
<body class="theme-purple">
<?php // Es folgen ab hier die HTML-Ausgaben beginnend mit dem HTML-Header: ?>
<?php require_once $_SERVER['DOCUMENT_ROOT'].'/intranet_repo/projects/_central/php/header.php'; ?>
<?php // Header (erweitert): Titel der Seite mit Untermenü ?>
<div class="header_title ht_pastoral text_white unselectable" id="header_title">
<span class="header_title_text">Seelsorgeplaner</span>
</div>
<div class="content" id="fullsize">
<div class="content-tab-bar" id="seelsorge-tabs">
<div class="content-tab-bar__item<?= $activeTab === 'calendar' ? ' active' : '' ?>" data-target="content_calendar">Kalendarium</div>
<div class="content-tab-bar__item<?= $activeTab === 'visit' ? ' active' : '' ?>" data-target="content_visit">Besuchsstellen</div>
</div>
<div class="content_seelsorge<?= $activeTab === 'calendar' ? ' active' : '' ?>" id="content_calendar">
<?php // Kalendarium:
include 'content/calendar.php'; ?>
</div>
<div class="content_seelsorge<?= $activeTab === 'visit' ? ' active' : '' ?>" id="content_visit">
<?php // Besuchsstellen:
include 'content/visit.php'; ?>
</div>
</div>
<!-- Modal für Kalendertag -->
<div class="standard_overlay" id="seelsorge-day-modal" onclick="closeDayModalOnBackdrop(event)">
<div class="seelsorge-modal-card">
<button type="button" class="exit" aria-label="Schließen" onclick="closeDayModal()">×</button>
<div class="seelsorge-modal-hero">
<div class="seelsorge-modal-hero-icon">
<svg viewBox="0 0 24 24" width="48" height="48" fill="none" stroke="#FFFFFF" stroke-width="1.5"><rect x="3" y="4" width="18" height="18" rx="2"/><line x1="16" y1="2" x2="16" y2="6"/><line x1="8" y1="2" x2="8" y2="6"/><line x1="3" y1="10" x2="21" y2="10"/></svg>
</div>
<div>
<div class="seelsorge-modal-title" id="modal-day-title">—</div>
<div class="seelsorge-modal-subtitle" id="modal-day-subtitle"></div>
</div>
</div>
<div class="seelsorge-modal-body" id="modal-day-body">
<div class="seelsorge-modal-loading"><div class="loading-spinner"></div></div>
</div>
</div>
</div>
<?php include __DIR__ . '/content/profile.php'; ?>
<script type="application/json" id="seelsorge-config"><?= json_encode([
'csrfToken' => $seelsorgeCsrfToken,
], JSON_UNESCAPED_UNICODE | JSON_HEX_TAG | JSON_HEX_AMP | JSON_HEX_APOS | JSON_HEX_QUOT) ?></script>
<?php require_once $_SERVER['DOCUMENT_ROOT'].'/intranet_repo/projects/_central/php/footer.php'; ?>
</body>
</html>