first commit

This commit is contained in:
2026-01-29 21:08:01 +01:00
commit 4e4dfe66c6
28 changed files with 2509 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
<?php
class DashboardController
{
public function index()
{
if (!isset($_SESSION['user_id'])) {
header('Location: /logowanie');
exit;
}
$userModel = new User();
$user = $userModel->getUserById($_SESSION['user_id']);
$calendarModel = new CalendarEvent();
$today = new DateTime('today');
$weekStart = (clone $today)->modify('monday this week');
$weekEnd = (clone $weekStart)->modify('+6 days');
$eventsThisWeek = $calendarModel->countByDateRange(
$_SESSION['user_id'],
$weekStart->format('Y-m-d'),
$weekEnd->format('Y-m-d')
);
require_once __DIR__ . '/../views/dashboard.php';
}
}