Files
Moritz Weinmann 8ff44a407e feat(wiki): Kategoriebeschreibungen, Kacheldesign und Migration
- Migrationsskript: Teaser/Content getrennt (kc_teaser id=55 → teaser,
  kc_article id=58 → content), Gemini-Summaries mit thinkingBudget=0,
  Retry-Logik für 503/429-Fehler
- Berechtigungsfehler behoben: AND active=1 aus main_contact_department-
  Abfrage entfernt (Middleware + Ajax)
- Kategoriebeschreibungen: neues description-Feld in
  knowledgecenter_category_translations, aus kc.tags befüllt
- Kacheln: Hauptebene erhält post_wiki-Klasse für einheitliches Design,
  Beschreibungstext in Grid-Ansicht, in Listenansicht ausgeblendet
- Buttons: Beitrag-erstellen nutzt --clr-mandant, alle vier Toolbar-
  Buttons auf gleiche Höhe normiert (line-height: 1 + SVG 1em)
- Platzhalterpfade für Kategorien und Beiträge korrigiert
- Zusammenfassung in Beitragsansicht angezeigt

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-06-23 10:00:17 +02:00

63 lines
2.5 KiB
PHP
Raw Permalink 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
/**
* Zunächst: Holen der User-Daten (Mandanten, Abteilungen, Rollen, Einrichtungen, Fachbereiche)
*/
$currentUserId = $GLOBALS["main_contact"]["id"] ?? 0;
$userMandants = [];
$userDepartments = [];
$userRoles = [];
$userEinrichts = [];
$userFachbereiche = [];
if ($currentUserId) {
$query = "SELECT main_mandant_id, main_department_id, main_role_id, main_einricht_id, main_bereich_id
FROM main_contact_department
WHERE main_contact_id = $currentUserId";
$result = mysqli_query($GLOBALS['mysql_con'], $query);
while ($row = mysqli_fetch_assoc($result)) {
// Filtere 0 aus 0 gilt als "keine Zuordnung"
if ($row['main_mandant_id'] != 0 && !in_array($row['main_mandant_id'], $userMandants)) {
$userMandants[] = $row['main_mandant_id'];
}
if ($row['main_department_id'] != 0 && !in_array($row['main_department_id'], $userDepartments)) {
$userDepartments[] = $row['main_department_id'];
}
if ($row['main_role_id'] != 0 && !in_array($row['main_role_id'], $userRoles)) {
$userRoles[] = $row['main_role_id'];
}
if ($row['main_einricht_id'] != 0 && !in_array($row['main_einricht_id'], $userEinrichts)) {
$userEinrichts[] = $row['main_einricht_id'];
}
if ($row['main_bereich_id'] != 0 && !in_array($row['main_bereich_id'], $userFachbereiche)) {
$userFachbereiche[] = $row['main_bereich_id'];
}
}
}
/**
* Für den LEFT JOIN-Ansatz bereiten wir die erlaubten Werte als
* kommaseparierte Strings vor.
*/
$allowedMandants = !empty($userMandants) ? implode(',', $userMandants) : 'NULL';
$allowedDepartments = !empty($userDepartments) ? implode(',', $userDepartments) : 'NULL';
$allowedRoles = !empty($userRoles) ? implode(',', $userRoles) : 'NULL';
$allowedEinrichts = !empty($userEinrichts) ? implode(',', $userEinrichts) : 'NULL';
$allowedFachbereiche = !empty($userFachbereiche) ? implode(',', $userFachbereiche) : 'NULL';
// Für den globalen Zugriff kannst Du auch die Variablen in $GLOBALS speichern:
$GLOBALS['allowedMandants'] = $allowedMandants;
$GLOBALS['allowedDepartments'] = $allowedDepartments;
$GLOBALS['allowedRoles'] = $allowedRoles;
$GLOBALS['allowedEinrichts'] = $allowedEinrichts;
$GLOBALS['allowedFachbereiche'] = $allowedFachbereiche;
// echo "<pre>";
// echo "Mandanten: " . $allowedMandants . "\n";
// echo "Abteilungen: " . $allowedDepartments . "\n";
// echo "Rollen: " . $allowedRoles . "\n";
// echo "</pre>";