1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859 |
- <?php
- namespace LeafletBundle\Controller;
- use Symfony\Bundle\FrameworkBundle\Controller\Controller;
- use Symfony\Component\Workflow\Exception\ExceptionInterface;
- use Symfony\Component\HttpFoundation\Request;
- use Symfony\Component\HttpFoundation\Response;
- use Sonata\AdminBundle\Admin\Pool;
- class LeafletController extends Controller
- {
-
- public function createVectorAction($layerId = 1, Request $request)
- {
- $vectors = array();
- $em = $this->get('doctrine')->getManager();
- $layer = $em->getRepository("MapBundle\Entity\Layer")->findOneById($layerId);
- if(!is_null($layer)) {
- $vectors = $em->getRepository("MapBundle\Entity\Vector")->findByLayer($layer);
- }
- // print_r("<pre>");
- // foreach($vectors as $k => $v) {
- // print_r($v->getData());
- // print_r("<br />");
- // print_r($v->getJsonDecodeData());
- // print_r("<br />");
- // print_r("<br />");
- // }
- // die;
- $adminPool = $this->get('sonata.admin.pool');
- $url_post = "admin_map_vector_create_ajax";
- return $this->render('LeafletBundle:Leaflet:create_vector.html.twig', array(
- 'base_template' => $adminPool->getTemplate('layout'),
- 'admin_pool' => $adminPool,
- 'admin' => $adminPool->getAdminByClass("MapBundle\Entity\Map"),
- 'uuid' => time(),
- 'url_post' => $url_post,
- 'vectors' => $vectors,
- 'layerId' => $layerId
- ));
- }
-
- public function saveVectorAction(Request $request)
- {
- print_r($request->request->all());
- die;
- }
- }
|