Beispiel #1
0
 public function uploadFichierDDC(\TRC\CoreBundle\ENtity\DDC\DDC $ddc, $type, $fichier, $nameuser = null)
 {
     $message = "";
     $code = 1;
     $chemin = $ddc->getDossier();
     $no = $fichier['name'];
     $ext = "";
     if (strlen($this->extension($no)) > 0) {
         $ext = "." . $this->extension($no);
     }
     $f = new Fichier();
     $f->setType($fichier['type']);
     $f->setNom($nameuser);
     if (is_null($nameuser)) {
         $f->setNom($this->nomSansExtension($no));
     }
     $f->setRs($type . date('dmYHis') . "." . $ext);
     $f->setNomoriginal($no);
     if ($type == "edp") {
         $f->setChemin($chemin . "epd/" . $f->getRs());
     } else {
         $f->setChemin($chemin . "fichiers/" . $f->getRs());
     }
     try {
         if (move_uploaded_file($fichier['tmp_name'], $f->getChemin())) {
             $message = "ok";
         }
     } catch (\Exception $e) {
         $message = "Erreur de téléchargement du fichier :: " . $no;
         // $e->getMessage();
         $code = 0;
     }
     return array("fichier" => $f, "message" => $message, "code" => $code);
 }
Beispiel #2
0
 public function initAction(Request $request, $code, $type)
 {
     $em = $this->getDoctrine()->getManager();
     $tdc = $em->getRepository('TRCCoreBundle:DDC\\TDC')->findOneByCode($code);
     if (is_null($tdc)) {
         throw $this->createNotFoundException("Error de code : " . $code);
     }
     $tddc = $em->getRepository('TRCCoreBundle:DDC\\TDDC')->findOneByCode($type);
     if (is_null($tddc)) {
         throw $this->createNotFoundException("Error de code de type : " . $type);
     }
     $sysnoti = $this->get('trc_core.noti');
     $sysddc = $this->get('trc_core.ddc');
     $sysgu = $this->get('trc_core.gu');
     $sysmatricule = $this->get('trc_core.matricule');
     $user = $this->getUser();
     $utilisateur = $em->getRepository('TRCCoreBundle:Utilisateur')->findOneByCompte($user);
     $fonction = $sysgu->fonction($utilisateur);
     $ddc = new DDC();
     // Affection du dossier de credit a l'utilisateur
     $ddc->setFonction($fonction);
     //$ddc->setCdcd(new CDCD());
     $ddc->setTddc($tddc);
     $ddc->setTdc($tdc);
     //Affection reference systeme
     $ddc = $sysmatricule->rsDDC($ddc);
     $ddc = $sysddc->initDDC($ddc, $user);
     $edp = new EDP();
     $edp->setMatricule($sysmatricule->matriculeStandard($edp));
     $ddc->setEdp($edp);
     $em->persist($ddc);
     $em->flush();
     $sysddc->initPhases($ddc);
     $sysddc->setDocs($ddc);
     //Activer la phase Etude de dossier
     $ddc->setPhaseActuelle($sysddc->activerPhase($ddc, "ETDOS"));
     //Activer l'etat INI
     $ddc->setEtatActuel($sysddc->activerEtat($ddc, $fonction, "INIT"));
     // Documentation du dossier
     $em->flush();
     $sysnoti->notifier(array("acteur" => $utilisateur->getActeur(), "titre" => "Enregistrement de DDC", "contenu" => " Vous avez crée avec succes un DDC RS : <strong>" . $ddc->getRs() . "</strong>"));
     return $this->redirect($this->generateUrl('trcddc_def_client', array('rs' => $ddc->getRs())));
 }
Beispiel #3
0
 public function setDocs(\TRC\CoreBundle\Entity\DDC\DDC $ddc)
 {
     $docs = $this->em->getRepository('TRCCoreBundle:DDC\\DOCTDC')->findBy(array("tdc" => $ddc->getTdc()), array(), null, 0);
     foreach ($docs as $key => $doc) {
         $docddc = new DOCDDC();
         $docddc->setNom($doc->getNom());
         $docddc->setDdc($ddc);
         $this->em->persist($docddc);
     }
     $this->em->flush();
     return true;
 }
 /**
  * {@inheritDoc}
  */
 public function getFonction()
 {
     $this->__initializer__ && $this->__initializer__->__invoke($this, 'getFonction', []);
     return parent::getFonction();
 }