diff --git a/src/Command/AccountCreationTeacherCommand.php b/src/Command/AccountCreationTeacherCommand.php index 3a44190bc9970abbb606e743f96df2fa2a26f55e..d1a94e2edaa313e16f66ad203182bfc04ca61db1 100644 --- a/src/Command/AccountCreationTeacherCommand.php +++ b/src/Command/AccountCreationTeacherCommand.php @@ -75,7 +75,7 @@ class AccountCreationTeacherCommand extends Command - $user = new User($this->translator); + $user = new User(); $user->setPseudo($username); $user->setEmail($email); $user->setUuid(new UuidV1()); diff --git a/src/Command/BootstrapCommand.php b/src/Command/BootstrapCommand.php index 43da10963ae6b913ed682252d2dbc2fe67f75182..24f301c6145f16b14a78dba6f4128431a2acca5a 100644 --- a/src/Command/BootstrapCommand.php +++ b/src/Command/BootstrapCommand.php @@ -63,7 +63,7 @@ class BootstrapCommand extends Command $redirectUris = explode(',', $input->getOption('redirect-uris')); // Create the user - $user = new User($this->translator); + $user = new User(); $user->setEmail($email); $user->setPassword($this->passwordHasher->hashPassword($user, $password)); $user->setRoles(['ROLE_SUPER_ADMIN']); diff --git a/src/Controller/RegistrationController.php b/src/Controller/RegistrationController.php index ea91516cc20635dcadd6d4394ceeef5081ac53f7..303907fdb2f02f4710c75bab1d89411f1196fb55 100644 --- a/src/Controller/RegistrationController.php +++ b/src/Controller/RegistrationController.php @@ -36,7 +36,7 @@ class RegistrationController extends AbstractController VerifyEmailHelperInterface $verifyEmailHelper, MailerInterface $mailer): Response { - $user = new User($this->translator); + $user = new User(); $form = $this->createForm(RegistrationFormType::class, $user); $form->handleRequest($request); diff --git a/src/Entity/User.php b/src/Entity/User.php index f36c198b95b72b1bd6efa2ba7fa0d021663970a3..1b501a10281fb97f37e86598530d0be068008f13 100644 --- a/src/Entity/User.php +++ b/src/Entity/User.php @@ -16,7 +16,6 @@ use Symfony\Component\Uid\UuidV1; use Symfony\Component\Validator\Constraints as Assert; use Vich\UploaderBundle\Mapping\Annotation as Vich; use Symfony\Component\Serializer\Annotation\Ignore; -use Symfony\Contracts\Translation\TranslatorInterface; /** * @ORM\Entity(repositoryClass=UserRepository::class) @@ -270,14 +269,12 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface */ private $lastDailyQuestUpdate; - private $translator; - public function __toString() { return $this->getPseudo(); } - public function __construct(TranslatorInterface $translator) + public function __construct() { $this->oAuth2UserConsents = new ArrayCollection(); $this->uuid = new UuidV1(); @@ -301,7 +298,6 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface $this->lexicons = new ArrayCollection(); $this->userPoints = 0; $this->successes = new ArrayCollection(); - $this->translator = $translator; $this->initializeSuccesses(); $this->dailyQuestStrike = 0; } @@ -315,7 +311,7 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface $success->setSuccessMilestones([0, 1, 10, 25, 50, 100]); // Set the initial success milestones to 0 $success->setCurrentMilestone(0); // Set the initial current milestone to 0 $success->setUser($this); // Bind the Success entity to the current user - $success->setExplanation($this->translator->trans('Nombre de mots ajoutés par vous dans tous vos lexiques')); + $success->setExplanation('Nombre de mots ajoutés par vous dans tous vos lexiques'); $success->setColors(['#181893', '#E5E8F9']); // $success->setIcon('assets/images/success_icons/vocabulord.png'); // Set the icon attribute // Add the Success entity to the user's $successes collection @@ -327,7 +323,7 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface $success->setSuccessMilestones([0, 1, 10, 25, 50, 100]); // Set the initial success milestones to 0 $success->setCurrentMilestone(0); // Set the initial current milestone to 0 $success->setUser($this); // Bind the Success entity to the current user - $success->setExplanation($this->translator->trans('Nombre de mots auquel vous avez ajouté au moins un label')); + $success->setExplanation('Nombre de mots auquel vous avez ajouté au moins un label'); $success->setColors(['#E52322', '#FFE5D9']); // $success->setIcon('assets/images/success_icons/labelliciste.png'); // Set the icon attribute $this->successes->add($success); @@ -338,7 +334,7 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface $success->setSuccessMilestones([0, 5, 25, 50, 100, 250]); // Set the initial success milestones to 0 $success->setCurrentMilestone(0); // Set the initial current milestone to 0 $success->setUser($this); // Bind the Success entity to the current user - $success->setExplanation($this->translator->trans('Nombre total de consultations de toutes vos entrées')); + $success->setExplanation('Nombre total de consultations de toutes vos entrées'); $success->setColors(['#93184A', '#FFE1EF']); // $success->setIcon('assets/images/success_icons/gardien_du_savoir.png'); // Set the icon attribute $this->successes->add($success); @@ -349,7 +345,7 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface $success->setSuccessMilestones([0, 2, 5, 10, 20, 35]); // Set the initial success milestones to 0 $success->setCurrentMilestone(0); // Set the initial current milestone to 0 $success->setUser($this); // Bind the Success entity to the current user - $success->setExplanation($this->translator->trans('Nombre de jours consécutifs où vous avez réussi la quête journalière')); + $success->setExplanation('Nombre de jours consécutifs où vous avez réussi la quête journalière'); $success->setColors(['#412666', '#E7D5E9']); // $success->setIcon('assets/images/success_icons/maitre_du_temps.png'); // Set the icon attribute $this->successes->add($success); @@ -360,7 +356,7 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface $success->setSuccessMilestones([0, 1, 5, 10, 20, 35]); // Set the initial success milestones to 0 $success->setCurrentMilestone(0); // Set the initial current milestone to 0 $success->setUser($this); // Bind the Success entity to the current user - $success->setExplanation($this->translator->trans('Nombre de mots ajoutés par vous à un label public')); + $success->setExplanation('Nombre de mots ajoutés par vous à un label public'); $success->setColors(['#009FE3', '#D0EBFC']); // $success->setIcon('assets/images/success_icons/altruiste.png'); // Set the icon attribute $this->successes->add($success); @@ -371,7 +367,7 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface $success->setSuccessMilestones([0, 1, 5, 10, 20, 35]); // Set the initial success milestones to 0 $success->setCurrentMilestone(0); // Set the initial current milestone to 0 $success->setUser($this); // Bind the Success entity to the current user - $success->setExplanation($this->translator->trans("Nombre d'entrées modifiées par vous dans vos lexiques de groupe")); + $success->setExplanation("Nombre d'entrées modifiées par vous dans vos lexiques de groupe"); $success->setColors(['#E9580C', '#FFE8D9']); // $success->setIcon('assets/images/success_icons/acolyte_anonyme.png'); // Set the icon attribute $this->successes->add($success); @@ -382,7 +378,7 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface $success->setSuccessMilestones([0, 1, 5, 10, 20, 35]); // Set the initial success milestones to 0 $success->setCurrentMilestone(0); // Set the initial current milestone to 0 $success->setUser($this); // Bind the Success entity to the current user - $success->setExplanation($this->translator->trans('Nombre de messages écrits dans les discussions de groupe')); + $success->setExplanation('Nombre de messages écrits dans les discussions de groupe'); $success->setColors(['#05993C', '#EAF3E3']); // $success->setIcon('assets/images/success_icons/messager.png'); // Set the icon attribute $this->successes->add($success); @@ -393,7 +389,7 @@ class User implements UserInterface, PasswordAuthenticatedUserInterface $success->setSuccessMilestones([0, 1, 5, 10, 20, 35]); // Set the initial success milestones to 0 $success->setCurrentMilestone(0); // Set the initial current milestone to 0 $success->setUser($this); // Bind the Success entity to the current user - $success->setExplanation($this->translator->trans('Nombre de commentaires écrits dans les entrées')); + $success->setExplanation('Nombre de commentaires écrits dans les entrées'); $success->setColors(['#F6A600', '#FBF6DB']); // $success->setIcon('assets/images/success_icons/commentateur_sportif.png'); // Set the icon attribute $this->successes->add($success); diff --git a/templates/dashboard/dashboard.html.twig b/templates/dashboard/dashboard.html.twig index 1c97c00c437bd2817aaa932f1c553ef034e73c1d..825ea432eadf956d87c1f533fad8d62709ca7b30 100644 --- a/templates/dashboard/dashboard.html.twig +++ b/templates/dashboard/dashboard.html.twig @@ -60,8 +60,7 @@ {% endfor %} </div> </div> - {% set counter = counter + 1 %} - {% endif %} + </div> {% endfor %} </div> </div> diff --git a/templates/successes.html.twig b/templates/successes.html.twig index 644b2c04f47c206168542eaaeec6c468a5dc8074..482f946fcf461bf72158286419a3b5d0f1fee850 100644 --- a/templates/successes.html.twig +++ b/templates/successes.html.twig @@ -43,7 +43,7 @@ {# <img src="{{ asset(successData.icon) }}" alt="{{ successData.successName }}" class="success-icon-img">#} </div> <div class="success-info"> - <div class="success-title" data-bs-toggle="tooltip" data-bs-placement="top" title="{{ successData.explanation }}"> + <div class="success-title" data-bs-toggle="tooltip" data-bs-placement="top" title="{{ successData.explanation |trans}}"> {{ successData.successName|trans }} </div> <div class="success-progress">