diff --git a/app/Resources/views/base.html.twig b/app/Resources/views/base.html.twig index 4f5d87e..f0ba10b 100644 --- a/app/Resources/views/base.html.twig +++ b/app/Resources/views/base.html.twig @@ -46,6 +46,12 @@
  • Domů
  • +
  • + FAQ +
  • +
  • + Kontakt +
  • +
    +

    {{ faq_item.question }}

    +
    +
    + {{ faq_item.answer }} +
    +
    +
    +{% endfor %} +{% endblock %} \ No newline at end of file diff --git a/app/config/services.yml b/app/config/services.yml index 59f9fb4..cf538a2 100644 --- a/app/config/services.yml +++ b/app/config/services.yml @@ -20,6 +20,10 @@ services: class: AppBundle\Controller\UserController autowire: true + app.controller.faq_controller: + class: AppBundle\Controller\FAQController + autowire: true + app.facade.category_facade: class: AppBundle\Facade\CategoryFacade autowire: true @@ -32,6 +36,10 @@ services: class: AppBundle\Facade\UserFacade autowire: true + app.facade.faq_facade: + class: AppBundle\Facade\FAQFacade + autowire: true + app.repository.category_repository: class: AppBundle\Repository\CategoryRepository factory: ['@doctrine.orm.default_entity_manager', getRepository] @@ -42,6 +50,11 @@ services: factory: ['@doctrine.orm.default_entity_manager', getRepository] arguments: ['AppBundle\Entity\Product'] + app.repository.faq_repository: + class: AppBundle\Repository\FAQRepository + factory: ['@doctrine.orm.default_entity_manager', getRepository] + arguments: ['AppBundle\Entity\FAQ'] + encoder: class: Symfony\Component\Security\Core\Encoder\BCryptPasswordEncoder arguments: diff --git a/src/AppBundle/Controller/FAQController.php b/src/AppBundle/Controller/FAQController.php new file mode 100644 index 0000000..ddafe52 --- /dev/null +++ b/src/AppBundle/Controller/FAQController.php @@ -0,0 +1,37 @@ +faqFacade = $faqFacade; + } + + /** + * @Route("/faq", name="faq") + * @Template("faq/faq.html.twig") + */ + public function faqDetailAction() + { + $faq = $this->faqFacade->getAll(); + if (!$faq) { + throw new NotFoundHttpException("Žádné otázky a odpovědi nenalezeny."); + } + + return [ + "faq" => $faq, + ]; + } +} \ No newline at end of file diff --git a/src/AppBundle/Entity/ContactForm.php b/src/AppBundle/Entity/ContactForm.php new file mode 100644 index 0000000..e1019a4 --- /dev/null +++ b/src/AppBundle/Entity/ContactForm.php @@ -0,0 +1,128 @@ +id; + } + + /** + * Set name + * + * @param string $name + * + * @return ContactForm + */ + public function setName($name) + { + $this->name = $name; + + return $this; + } + + /** + * Get name + * + * @return string + */ + public function getName() + { + return $this->name; + } + + /** + * Set subject + * + * @param string $subject + * + * @return ContactForm + */ + public function setSubject($subject) + { + $this->subject = $subject; + + return $this; + } + + /** + * Get subject + * + * @return string + */ + public function getSubject() + { + return $this->subject; + } + + /** + * Set message + * + * @param string $message + * + * @return ContactForm + */ + public function setMessage($message) + { + $this->message = $message; + + return $this; + } + + /** + * Get message + * + * @return string + */ + public function getMessage() + { + return $this->message; + } +} + diff --git a/src/AppBundle/Entity/FAQ.php b/src/AppBundle/Entity/FAQ.php new file mode 100644 index 0000000..2a970af --- /dev/null +++ b/src/AppBundle/Entity/FAQ.php @@ -0,0 +1,97 @@ +id; + } + + /** + * Set question + * + * @param string $question + * + * @return FAQ + */ + public function setQuestion($question) + { + $this->question = $question; + + return $this; + } + + /** + * Get question + * + * @return string + */ + public function getQuestion() + { + return $this->question; + } + + /** + * Set answer + * + * @param string $answer + * + * @return FAQ + */ + public function setAnswer($answer) + { + $this->answer = $answer; + + return $this; + } + + /** + * Get answer + * + * @return string + */ + public function getAnswer() + { + return $this->answer; + } +} + diff --git a/src/AppBundle/Facade/FAQFacade.php b/src/AppBundle/Facade/FAQFacade.php new file mode 100644 index 0000000..beb4a86 --- /dev/null +++ b/src/AppBundle/Facade/FAQFacade.php @@ -0,0 +1,20 @@ +faqRepository = $faqRepository; + } + + public function getAll() { + return $this->faqRepository->findBy([]); + } + +} \ No newline at end of file diff --git a/src/AppBundle/FormType/ContactFormType.php b/src/AppBundle/FormType/ContactFormType.php new file mode 100644 index 0000000..e619ca2 --- /dev/null +++ b/src/AppBundle/FormType/ContactFormType.php @@ -0,0 +1,42 @@ +add("name", TextType::class, [ + "label" => "Jméno", + "attr" => [ + "class" => "form-control", + ], + "constraints" => [ + new NotBlank(["message" => "Prosím vyplňte Vaše jméno"]), + ], + ])->add("subject", TextType::class, [ + "label" => "Předmět", + "attr" => [ + "class" => "form-control", + ], + "constraints" => [ + new NotBlank(["message" => "Prosím vyplňte předmět zprávy"]), + ], + ])->add("message", TextType::class, [ + "label" => "Zpráva", + "attr" => [ + "class" => "form-control", + ], + "constraints" => [ + new NotBlank(["message" => "Prosím vyplňte obsah zprávy"]), + ], + ]); + } + +} \ No newline at end of file diff --git a/src/AppBundle/Repository/ContactFormRepository.php b/src/AppBundle/Repository/ContactFormRepository.php new file mode 100644 index 0000000..b4a2a76 --- /dev/null +++ b/src/AppBundle/Repository/ContactFormRepository.php @@ -0,0 +1,13 @@ +