2024-09-17 17:21:43 +02:00
|
|
|
<?php
|
2025-01-22 17:08:32 +01:00
|
|
|
|
2026-01-15 11:16:17 +01:00
|
|
|
// Récupérer le collector de notifications pour ce projet individuel
|
|
|
|
|
$notificationCollector = $kirby->option('adrienpayet.pdc-notifications.collector');
|
|
|
|
|
$notifications = [];
|
|
|
|
|
|
|
|
|
|
if ($notificationCollector && $kirby->user()) {
|
|
|
|
|
try {
|
|
|
|
|
$notifications = $notificationCollector->collect($page, $kirby->user());
|
|
|
|
|
} catch (\Throwable $e) {
|
|
|
|
|
error_log("Error collecting notifications for project {$page->uri()}: " . $e->getMessage());
|
|
|
|
|
$notifications = [];
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2025-01-23 12:23:14 +01:00
|
|
|
$project = [
|
2025-02-05 11:22:09 +01:00
|
|
|
'title' => $page->title()->value(),
|
|
|
|
|
'url' => $page->url(),
|
|
|
|
|
'modified' => $page->modified('Y-MM-d'),
|
|
|
|
|
'status' => $page->status(),
|
|
|
|
|
'logo' => $page->client()->isNotEmpty() && $page->client()->toPage()
|
2025-01-23 12:23:14 +01:00
|
|
|
? $page->client()->toPage()->logo()->toFile()->url()
|
|
|
|
|
: null,
|
2025-05-27 11:39:20 +02:00
|
|
|
'steps' => $page->getSteps(),
|
2025-02-05 11:22:09 +01:00
|
|
|
'designToLight' => $page->isDTLEnabled()->isTrue() ? processDTLProposals($page) : null,
|
|
|
|
|
'hasOptimizationRequest' => $page->hasOptimizationRequest()->isTrue(),
|
2026-01-15 11:16:17 +01:00
|
|
|
'notifications' => $notifications,
|
2025-01-23 12:23:14 +01:00
|
|
|
];
|
2025-01-22 13:25:34 +01:00
|
|
|
|
2024-10-28 15:33:52 +01:00
|
|
|
$pageData = array_merge($genericData, $project);
|
2024-09-17 17:21:43 +02:00
|
|
|
|
2024-10-28 15:33:52 +01:00
|
|
|
echo json_encode([
|
2025-02-05 11:22:09 +01:00
|
|
|
'page' => $pageData,
|
|
|
|
|
'user' => $userData,
|
2025-01-23 12:23:14 +01:00
|
|
|
]);
|