List elementtypes.

@param Request $request

@return JsonResponse
@Route("", name="elementtypes_list")
778712
public function listAction(Request $request)
    {
        $type = $request->get('type', Elementtype::TYPE_FULL);

        $elementtypeService = $this->get('phlexible_elementtype.elementtype_service');

        $elementtypes = [];
        foreach ($elementtypeService->findAllElementtypes() as $elementtype) {
            if ($type !== $elementtype->getType()) {
                continue;
            }

            if ($elementtype->getDeleted()) {
                continue;
            }

            $elementtypes[$elementtype->getTitle().$elementtype->getId()] = [
                'id' => $elementtype->getId(),
                'title' => $elementtype->getTitle(),
                'icon' => $elementtype->getIcon(),
                'version' => $elementtype->getRevision(),
                'type' => $elementtype->getType(),
            ];
        }

        ksort($elementtypes);
        $elementtypes = array_values($elementtypes);

        $checker = $this->get('phlexible_element.checker');
        $changes = $checker->check();
        $hasChanges = false;
        foreach ($changes as $change) {
            if ($change->getNeedImport()) {
                $hasChanges = true;
                break;
            }
        }

        return new JsonResponse([
            'elementtypes' => $elementtypes,
            'total' => count($elementtypes),
            'changes' => $hasChanges,
        ]);
    }
689490
public function listAction(Request $request)
    {
        $current_page = $request->get('page', 1);
        $current_page = $current_page > 1 ? $current_page : 1;
        $rep = $this->getRepository();

        // filter list notice
        $filter = $this->createForm('notices_filter')->handleRequest($request);
        if ($filter->isValid()) {
            $query = $rep->getFilteredQuery($filter->getData()['status'], $filter->getData()['type']);
        } else {
            $query = $rep->createQueryBuilder('n');
        }
        $query
            ->orderBy('n.date_created', 'DESC')
            ->setFirstResult(($current_page - 1) * self::NOTICE_PER_PAGE)
            ->setMaxResults(self::NOTICE_PER_PAGE);
        $list = $query->getQuery()->getResult();

        // get count all items
        $count = $query
            ->select('COUNT(n)')
            ->getQuery()
            ->getSingleScalarResult();

        // pagination
        $that = $this;
        $request_query = $request->query->all();
        unset($request_query['page']);
        $pagination = $this->get('anime_db.pagination')
            ->create(ceil($count / self::NOTICE_PER_PAGE), $current_page)
            ->setPageLink(function ($page) use ($that, $request_query) {
                return $that->generateUrl('notice_list', array_merge($request_query, ['page' => $page]));
            })
            ->setFirstPageLink($this->generateUrl('notice_list', $request_query))
            ->getView();

        return $this->render('AnimeDbCatalogBundle:Notice:list.html.twig', [
            'list' => $list,
            'pagination' => $pagination,
            'change_form' => $this->createForm(new ChangeNotice())->createView(),
            'filter' => $filter->createView(),
            'action_remove' => ChangeNotice::ACTION_REMOVE,
        ]);
    }
863242
public function indexAction(Request $request)
    {
        try {
            $configurator = $this->get('phlexible_element_renderer.configurator');
            $configuration = $configurator->configure($request);
            if ($configuration->hasResponse()) {
                return $configuration->getResponse();
            }
            $data = $configuration->getVariables();

            $template = $data['template'];
            if ($request->attributes->has('template')) {
                $template = $request->attributes->get('template');
            }

            return $this->render($template, (array) $data);

        } catch (NotFoundHttpException $e) {
            $nodeId                 = $this->get('phlexible_siteroot.siteroot_request_matcher')->matchRequest($this->getRequest())->getSpecialTid($request->getLocale(), 'error_' . $e->getStatusCode());
            $contentTreeNode        = $this->get('phlexible_tree.content_tree_manager')->findByTreeId($nodeId)->get($nodeId);
            $url                    = $this->get('router')->generate($contentTreeNode);

            return new RedirectResponse($url);
        }
    }
663269
public function listJsonAction(Request $request)
    {
        $em = $this->getDoctrine()->getManager();

        /** @var \AdminBundle\Services\DataTables\JsonList $jsonList */
        $jsonList = $this->get('json_list');
        $jsonList->setRepository($em->getRepository('CoreBundle:Page'));
        $jsonList->setLocale($request->getLocale());
        $response = $jsonList->get();
        

        return new JsonResponse($response);
    }
407793
public function pagesListAction(Request $request)
    {
        $repository = $this->get('ekyna_cms.page.repository');

        $lastModifiedAt = $repository->getLastUpdatedAt();

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

        if ($response->isNotModified($request)) {
            return $response;
        }

        $documentLocale = $request->query->get('document_locale', $request->getLocale());
        $list = [];

        /** @var \Ekyna\Bundle\CmsBundle\Model\PageInterface[] $pages */
        $pages = $this
            ->get('ekyna_cms.page.repository')
            ->findBy(['dynamicPath' => false], ['left' => 'ASC']);

        foreach ($pages as $page) {
            $list[] = $this->pageToArray($page, $documentLocale);
        }

        return $response->setContent(json_encode($list));
    }
1360905
public function changeTypeAction(Request $request)
    {
        $container = $this->findContainerByRequest($request);

        $type = $request->request->get('type', null);

        $data = [];

        if ($type != $container->getType()) {
            try {
                $removed = $this->getEditor()->getContainerManager()->changeType($container, $type);
            } catch (EditorExceptionInterface $e) {
                return $this->handleException($e);
            }

            if (!empty($removed)) {
                $data['removed'] = $removed;
            }

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

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

        return $this->buildResponse($data, self::SERIALIZE_FULL);
    }
946745
public function listElement(Request $request)
    {
        $baseIds = array_keys($this->getAclForUser()->get_granted_base([\ACL::CANADDRECORD]));

        $lazaretFiles = null;
        $perPage = 10;
        $page = max(1, $request->query->get('page', 1));
        $offset = ($page - 1) * $perPage;

        if (count($baseIds) > 0) {
            $lazaretFiles = $this->getLazaretFileRepository()->findPerPage($baseIds, $offset, $perPage);
        }

        return $this->render('prod/upload/lazaret.html.twig', [
            'lazaretFiles' => $lazaretFiles,
            'currentPage'  => $page,
            'perPage'      => $perPage,
        ]);
    }
1321919
public function manyToManyForm(Request $request)
    {
        $dummyData = DatabaseManager::tableNames();
        $elements = Ajaxis::MtcreateFormModal([
            ['type' => 'select', 'name' => 'table1', 'key' => 'table1', 'value' => $dummyData],
            ['type' => 'select', 'name' => 'table2', 'key' => 'table2', 'value' => $dummyData], ], '/scaffold/manyToMany', 'Many To Many');

        return $elements;
    }
1363698
public function listAction(Request $request)
    {
        $theme = $request->attributes->get(
            'synapse_theme',
            $this->container->get('synapse')
                ->enableDefaultTheme()
                ->getCurrentTheme()
        );

        $templateCollection = $this->container->get('synapse.template.loader')
            ->retrieveAll(array(
                'scope' => TemplateInterface::GLOBAL_SCOPE,
                'templateTypeId' => $theme->getTemplateTypes()->column('id')
            ))
        ;
        $templateMap = array();
        foreach ($templateCollection as $template) {
            $templateMap[$template->getTemplateType()->getName()][$template->getContentType()->getName()] = $template;
        }

        return $this->render('SynapseAdminBundle:Template:list.html.twig', array(
            'theme' => $theme,
            'content_types' => $this->container->get('synapse.content_type.loader')
                ->retrieveAll(),
            'templates' => $templateMap,
        ));
    }
854990
public function displayTypeProperty(Request $request)
    {
        if (!$request->isXmlHttpRequest()) {
            $this->app->abort(400);
        }

        $records = RecordsRequest::fromRequest($this->app, $request, false, [\ACL::CANMODIFRECORD]);

        $recordsType = [];

        foreach ($records as $record) {
            //perform logic
            $sbasId = $record->getDataboxId();

            if (!isset($recordsType[$sbasId])) {
                $recordsType[$sbasId] = [];
            }

            if (!isset($recordsType[$sbasId][$record->getType()])) {
                $recordsType[$sbasId][$record->getType()] = [];
            }

            $recordsType[$sbasId][$record->getType()][] = $record;
        }

        return new Response($this->render('prod/actions/Property/type.html.twig', [
            'records'     => $records,
            'recordsType' => $recordsType,
        ]));
    }
928582
public function getElementHtml(Request $request)
    {
        $attributes = $this->repository->findMany($request->get('attribute_id'));

        $tmpString = '__RANDOM__STRING__';
        $view = view('avored-ecommerce::attribute.get-element')
            ->with('attributes', $attributes)
            ->with('tmpString', $tmpString);

        return new JsonResponse(['success' => true, 'content' => $view->render()]);
    }
999527
public function treeAction(Request $request)
    {
        $siterootId = $request->get('siteroot_id');
        $tid = $request->get('node');
        $language = $request->get('language');

        $treeManager = $this->get('phlexible_tree.tree_manager');
        $elementService = $this->get('phlexible_element.element_service');
        $nodeSerializer = $this->get('phlexible_tree.node_serializer');

        // TODO: switch to master language of element
        $defaultLanguage = $this->container->getParameter('phlexible_cms.languages.default');

        $tree = $treeManager->getBySiteRootId($siterootId);
        $rootNode = $tree->getRoot();

        $data = [];
        if ($rootNode) {
            if ($tid === null || $tid < 1) {
                $data = [$nodeSerializer->serializeNode($rootNode, $language, $this->container->get('security.token_storage')->getToken())];
            } else {
                $node = $tree->get($tid);

                // check if children of this node should be shown
                $element = $elementService->findElement($node->getTypeId());
                $elementtype = $elementService->findElementtype($element);

                $nodes = $tree->getChildren($node);
                if (!empty($nodes) && !$elementtype->getHideChildren()) {
                    $data = $nodeSerializer->serializeNodes($nodes, $language, $this->container->get('security.token_storage')->getToken());
                }
            }
        }

        return new JsonResponse($data);
    }
94424
public static function getHeadersFromRequest(Request $request)
    {
        $headers = array();
        foreach($request->headers as $key => $value)
        {
            if(isset($key) && isset($value) && isset($value[0]))
            {
                $headers[$key] = $value[0];
            }
        }
        return $headers;
    }
71239
public function listAction(Request $request)
    {
        $folderId = $request->get('folder_id');
        $start = $request->get('start', 0);
        $limit = $request->get('limit', 25);
        $sort = $request->get('sort', 'name');
        $dir = $request->get('dir', 'ASC');
        $showHidden = $request->get('show_hidden', false);
        $filter = $request->get('filter');

        if (!$folderId) {
            throw new \RuntimeException('No folder ID');
        }

        if ($filter) {
            $filter = json_decode($filter, true);
        }

        $data = [];
        $total = 0;

        $volume = $this->getVolumeByFolderId($folderId);
        $securityContext = $this->get('security.context');

        $folder = $volume->findFolder($folderId);

        if ($securityContext->isGranted('ROLE_SUPER_ADMIN') || $securityContext->isGranted('FILE_READ', $folder)) {
            if ($sort === 'create_time') {
                $sort = 'created_at';
            } elseif ($sort === 'document_type_key') {
                $sort = 'mime_type';
            }

            if ($filter) {
                $filter['folder'] = $folder;
                if (!$showHidden) {
                    $filter['hidden'] = false;
                }
                $files = $volume->findFiles($filter, [$this->toCamelCase($sort) => $dir], $limit, $start);
                $total = $volume->countFiles($filter);
            } else {
                $files = $volume->findFilesByFolder($folder, [$this->toCamelCase($sort) => $dir], $limit, $start, $showHidden);
                $total = $volume->countFilesByFolder($folder, $showHidden);
            }

            $data = $this->filesToArray($volume, $files);
        }

        return new JsonResponse(['files' => $data, 'totalCount' => $total]);
    }
1295838
public function listRoles(Request $request)
    {
        $roles = array();
        if ($request->query->has('identifier')) {
            try {
                $role = $this->roleService->loadRoleByIdentifier($request->query->get('identifier'));
                $roles[] = $role;
            } catch (APINotFoundException $e) {
                // Do nothing
            }
        } else {
            $offset = $request->query->has('offset') ? (int)$request->query->get('offset') : 0;
            $limit = $request->query->has('limit') ? (int)$request->query->get('limit') : -1;

            $roles = array_slice(
                $this->roleService->loadRoles(),
                $offset >= 0 ? $offset : 0,
                $limit >= 0 ? $limit : null
            );
        }

        return new Values\RoleList($roles, $request->getPathInfo());
    }
353049
public function saveAction(Request $request)
    {
        $treeSaver = $this->get('phlexible_elementtype.tree_saver');

        $elementtype = $treeSaver->save($request, $this->getUser());

        return new ResultResponse(
            true,
            "Element Type {$elementtype->getTitle()} saved as version {$elementtype->getRevision()}."
        );
    }
930971
public function listAction(Request $request)
    {
        $mediaTypeManager = $this->get('phlexible_media_type.media_type_manager');
        $iconResolver = $this->get('phlexible_media_type.icon_resolver');

        $mediaTypes = [];
        foreach ($mediaTypeManager->findAll() as $mediaType) {
            $mediaTypes[] = [
                'id' => $mediaType->getName(),
                'key' => $mediaType->getName(),
                'upperkey' => strtoupper($mediaType->getName()),
                'type' => $mediaType->getCategory(),
                'de' => $mediaType->getTitle('de'),
                'en' => $mediaType->getTitle('en'),
                'mimetypes' => $mediaType->getMimetypes(),
                'icon16' => (bool) $iconResolver->resolve($mediaType, 16),
                'icon32' => (bool) $iconResolver->resolve($mediaType, 32),
                'icon48' => (bool) $iconResolver->resolve($mediaType, 48),
                'icon256' => (bool) $iconResolver->resolve($mediaType, 256),
            ];
        }

        return new JsonResponse([
            'totalCount' => count($mediaTypes),
            'mediatypes' => $mediaTypes,
        ]);
    }