projectsService = $projectsService; $this->menuService = $menuService; $this->reactionService = $reactionService; } public function get() {} /** * Toggles the current user's favorite reaction for a project and re-renders the card. */ public function toggleFavorite(): void { $projectData = $this->incomingRequest->request->all(); $projectId = $projectData['projectId']; $isFavorite = $projectData['isFavorite']; if ($isFavorite) { $this->reactionService->removeReaction( userId: session('userdata.id'), module: 'project', moduleId: $projectId, reaction: 'favorite' ); } else { $this->reactionService->addReaction( userId: session('userdata.id'), module: 'project', moduleId: $projectId, reaction: 'favorite' ); } $this->tpl->setHTMXEvent('HTMX.updateProjectList'); $this->tpl->assign('project', $this->projectsService->getProject($projectId)); } /** * Renders the project card for a project. */ public function getProgress(): void { $projectId = $_GET['projectId']; $projectTypeAvatars = $this->menuService->getProjectTypeAvatars(); $currentUrlPath = BASE_URL.'/'.str_replace('.', '/', Frontcontroller::getCurrentRoute()); $this->tpl->assign('projectTypeAvatars', $projectTypeAvatars); $this->tpl->assign('currentUrlPath', $currentUrlPath); $this->tpl->assign('project', $this->projectsService->getProject($projectId)); $this->tpl->assign('type', 'full'); } }