Exemplo n.º 1
0
 /**
  * @Template()
  *
  * http://localhost/Wind/web/app_dev.php/admin/BO/ajax/spot/edit/1
  */
 public function spotEditAction($id = null, Request $request)
 {
     $em = $this->container->get('doctrine.orm.entity_manager');
     if (isset($id) && $id != -1) {
         $spot = $em->find('LaPoizWindBundle:Spot', $id);
         if (!$spot) {
             return $this->container->get('templating')->renderResponse('LaPoizWindBundle:BackOffice:errorPage.html.twig', array('errMessage' => "No spot find !"));
         }
         $form = $this->createForm('spot', $spot)->add('save', 'submit')->add('effacer', 'button', array('attr' => array('onclick' => 'effacerSpot()', 'class' => 'btn btn-danger')));
         /*$form->add('actions', 'form_actions', [
               'buttons' => [
                   'save' => ['type' => 'submit', 'options' => ['label' => 'Save']],
               ]
           ]);*/
         if ('POST' == $request->getMethod()) {
             //$form->submit($request);
             $form->handleRequest($request);
             //$form->submit($request->request->get($form->getName()));
             if ($form->isValid()) {
                 // form submit
                 $spot = $form->getData();
                 $em->persist($spot);
                 $em->flush();
                 RosaceWindManage::createRosaceWind($spot, $this);
             }
             /*else {
                   return new Response($request);
               }*/
         }
         return $this->render('LaPoizWindBundle:BackOffice/Spot/Ajax:spotEdit.html.twig', array('spot' => $spot, 'form' => $form->createView()));
     } else {
         return $this->container->get('templating')->renderResponse('LaPoizWindBundle:BackOffice:errorPage.html.twig', array('errMessage' => "Miss id of spot... !"));
     }
 }
Exemplo n.º 2
0
 /**
  * @Template()
  *
  */
 public function rosaceConvertPNGAllSpotsAction()
 {
     $em = $this->container->get('doctrine.orm.entity_manager');
     $listSpot = $em->getRepository('LaPoizWindBundle:Spot')->findAllValid();
     $listRegion = $em->getRepository('LaPoizWindBundle:Region')->findAllOrderByNumDisplay();
     $listSpotNotValid = $em->getRepository('LaPoizWindBundle:Spot')->findAllNotValid();
     $listSpotsWithoutRegion = $em->getRepository('LaPoizWindBundle:Spot')->findAllWithoutRegion();
     $listWebsites = $em->getRepository('LaPoizWindBundle:WebSite')->findAll();
     foreach ($listSpot as $spot) {
         RosaceWindManage::createRosaceWind($spot, $this);
     }
     foreach ($listSpotNotValid as $spot) {
         RosaceWindManage::createRosaceWind($spot, $this);
     }
     return $this->container->get('templating')->renderResponse('LaPoizWindBundle:BackOffice/Tools:rosaceConvertPNGAllSpots.html.twig', array('listSpot' => $listSpot, 'listRegion' => $listRegion, 'listSpotNotValid' => $listSpotNotValid, 'listSpotsWithoutRegion' => $listSpotsWithoutRegion, 'listWebsites' => $listWebsites));
 }
Exemplo n.º 3
0
 static function getMoveArray()
 {
     $result = array();
     $points = RosaceWindManage::createPointsFleche();
     $pointsHalf = RosaceWindManage::reduceArrow($points, ScalledHalf, LargeurImg / 2, HauteurImg / 2 + RayonCentral);
     $pointsQuarter = RosaceWindManage::reduceArrow($points, ScalledQuater, LargeurImg / 2, HauteurImg / 2 + RayonCentral);
     $result['n'] = RosaceWindManage::getMoveElemArray(0, $points);
     $result['nnw'] = RosaceWindManage::getMoveElemArray(22.5, $pointsQuarter);
     $result['nw'] = RosaceWindManage::getMoveElemArray(45, $pointsHalf);
     $result['wnw'] = RosaceWindManage::getMoveElemArray(67.5, $pointsQuarter);
     $result['w'] = RosaceWindManage::getMoveElemArray(90, $points);
     $result['wsw'] = RosaceWindManage::getMoveElemArray(112.5, $pointsQuarter);
     $result['sw'] = RosaceWindManage::getMoveElemArray(135, $pointsHalf);
     $result['ssw'] = RosaceWindManage::getMoveElemArray(157.5, $pointsQuarter);
     $result['s'] = RosaceWindManage::getMoveElemArray(180, $points);
     $result['sse'] = RosaceWindManage::getMoveElemArray(202.5, $pointsQuarter);
     $result['se'] = RosaceWindManage::getMoveElemArray(225, $pointsHalf);
     $result['ese'] = RosaceWindManage::getMoveElemArray(247.5, $pointsQuarter);
     $result['e'] = RosaceWindManage::getMoveElemArray(270, $points);
     $result['ene'] = RosaceWindManage::getMoveElemArray(292.5, $pointsQuarter);
     $result['ne'] = RosaceWindManage::getMoveElemArray(315, $pointsHalf);
     $result['nne'] = RosaceWindManage::getMoveElemArray(337.5, $pointsQuarter);
     return $result;
 }