Пример #1
0
  @RequestMapping(value = "mesdctap", method = RequestMethod.GET)
  public String mesdctap(Model model) {
    User me = UtilSession.getUserInSession();
    model.addAttribute("mesdctaps", manager.getAllDVCTAPByEleve(me));
    Long id = me.getId();
    model.addAttribute("etat0", manager.getAllDVCTAPByEtat(0, id));
    model.addAttribute("etat1", manager.getAllDVCTAPByEtat(1, id));
    model.addAttribute("etat2", manager.getAllDVCTAPByEtat(2, id));
    model.addAttribute("etat4", manager.getAllDVCTAPByEtat(4, id));
    model.addAttribute("etat8", manager.getAllDVCTAPByEtat(8, id));
    model.addAttribute("etat16", manager.getAllDVCTAPByEtat(16, id));
    model.addAttribute("etat32", manager.getAllDVCTAPByEtat(32, id));
    model.addAttribute("etat64", manager.getAllDVCTAPByEtat(64, id));
    model.addAttribute("etatsup1000", manager.getAllDVCTAPModifByEtat(id));

    return "eleve/mesdctap";
  }
Пример #2
0
  @RequestMapping(value = "doedit", method = RequestMethod.POST)
  public String doeditDCTAPById(
      FormDemandeConsoTempsAccPers formDctap, BindingResult bindResult, Model model) {
    User prof = manager.getUserById(formDctap.getProfId());
    if (prof == null)
      bindResult.rejectValue("profId", "required", "Erreur d'identifiant de professeur");

    if (bindResult.hasErrors()) {
      model.addAttribute("lesProfs", manager.getAllProf());
      return "eleve/edit";
    } else {
      User user = UtilSession.getUserInSession();
      DemandeValidationConsoTempsAccPers dctapForUpdate =
          manager.getDVCTAPById(Long.valueOf(formDctap.getId()));
      if (dctapForUpdate.getEtat() == 0 || dctapForUpdate.getEtat() == 4) {

        AccPersonalise acc = new AccPersonalise(null, formDctap.getAccPersNom(), 1, user.getId());
        if (manager.getAPById(formDctap.getAccPersId()) != null) {
          acc = manager.getAPById(formDctap.getAccPersId());
          dctapForUpdate.setAccPers(manager.getAPById(formDctap.getAccPersId()));
        } else {
          manager.addAP(acc);
          dctapForUpdate.setAccPers(manager.getAPByNom(formDctap.getAccPersNom()));
        }

        dctapForUpdate.setDateAction(formDctap.getDateAction());
        dctapForUpdate.setMinutes(formDctap.getMinutes());

        dctapForUpdate.setProf(manager.getUserById(formDctap.getProfId()));
        dctapForUpdate.setDctapModifEleve();
        manager.updateDVCTAP(dctapForUpdate);
      }

      return "redirect:/app/eleve/mesdctap";
    }
  }