Beide Module wurden aus einem anderen Kundenprojekt kopiert und bereinigt: Knowledgecenter: - Bild-Cache (1.985 Dateien) geleert, Ordnerstruktur mit .gitkeep behalten - Files-Gallery-Lizenzschlüssel entfernt (config.php) - Kundenspezifische Kategorien gelöscht: Teil I/II/III QM-Struktur, nummerierte QM-Kapitel, Gremien (Präsidium/Finanzausschuss/Landesausschuss), Sitzungsservice-Serie, Protokoll-Abteilungen, Testeinträge - 56 generische Kategorien bleiben (Downloads, Onboarding, Personalthemen …) Tasks: - Alle Betriebsdaten gelöscht (114 Tasks, 914 Submissions, 579 Assignments) - Task-Definitionen und Verlinkungen geleert - Kategoriestruktur bleibt (Allgemein, IT, Personal, Buchhaltung …) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
71 lines
2.4 KiB
PHP
71 lines
2.4 KiB
PHP
<?php
|
|
declare(strict_types=1);
|
|
|
|
require_once dirname(dirname(__DIR__)) . '/bootstrap.php';
|
|
|
|
function task_cert_admin_task_list_action(): array
|
|
{
|
|
$auth = TaskCertAuthContext::fromGlobals();
|
|
if (!$auth->hasPermission('r-task-cert-admin')) {
|
|
return [
|
|
'error' => 'Keine Berechtigung für die Aufgaben-Administration.',
|
|
'tasks' => [],
|
|
];
|
|
}
|
|
|
|
$services = task_cert_services();
|
|
$searchQuery = TaskCertRequest::queryString('q', '');
|
|
$categoryIdFilter = TaskCertRequest::queryInt('category_id', 0);
|
|
if ($categoryIdFilter < 0) {
|
|
$categoryIdFilter = 0;
|
|
}
|
|
|
|
$tasks = $services['taskDefinitionService']->listTasksForAdmin($searchQuery, $categoryIdFilter);
|
|
$categoryFilter = null;
|
|
|
|
if ($categoryIdFilter > 0) {
|
|
$categoryService = $services['taskCategoryService'] ?? null;
|
|
if ($categoryService instanceof TaskCategoryService) {
|
|
$categoryFilter = $categoryService->getById($categoryIdFilter);
|
|
}
|
|
}
|
|
|
|
$myTasks = [];
|
|
$contactId = $auth->contactId();
|
|
if ($contactId > 0) {
|
|
$myTasks = $services['taskDefinitionService']->listTasksForResponsible($contactId);
|
|
}
|
|
|
|
$lookupRepo = $services['lookupRepo'] ?? null;
|
|
|
|
$selectedContactId = TaskCertRequest::queryInt('contact_id', 0);
|
|
$contactAssignments = [];
|
|
$selectedContactName = '';
|
|
if ($selectedContactId > 0 && $lookupRepo instanceof TaskLookupRepository) {
|
|
$contact = $lookupRepo->getContactById($selectedContactId);
|
|
if (is_array($contact)) {
|
|
$selectedContactName = trim((string) ($contact['name'] ?? ''));
|
|
if ($selectedContactName === '') {
|
|
$selectedContactName = trim((string) ($contact['email'] ?? 'Kontakt #' . $selectedContactId));
|
|
}
|
|
}
|
|
if ($selectedContactName === '') {
|
|
$selectedContactName = 'Kontakt #' . $selectedContactId;
|
|
}
|
|
$contactAssignments = $services['assignmentRepo']->listByContactId($selectedContactId);
|
|
}
|
|
|
|
return [
|
|
'error' => null,
|
|
'tasks' => $tasks,
|
|
'my_tasks' => $myTasks,
|
|
'search_query' => $searchQuery,
|
|
'category_id_filter' => $categoryIdFilter,
|
|
'category_filter' => $categoryFilter,
|
|
'selected_contact_id' => $selectedContactId,
|
|
'selected_contact_name' => $selectedContactName,
|
|
'contact_assignments' => $contactAssignments,
|
|
'csrf_token' => TaskCertCsrf::token(),
|
|
];
|
|
}
|