Handles template list request.

@return SupraJsonResponse
513158
public function templatesListAction()
	{
		$localeId = $this->getCurrentLocale()
				->getId();

		$templateLocalizations = $this->getEntityManager()
				->getRepository(TemplateLocalization::CN())
				->findBy(array('locale' => $localeId), array('title' => 'asc'));

		/* @var $templateLocalizations TemplateLocalization[] */

		$responseData = array();

		foreach ($templateLocalizations as $templateLocalization) {
			$responseData[] = array(
				'id'		=> $templateLocalization->getMaster()->getId(),
				'title'		=> $templateLocalization->getTitle(),
			);
		}

		return new SupraJsonResponse($responseData);
	}
790865
public function listAction()
    {
        $response = $this->getResponse();
        $response->setStatusCode(200);
        $headers = $response->getHeaders();
        $headers->addHeaderLine('Cache-Control', 'public, max-age=86400');
        $headers->addHeaderLine('Expires', date(DATE_RFC822, strtotime("1 day")));


        $key = strtolower($this->getEvent()->getRouteMatch()->getParam('key'));
        $locale = $this->getEvent()->getRouteMatch()->getParam('locale');

        if (strlen($key)<=2) {
            $response->setContent(json_encode(array('status' => 1, 'message' => "The key length should be greater than 3!")));
        
            return $response;
        }

        $translatesSelected = array();
        if (empty($locale)) {
            $locale = 'en_UK';
        }
        $translatesSelected = array();
        $translates = $this->getTranslateService()->readLanguageFile($locale);
        if ($translates) {
            foreach ($translates as $translateKey => $translateValue) {
                $pattern = "/^".$key."/";
                if (preg_match($pattern, strtolower($translateKey))) {
                    $translatesSelected[$translateKey] = $translateValue;
                }
            }
        }

        $return['status'] = 0;
        $return['translates'] = $translatesSelected;

        $response->setContent(json_encode($return));
        
        return $response;
    }
617834
public function resolveNotFoundTemplate()
    {
        $this->buildTemplateIndex();

        $template = (array_key_exists(self::NOTFOUND_TEMPLATE, $this->templateIndex)) ?
            $this->templateIndex[self::NOTFOUND_TEMPLATE] :
            false;

        return($template);
    }
249841
public function httpResponse()
    {
        // get the template
        $template = $this->view()->getTemplate();

        // if there is no template, then we return false
        if(empty($template)) {
            return false;
        }

        // get view data
        $viewData = $this->view()->getAssignedData();

        // assign application data to view
        $viewData['App'] = [
            'Config'       => $this->getEnvironmentConfig(),
            'Components'   => $this->environment->getComponentConfigs()->toArray(),
            'Environment'  => $this->getEnvironmentName(),
            'AbsolutePath' => $this->getAbsolutePath(),
            'WebPath'      => $this->getWebPath()
        ];

        // render the view and assign it to the response object
        return new Response($this->getTemplateEngineInstance()->fetch($this->view()->getTemplate(), $viewData));
    }
1044013
public function resolveIndexTemplate()
    {
        $this->buildTemplateIndex();

        $template = (array_key_exists(self::INDEX_TEMPLATE, $this->templateIndex)) ?
            $this->templateIndex[self::INDEX_TEMPLATE] :
            false;

        return($template);
    }
844579
protected function handleOptions() : HttpResponse
    {
        $headers = [
            'Allow' => implode(',', $this->request->allowedHttpVerbs()),
            'Tus-Version' => self::TUS_PROTOCOL_VERSION,
            'Tus-Extension' => implode(',', self::TUS_EXTENSIONS),
            'Tus-Checksum-Algorithm' => $this->getSupportedHashAlgorithms(),
        ];

        $maxUploadSize = $this->getMaxUploadSize();

        if ($maxUploadSize > 0) {
            $headers['Tus-Max-Size'] = $maxUploadSize;
        }

        return $this->response->send(null, HttpResponse::HTTP_OK, $headers);
    }
530550
private function initial_response()
    {
        $options = $this->options;
        $options['params']['after'] = null;
        return $this->service->list($options);
    }
722243
private function getTemplate()
    {
        $template = config('laranotify.template');
        if ($template == '' && $this->template == '') {
            return $this->defaultTemplate();
        }

        if ($this->template != '') {
            return ($this->template);
        }

        return view($template);
    }
303306
public function listAction(Request $request): Response
    {
        $currentPage = $request->query->getInt(self::PAGINATION_PARAM_NAME, 1);

        $contentDraftsDataset = $this->datasetFactory->contentDrafts();
        $contentDraftsDataset->load();

        $pagination = new Pagerfanta(
            new ArrayAdapter($contentDraftsDataset->getContentDrafts())
        );
        $pagination->setMaxPerPage($this->defaultPaginationLimit);
        $pagination->setCurrentPage(min($currentPage, $pagination->getNbPages()));

        $removeContentDraftForm = $this->formFactory->removeContentDraft(
            $this->createContentRemoveData($pagination)
        );

        return $this->render('@ezdesign/admin/content_draft/list.html.twig', [
            'pager' => $pagination,
            'form_remove' => $removeContentDraftForm->createView(),
        ]);
    }
960739
protected function getResponse()
    {
        try {
            $response = $this->client->getInternalResponse();
        } catch (BadMethodCallException $e) {
            // Handling Symfony 5+ behaviour
            $response = null;
        }

        if (null === $response) {
            throw new DriverException('Unable to access the response before visiting a page');
        }

        return $response;
    }
922935
public function getResponse()
    {
        $this->isRateLimitReached();
        $this->isAccessTokenPresent();
        $oauth = $this->instagram->getOAuth();

        if (!$oauth->isAccessTokenSet()) {
            $oauth->setAccessToken($this->params['access_token']);
        }

        $this->execute();

        return $this->response;
    }
597004
def render(self, request, context, status=codes.ok, content_type=None,
            args=None, kwargs=None):
        ""

        if isinstance(self.template_name, (list, tuple)):
            template = loader.select_template(self.template_name)
        elif self.template_name:
            template = loader.get_template(self.template_name)
        else:
            template = loader.Template(self.template_string)

        context = RequestContext(request, context)
        content = template.render(context)

        return HttpResponse(content, status=status, content_type=content_type)
543373
public function getAction()
	{
		$localization = $this->getPageLocalization();

		$pageRequest = $this->createPageRequest();

		$pageController = $this->getPageController();

		$templateException = $response
				= $internalHtml
				= null;

		try {
			$response = $pageController->execute($pageRequest);
		} catch (\Twig_Error_Loader $e) {
			$templateException = $e;
		} catch (LayoutNotFound $e) {
			$templateException = $e;
		} catch (\Exception $e) {
			throw $e;
		}

		$localizationData = $this->getLocalizationData($localization);

		if ($templateException) {
			$internalHtml = '<h1>Page template or layout not found.</h1>
				<p>Please make sure the template is assigned and the template is published in this locale and it has layout assigned.</p>';
		} elseif ($response instanceof Response) {
			$internalHtml = $response->getContent();
		}

		$localizationData['internal_html'] = $internalHtml;

		$placeHolders = $pageRequest->getPlaceHolderSet()
				->getFinalPlaceHolders();

		$blocks = $pageRequest->getBlockSet();

		$placeHoldersData = &$localizationData['contents'];

		foreach ($placeHolders as $placeHolder) {

			$blocksData = array();

			foreach ($blocks->getPlaceHolderBlockSet($placeHolder) as $block) {
				/* @var $block Block */
				$blocksData[] = $this->getBlockData($block);
			}

			$placeHolderData = array(
				'id'		=> $placeHolder->getName(),
				'title'		=> $placeHolder->getTitle(),
				'locked'	=> $placeHolder->isLocked(),
				'closed'	=> ! $localization->isPlaceHolderEditable($placeHolder),
				'contents'	=> $blocksData,
				// @TODO: if this one is hardcoded, why not to hardcode in UI?
				'type'		=> 'list',
				// @TODO: list of blocks that are allowed to be insterted
//				'allow' => array(
//						0 => 'Project_Text_TextController',
//				),
			);

			$placeHoldersData[] = $placeHolderData;
		}

		$jsonResponse = new SupraJsonResponse($localizationData);

		// @FIXME: dummy. when needed, move to prefilter.
		$jsonResponse->setPermissions(array(array(
			'edit_page' => true,
			'supervise_page' => true
		)));

		return $jsonResponse;
	}
798577
public function getDeliverTemplateList()
    {
        $result = $this->wechat->httpGet(self::WECHAT_DELIVERY_TEMPLATE_LIST_GET_PREFIX, [
            'access_token' => $this->wechat->getAccessToken()
        ]);
        return isset($result['errmsg']) && $result['errmsg'] == 'success' ? $result['templates_info'] : false;
    }
1178399
public function saveAction()
	{
		$this->isPostRequest();

		$this->checkLock();

		$localization = $this->getPageLocalization();
		
		if (! $localization instanceof GroupLocalization) {
			throw new \UnexpectedValueException(sprintf(
					'Expecting instanceof GroupLocalization, [%s] received.',
					get_class($localization)
			));
		}

		$this->saveLocalizationCommonAction();

		$this->getEntityManager()
					->flush($localization->getMaster());

		return new SupraJsonResponse();
	}
1027774
public function indexAction()
    {
        if (!$this->rcmUserService->isAllowed(ResourceName::RESOURCE_SITES, 'admin')) {
            $this->getResponse()->setStatusCode(Response::STATUS_CODE_401);

            return $this->getResponse();
        }

        $this->layout()->setTemplate('layout/blank');

        $view = new ViewModel();
        $view->setVariable(
            'siteSettingsSectionDefinitions',
            $this->getSettingsSectionDefinitions->__invoke()
        );

        return $view;
    }
486205
public function doActions()
    {
        if ($this->isNamed()) {
            list($slug, $name) = $this->file;

            do_action("get_template_part_{$slug}", $slug, $name);

            return;
        }

        // Use first template name, if template
        // file is an array, but is not named.
        if (is_array($this->file) && isset($this->file[0])) {
            return do_action("get_template_part_{$this->file[0]}", $this->file[0], null);
        }

        do_action("get_template_part_{$this->file}", $this->file, null);
    }