Pobiera dostępny layout
@param \Mmi\Http\Request $request
@return string
@throws \Mmi\Mvc\MvcException brak layoutów
8365
private function _getLayout(\Mmi\Http\Request $request)
    {
        //test layoutu dla modułu i kontrolera
        if ($this->getTemplateByPath($request->getModuleName() . '/' . $request->getControllerName() . '/layout')) {
            //zwrot layoutu moduł:kontroler
            return $request->getModuleName() . '/' . $request->getControllerName() . '/layout';
        }
        //test layoutu dla modułu
        if ($this->getTemplateByPath($request->getModuleName() . '/layout')) {
            //zwrot layoutu moduł
            return $request->getModuleName() . '/layout';
        }
        //zwrot layoutu aplikacyjnego
        return 'app/layout';
    }
1021326
public function indexAction(Request $request)
    {
        // Make sure we have a menu for each possible locale
        $this->container->get('kunstmaan_menu.menu.service')->makeSureMenusExist();

        return parent::doIndexAction(
            $this->getAdminListConfigurator($request),
            $request
        );
    }
581556
public function entryAction(Request $request)
    {
        $language = $this->getLanguage($request);
        $webspace = $this->getWebspace($request);

        $depth = $this->getRequestParameter($request, 'depth', false, 1);
        $ghostContent = $this->getBooleanRequestParameter($request, 'ghost-content', false, false);

        $view = $this->responseGetById(
            null,
            function() use ($language, $webspace, $depth, $ghostContent) {
                try {
                    return $this->getRepository()->getWebspaceNode(
                        $webspace,
                        $language,
                        $depth,
                        $ghostContent
                    );
                } catch (DocumentNotFoundException $ex) {
                    return;
                }
            }
        );

        return $this->handleView($view);
    }
1316840
protected function doRequest($request)
    {
        $path = getcwd();
        if (defined('APP_PATH')) {
            $path = APP_PATH;
        }
        $loader = new ClassLoader();

        $loader->add(null, $path);
        $loader->register();

        // Create application
        Configuration::addPath($path . '/Configuration');
        Template::addPath($path . '/Views');

        $uri = str_replace('http://localhost/', '', $request->getUri());
        preg_match('/^([a-zA-Z0-9\/\-_]+).?([a-zA-Z0-9\-_]*)\??([a-zA-Z0-9\-_\=]*)/i', $uri, $matches);

        if (isset($matches[3]) && $matches[3] != '') {
            $params = parse_url($request->getUri());
            parse_str($params['query'], $_GET);
        }

        if (isset($matches[1]) && $matches[1] != '') {
            $_GET['url'] = $matches[1];
        }

        if (isset($matches[2]) && $matches[2] != '') {
            $_GET['extension'] = $matches[2];
        }

        $app = new Application();

        $zendRequest = $app->getRequest();
        $zendResponse = $app->getResponse();

        $uri = new HttpUri($request->getUri());
        $queryString = $uri->getQuery();
        $method = strtoupper($request->getMethod());

        if ($queryString) {
            parse_str($queryString, $query);
        }

        if ($method == HttpRequest::METHOD_POST) {
            $zendRequest->setPost(new Parameters($request->getParameters()));
        }
        /* elseif ($method == HttpRequest::METHOD_PUT) {
            $zendRequest->setContent($request->getContent());
        }*/

        $zendRequest->setMethod($method);
        $zendRequest->setUri($uri);

        // Application bootstrap
        $app->bootstrap();

        $app->run();


        return new Response(
            $zendResponse->getContent(),
            $zendResponse->getStatusCode(),
            $zendResponse->getHeaders()->toArray()
        );

    }
1295364
public function getElementHtml(Request $request)
    {
        $properties = Model::whereIn('id', $request->get('property_id'))->get();

        $tmpString = str_random();
        $view = view('avored-ecommerce::property.get-element')
                        ->with('properties', $properties)
                        ->with('tmpString', $tmpString);

        $json = new JsonResponse(['success' => true, 'content' => $view->render()]);

        return $json;
    }
845166
public function newAction(Request $request)
    {
        $em = $this->getDoctrine()->getManager();
        $template = new Template();
        $form = $this->container->get('form.factory')->create(TemplateType::class, $template);

        $form->handleRequest($request);
        if ($form->isValid()) {
            $em->persist($template);
            $em->flush();

            return new JsonResponse([
                'success' => true,
                'url'     => $this->generateUrl('victoire_template_show', ['id' => $template->getId()]),
            ]);
        }

        return new JsonResponse(
            [
                'success' => true,
                'html'    => $this->container->get('templating')->render(
                    'VictoireTemplateBundle:Template:new.html.twig',
                    ['form' => $form->createView()]
                ),
            ]
        );
    }
342041
public function indexAction(Request $request)
    {
        $this->init($request);

        $nodeAdminListConfigurator = new NodeAdminListConfigurator(
            $this->em,
            $this->aclHelper,
            $this->locale,
            PermissionMap::PERMISSION_VIEW,
            $this->authorizationChecker
        );

        $locale = $this->locale;
        $acl = $this->authorizationChecker;
        $itemRoute = function (EntityInterface $item) use ($locale, $acl) {
            if ($acl->isGranted(PermissionMap::PERMISSION_VIEW, $item->getNode())) {
                return array(
                    'path' => '_slug_preview',
                    'params' => ['_locale' => $locale, 'url' => $item->getUrl()],
                );
            }
        };
        $nodeAdminListConfigurator->addSimpleItemAction('action.preview', $itemRoute, 'eye');
        $nodeAdminListConfigurator->setDomainConfiguration($this->get('kunstmaan_admin.domain_configuration'));
        $nodeAdminListConfigurator->setShowAddHomepage($this->getParameter('kunstmaan_node.show_add_homepage') && $this->isGranted('ROLE_SUPER_ADMIN'));

        /** @var AdminList $adminlist */
        $adminlist = $this->get('kunstmaan_adminlist.factory')->createList($nodeAdminListConfigurator);
        $adminlist->bindRequest($request);

        return array(
            'adminlist' => $adminlist,
        );
    }
1277708
public function imageAction(Request $request)
    {
        $params = $request->request->all();

        unset($params['module']);
        unset($params['controller']);
        unset($params['action']);

        if (empty($params['width'])) {
            $params['width'] = 100;
        }
        if (empty($params['height'])) {
            $params['height'] = 100;
        }
        if (empty($params['xmethod'])) {
            $params['xmethod'] = 'fit';
        }

        $previewer = $this->get('phlexible_media_template.previewer.image');
        $locator = $this->get('file_locator');

        $previewImage = 'test_1000_600.jpg';
        if (isset($params['preview_image'])) {
            $previewImage = $params['preview_image'];
            unset($params['preview_image']);
            if ($previewImage === '800_600') {
                $previewImage = "test_$previewImage.png";
            } else {
                $previewImage = "test_$previewImage.jpg";
            }
        }

        $filePath = $locator->locate("@PhlexibleMediaTemplateBundle/Resources/public/images/$previewImage", null, true);
        $data = $previewer->create($filePath, $params);

        return new ResultResponse(true, 'Preview created', $data);
    }
808764
public function form(Request $request)
    {
        //Renders form payment
        $paymentData = $this->paymentService->setDataFromSession('stripe');
        if (is_array($paymentData)) {
            return $this->render('@c975LPayment/pages/payment.html.twig', $paymentData);
        }

        //No current payment
        return $this->render('@c975LPayment/pages/noPayment.html.twig');
    }
755063
public function parentPageListAction(Request $request)
    {
        $locale = $request->get('locale');
        $pages = [];
        $pageManager = $this->get('networking_init_cms.page_manager');

        if ($result = $pageManager->getParentPagesChoices($locale)) {
            foreach ($result as $page) {
                /* @var PageInterface $page */
                $pages[$page->getId()] = [$page->getAdminTitle()];
            }
        }

        return $this->renderJson($pages);
    }
771545
public function networkMap(Request $request)
    {
        $this->admControlInit($request, '/dashboard/db/diagrams');
        if (!$this->checkCache('/dashboard/db/diagrams/network-map')) {
            $this->v["errors"] = '';
            $this->sysDef = new SystemDefinitions;
            $this->v["css"] = $this->sysDef->loadCss();
            $this->v["canvasDimensions"] = array(950, 950);
            $mainCircleCenter = [ $this->v["canvasDimensions"][0]/2, $this->v["canvasDimensions"][1]/2 ];
            $sizeMax = 0;
            $this->v["tables"] = $tableLookup = [];
            //$this->v["tables"][] = array('English', Size, Center-X, Center-Y);
            $tbls = SLTables::select('TblID', 'TblName', 'TblNumForeignKeys', 'TblNumForeignIn', 'TblOpts')
                ->where('TblDatabase', $this->dbID)
                ->orderBy('TblOrd', 'asc')
                ->get();
            if ($tbls->isNotEmpty()) {
                foreach ($tbls as $tbl) {
                    $tableLookup[$tbl->TblID] = sizeof($this->v["tables"]);
                    $this->v["tables"][] = [
                        $tbl->TblName, 
                        sqrt(sqrt($tbl->TblNumForeignKeys+$tbl->TblNumForeignIn)), 
                        0, 
                        0, 
                        (($GLOBALS["SL"]->isCoreTbl($tbl->TblID)) ? $this->v["css"]["color-success-on"] : '')
                    ];
                }
                foreach ($this->v["tables"] as $i => $tbl) {
                    if ($sizeMax < $this->v["tables"][$i][1]) {
                        $sizeMax = $this->v["tables"][$i][1];
                    }
                }
                foreach ($this->v["tables"] as $i => $tbl) {
                    if ($sizeMax <= 0) $sizeMax = 1;
                    $this->v["tables"][$i][1] = 43*($this->v["tables"][$i][1]/$sizeMax);
                    if ($this->v["tables"][$i][1] <= 10) {
                        $this->v["tables"][$i][1] = 10;
                    }
                    $rad = deg2rad(360*$i/sizeof($this->v["tables"]));
                    $dim = 0.42*$this->v["canvasDimensions"][1];
                    $this->v["tables"][$i][2] = round($mainCircleCenter[0]+(sin($rad)*$dim));
                    $this->v["tables"][$i][3] = round($mainCircleCenter[1]-(cos($rad)*$dim));
                }
            }
            $this->v["keyLines"] = [];
            $foreignFlds = SLFields::select('FldTable', 'FldForeignTable')
                ->where('FldForeignTable', '>', 0)
                ->where('FldSpecType', 'NOT LIKE', 'Generic')
                ->where('FldDatabase', $this->dbID)
                ->get();
            if ($foreignFlds->isNotEmpty()) {
                foreach ($foreignFlds as $fld) {
                    if (!isset($tableLookup[$fld->FldTable])) {
                        $this->v["errors"] .= '<br />add line, missing FldTable tblLookup[' . $fld->FldTable . ']';
                    } elseif (!isset($tableLookup[$fld->FldForeignTable])) {
                        $this->v["errors"] .= '<br />add line, missing FldForeignTable tblLookup[' . $fld->FldForeignTable . ']';
                    } else {
                        $this->v["keyLines"][] = [
                            $tableLookup[$fld->FldTable], 
                            $tableLookup[$fld->FldForeignTable]
                        ];
                    }
                }
            }
            $this->v["content"] = view('vendor.survloop.admin.db.network-map', $this->v)->render();
            $this->saveCache();
        }
        $this->v["hideWrap"] = true;
        $this->v["isPrint"] = true;
        $this->v["isFrame"] = true;
        return view('vendor.survloop.master', $this->v);
    }
772344
public function layoutAction(Request $request)
    {
        $container = $this->findContainerByRequest($request);

        $data = $request->request->get('data', []);

        try {
            $this->getEditor()->getLayoutAdapter()->updateContainerLayout($container, $data);
        } catch (EditorExceptionInterface $e) {
            return $this->handleException($e);
        }

        $this->validate($container);
        $this->persist($container);

        $data = [
            'containers' => [$this->getViewBuilder()->buildContainer($container)],
        ];

        return $this->buildResponse($data, self::SERIALIZE_LAYOUT);
    }
362104
public function create(Request $request)
    {
        $view = parent::create($request);

        $view['layouts'] = Layouts::getLayouts('voyager-frontend');

        return $view;
    }
357220
protected function _initTranslation(\Mmi\Http\Request $request)
    {
        //języki nie zdefiniowane
        if (empty(\App\Registry::$config->languages)) {
            return;
        }
        //niepoprawny język
        if ($request->__get('lang') && !in_array($request->__get('lang'), \App\Registry::$config->languages)) {
            throw new \Mmi\Mvc\MvcNotFoundException('Language not found');
        }
        //ustawianie języka z requesta
        if ($request->__get('lang')) {
            return \App\Registry::$translate->setLocale($request->__get('lang'));
        }
        //ustawienie języka edycji
        $session = new \Mmi\Session\SessionSpace('cms-language');
        $lang = in_array($session->lang, \App\Registry::$config->languages) ? $session->lang : \App\Registry::$config->languages[0];
        \App\Registry::$translate->setLocale($lang);
    }
1226132
public function gridAction(Request $request)
    {
        return $this->processView('grid', $this->view([
            'form' => $form = $this->submitGrid($grid = $this->buildGrid(), $request),
            'grid' => $this->getGridHandler()->handle($grid, $form),
        ]));
    }
96447
public function formsActions(Request $request)
    {
        /**
         * http://getbootstrap.com/css/#forms-example
         */
        $basicExample = $this->createFormBuilder();
        $basicExample->add('EmailAddress', 'email');
        $basicExample->add('Password', 'password');
        $basicExample->add('FileInput', 'file');
        $basicExample->add('Submit', 'submit');

        $inlineForm = $this->createFormBuilder(null, array('style' => 'inline'));
        $inlineForm->add('EmailAddress', 'email');
        $inlineForm->add('Password', 'password');
        $inlineForm->add('Submit', 'submit');

        $horizontalForm = $this->createFormBuilder(null, array('style' => 'horizontal'));
        $horizontalForm->add('EmailAddress', 'email');
        $horizontalForm->add('Password', 'password');
        $horizontalForm->add('Submit', 'submit');


//        $supportedControls = $this->createFormBuilder(null, array('style' => 'horizontal'));
//        $types = array(
//            'text',
//            'password',
//            'datetime',
//            //    'datetime-local',
//            'date',
//            //    'month',
//            'time',
//            //    'week',
//            'number',
//            'email',
//            'url',
//            'search',
//            //    'tel',
//            //    'color',
//            'textarea',
//        );
//        foreach ($types as $type) {
//            $supportedControls->add($type, $type);
//        }
        //$supportedControls->add('Submit', 'submit');


        $builder = $this->createFormBuilder(null, array('style' => 'horizontal'));
        $builder->add('prependedInput', 'text', array(
            'attr' => array(
                'placeholder' => 'Username',
                'input_group' => array(
                    'prepend' => '@'
                ),
                'help_text' => 'Letters, numbers and underscores are allowed.'
            )
        ));
        $builder->add('appendedInput', 'text', array(
            'attr' => array(
                'input_group' => array(
                    'append' => '.00'
                ),
            )
        ));
        $builder->add('appendedPrependedInput', 'text', array(
            'attr' => array(
                'input_group' => array(
                    'prepend' => '$',
                    'append' => '.00',
                ),
            )
        ));

        $builder->add('iconInput', 'text', array(
            'attr' => array(
                'input_group' => array(
                    'prepend' => '.icon-cloud',
                    'append' => '.icon-off',
                ),
            )
        ));
        $builder->add('keywords', 'text', array(
            'attr' => array(
                'input_group' => array(
                    'button_append' => array('name' => 'search', 'type' => 'submit')
                )
            )
        ));
        $builder->add(
            'hobbits',
            'bootstrap_collection',
            array(
                'allow_add' => true,
                'allow_delete' => true,
                'add_button_text' => 'Add Hobbit',
                'delete_button_text' => 'Delete Hobbit',
                'sub_widget_col' => 9,
                'button_col' => 3,
            )
        );
        return $this->render(
            'AkumaBootswatchBundle:Demo:baseCss.html.twig',
            array(
                'basicExample' => $basicExample->getForm()->createView(),
                'inlineForm' => $inlineForm->getForm()->createView(),
                'horizontalForm' => $horizontalForm->getForm()->createView(),
//                'supportedControls' => $supportedControls->getForm()->createView(),
                'builderForm' => $builder->getForm()->createView(),
            )
        );
    }
498371
private function getTraceKey(Request $request): string
    {
        $path = $request->getPathInfo();
        if ($qs = $request->getQueryString()) {
            $path .= '?'.$qs;
        }

        return $request->getMethod().' '.$path;
    }