Show reminders on dashboard
This commit is contained in:
@@ -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,
|
||||
]);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user