Creates a analytics for given webspace.

@param Request $request
@param string $webspace

@return Response
428214
public function postAction(Request $request, $webspace)
    {
        $data = $request->request->all();
        $data['content'] = $this->buildContent($data);

        $entity = $this->get('sulu_website.analytics.manager')->create($webspace, $data);
        $this->get('doctrine.orm.entity_manager')->flush();
        $this->get('sulu_website.http_cache.clearer')->clear();

        return $this->handleView($this->view($entity, 200));
    }
974817
public function importAction(Request $request)
    {
        $data = json_decode($request->getContent(), true);
        $file = $data['file'];
        $workspace = $data['workspace'];
        $workspace = $workspace['id'] ? $this->om->getObject($workspace, Workspace::class) : null;
        $fileEntity = $this->om->getObject($file, PublicFile::class) ?? new PublicFile();
        $file = $this->serializer->deserialize($file, $fileEntity);
        $fileData = $this->container->get('claroline.utilities.file')->getContents($file);
        $events = $this->container->get('claroline.manager.agenda_manager')->import($fileData, $workspace);

        return new JsonResponse(array_map(function (Event $event) {
            return $this->serializer->serialize($event);
        }, $events));
    }
1302840
public function createAction(Request $request)
    {
        $form = $this->container->get('form.factory')->createNamed(
            'page',
            CreationType::class,
            null,
            array(
                'action' => $this->container->get('router')->generate('synapse_admin_page_creation'),
                'method' => 'POST',
                'csrf_protection' => false,
            )
        );

        if ($request->request->has('page')) {
            $form->handleRequest($request);
            if ($form->isValid()) {
                $page = $form->getData()->resolve();

                return $this->redirect(
                    $this->container->get('router')->generate('synapse_admin_page_edition', array(
                        'id' => $page->getId(),
                    ))
                );
            }
        }

        return $this->render('SynapsePageBundle:Admin/Page:create.html.twig', array(
            'form' => $form->createView(),
        ));
    }
490557
public function createAction(Request $request)
    {
        $measureunit = new MeasureUnit();
        $form = $this->createForm(new MeasureUnitType(), $measureunit);
        if ($form->handleRequest($request)->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $em->persist($measureunit);
            $em->flush();

            return $this->redirect($this->generateUrl('admin_shop_measure_unit_show', array('id' => $measureunit->getId())));
        }

        return array(
            'measureunit' => $measureunit,
            'form' => $form->createView(),
        );
    }
427586
public function sitemapAction(Request $request)
    {
        $urls = $this->get('zicht_url.sitemap_provider')->all($this->get('security.authorization_checker'));

        return new Response(
            $this->renderView('ZichtUrlBundle:Sitemap:sitemap.xml.twig', ['urls' => $urls]),
            200,
            [
                'content-type' => 'text/xml'
            ]
        );
    }
997795
public function indexAction(Request $request)
    {
        $errorMessage = '';
        $hasDB = false;
        $installed = false;
        try {
            /** @var $page Page */
            $pageManager = $this->get('networking_init_cms.page_manager');
            $page = $pageManager->findOneBy(
                ['isHome' => 1, 'locale' => $request->getLocale()]
            );
            if (!$page) {
                throw new \Exception('Pages not loaded');
            }
            $url = $page->getFullPath();
            $label = 'Go to the homepage';
            $hasDB = true;
            $installed = true;
        } catch (\Exception $e) {
            $connection = $this->getDoctrine()->getConnection();
            try {
                $connection->connect();
                $hasDB = true;
            } catch (\Exception $e) {
                $errorMessage = $e->getMessage();
            }

            $url = $this->generateUrl('_install_db');
            $label = 'Install init cms';
        }

        return $this->render(
            '@NetworkingInitCms/InitCmsInstall/index.html.twig',
            [
                'action' => ['url' => $url, 'label' => $label],
                'title' => 'Welcome to the init cms',
                'has_DB' => $hasDB,
                'error_message' => $errorMessage,
                'installed' => $installed,
            ]
        );
    }
1203437
public function returnAction(Request $request)
    {
        $name = $request->getSession()->get(self::SESSION_KEY, null);

        /* @var \Google_Client $client */
        $clientProvider = $this->get('happyr.google_site_authenticator.client_provider');
        $client = $clientProvider->getClient($name);

        $flashBag = $this->get('session')->getFlashbag();
        if ($request->query->has('code')) {
            try {
                $client->authenticate($request->query->get('code'));
                $clientProvider->setAccessToken($client->getAccessToken(), $name);

                $flashBag->add('msg', 'Successfully authenticated!');
            } catch (\Google_Auth_Exception $e) {
                $flashBag->add('error', $e->getMessage());
            }
        } else {
            $flashBag->add('error', 'Authentication aborted.');
        }

        return $this->redirect($this->generateUrl('happyr.google_site_authenticator.index'));
    }
1037798
public function roomFormAction(Request $request)
    {
        $room = new Room();
        // Manage edition mode
        $this->currentRoom = $request->get('room');
        if ($this->currentRoom) {
            $room = $this->get("ydle.room.manager")->find($request->get('room'));
        }
        $action = $this->get('router')->generate('submitRoomForm', array('room' => $this->currentRoom));

        $form = $this->createForm("rooms_form", $room);
        $form->handleRequest($request);

        return $this->render('YdleHubBundle:Rooms:form.html.twig', array(
            'action' => $action,
            'form' => $form->createView()
        ));
    }
686249
public function queryAction(Request $request)
    {
        $query = $this->getRequestParameter($request, 'q', true);

        $locale = $this->requestAnalyzer->getCurrentLocalization()->getLocale();
        $webspace = $this->requestAnalyzer->getWebspace();

        $queryString = '';
        if (strlen($query) < 3) {
            $queryString .= '+("' . self::escapeDoubleQuotes($query) . '") ';
        } else {
            $queryValues = explode(' ', $query);
            foreach ($queryValues as $queryValue) {
                if (strlen($queryValue) > 2) {
                    $queryString .= '+("' . self::escapeDoubleQuotes($queryValue) . '" OR ' .
                        '"' . preg_replace('/([^\pL\s\d])/u', '?', $queryValue) . '*" OR ' .
                        '"' . preg_replace('/([^\pL\s\d])/u', '', $queryValue) . '~") ';
                } else {
                    $queryString .= '+("' . self::escapeDoubleQuotes($queryValue) . '") ';
                }
            }
        }

        $hits = $this->searchManager
            ->createSearch($queryString)
            ->locale($locale)
            ->index('page_' . $webspace->getKey() . '_published')
            ->execute();

        $template = $webspace->getTemplate('search', $request->getRequestFormat());

        if (!$this->twig->getLoader()->exists($template)) {
            throw new NotFoundHttpException();
        }

        return new Response($this->twig->render(
            $template,
            $this->parameterResolver->resolve(
                ['query' => $query, 'hits' => $hits],
                $this->requestAnalyzer
            )
        ));
    }
14473
public static function factory(Request $request)
    {
        /** @var Action[] $actions */
        $actions = self::getAllActions($request);

        foreach ($actions as $actionType) {
            if (empty($action)) {
                $action = $actionType;
                continue;
            }

            $posPrevious = self::getPriority($action);
            $posCurrent  = self::getPriority($actionType);

            if ($posCurrent > $posPrevious) {
                $action = $actionType;
            }
        }

        if (!empty($action)) {
            return $action;
        }

        return new ActionPageview($request);
    }
559881
public function createAction(Request $request)
    {
        $newTag = new Tag();
        $newTagForm = $this->createForm(new TagType(),$newTag);

        $newTagForm->handleRequest($request);

        if($newTagForm->isValid())
        {
            $em = $this->getDoctrine()->getManager();
            $em->persist($newTag);
            $em->flush();
        }

        return $this->redirect($this->generateUrl('tag'));
    }
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);
    }
1363081
public function listJsonAction(Request $request)
    {
        $totalEntities = $this->countTotal();
                
        $offset = intval($request->get('iDisplayStart'));
        $limit = intval($request->get('iDisplayLength'));
        $sortColumn = intval($request->get('iSortCol_0'));
        $sortDirection = $request->get('sSortDir_0');
        $search = $request->get('sSearch');
        $echo = intval($request->get('sEcho'));
        
        $entities = $this->findAllForDataTables($search, $sortColumn, $sortDirection, null, $request->getLocale());
        
        $totalFilteredEntities = count($entities->getScalarResult());

        // paginate
        $entities->setFirstResult($offset)
            ->setMaxResults($limit);

        $data = $entities->getResult();


        $response = array(
            'iTotalRecords'         => $totalEntities,
            'iTotalDisplayRecords'  => $totalFilteredEntities,
            'sEcho'                 => $echo,
            'aaData'                => $data
        );
        

        return new JsonResponse($response);
    }
51975
public function typeroomAction(Request $request)
    {
        $roomType = new RoomType();

        $form = $this->createForm("room_types", $roomType);
        $form->handleRequest($request);

        if ($form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $em->persist($roomType);
            $em->flush();
            $message = 'roomtype.add.success';
            if ($roomType->getId()) {
                $message = 'roomtype.edit.success';
            }

            $response = new JsonResponse();
            $data = array(
                'result' => 'ok',
                'message' => $message
            );
            $response->setData($data);

            return $response;
        }

        return $this->render('YdleHubBundle:Config:typeroom.html.twig', array(
            'form' => $form->createView()
        ));
    }
1231436
public function createAction(Request $request)
    {
        $entity  = new Tag();
        $form = $this->createForm(new TagType(), $entity);
        $form->bind($request);

        if ($form->isValid()) {
            $em = $this->getDoctrine()->getManager();
            $em->persist($entity);
            $em->flush();

            $this->getSession()->getFlashBag()->set('success', 'The tag has been created successfully.');

            return $this->redirect($this->generateUrl('manage_tags'));
        }

        return array(
            'entity' => $entity,
            'form'   => $form->createView(),
        );
    }
1152664
public function indexAction(Request $request)
    {
        $query = $this->get('ydle.logger')->createViewLogQuery();

        $paginator  = $this->get('knp_paginator');
        $pagination = $paginator->paginate(
            $query,
            $this->get('request')->query->get('page', 1)/*page number*/,
            25/*limit per page*/
        );

        $logs = new Logs();
        $form = $this->createForm("logsfilter_form", $logs);

        return $this->render('YdleHubBundle:Logs:index.html.twig', array(
            'pagination' => $pagination,
            'form' => $form->createView()
        ));
    }
837157
public function createAction(Request $request)
    {
        $this->registerBreadcrubms()->addItem($this->get("translator")->trans("Add"));

        $entity = $this->getNewEntity();
        $form = $this->createCreateForm($entity);

        $form->handleRequest($request);

        if ($form->isValid()) {
            $em = $this->getDoctrine()->getManager();

            try {
                if ($form->get("saveAndPublish")->isClicked()) {
                    $entity->setPublished(1);
                }
            } catch (OutOfBoundsException $e) {

            }

            $em->persist($entity);

            $em->flush();

            $this->get('session')->getFlashBag()->add('notice', $this->getEntityName() . ' has been created!');

            if ($form->get("saveAndExit")->isClicked()) {
                return $this->redirect($this->generateUrl($this->getRouteName(), $this->getRouteParams()));
            } else {
                try {
                    if ($form->get("addNext")->isClicked()) {
                        return $this->redirect($this->generateUrl($this->getRouteName() . "Add", $this->getRouteParams()));
                    }
                } catch (OutOfBoundsException $e) {

                }
                return $this->redirect($this->generateUrl($this->getRouteName() . "Edit", $this->getRouteParams(['id' => $entity->getId()])));
            }
        }

        return $this->render($this->getListTemplate() . ":edit.html.twig", [
            'entity' => $entity,
            'form' => $form->createView()
        ]);
    }