Show reminders on dashboard

This commit is contained in:
2026-08-09 02:33:02 +02:00
parent 81ad4b82c9
commit 3d48595ee9
3 changed files with 150 additions and 2 deletions
+9 -1
View File
@@ -6,15 +6,23 @@ class HabitController
{
require_login();
$userId = (int) current_user_id();
$filters = [
'category_id' => $_GET['category_id'] ?? '',
'status' => $_GET['status'] ?? '',
];
$remindersByHabit = [];
foreach (Reminder::allForUser($userId) as $reminder) {
$remindersByHabit[(int) $reminder['habit_id']][] = $reminder;
}
View::render('habits/dashboard', [
'habits' => Habit::allForUser(current_user_id(), $filters),
'habits' => Habit::allForUser($userId, $filters),
'categories' => Category::all(),
'filters' => $filters,
'remindersByHabit' => $remindersByHabit,
]);
}