/**
  * Get the dashboard profil % completed
  *
  * @param User $user
  *
  * @return float
  */
 function getPercentCompleted(User $user)
 {
     $totalToFill = 13;
     $completed = 0;
     if ($user->getPrenom()) {
         $completed++;
     }
     if ($user->getNom()) {
         $completed++;
     }
     if ($user->getTel()) {
         $completed++;
     }
     if ($user->getSexe()) {
         $completed++;
     }
     if ($user->getDob()) {
         $completed++;
     }
     if ($user->getArrival()) {
         $completed++;
     }
     if ($user->getDepart()) {
         $completed++;
     }
     if ($user->getEsncard()) {
         $completed++;
     }
     if ($user->getSexewanted()) {
         $completed++;
     }
     if ($user->getNationalite()) {
         $completed++;
     }
     if ($user->getLanguages()) {
         $completed++;
     }
     if ($user->getHobbies()) {
         $completed++;
     }
     if ($user->getUniversite()) {
         $completed++;
     }
     return round($completed / $totalToFill * 100);
 }
 private function replace_keys(Emails $mail, User $is)
 {
     $mail->setBody(str_replace('is_student.prenom', $is->getPrenom(), $mail->getBody()));
     $mail->setBody(str_replace('is_student.nom', $is->getNom(), $mail->getBody()));
     $mail->setBody(str_replace('is_student.age', $is->getAge(), $mail->getBody()));
     $mail->setBody(str_replace('is_student.universite', $is->getUniversite(), $mail->getBody()));
     $mail->setBody(str_replace('is_student.email', $is->getEmail(), $mail->getBody()));
     $mail->setBody(str_replace('is_student.username', $is->getUsername(), $mail->getBody()));
     $mail->setBody(str_replace('is_student.password', $this->plainpass, $mail->getBody()));
     $mail->setBody(str_replace('is_student.nationality', $is->getNationalite(), $mail->getBody()));
     $mail->setBody(str_replace('section.name', $this->sectionManager->getCurrentSection()->getName(), $mail->getBody()));
     return $mail;
 }
 public function replace_keys(Emails $mail, User $local, User $is, Section $section)
 {
     $mail->setBody(str_replace('local.prenom', $local->getPrenom(), $mail->getBody()));
     $mail->setBody(str_replace('is_student.prenom', $is->getPrenom(), $mail->getBody()));
     $mail->setBody(str_replace('local.nom', $local->getNom(), $mail->getBody()));
     $mail->setBody(str_replace('is_student.nom', $is->getNom(), $mail->getBody()));
     $mail->setBody(str_replace('local.age', $local->getAge(), $mail->getBody()));
     $mail->setBody(str_replace('is_student.age', $is->getAge(), $mail->getBody()));
     $mail->setBody(str_replace('local.universite', $local->getUniversite(), $mail->getBody()));
     $mail->setBody(str_replace('is_student.universite', $is->getUniversite(), $mail->getBody()));
     if ($local->getArrival() != null) {
         $mail->setBody(str_replace('local.arrival', $local->getArrival()->format('d/m/Y'), $mail->getBody()));
     }
     if ($is->getArrival() != null) {
         $mail->setBody(str_replace('is_student.arrival', $is->getArrival()->format('d/m/Y'), $mail->getBody()));
     } else {
         $mail->setBody(str_replace(' et arrivera le is_student.arrival.', '.', $mail->getBody()));
     }
     $mail->setBody(str_replace('local.email', $local->getEmail(), $mail->getBody()));
     $mail->setBody(str_replace('is_student.email', $is->getEmail(), $mail->getBody()));
     $mail->setBody(str_replace('local.username', $local->getUsername(), $mail->getBody()));
     $mail->setBody(str_replace('is_student.username', $is->getUsername(), $mail->getBody()));
     $mail->setBody(str_replace('local.password', $local->getPassword(), $mail->getBody()));
     $mail->setBody(str_replace('is_student.password', $is->getPassword(), $mail->getBody()));
     $mail->setBody(str_replace('local.nationality', $local->getNationalite(), $mail->getBody()));
     $mail->setBody(str_replace('is_student.nationality', $is->getNationalite(), $mail->getBody()));
     $mail->setBody(str_replace('section.name', $section->getName(), $mail->getBody()));
     return $mail;
 }
 private function replace_keys(Emails $mail, User $local)
 {
     $mail->setBody(str_replace('local.prenom', $local->getPrenom(), $mail->getBody()));
     $mail->setBody(str_replace('local.nom', $local->getNom(), $mail->getBody()));
     $mail->setBody(str_replace('local.age', $local->getAge(), $mail->getBody()));
     $mail->setBody(str_replace('local.universite', $local->getUniversite(), $mail->getBody()));
     $mail->setBody(str_replace('local.email', $local->getEmail(), $mail->getBody()));
     $mail->setBody(str_replace('local.username', $local->getUsername(), $mail->getBody()));
     $mail->setBody(str_replace('local.password', $this->plainpass, $mail->getBody()));
     $mail->setBody(str_replace('local.nationality', $local->getNationalite(), $mail->getBody()));
     $mail->setBody(str_replace('section.name', $this->section->getName(), $mail->getBody()));
     return $mail;
 }