public String editUserById(@RequestParam("id") String id,
FormEditUser formUser, Model model) {
// System.out.println("TEST id recu :" + formUser.getId());
User currentUser = manager.getUserById(Long.valueOf(id));
System.out.println(currentUser);
formUser.setId(currentUser.getId());
System.out.println("editUserById : id = " + currentUser.getId());
formUser.setNom(currentUser.getNom());
System.out.println("editUserById : nom = " + currentUser.getNom());
formUser.setPrenom(currentUser.getPrenom());
formUser.setRole(currentUser.getRole());
model.addAttribute("fonction", currentUser.getRole());
if (currentUser.getRole().startsWith("prof")) {
formUser.setDisciplineId(currentUser.getDiscipline().getId());
}
if (currentUser.getRole().equals("eleve")) {
formUser.setClasseId(currentUser.getClasse().getId());
}
model.addAttribute("lesClasses", manager.getAllClasses());
model.addAttribute("lesRoles", manager.getAllRole());
model.addAttribute("lesDisciplines", manager.getAllDiscipline());
model.addAttribute("mesClasses",
manager.getAllClasseByProf(currentUser.getId()));
// model.addAttribute("mdp", currentUser.getPass());
model.addAttribute("user", currentUser);
return "admin/editUser";
}