src/Controller/Module/FormController.php line 23

Open in your IDE?
  1. <?php
  2. namespace App\Controller\Module;
  3. use App\Services\Form;
  4. use App\AppBundle;
  5. use App\Services\Fields;
  6. use Pimcore\Controller\Configuration\ResponseHeader;
  7. use Pimcore\Controller\FrontendController;
  8. use Pimcore\Model\Asset;
  9. use Pimcore\Translation\Translator;
  10. use SaintElmos\BaseBundle\Services\ImageResponsive;
  11. use SaintElmos\BaseBundle\Templating\Helper\FrontendHelper;
  12. use SaintElmos\BaseBundle\Utils\SETConf;
  13. use Symfony\Contracts\Translation\TranslatorInterface;
  14. use SaintElmos\BaseBundle\Controller\BaseController;
  15. use Symfony\Component\HttpFoundation\Request;
  16. use \Pimcore\Model\DataObject;
  17. class FormController extends FrontendController
  18. {
  19.     protected $translator;    
  20.     public function __construct(TranslatorInterface $translator) {
  21.         $this->translator $translator;
  22.     }
  23.     public function newsletterAction(Request $request\Pimcore\Config\Config $websiteConfig)
  24.     {
  25.         $websiteConfigName 'konfiguration_newsletter_formular';
  26.         $confAnfrageformObject \Pimcore\Config::getWebsiteConfig()->get($websiteConfigName);
  27.         $service \Pimcore::getContainer()->get(Form::class);
  28.         $buttontext AppBundle::getValue($confAnfrageformObject'getSubmitbutton_text');
  29.         $dsgvotext AppBundle::getValue($confAnfrageformObject'getFormular_dsgvo_text');
  30.         $fields Fields::getDefaultForm();
  31.         $excludelabelarray=[];
  32.         $formFields $service->getFormFields($fields$_POST$excludelabelarray);
  33.         $pflichtfeldtext $this->translator->trans('form_pflichtfeldtext');
  34.         $formTemplate 'newsletter.html.twig';
  35.         /* ********************************************************************************* */
  36.         /* Ausgabe ************************************************************************* */
  37.         /* ********************************************************************************* */
  38.         $frontend['formular'] = array(
  39.             'formFields'        => $formFields,
  40.             'formTemplate'      => $formTemplate,
  41.             'buttontext'        => $buttontext,
  42.             'pflichtfeldtext'   => $pflichtfeldtext,
  43.             'dsgvotext'         => $dsgvotext
  44.         );
  45.         //$this->view->frontend = $frontend;
  46.         return $this->render('module/Form/__newsletter-bestellen.html.twig', ['frontend' => $frontend]);
  47.     }
  48.     public function homeanfrageAction(Request $request\Pimcore\Config\Config $websiteConfig)
  49.     {
  50.         $websiteConfigName 'konfiguration_home_anfrageformular';
  51.         $confAnfrageformObject \Pimcore\Config::getWebsiteConfig()->get($websiteConfigName);
  52.         $service \Pimcore::getContainer()->get(Form::class);
  53.         $buttontext AppBundle::getValue($confAnfrageformObject'getSubmitbutton_text');
  54.         $dsgvotext AppBundle::getValue($confAnfrageformObject'getFormular_dsgvo_text');
  55.         $antwort =  '//' .  $_SERVER['HTTP_HOST'] . AppBundle::getValue($confAnfrageformObject'getAntwortseite');
  56.         $fields Fields::getDefaultForm();
  57.         $excludelabelarray=[];
  58.         $formFields $service->getFormFields($fields$_POST$excludelabelarray);
  59.         $pflichtfeldtext $this->translator->trans('form_pflichtfeldtext');
  60.         $formTemplate 'homeanfrage.html.twig';
  61.         $mailTemplate '/src/Resources/public/static/init/mail-templates/homeanfrage'// ohne .html.php
  62.         $pagename $this->document->getParent()->getFullPath();
  63.         $server_protocol 'http' . ($_SERVER['REQUEST_SCHEME'] == 'https' 's' '');
  64.         $domain $server_protocol '://' $_SERVER['HTTP_HOST'];
  65.         $url $domain $pagename;
  66.         /* ********************************************************************************* */
  67.         /* Ausgabe ************************************************************************* */
  68.         /* ********************************************************************************* */
  69.         $frontend['formular'] = array(
  70.             'formFields'        => $formFields,
  71.             'formTemplate'      => $formTemplate,
  72.             'buttontext'        => $buttontext,
  73.             'pflichtfeldtext'   => $pflichtfeldtext,
  74.             'dsgvotext'         => $dsgvotext,
  75.             'websiteConfigName' => $websiteConfigName,
  76.             'mailTemplate'      => $mailTemplate,
  77.             'antwort'           => $antwort,
  78.             'url'               => $url
  79.         );
  80.         //$this->view->frontend = $frontend;
  81.         return $this->render('module/Form/__allgemeine-anfragen.html.twig', ['frontend' => $frontend]);
  82.     }
  83.     public function schnellanfrageAction(Request $request\Pimcore\Config\Config $websiteConfig)
  84.     {
  85.         $service \Pimcore::getContainer()->get(Form::class);
  86.         $fields Fields::getQuickForm();
  87.         $excludelabelarray=[];
  88.         $formFields $service->getFormFields($fields$_POST$excludelabelarray);
  89.         $formTemplate 'schnellanfrage.html.twig';
  90.         $target_page =  $this->document->getEditable("zielseite");
  91.         $buttontext =  $this->document->getEditable("buttontext");
  92.         $server_protocol 'http' . ($_SERVER['REQUEST_SCHEME'] == 'https' 's' '');
  93.         $domain $server_protocol '://' $_SERVER['HTTP_HOST'];
  94.         /* ********************************************************************************* */
  95.         /* Ausgabe ************************************************************************* */
  96.         /* ********************************************************************************* */
  97.         $frontend['formular'] = array(
  98.             'formFields'        => $formFields,
  99.             'formTemplate'      => $formTemplate,
  100.             'buttontext'        => $buttontext,
  101.             'target_page'       => $target_page
  102.         );
  103.         //$this->view->frontend = $frontend;
  104.         return $this->render('module/Form/__schnell-anfrage.html.twig', ['frontend' => $frontend]);
  105.     }
  106.     public function schnellanfragehomeAction(Request $request\Pimcore\Config\Config $websiteConfig)
  107.     {
  108.         $service \Pimcore::getContainer()->get(Form::class);
  109.         $fields Fields::getQuickForm();
  110.         $excludelabelarray=[];
  111.         $formFields $service->getFormFields($fields$_POST$excludelabelarray);
  112.         $formTemplate 'schnellanfrage-home.html.twig';
  113.         $target_page =  $this->document->getEditable("zielseite");
  114.         $buttontext =  $this->document->getEditable("buttontext");
  115.         $server_protocol 'http' . ($_SERVER['REQUEST_SCHEME'] == 'https' 's' '');
  116.         $domain $server_protocol '://' $_SERVER['HTTP_HOST'];
  117.         /* ********************************************************************************* */
  118.         /* Ausgabe ************************************************************************* */
  119.         /* ********************************************************************************* */
  120.         $frontend['formular'] = array(
  121.             'formFields'        => $formFields,
  122.             'formTemplate'      => $formTemplate,
  123.             'buttontext'        => $buttontext,
  124.             'target_page'       => $target_page
  125.         );
  126.         return $this->render('module/Form/__schnell-anfrage-home.html.twig', ['frontend' => $frontend]);
  127.     }
  128.     public function bewertungenHomesAction(Request $request\Pimcore\Config\Config $websiteConfig)
  129.     {
  130.         $websiteConfigName 'konfiguration_bewertungen-homes_senden';
  131.         $confAnfrageformObject \Pimcore\Config::getWebsiteConfig()->get($websiteConfigName);
  132.         $service \Pimcore::getContainer()->get(Form::class);
  133.         $buttontext AppBundle::getValue($confAnfrageformObject'getSubmitbutton_text');
  134.         $dsgvotext AppBundle::getValue($confAnfrageformObject'getFormular_dsgvo_text');
  135.         $antwort =  '//' .  $_SERVER['HTTP_HOST'] . AppBundle::getValue($confAnfrageformObject'getAntwortseite');
  136.         $fields Fields::getBewertungenHomesForm();
  137.         $excludelabelarray = array('form_UNTERKUNFT');
  138.         $formFields $service->getFormFields($fields$_POST$excludelabelarray);
  139.         $pflichtfeldtext $this->translator->trans('form_pflichtfeldtext');
  140.         $formTemplate 'bewertungen-homes.html.twig';
  141.         $mailTemplate '/src/AppBundle/Resources/public/static/init/mail-templates/bewertungen-homes'// ohne .html.php
  142.         $pagename $this->document->getParent()->getFullPath();
  143.         $server_protocol 'http' . ($_SERVER['REQUEST_SCHEME'] == 'https' 's' '');
  144.         $domain $server_protocol '://' $_SERVER['HTTP_HOST'];
  145.         $url $domain $pagename;
  146.         /* ********************************************************************************* */
  147.         /* Ausgabe ************************************************************************* */
  148.         /* ********************************************************************************* */
  149.         $frontend['formular'] = array(
  150.             'formFields'        => $formFields,
  151.             'formTemplate'      => $formTemplate,
  152.             'buttontext'        => $buttontext,
  153.             'pflichtfeldtext'   => $pflichtfeldtext,
  154.             'dsgvotext'         => $dsgvotext,
  155.             'websiteConfigName' => $websiteConfigName,
  156.             'mailTemplate'      => $mailTemplate,
  157.             'antwort'           => $antwort,
  158.             'url'               => $url
  159.         );
  160.         //$this->view->frontend = $frontend;
  161.         return $this->render('module/Form/__bewertungen-homes-senden.html.twig', ['frontend' => $frontend]);
  162.     }
  163.     public function bewertungenShopsAction(Request $request\Pimcore\Config\Config $websiteConfig)
  164.     {
  165.         $websiteConfigName 'konfiguration_bewertungen-shops_senden';
  166.         $confAnfrageformObject \Pimcore\Config::getWebsiteConfig()->get($websiteConfigName);
  167.         $service \Pimcore::getContainer()->get(Form::class);
  168.         $buttontext AppBundle::getValue($confAnfrageformObject'getSubmitbutton_text');
  169.         $dsgvotext AppBundle::getValue($confAnfrageformObject'getFormular_dsgvo_text');
  170.         $antwort =  '//' .  $_SERVER['HTTP_HOST'] . AppBundle::getValue($confAnfrageformObject'getAntwortseite');
  171.         $fields Fields::getBewertungenShopsForm();
  172.         $excludelabelarray=[];
  173.         $formFields $service->getFormFields($fields$_POST$excludelabelarray);
  174.         $pflichtfeldtext $this->translator->trans('form_pflichtfeldtext');
  175.         $formTemplate 'bewertungen-shops.html.twig';
  176.         $mailTemplate '/src/AppBundle/Resources/public/static/init/mail-templates/bewertungen-shops'// ohne .html.php
  177.         $pagename $this->document->getParent()->getFullPath();
  178.         $server_protocol 'http' . ($_SERVER['REQUEST_SCHEME'] == 'https' 's' '');
  179.         $domain $server_protocol '://' $_SERVER['HTTP_HOST'];
  180.         $url $domain $pagename;
  181.         /* ********************************************************************************* */
  182.         /* Ausgabe ************************************************************************* */
  183.         /* ********************************************************************************* */
  184.         $frontend['formular'] = array(
  185.             'formFields'        => $formFields,
  186.             'formTemplate'      => $formTemplate,
  187.             'buttontext'        => $buttontext,
  188.             'pflichtfeldtext'   => $pflichtfeldtext,
  189.             'dsgvotext'         => $dsgvotext,
  190.             'websiteConfigName' => $websiteConfigName,
  191.             'mailTemplate'      => $mailTemplate,
  192.             'antwort'           => $antwort,
  193.             'url'               => $url
  194.         );
  195.         //$this->view->frontend = $frontend;
  196.         return $this->render('module/Form/__bewertungen-shops-senden.html.twig', ['frontend' => $frontend]);
  197.     }
  198.     public function bewerbungAction(Request $request\Pimcore\Config\Config $websiteConfig)
  199.     {
  200.         $websiteConfigName 'konfiguration_bewertungen-homes_sendenr';
  201.         $confAnfrageformObject \Pimcore\Config::getWebsiteConfig()->get($websiteConfigName);
  202.         $service \Pimcore::getContainer()->get(Form::class);
  203.         $buttontext AppBundle::getValue($confAnfrageformObject'getSubmitbutton_text');
  204.         $dsgvotext AppBundle::getValue($confAnfrageformObject'getFormular_dsgvo_text');
  205.         $antwort =  '//' .  $_SERVER['HTTP_HOST'] . AppBundle::getValue($confAnfrageformObject'getAntwortseite');
  206.         $fields Fields::getDefaultForm();
  207.         $formFields $service->getFormFields($fields$_POST$excludelabelarray);
  208.         $pflichtfeldtext $this->translator->trans('form_pflichtfeldtext');
  209.         $formTemplate 'bewerbung.html.twig';
  210.         $mailTemplate '/src/AppBundle/Resources/public/static/init/mail-templates/bewerbung'// ohne .html.php
  211.         $pagename $this->document->getParent()->getFullPath();
  212.         $server_protocol 'http' . ($_SERVER['REQUEST_SCHEME'] == 'https' 's' '');
  213.         $domain $server_protocol '://' $_SERVER['HTTP_HOST'];
  214.         $url $domain $pagename;
  215.         /* ********************************************************************************* */
  216.         /* Ausgabe ************************************************************************* */
  217.         /* ********************************************************************************* */
  218.         $frontend['formular'] = array(
  219.             'formFields'        => $formFields,
  220.             'formTemplate'      => $formTemplate,
  221.             'buttontext'        => $buttontext,
  222.             'pflichtfeldtext'   => $pflichtfeldtext,
  223.             'dsgvotext'         => $dsgvotext,
  224.             'websiteConfigName' => $websiteConfigName,
  225.             'mailTemplate'      => $mailTemplate,
  226.             'antwort'           => $antwort,
  227.             'url'               => $url
  228.         );
  229.         $this->view->frontend $frontend;
  230.     }
  231. }