authService = $authService; } public function getUsersList(): ?array { if ($this->authService->currentUser && $this->authService->currentUser->getRole()->getUsersList()) { return $this->authService->currentUser->getRole()->getUsersList(); } return null; } public function getTrainingsList(): ?array { if ($this->authService->currentUser && $this->authService->currentUser->getRole()->getTrainingsList()) { return $this->authService->currentUser->getRole()->getTrainingsList(); } return null; } public function addUser(String $username): bool { if ($this->authService->currentUser && $this->authService->currentUser->getRole()) { if(($user = $this->authService->getUserRepository()->GetItemByName($username,0,1))) { // count 1 seul et debuis 0 (debut) if ($this->authService->currentUser->getRole()->addUser($user)) { return true; } } } return false; } public function removeUser(String $username): bool { if ($this->authService->currentUser && $this->authService->currentUser->getRole()) { if(($user = $this->authService->getUserRepository()->GetItemByName($username,0,1))) { // count 1 seul et debuis 0 (debut) if ($this->authService->currentUser->getRole()->removeUser($user)) { return true; } } } return false; } public function addTraining(Training $training): bool { if ($this->authService->currentUser && $this->authService->currentUser->getRole()) { if ($this->authService->currentUser->getRole()->addTraining($training)) { return true; } } return false; } public function removeTraining(String $trainingId): bool { if ($this->authService->currentUser && $this->authService->currentUser->getRole()) { if(($training = $this->authService->currentUser->getRole()->getTraining()->getItemById($trainingId))) { // count 1 seul et debuis 0 (debut) if ($this->authService->currentUser->getRole()->removeTraining($training)) { return true; } } } return false; } // public function getStatistics(User $user) : ?Statistic { // if ($this->authService->currentUser && $this->authService->currentUser->getRole()) { // if (($arrayStat = $this->authService->currentUser->getRole()->getUserList($user)->getStatistic())) { // return $arrayStat; // } // } // return null; // } // // public function getAnalyse(User $user): bool { // return false; // } } ?>