コード例 #1
0
ファイル: PassageController.php プロジェクト: 24eme/aurouze
 /**
  * @Route("/passage/pdf-mission/{id}", name="passage_pdf_mission")
  * @ParamConverter("passage", class="AppBundle:Passage")
  */
 public function pdfMissionAction(Request $request, Passage $passage)
 {
     $pm = $this->get('passage.manager');
     $passagesHistory = $pm->getRepository()->findHistoriqueByEtablissementAndPrestationsAndNumeroContrat($passage->getContrat(), $passage->getEtablissement(), $passage->getPrestations());
     $filename = sprintf("suivi_client_%s_%s.pdf", $passage->getDateDebut()->format("Y-m-d_H:i"), strtoupper(Transliterator::urlize($passage->getTechniciens()->first()->getIdentite())));
     $html = $this->renderView('passage/pdfMission.html.twig', array('passage' => $passage, 'passagesHistory' => $passagesHistory));
     if ($request->get('output') == 'html') {
         return new Response($html, 200);
     }
     return new Response($this->get('knp_snappy.pdf')->getOutputFromHtml($html, $this->getPdfGenerationOptions()), 200, array('Content-Type' => 'application/pdf', 'Content-Disposition' => 'attachment; filename="' . $filename . '"'));
 }
コード例 #2
0
ファイル: Passage.php プロジェクト: 24eme/aurouze
 public function copyTechnicienFromPassage(Passage $p)
 {
     if (!count($this->getTechniciens()) && count($p->getTechniciens())) {
         foreach ($p->getTechniciens() as $technicien) {
             $this->addTechnicien($technicien);
         }
         return $this;
     }
     return false;
 }