/** * @param \Nette\DI\IContainer */ protected function processRequests(\Nette\DI\IContainer $container) { $this->updating(); $httpRequest = $container->httpRequest; $httpResponse = $container->httpResponse; if ($httpRequest->getHeader(self::XHR_HEADER, FALSE)) { $data = FALSE; $this->translator->setLang($httpRequest->getPost('lang')); switch($httpRequest->getPost('action')) { case 'get': break; case 'extract': $this->extractor->run(); break; case 'save': $data = $httpRequest->getPost('data', ""); break; } $dictionaries = $this->getDictionaries($data); $response = new \Nette\Application\Responses\JsonResponse(array( 'status' => "OK", 'lang' => $this->translator->dictionaries, 'data' => $dictionaries, )); $response->send($httpRequest, $httpResponse); exit(255); } $this->freeze(); }