/**
  * @Route("/{id}/print",name="contract_print")
  * @Route("/{id}/print/{number}",name="contract_printnumb")
  * @Template()
  * @Secure(roles="ROLE_USER")
  */
 public function printAction(Contract $entity, $number = 0)
 {
     $response = new Response();
     $response->headers->set('Content-Type', 'application/pdf');
     $response->headers->set('Content-Disposition', 'inline; filename=' . $entity->getNumber() . '.pdf');
     $response->setContent($this->render('JLMOfficeBundle:Contract:bill.pdf.php', array('entities' => array($entity), 'number' => $number)));
     //   return array('entity'=>$entity);
     return $response;
 }
 /**
  * Displays a form to create a new Contract entity.
  *
  * @Template()
  * @Secure(roles="ROLE_USER")
  */
 public function newAction(Door $door)
 {
     $entity = new Contract();
     if (!empty($door)) {
         $entity->setDoor($door);
         $entity->setTrustee($door->getSite()->getTrustee());
     }
     $entity->setBegin(new \DateTime());
     $form = $this->createForm(new ContractType(), $entity);
     return array('entity' => $entity, 'form' => $form->createView());
 }
Ejemplo n.º 3
0
 /**
  * Finds and displays a Door entity.
  *
  * @Template()
  * @Secure(roles="ROLE_USER")
  */
 public function showAction(Door $entity)
 {
     $em = $this->getDoctrine()->getManager();
     $contracts = $em->getRepository('JLMContractBundle:Contract')->findByDoor($entity, array('begin' => 'DESC'));
     // Modal nouveau contrat
     $contractNew = new Contract();
     $contractNew->setDoor($entity);
     $contractNew->setTrustee($entity->getSite()->getTrustee());
     $contractNew->setBegin(new \DateTime());
     $form_contractNew = $this->createForm(new ContractType(), $contractNew);
     // Formulaires d'edition des contrat
     $form_contractEdits = $form_contractStops = array();
     foreach ($contracts as $contract) {
         $form_contractEdits[] = $this->get('form.factory')->createNamed('contractEdit' . $contract->getId(), new ContractType(), $contract)->createView();
         $form_contractStops[] = $this->get('form.factory')->createNamed('contractStop' . $contract->getId(), new ContractStopType(), $contract)->createView();
     }
     return array('entity' => $entity, 'contracts' => $contracts, 'form_contractNew' => $form_contractNew->createView(), 'form_contractEdits' => $form_contractEdits, 'form_contractStops' => $form_contractStops);
 }