Show installed packages.

@param Request $request

@throws PackageManagerException]

@return \Symfony\Component\HttpFoundation\JsonResponse
325561
public function packageInfo(Request $request)
    {
        $packageName = $request->get('package');
        $reqVersion = $request->get('version');

        try {
            $response = $this->manager()->showPackage('installed', $packageName, $reqVersion);
        } catch (\Exception $e) {
            return $this->getJsonException($e);
        }

        if (isset($response[$packageName]['package'])) {
            /** @var PackageInterface $package */
            $package = $response[$packageName]['package'];

            return $this->json([
                'name'    => $packageName,
                'version' => $package->getPrettyVersion(),
                'type'    => $package->getType(),
            ]);
        }

        return $this->getJsonException(new PackageManagerException(Trans::__('page.extend.message.package-install-info-fail', ['%PACKAGE%' => $packageName, '%VERSION%' => $reqVersion])));
    }
1340999
public function indexAction(Request $request)
    {
        // Special case, not correctly setup yet. Do so now.
        if (!$this->isInstalled()) {
            return new RedirectResponse($request->getUri() . 'install.html');
        }

        return new Response(
            str_replace(
                'var TENSIDEApi=window.location.href.split(\'#\')[0];',
                'var TENSIDEApi=\'' . $request->getSchemeAndHttpHost() . $request->getBaseUrl() . '/\';',
                file_get_contents($this->getAssetsDir() . '/index.html')
            ),
            200,
            [
                'Content-Type' => 'text/html; charset=UTF-8'
            ]
        );
    }
1336670
public function show($id,Request $request)
    {
        if($request->ajax())
        {
            return URL::to('package/'.$id);
        }

        $package = Package::findOrfail($id);
        return view('unstarter.package.show',compact('package'));
    }
740371
public function showAction(Request $request)
    {
        $gridSource = $this->get('dtc_grid.manager.source')->get($request->get('id'));
        $id = $request->get('identifier');
        $result = $gridSource->find($id);

        $responseResult = [];
        if (!$result) {
            return new Response('Not Found', 404);
        }
        if (is_array($result)) {
            foreach ($result as $key => $value) {
                $responseResult[$this->fromCamelCase($key)] = $value;
            }
        } elseif (method_exists($gridSource, 'getClassMetadata')) {
            $classMetadata = $gridSource->getClassMetadata();
            $fieldNames = $classMetadata->getFieldNames();
            foreach ($fieldNames as $fieldName) {
                $method = 'get'.ucfirst($fieldName);
                if (method_exists($result, $method)) {
                    $responseResult[$this->fromCamelCase($fieldName)] = $result->$method();
                }
            }
        }

        return new JsonResponse($responseResult);
    }
1082979
public function generateTheme(Request $request)
    {
        $theme = $request->query->get('theme');
        $newName = $request->query->get('name');

        if (empty($theme)) {
            return new Response(Trans::__('page.extend.theme.generation.missing.name'));
        }

        if (!$newName) {
            $newName = basename($theme);
        }

        $source = $this->filesystem()->getDir('extensions://vendor/' . $theme);
        if (!$source->exists()) {
            return $this->getJsonException(new PackageManagerException(Trans::__('page.extend.message.invalid-theme-source-dir', ['%SOURCE%', $source])));
        }

        try {
            $this->filesystem()->mirror('extensions://vendor/' . $theme, 'themes://' . $newName);

            try {
                $this->filesystem()->copy("themes://$newName/config.yml.dist", "themes://$newName/config.yml");
            } catch (FileNotFoundException $e) {
                // Ignore if there's no dist file
            }
        } catch (IOException $e) {
            return new Response(Trans::__('page.extend.theme.generation.failure'));
        }

        return new Response(Trans::__('page.extend.theme.generation.success'));
    }
898450
public function listPlatformRolesGrantableAction(Request $request)
    {
        return new JsonResponse(
            $this->finder->search('Claroline\CoreBundle\Entity\Role', array_merge(
                $request->query->all(),
                ['hiddenFilters' => ['type' => 1, 'grantable' => true]]
            ))
        );
    }
349455
public function create(Request $request)
    {
        if ($request->wantsJson()) {
            return $this->validNotFoundJsonResponse();
        }

        $model = new $this->repository->model;

        $view = $this->getViewLocation(__FUNCTION__);
        $this->checkViewExists($view);

        return response()->view($view, compact('model'));
    }
432674
public function listAction(Request $request)
    {
        $this->buildBreadcrumbs($this->getType());

        $queryBuilder = $this->getDoctrine()
            ->getManager()
            ->createQueryBuilder()
            ->select('e')
            ->from($this->getEntityName($this->getType()), 'e')
            ->orderBy('e.id', 'DESC');

        $adapter = new DoctrineORMAdapter($this->alterListQuery($queryBuilder));
        $data = new Pagerfanta($adapter);
        $data->setCurrentPage($request->query->get('page', 1));

        $module = $this->getModule($this->getType());

        return $this->render($this->getListTemplate(), array_merge(array(
            'data' => $data,
            'type' => $this->getType(),
            'module' => $module,
            'submodules' => $this->getSubmodules($module),
        ), $this->getExtraListVariables()));
    }
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);
    }
222735
public function listAction(Request $request)
    {
        $id = $request->get('id');

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

        $elementtype = $elementtypeService->findElementtype($id);

        $usages = [];
        foreach ($usageManager->getUsage($elementtype) as $usage) {
            $usages[] = [
                'type' => $usage->getType(),
                'as' => $usage->getAs(),
                'id' => $usage->getId(),
                'title' => $usage->getTitle(),
                'latest_version' => $usage->getLatestVersion(),
            ];
        }

        return new JsonResponse(['list' => $usages, 'total' => count($usages)]);
    }
1335601
public function listAction(Request $request)
    {
        $this->denyAccessUnlessGranted('ROLE_SUPER_ADMIN');

        $em = $this->getDoctrine()->getManager();
        $configuratorClassName = '';
        if ($this->container->hasParameter('kunstmaan_user_management.user_admin_list_configurator.class')) {
            $configuratorClassName = $this->container->getParameter(
                'kunstmaan_user_management.user_admin_list_configurator.class'
            );
        }

        $configurator = new $configuratorClassName($em);

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

        return array(
            'adminlist' => $adminList,
        );
    }
1362468
public function installedAction(Request $request)
    {
        $response = $this->getCacheTimeKeeper()->getResponse('AnimeDbAppBundle:Plugin');
        // response was not modified for this request
        if ($response->isNotModified($request)) {
            return $response;
        }

        /* @var $rep EntityRepository */
        $rep = $this->getDoctrine()->getRepository('AnimeDbAppBundle:Plugin');

        return $this->render('AnimeDbCatalogBundle:Plugin:installed.html.twig', [
            'plugins' => $rep->findAll(),
        ], $response);
    }
407196
public function listAction(Request $request)
    {
        return $this->render('SynapsePageBundle:Admin/Page:list.html.twig', array(
            'pages' => $this->container->get('synapse.page.loader')->retrieveAll(),
            'page_rendering_route' => $this->container->getParameter('synapse.page.rendering_route'),
        ));
    }
892109
public function scanAction(Request $request)
    {
        // app already installed
        if ($this->container->getParameter('anime_db.catalog.installed')) {
            return $this->redirect($this->generateUrl('home'));
        }

        $storage = $this->getRepository()->getLast();
        if (!$storage) {
            return $this->redirect('install_add_storage');
        }

        $response = $this->getCacheTimeKeeper()->getResponse($storage->getDateUpdate());

        // scan storage in background
        $this->get('anime_db.storage.scan_executor')->export($storage);

        // response was not modified for this request
        if ($response->isNotModified($request)) {
            return $response;
        }

        return $this->render('AnimeDbCatalogBundle:Install:scan.html.twig', [
            'storage' => $storage,
        ], $response);
    }
672597
public function quicklistAction(Request $request)
    {
        $quicklist = $this->get('zicht_admin.quicklist');
        if ($request->get('repo') && $request->get('pattern')) {
            if ($request->get('language')) {
                $language = $request->get('language');
            } else {
                $language = null;
            }
            return new JsonResponse($quicklist->getResults($request->get('repo'), $request->get('pattern'), $language));
        }

        return array(
            'repos' => $quicklist->getRepositoryConfigs()
        );
    }
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);
    }
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);
    }