From d58f61770463aab2c71464c11f902f0074b49b62 Mon Sep 17 00:00:00 2001 From: Daniel Weipert Date: Mon, 15 Jan 2024 15:50:43 +0100 Subject: http catch-up --- src/http/Controller/Village.php | 44 ++++++++++++++++++++++++++++++++++++++++- 1 file changed, 43 insertions(+), 1 deletion(-) (limited to 'src/http/Controller/Village.php') diff --git a/src/http/Controller/Village.php b/src/http/Controller/Village.php index 7b1f227..2d6aa39 100644 --- a/src/http/Controller/Village.php +++ b/src/http/Controller/Village.php @@ -4,6 +4,8 @@ namespace App\http\Controller; use App\DB; use App\Guard; +use App\Model\Event\SendResources; +use App\Model\Event\SendResourcesCarriers; use App\Model\Event\SendUnits; use App\Model\Event\TrainUnits; use App\Model\Event\UpgradeBuilding; @@ -27,7 +29,7 @@ class Village join user_villages on villages.id = user_villages.village_id where user_villages.user_id=:id SQL, - ['id' => $_SESSION['user']['id']] + ['id' => $_SESSION['user']['id'] ?? -1] ); return new Response(View::render('villages.twig', [ @@ -90,6 +92,46 @@ class Village $events['SendUnits'][] = DB::convertToModel(SendUnits::class, $row);; } + $eventsResourcesSendOwn = DB::query( + << $village->id] + )->fetchAll(); + + $eventsResourcesSendOther = DB::query( + << $village->id] + )->fetchAll(); + + foreach ([...$eventsResourcesSendOwn, ...$eventsResourcesSendOther] as $row) { + $events['SendResources'][] = DB::convertToModel(SendResources::class, $row);; + } + + $eventsResourcesCarriersSendOwn = DB::query( + << $village->id] + )->fetchAll(); + + $eventsResourcesCarriersSendOther = DB::query( + << $village->id] + )->fetchAll(); + + foreach ([...$eventsResourcesCarriersSendOwn, ...$eventsResourcesCarriersSendOther] as $row) { + $events['SendResourcesCarriers'][] = DB::convertToModel(SendResourcesCarriers::class, $row);; + } + $buildings = []; foreach (Model::getBuildings($village->id, true) as $building) { $buildings[$building->type] = $building; -- cgit v1.2.3