Example #1
0
 /**
  * Redirect to an other URLs
  *
  * @param string $path
  * @param int    $statusCode
  *
  * @return \Symfony\Component\HttpFoundation\JsonResponse|\Symfony\Component\HttpFoundation\RedirectResponse
  */
 protected function createRedirectResponse($path, $statusCode)
 {
     $path = $this->router->route($path, true);
     if ($this->request->isXmlHttpRequest() === true) {
         return $this->createAjaxRedirectResponse($path);
     }
     return new SymfonyRedirectResponse($path, $statusCode);
 }
Example #2
0
File: Action.php Project: acp3/core
 /**
  * @param \Exception $exception
  * @return array|JsonResponse
  */
 public function renderErrorBoxOnFailedFormValidation(\Exception $exception)
 {
     $errors = $this->alerts->errorBox($exception->getMessage());
     if ($this->request->isXmlHttpRequest()) {
         return new JsonResponse(['success' => false, 'content' => $errors]);
     }
     return ['error_msg' => $errors];
 }
Example #3
0
 /**
  * @return string
  */
 protected function addElementFromMinifier()
 {
     $minifyJs = '';
     if (!$this->request->isXmlHttpRequest()) {
         $minifyJs = '<script type="text/javascript" src="' . $this->minifier->getURI() . '"></script>' . "\n";
     }
     return $minifyJs;
 }
Example #4
0
 /**
  * @inheritdoc
  */
 protected function addCustomTemplateVarsBeforeOutput()
 {
     $this->view->assign('PAGE_TITLE', $this->translator->t('install', 'acp3_installation'));
     $this->view->assign('TITLE', $this->translator->t($this->request->getModule(), $this->request->getController() . '_' . $this->request->getAction()));
     $this->view->assign('LAYOUT', $this->request->isXmlHttpRequest() ? 'layout.ajax.tpl' : $this->getLayout());
 }
Example #5
0
File: Alerts.php Project: acp3/core
 /**
  * Returns the pretty printed form errors
  *
  * @param string|array $errors
  * @return string
  */
 public function errorBox($errors)
 {
     $this->view->assign('CONTENT_ONLY', $this->request->isXmlHttpRequest() === true);
     return $this->view->fetchTemplate($this->errorBoxContent($errors));
 }