LuminaWebsite/includes/calendar_audience.php
Maaxxs 8b59cb503b DACH Elyos: the Consilium Elyseum is now called DACH Elyos across the website
Asked for: "das consilium elyseum wurde umbenannt zu DACH Elyos. pass das bitte an auf der website".

- CONSILIUM_NAME is 'DACH Elyos', and every visible text follows it: sidebar, the alliance page, member tab, raid
  area, calendar audience and badge, iCal note, map live sessions and share buttons, admin pages (Verwaltung ->
  DACH Elyos, Discord-Bot, Berechtigungsgruppen), flash messages, log entries, permission descriptions (synced to
  the database by schema_sync_core_permissions()) and the privacy page.
- The name takes no article, so the sentences around it changed too: "von DACH Elyos", "in DACH Elyos", "für DACH
  Elyos" instead of "des Consiliums", "im Consilium", "für das Consilium". The bot channel label is now
  "Raid-Kanal DACH Elyos".
- Internal names stay "consilium": permission keys, tables, settings, files and URLs (?bereich=consilium,
  ?tab=consilium), so nothing in the database or in existing links changes. includes/consilium.php says so.
- README: section renamed to "DACH Elyos" (anchor #dach-elyos).
- No patch note (alliance topics stay out of them). The bot's two "Consilium" error texts in live_tactics.py never
  reach the page - the map only reads the status code - so the bot needs no update.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-09-28 14:15:10 +02:00

77 lines
3.1 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
declare(strict_types=1);
/**
* Fuer wen ein Kalender-Termin der Mitglieder gedacht ist (calendar_entries.audience). Termine nur
* fuer die Leitung tragen Konten mit calendar.leadership ein (die Sedes Luminis):
* all - wie bisher: alle sehen ihn und koennen "Bin dabei" klicken
* consilium - fuer das Consilium Elyseum: sehen und teilnehmen nur mit consilium.view - die verbuendeten Legionen
* und aus der Legion z.B. die Leitung, normale Mitglieder nicht
* leadership - alle sehen ihn, teilnehmen kann nur die Leitung (z.B. eine Besprechung)
* internal - nur die Leitung sieht ihn ueberhaupt
* Mitglieder verbuendeter Legionen (consilium_only()) sehen nur Consilium-Termine und tragen nur solche ein; der
* oeffentliche Kalender zeigt sie nicht.
*/
const CALENDAR_AUDIENCES = [
'all' => 'Alle Mitglieder',
'consilium' => 'DACH Elyos – auch die verbündeten Legionen sehen ihn und nehmen teil',
'leadership' => 'Nur Leitung nimmt teil (für alle sichtbar)',
'internal' => 'Intern – nur für die Leitung sichtbar',
];
function calendar_can_lead(): bool
{
return user_has_permission('calendar.leadership');
}
/**
* Darf der Betrachter den Termin sehen? (Freigabe/Moderation prueft der Aufrufer wie bisher.) $consiliumOnly: ob er nur
* zum Consilium gehoert, $seeConsilium: ob er das Consilium sieht (consilium.view) - null = das angemeldete Konto.
*/
function calendar_can_view(array $row, bool $canLead, int $myId, ?bool $consiliumOnly = null, ?bool $seeConsilium = null): bool
{
$audience = $row['audience'] ?? 'all';
if ((int) $row['user_id'] === $myId) {
return true;
}
if ($consiliumOnly ?? consilium_only()) {
return $audience === 'consilium';
}
if ($audience === 'consilium') {
return $seeConsilium ?? consilium_can_view();
}
return $audience !== 'internal' || $canLead;
}
/** Darf der Betrachter sich mit "Bin dabei" eintragen? (Sehen darf er ihn, siehe calendar_can_view().) */
function calendar_can_join(array $row, bool $canLead): bool
{
return in_array($row['audience'] ?? 'all', ['all', 'consilium'], true) || $canLead;
}
/** Darf das angemeldete Konto Consilium-Termine eintragen (consilium.calendar, und es sieht das Consilium)? */
function calendar_can_add_consilium(): bool
{
return consilium_can_view() && user_has_permission('consilium.calendar');
}
/**
* Zielgruppe aus dem Formular: die der Leitung nur mit calendar.leadership, Consilium-Termine nur mit
* consilium.calendar - sonst bleibt es beim bisherigen Wert. Verbuendete aus dem Consilium tragen immer
* Consilium-Termine ein.
*/
function calendar_audience_input(?string $current, bool $canLead): string
{
if (consilium_only()) {
return 'consilium';
}
$value = (string) ($_POST['audience'] ?? '');
if ($value === 'consilium') {
if (calendar_can_add_consilium()) {
return $value;
}
} elseif (isset(CALENDAR_AUDIENCES[$value]) && ($canLead || ($value === 'all' && calendar_can_add_consilium()))) {
return $value;
}
return $current !== null && isset(CALENDAR_AUDIENCES[$current]) ? $current : 'all';
}