Package org.ldv.sio.getap.app

Examples of org.ldv.sio.getap.app.User


    }
  }

  @RequestMapping(value = "detailUser", method = RequestMethod.GET)
  public String detailUser(@RequestParam("id") String id, Model model) {
    User user = manager.getUserById(Long.valueOf(id));
    List<LoginInfo> loginInfo = manager.getLoginInfoById(id);
    model.addAttribute("lastlog", loginInfo.get(0).getLastlog());
    model.addAttribute("countlog", loginInfo.get(0).getCountlog());

    model.addAttribute("utilisateur", user);
    model.addAttribute("sesDCTAPeleve", manager.getAllDVCTAPByEleve(user));
    model.addAttribute("sesDCTAPprof",
        manager.getAllDVCTAPByProfInterv(user));
    Long idUser = user.getId();
    model.addAttribute("etat0", manager.getAllDVCTAPByEtat(0, idUser));
    model.addAttribute("etat1", manager.getAllDVCTAPByEtat(1, idUser));
    model.addAttribute("etat2", manager.getAllDVCTAPByEtat(2, idUser));
    model.addAttribute("etat4", manager.getAllDVCTAPByEtat(4, idUser));
    model.addAttribute("etat8", manager.getAllDVCTAPByEtat(8, idUser));
View Full Code Here


  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";
  }
View Full Code Here

    if (bindResult.hasErrors()) {
      return "admin/editUser";
    } else {

      User userForUpdate = manager.getUserById(Long.valueOf(formUser
          .getId()));
      Discipline dis = null;
      if (formUser.getRoleNom().startsWith("prof")) {
        dis = new Discipline(formUser.getDisciplineId(),
            formUser.getDisciplineNom());
      }
      userForUpdate.setNom(formUser.getNom());
      userForUpdate.setPrenom(formUser.getPrenom());
      userForUpdate.setRole(formUser.getRoleNom());
      userForUpdate.setDiscipline(dis);
      // System.out.println("ROLE : " + formUser.getRoleNom());
      if (formUser.getRoleNom().equals("eleve")) {
        userForUpdate.setClasse(manager.getClasseById(formUser
            .getClasseId()));
      } else if (formUser.getRoleNom().equals("prof-principal")) {
        userForUpdate.setLesClasses(formUser.getClasse());
      }

      manager.updateUser(userForUpdate);
      return "redirect:/app/admin/index";
    }
View Full Code Here

  @RequestMapping(value = "delUser/{id}", method = RequestMethod.GET)
  public String deleteUserById(@PathVariable String id, Model model,
      HttpSession session) {

    User user = manager.getUserById(Long.valueOf(id));

    if (!user.getId().equals(null)) {
      manager.deleteUser(user);
      session.setAttribute("eleveDeleted", "DELETED");
    }
    return "redirect:/app/admin/dosearchProf?query=";
  }
View Full Code Here

  @RequestMapping(value = "exportStats/{id}", method = RequestMethod.GET)
  public void exportStats(@PathVariable String id,
      HttpServletResponse response) {
    List<DemandeValidationConsoTempsAccPers> dctaps;
    User user = manager.getUserById(Long.valueOf(id));
    if (user.getRole().equals("prof-principal")) {
      dctaps = manager.getAllDVCTAPByProfPrinc(user);
    } else if (user.getRole().equals("prof-intervenant")) {
      dctaps = manager.getAllDVCTAPByProfInterv(user);
    } else /* user.getRole().equals("eleve") */{
      dctaps = manager.getAllDVCTAPByEleve(user);
    }
    response.setContentType("application/pdf");
    response.setHeader("Content-Disposition", "attachment;filename=stats"
        + user.getNom() + ".pdf");
    statsPdf.export(response, user.getId(), dctaps);
  }
View Full Code Here

  @RequestMapping(value = "exportDemandeCsv/{id}", method = RequestMethod.GET)
  public void exportDemandeCsv(@PathVariable String id,
      HttpServletResponse response) {
    List<DemandeValidationConsoTempsAccPers> dctaps;
    User user = manager.getUserById(Long.valueOf(id));
    if (user.getRole().equals("prof-principal")) {
      dctaps = manager.getAllDVCTAPByProfPrinc(user);
    } else if (user.getRole().equals("prof-intervenant")) {
      dctaps = manager.getAllDVCTAPByProfInterv(user);
    } else /* user.getRole().equals("eleve") */{
      dctaps = manager.getAllDVCTAPByEleve(user);
    }
    response.setContentType("application/csv");
    response.setHeader("Content-Disposition",
        "attachment;filename=demandes" + user.getNom().trim() + ".csv");
    demandes.export(response, dctaps);
  }
View Full Code Here

    // System.out.println("TEST :" + model);

    if (bindResult.hasErrors())
      return "admin/ajoutUsers";
    else {
      User user = manager.getUserById(Long.valueOf(formUser.getId()));
      manager.updatePass(user);
      return "redirect:/app/admin/index";
    }
  }
View Full Code Here

        + "ORDER BY dctap.dateAction", new UserMapper());
  }

  private static final class UserMapper implements RowMapper<User> {
    public User mapRow(ResultSet rs, int rowNum) throws SQLException {
      User user = new User();
      user.setId(rs.getLong("id"));
      user.setPrenom(rs.getString("prenom"));
      user.setNom(rs.getString("nom"));
      user.setRole(rs.getString("role"));
      user.setHash(rs.getString("hash"));
      try {
        user.setDureeTotal(rs.getInt("dureeTotal"));
      } catch (SQLException ex) {

      }

      DisciplineDAOJdbc disciplineDao = new DisciplineDAOJdbc();
      ClasseDAOJdbc classeDao = new ClasseDAOJdbc();
      Classe classe = classeDao.getClasseById(rs.getInt("idClasse"));
      Discipline dis = disciplineDao.getDisciplineById(rs
          .getInt("idDiscipline"));
      user.setDiscipline(dis);
      user.setClasse(classe);
      user.setLogin(rs.getString("login"));
      user.setPass(rs.getString("mdp"));
      user.setMail(rs.getString("mail"));
      return user;
    }
View Full Code Here

    return this.jdbcTemplate.query(
        "select * from ap where origineEtat = 0", new AccMapper());
  }

  public List<AccPersonalise> getAllAPForProf() {
    User user = UtilSession.getUserInSession();
    Long id = user.getId();
    return this.jdbcTemplate
        .query("select distinct ap.id, ap.libelle, ap.origineEtat, ap.idUser from ap, dctap where origineEtat = 0 or (origineEtat = 1 and dctap.idAP = ap.id and dctap.idEleve = ap.idUser and dctap.idProf = "
            + id + ")", new AccMapper());
  }
View Full Code Here

        .query("select distinct ap.id, ap.libelle, ap.origineEtat, ap.idUser from ap, dctap where origineEtat = 0 or (origineEtat = 1 and dctap.idAP = ap.id and dctap.idEleve = ap.idUser and dctap.idProf = "
            + id + ")", new AccMapper());
  }

  public List<AccPersonalise> getAllAPForEleve() {
    User user = UtilSession.getUserInSession();
    Long id = user.getId();
    return this.jdbcTemplate.query(
        "select * from ap where origineEtat = 0 or (origineEtat = 1 and idUser = "
            + id + ")", new AccMapper());
  }
View Full Code Here

TOP

Related Classes of org.ldv.sio.getap.app.User

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.