Render basic sitemap from all database urls

@param Request $request
@return Response

@Route("/sitemap.{_format}", defaults={"_format": "xml"})
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'
            ]
        );
    }
1043688
public function urlsAction(Request $request)
    {
        $tid = $request->get('tid');
        $language = $request->get('language');

        $treeManager = $this->get('phlexible_tree.tree_manager');
        $stateManager = $this->get('phlexible_tree.state_manager');

        $node = $treeManager->getByNodeId($tid)->get($tid);

        $urls = [
            'preview' => '',
            'online' => '',
        ];

        if ($node) {
            $nodeUrlGenerator = $this->get('phlexible_tree.node_url_generator');
            $urls['preview'] = $nodeUrlGenerator->generatePreviewUrl($node, $language);

            if ($stateManager->isPublished($node, $language)) {
                try {
                    $urls['online'] = $nodeUrlGenerator->generateOnlineUrl($node, $language);
                } catch (\Exception $e) {
                }
            }
        }

        return new ResultResponse(true, '', $urls);
    }
315158
private function parseMap(Request $request) {
		//解析
		$res = explode('/', trim($request->uri, '/'), 3);
		if (count($res) === 3) {
			$request->module = $res[0];
			$request->controller = $res[1];
			$request->action = $res[2];
		} else {
			$request->module = $this->module;
			$request->controller = $res[0];
			$request->action = $res[1];
		}
		return true;
	}
1335949
public function renderAction(Request $request)
    {
        $data = (array) json_decode($request->getContent(), true);
        $menu = null;

        if (isset($data['data'])) {
            $menu = $this->getMenuFactory()->fromArray($data['data']);
        }

        return [
            'menu'    => $menu,
            'options' => isset($data['options']) ? $data['options'] : [],
        ];
    }
966813
public function indexAction(Request $request)
    {
        $formattedContent = [];

        /** @var ContentManager $manager */
        $contentManager = $this->get('opifer.content.content_manager');

        $contents = $contentManager->getRepository()->getContentFromRequest($request);

        foreach ($contents as $key => $content) {
            $formattedContent[$key]['id'] = $content->getId();
            $formattedContent[$key]['parent_id'] = ($content->getParent()) ? $content->getParent()->getId() : 0;
            $formattedContent[$key]['site_id'] = ($content->getSite()) ? $content->getSite()->getId() : null;
            $formattedContent[$key]['active'] = $content->getActive();
            $formattedContent[$key]['title'] = $content->getTitle();
            $formattedContent[$key]['short_title'] = $content->getShortTitle();
            $formattedContent[$key]['description'] = $content->getDescription();
            $formattedContent[$key]['slug'] = $content->getSlug();
            $formattedContent[$key]['created_at'] = $content->getCreatedAt()->format('Y-m-d H:i:s');
            $formattedContent[$key]['updated_at'] = $content->getUpdatedAt()->format('Y-m-d H:i:s');
            $formattedContent[$key]['publish_at'] = $content->getPublishAt()->format('Y-m-d H:i:s');
            $formattedContent[$key]['path'] = '/'.$content->getSlug();
            $formattedContent[$key]['coverImage'] = '';
            $formattedContent[$key]['content_type']['id'] = ($content->getContentType()) ? $content->getContentType()->getId() : '';
            $formattedContent[$key]['content_type']['name'] = ($content->getContentType()) ? $content->getContentType()->getName() : '';
        }

        $data = [
            'results' => $formattedContent,
        ];

        return new JsonResponse($data);
    }
826038
public function listAction(Request $request): Response
    {
        $page = $request->query->get('page') ?? 1;

        $pagerfanta = new Pagerfanta(
            new ArrayAdapter($this->roleService->loadRoles())
        );

        $pagerfanta->setMaxPerPage($this->defaultPaginationLimit);
        $pagerfanta->setCurrentPage(min($page, $pagerfanta->getNbPages()));

        /** @var \eZ\Publish\API\Repository\Values\User\Role[] $sectionList */
        $roles = $pagerfanta->getCurrentPageResults();

        $rolesNumbers = array_column($roles, 'id');

        $rolesDeleteData = new RolesDeleteData(
            array_combine($rolesNumbers, array_fill_keys($rolesNumbers, false))
        );

        $rolesDeleteForm = $this->formFactory->deleteRoles($rolesDeleteData);

        return $this->render('@ezdesign/admin/role/list.html.twig', [
            'form_roles_delete' => $rolesDeleteForm->createView(),
            'pager' => $pagerfanta,
            'can_create' => $this->isGranted(new Attribute('role', 'create')),
            'can_delete' => $this->isGranted(new Attribute('role', 'delete')),
            'can_update' => $this->isGranted(new Attribute('role', 'update')),
            'can_assign' => $this->isGranted(new Attribute('role', 'assign')),
        ]);
    }
1144432
public function sitesAction(Request $request)
    {
        $sites = $this->get('opifer.cms.site_manager')->getRepository()->findAll();
        $data = $this->get('jms_serializer')->serialize($sites, 'json');

        $data = [
            'results' => json_decode($data, true),
        ];

        return new JsonResponse($data);
    }
978101
public function searchAction(Request $request)
    {
        $queryString = $request->query->get('q');
        $index = $request->query->get('index', null);
        $locale = $request->query->get('locale', null);

        $page = $this->listRestHelper->getPage();
        $limit = $this->listRestHelper->getLimit();
        $startTime = microtime(true);

        $indexes = $index ? [$index] : $this->getAllowedIndexes();

        $query = $this->searchManager->createSearch($queryString);

        if ($locale) {
            $query->locale($locale);
        }

        $query->indexes($indexes);
        $query->setLimit($limit);

        $time = microtime(true) - $startTime;

        $adapter = new ArrayAdapter(iterator_to_array($query->execute()));
        $pager = new Pagerfanta($adapter);
        $pager->setMaxPerPage($limit);
        $pager->setCurrentPage($page);

        $representation = new SearchResultRepresentation(
            new CollectionRepresentation($pager->getCurrentPageResults(), 'result'),
            'sulu_search_search',
            [
                'locale' => $locale,
                'query' => $query,
                'index' => $index,
            ],
            (int) $page,
            (int) $limit,
            $pager->getNbPages(),
            'page',
            'limit',
            false,
            $adapter->getNbResults(),
            $this->getIndexTotals($adapter->getArray()),
            number_format($time, 8)
        );

        $view = View::create($representation);
        $context = new Context();
        $context->enableMaxDepth();
        $view->setContext($context);

        return $this->viewHandler->handle($view);
    }
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
            )
        ));
    }
680998
public function resolveRequest(Request $request)
    {
        $format = $request->attributes->get(
            'format',
            $request->attributes->get('_format', 'html')
        );
        
        switch ($format) {
            case 'html':
            case 'page':
                return new DefaultHtmlRenderer();
                break;
            case 'api':
            case 'json':
                return new JsonApiRenderer();
                break;
            default:
                throw new InvalidConfigurationException(sprintf("Unsupported response format %s", $format));
        }
    }
1245190
public function viewAction(Request $request): Response
    {
        $configuration = $this->requestConfigurationFactory->create($this->metadata, $request);

        $this->isGrantedOr403($configuration, ResourceActions::SHOW);

        /** @var DefinedTranslationInterface|TemplateAwareInterface|ResourceInterface $resource */
        $resource = $this->findOr404($configuration);

        $this->eventDispatcher->dispatch(ResourceActions::SHOW, $configuration, $resource);

        $view = View::create($resource);

        if ($configuration->isHtmlRequest()) {
            $template = $resource->getTemplate();

            if ($template) {
                $tpl = $resource->getTemplateName();
                $options = $template->getOptions();
            } else {
                $tpl = $configuration->getTemplate(ResourceActions::SHOW.'.html');
                $options = [];
            }

            $this->addTranslations($resource);

            $view
                ->setTemplate($tpl)
                ->setTemplateVar($this->metadata->getName())
                ->setData(
                    [
                        'configuration' => $configuration,
                        'metadata' => $this->metadata,
                        'resource' => $resource,
                        'tpl' => ['options' => $options],
                        $this->metadata->getName() => $resource,
                    ]
                );
        }

        return $this->viewHandler->handle($configuration, $view);
    }
965849
public function indexDataAction(Request $request)
        {

            $aRemoteApps = RemoteAppQuery::create()->find();
            $sResult     = $this->renderView('SlashworksAppBundle:RemoteApp:data.json.twig', array(
                'entities' => $aRemoteApps,
            ));

            $response = new Response($sResult);
            $response->headers->set('Content-Type', 'application/json');

            return $response;

        }
833655
public function treeAction(Request $request = null)
    {
        $this->admin->checkAccess('tree');

        $sites = $this->get('sonata.page.manager.site')->findBy(array());
        $pageManager = $this->get('sonata.page.manager.page');

        $currentSite = null;
        $siteId = $request->get('site');
        foreach ($sites as $site) {
            if ($siteId && $site->getId() === $siteId) {
                $currentSite = $site;
            } elseif (!$siteId && $site->getIsDefault()) {
                $currentSite = $site;
            }
        }
        if (!$currentSite && count($sites) === 1) {
            $currentSite = $sites[0];
        }

        $showAllPages = $this->get('security.context')->isGranted('ROLE_SUPER_ADMIN');

        if ($currentSite) {
            $pages = $pageManager->loadPages($currentSite, $showAllPages);
        } else {
            $pages = array();
        }

        $datagrid = $this->admin->getDatagrid();
        $formView = $datagrid->getForm()->createView();

        $this->get('twig')->getExtension('form')->renderer->setTheme($formView, $this->admin->getFilterTheme());

        return $this->render($this->admin->getTemplate('tree'), array(
            'action' => 'tree',
            'sites' => $sites,
            'currentSite' => $currentSite,
            'pages' => $pages,
            'form' => $formView,
            'csrf_token' => $this->getCsrfToken('sonata.batch'),
        ));
    }
1004266
public function listAction(Request $request): Response
    {
        $data = new URLListData();

        $form = $this->formFactory->createUrlListForm($data, '', [
            'method' => Request::METHOD_GET,
            'csrf_protection' => false,
        ]);
        $form->handleRequest($request);
        if ($form->isSubmitted() && !$form->isValid()) {
            throw new BadRequestHttpException();
        }

        $urls = new Pagerfanta(new URLSearchAdapter(
            $this->buildListQuery($data),
            $this->urlService
        ));

        $urls->setCurrentPage($data->page);
        $urls->setMaxPerPage($data->limit ? $data->limit : self::DEFAULT_MAX_PER_PAGE);

        return $this->render('@ezdesign/link_manager/list.html.twig', [
            'form' => $form->createView(),
            'can_edit' => $this->isGranted(new Attribute('url', 'update')),
            'urls' => $urls,
        ]);
    }
1176843
public function indexAction(Request $request)
    {
        $query = htmlspecialchars($request->query->get('q'));

        $queryMinLength = $this->getParameter('darvin_admin.search_query_min_length');

        $queryTooShort = mb_strlen($query) < $queryMinLength;

        $entityNames = $queryTooShort ? [] : $this->getSearcher()->getSearchableEntityNames();

        return $this->render('DarvinAdminBundle:Search:index.html.twig', [
            'entity_names'     => $entityNames,
            'query'            => $query,
            'query_min_length' => $queryMinLength,
            'query_too_short'  => $queryTooShort,
        ]);
    }
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);
    }
643788
public function listAction(Request $request): Response
    {
        $page = $request->query->get('page') ?? 1;

        $pagerfanta = new Pagerfanta(
            new ArrayAdapter($this->sectionService->loadSections())
        );

        $pagerfanta->setMaxPerPage($this->defaultPaginationLimit);
        $pagerfanta->setCurrentPage(min($page, $pagerfanta->getNbPages()));

        /** @var \eZ\Publish\API\Repository\Values\Content\Section[] $sectionList */
        $sectionList = $pagerfanta->getCurrentPageResults();
        $contentCountBySectionId = [];
        $deletableSections = [];
        $assignableSections = [];

        $deleteSectionsForm = $this->formFactory->deleteSections(
            new SectionsDeleteData($this->getSectionsNumbers($sectionList))
        );

        $assignContentForms = $this->formFactory->assignContentSectionForm(
            new SectionContentAssignData()
        );

        foreach ($sectionList as $section) {
            $contentCountBySectionId[$section->id] = $this->sectionService->countAssignedContents($section);
            $deletableSections[$section->id] = !$this->sectionService->isSectionUsed($section);
            $assignableSections[$section->id] = $this->canUserAssignSectionToSomeContent($section);
        }

        return $this->render('@ezdesign/admin/section/list.html.twig', [
            'can_edit' => $this->isGranted(new Attribute('section', 'edit')),
            'can_assign' => $this->isGranted(new Attribute('section', 'assign')),
            'pager' => $pagerfanta,
            'content_count' => $contentCountBySectionId,
            'deletable' => $deletableSections,
            'assignable' => $assignableSections,
            'form_sections_delete' => $deleteSectionsForm->createView(),
            'form_section_content_assign' => $assignContentForms->createView(),
        ]);
    }