Ejemplo n.º 1
0
  @RequestMapping(value = "ajoutdctap", method = RequestMethod.GET)
  public String ajoutUser(FormAjoutDctap formAjout, Model model) {

    model.addAttribute("lesProfs", manager.getAllProf());
    model.addAttribute("lesAP", manager.getAllAPForEleve());

    formAjout.setAnneeScolaire(UtilSession.getAnneeScolaireInSession());
    formAjout.setProfId(UtilSession.getUserInSession().getId());
    formAjout.setEtat(0);

    return "eleve/ajoutdctap";
  }
Ejemplo n.º 2
0
  @RequestMapping(value = "doajout", method = RequestMethod.POST)
  public String doajoutUser(FormAjoutDctap formAjout, BindingResult bindResult, Model model) {
    model.addAttribute("lesProfs", manager.getAllProf());
    model.addAttribute("lesAP", manager.getAllAPForEleve());

    formAjout.setAnneeScolaire(UtilSession.getAnneeScolaireInSession());
    formAjout.setEleveId(UtilSession.getUserInSession().getId());
    formAjout.setEtat(0);

    if (formAjout.getDate() == null) {
      bindResult.rejectValue("date", "required", "Une date valide est attendue !");
      return "eleve/doajout";
    }

    if (bindResult.hasErrors()) {
      return "eleve/ajoutdctap";
    } else {
      AccPersonalise acc =
          new AccPersonalise(null, formAjout.getAccPersNom(), 1, formAjout.getEleveId());
      if (manager.getAPById(formAjout.getAccPersId()) != null) {
        acc = manager.getAPById(formAjout.getAccPersId());
      } else {
        manager.addAP(acc);
      }
      DemandeValidationConsoTempsAccPers dctap =
          new DemandeValidationConsoTempsAccPers(
              formAjout.getId(), manager.getCurrentAnneeScolaire(),
              formAjout.getDate(), formAjout.getMinutes(),
              manager.getUserById(formAjout.getProfId()), acc,
              manager.getUserById(formAjout.getEleveId()), formAjout.getEtat());

      if (dctap.getMinutes() % 10 == 0 && dctap.getMinutes() <= 300 && dctap.getMinutes() != 0) {
        manager.addDVCTAP(dctap);
      } else {
        bindResult.rejectValue("date", "required", "La durée de l'AP est invalide !");
        return "eleve/doajout";
      }

      return "redirect:/app/eleve/index";
    }
  }
Ejemplo n.º 3
0
  @RequestMapping(value = "edit", method = RequestMethod.GET)
  public String editDCTAPById(
      @RequestParam("id") String id, FormDemandeConsoTempsAccPers formDctap, Model model) {

    // System.out.println("TEST id recu :" + formDctap.getId());

    DemandeValidationConsoTempsAccPers currentDctap = manager.getDVCTAPById(Long.valueOf(id));

    System.out.println("DCTAP : " + currentDctap);

    // valorise le bean de vue avec le dctap courant
    formDctap.setId(currentDctap.getId()); // en provenance d'un champ caché
    formDctap.setDateAction(currentDctap.getDateAction());
    formDctap.setProfId(currentDctap.getProf().getId());
    // formDctap.setProfNom(currentDctap.getProf().getNom());
    formDctap.setIdEleve(currentDctap.getEleve().getId());
    formDctap.setAccPersId(currentDctap.getAccPers().getId());
    formDctap.setMinutes(currentDctap.getMinutes());
    model.addAttribute("minute", currentDctap.getMinutes());
    model.addAttribute("lesProfs", manager.getAllProf());
    model.addAttribute("etat", manager.getDVCTAPById(formDctap.getId()).getEtat());
    model.addAttribute("lesAP", manager.getAllAPForEleve());
    return "eleve/edit";
  }