Overview

Namespaces

  • Mapbender
    • Component
      • HTTP
    • CoreBundle
      • Command
      • Component
        • Exception
      • Controller
      • DataFixtures
        • ORM
      • DependencyInjection
      • Element
        • Type
      • Entity
      • EventListener
      • Extension
      • Form
        • DataTransformer
        • EventListener
        • Type
      • Security
      • Template
    • DrupalIntegrationBundle
      • DependencyInjection
      • Security
        • Authentication
          • Provider
          • Token
        • Authorization
          • Voter
        • Factory
        • Firewall
        • User
      • Session
    • KmlBundle
      • Element
    • ManagerBundle
      • Controller
      • Form
        • DataTransformer
        • Type
    • MonitoringBundle
      • Command
      • Component
      • Controller
      • DependencyInjection
      • Entity
      • EventListener
      • Form
    • PrintBundle
      • Component
      • Controller
    • WmcBundle
      • Component
        • Exception
      • Element
        • Type
      • Entity
      • Form
        • EventListener
        • Type
    • WmsBundle
      • Component
        • Exception
      • Controller
      • DependencyInjection
      • Element
        • Type
      • Entity
      • Event
      • Form
        • EventListener
        • Type
    • WmtsBundle
      • Component
        • Exception
      • Controller
      • Entity
      • Form
        • Type
  • None
  • PHP

Classes

  • ApplicationController
  • GroupController
  • ProxyController
  • TranslationController
  • WelcomeController
  • Overview
  • Namespace
  • Class
  • Tree
  • Deprecated
  • Todo
  • Download
 1: <?php
 2: 
 3: namespace Mapbender\CoreBundle\Controller;
 4: 
 5: use JMS\SecurityExtraBundle\Annotation\Secure;
 6: use Symfony\Bundle\FrameworkBundle\Controller\Controller;
 7: use Sensio\Bundle\FrameworkExtraBundle\Configuration\Route;
 8: use Sensio\Bundle\FrameworkExtraBundle\Configuration\Method;
 9: use Sensio\Bundle\FrameworkExtraBundle\Configuration\Template;
10: use Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter;
11: use Symfony\Component\Form\FormBuilder;
12: use Symfony\Component\DependencyInjection\ContainerInterface;
13: use Symfony\Component\Security\Core\SecurityContext;
14: use Symfony\Component\HttpFoundation\Request;
15: use Symfony\Component\HttpFoundation\Response;
16: use Symfony\Component\HttpKernel\Exception\NotFoundHttpException;
17: /**
18:  * Translation controller.
19:  *
20:  * @author Paul Schmidt
21:  *
22:  */
23: class TranslationController extends Controller {
24:      /**
25:      * @Route("/trans")
26:      * @Method({"POST"})
27:      */
28:     public function transAction() {
29:         $tr = $this->get('translator');
30:         $request = $this->get('request');
31:         $paramspost = $request->request->all();
32:         $data = array();
33:         foreach ($paramspost as $k => $v) {
34:             $par_vals = explode("|", $v);
35:             if(count($par_vals) == 1){
36:                 $data[$k] = $tr->trans($v);
37:             } else if(count($par_vals) > 1){
38:                 if($par_vals[0]== "twig"){
39:                     $templating = $this->get("templating");
40:                     $content = $templating->render($par_vals[1],array());
41:                     $data[$k] = $content;
42:                 }
43:             }
44:         }
45:         $response = new Response();
46:         $response->setContent(json_encode($data));
47:         $response->headers->set('Content-Type', 'application/json');
48:         return $response;
49:     }
50: 
51: }
52: 
Mapbender3 API documenation API documentation generated by ApiGen 2.8.0