コード例 #1
0
 /**
  * @Route("/pomoc")
  */
 public function helpAction(Request $request)
 {
     $session = $request->getSession();
     $cookieLogin = new CookieLogin($em = $this->getDoctrine()->getManager());
     $cookieLogin->setCookieLogin($session);
     $quickForm = new QuickForm($this, $request);
     $menu = new Menu($em, 1, 0);
     return $this->render('help/help.html.twig', array('session' => $session->get('user'), 'quickForm' => $quickForm->createView(), 'activeCategory' => 1, 'activeProvince' => 0, 'activeCity' => 0, 'categories' => $menu->getCategories(), 'places' => $menu->getPlaces(), 'isProvince' => $menu->isProvince()));
 }
コード例 #2
0
 /**
  * @Route("/konto")
  */
 public function accountAction(Request $request)
 {
     $config = new Config();
     $session = $request->getSession();
     $cookieLogin = new CookieLogin($em = $this->getDoctrine()->getManager());
     $cookieLogin->setCookieLogin($session);
     if (!$session->get('user')) {
         header('Location: ' . $config->getUrl() . '/logowanie');
         exit;
     }
     $quickForm = new QuickForm($this, $request);
     $menu = new Menu($em, 1, 0);
     return $this->render('account/account.html.twig', array('session' => $session->get('user'), 'quickForm' => $quickForm->createView(), 'activeCategory' => 1, 'activeProvince' => 0, 'activeCity' => 0, 'categories' => $menu->getCategories(), 'places' => $menu->getPlaces(), 'isProvince' => $menu->isProvince()));
 }
コード例 #3
0
 /**
  * @Route("/kontakt")
  */
 public function contactAction(Request $request)
 {
     $config = new Config();
     $session = $request->getSession();
     $cookieLogin = new CookieLogin($em = $this->getDoctrine()->getManager());
     $cookieLogin->setCookieLogin($session);
     $quickForm = new QuickForm($this, $request);
     $email = new Email($this);
     $messageString = '';
     $messageClass = 'bad';
     $contactForm = new ContactForm();
     $form = $this->createForm(ContactFormType::class, $contactForm);
     $form->handleRequest($request);
     if ($form->isSubmitted()) {
         $validator = $this->get('validator');
         $errors = $validator->validate($contactForm);
         if (count($errors) > 0) {
             foreach ($errors as $error) {
                 $messageString .= $error->getMessage() . '<br />';
             }
         } else {
             $sendEmail = $email->sendEmail($contactForm->getEmail(), $config->getAdminEmail(), $contactForm->getSubject(), $contactForm->getMessage());
             if ($sendEmail) {
                 $messageString .= 'Wiadomość została wysłana.<br />';
                 $messageClass = 'ok';
                 unset($contactForm);
                 unset($form);
                 $contactForm = new ContactForm();
                 $form = $this->createForm(ContactFormType::class, $contactForm);
             } else {
                 $messageString .= 'Wysłanie wiadomości nie powiodło się.<br />';
             }
         }
     }
     $menu = new Menu($em, 1, 0);
     return $this->render('contact/contact.html.twig', array('session' => $session->get('user'), 'quickForm' => $quickForm->createView(), 'form' => $form->createView(), 'messageString' => $messageString, 'messageClass' => $messageClass, 'activeCategory' => 1, 'activeProvince' => 0, 'activeCity' => 0, 'categories' => $menu->getCategories(), 'places' => $menu->getPlaces(), 'isProvince' => $menu->isProvince()));
 }
コード例 #4
0
 /**
  * @Route(
  *     "/kategoria,{activeCategory},miejsce,{activeProvince},{activeCity},sortowanie,{activeSort},{activeDescend},zlecenia,{activeOrder},komentarze,{activeComment},strona,{activeLevel}",
  *     requirements={
  *         "activeCategory": "\d+",
  *         "activeProvince": "\d+",
  *         "activeCity": "\d+",
  *         "activeSort": "\d+",
  *         "activeDescend": "\d+",
  *         "activeOrder": "\d+",
  *         "activeComment": "\d+",
  *         "activeLevel": "\d+"
  *     }
  * )
  */
 public function fullListAction(Request $request, $activeCategory, $activeProvince, $activeCity, $activeSort, $activeDescend, $activeOrder, $activeComment, $activeLevel)
 {
     $config = new Config();
     $session = $request->getSession();
     $cookieLogin = new CookieLogin($em = $this->getDoctrine()->getManager());
     $cookieLogin->setCookieLogin($session);
     $quickForm = new QuickForm($this, $request);
     $mainForm = new MainForm();
     $mainForm->setComment($activeComment);
     $form = $this->createForm(MainFormType::class, $mainForm);
     $form->handleRequest($request);
     if ($form->isSubmitted() && $form->isValid()) {
         $activeComment = $mainForm->getComment();
         header('Location: ' . $config->getUrl() . '/kategoria,' . $activeCategory . ',miejsce,' . $activeProvince . ',' . $activeCity . ',sortowanie,' . $activeSort . ',' . $activeDescend . ',zlecenia,' . $activeOrder . ',komentarze,' . $activeComment . ',strona,1');
         exit;
     }
     $title = $this->getTitle($activeCategory, $activeProvince, $activeCity);
     $firms = $em->getRepository('AppBundle:Firm')->getFirmList($activeCategory, $activeProvince, $activeCity, $activeSort, $activeDescend, $activeOrder, $activeComment, $activeLevel, 100);
     $pageNavigator = $em->getRepository('AppBundle:Firm')->pageNavigator($config->getUrl(), $activeCategory, $activeProvince, $activeCity, $activeSort, $activeDescend, $activeOrder, $activeComment, $activeLevel, 100);
     $categoryNavigator = $em->getRepository('AppBundle:Category')->categoryNavigator($config->getUrl(), $activeCategory, $activeProvince, $activeCity);
     if (!$firms && $activeLevel > 1) {
         header('Location: ' . $config->getUrl() . '/kategoria,' . $activeCategory . ',miejsce,' . $activeProvince . ',' . $activeCity . ',sortowanie,' . $activeSort . ',' . $activeDescend . ',zlecenia,' . $activeOrder . ',komentarze,' . $activeComment . ',strona,1');
         exit;
     }
     $menu = new Menu($em, $activeCategory, $activeProvince);
     return $this->render('main/list.html.twig', array('session' => $session->get('user'), 'quickForm' => $quickForm->createView(), 'form' => $form->createView(), 'title' => $title, 'activeCategory' => $activeCategory, 'activeProvince' => $activeProvince, 'activeCity' => $activeCity, 'activeSort' => $activeSort, 'activeDescend' => $activeDescend, 'activeOrder' => $activeOrder, 'activeComment' => $activeComment, 'activeLevel' => $activeLevel, 'categories' => $menu->getCategories(), 'places' => $menu->getPlaces(), 'isProvince' => $menu->isProvince(), 'firms' => $firms, 'pageNavigator' => $pageNavigator, 'categoryNavigator' => $categoryNavigator));
 }
コード例 #5
0
 /**
  * @Route("/logowanie,{user},{code}")
  */
 public function emailAction(Request $request, $user, $code)
 {
     $config = new Config();
     $session = $request->getSession();
     $cookieLogin = new CookieLogin($em = $this->getDoctrine()->getManager());
     $cookieLogin->setCookieLogin($session);
     $quickForm = new QuickForm($this, $request);
     $email = new Email($this);
     $messageString = '';
     $messageClass = 'bad';
     $loginForm = new LoginForm();
     $form = $this->createForm(LoginFormType::class, $loginForm);
     $userLogin = $this->getDoctrine()->getRepository('AppBundle:User')->isUserLogin($user);
     if ($userLogin && $code == $userLogin->getKey()) {
         if (!$userLogin->getActive()) {
             $messageString .= 'Konto użytkownika nie jest aktywne.<br />';
         } else {
             $userPassword = $this->getDoctrine()->getRepository('AppBundle:User')->setUserPassword($userLogin->getId(), $password = $this->getDoctrine()->getRepository('AppBundle:User')->generatePassword(), $config->getRemoteAddress(), $config->getDateTimeNow());
             if ($userPassword) {
                 $messageString .= 'Hasło konta użytkownika zostało zmienione.<br />';
                 $messageClass = 'ok';
                 if ($this->sendNewPasswordEmail($config, $email, $userLogin, $password)) {
                     $messageString .= 'Sprawdź pocztę w celu zapoznania z hasłem.<br />';
                 } else {
                     $messageString .= "Wysłanie e-mail'a z hasłem nie powiodło się.<br />";
                     $messageClass = 'bad';
                 }
                 unset($loginForm);
                 unset($form);
                 $loginForm = new LoginForm();
                 $form = $this->createForm(LoginFormType::class, $loginForm);
             } else {
                 $messageString .= 'Zmiana hasła konta użytkownika nie powiodła się.<br />';
             }
         }
     } else {
         $messageString .= 'Podany kod zmiany hasła jest niepoprawny.<br />';
     }
     $menu = new Menu($em, 1, 0);
     return $this->render('login/login.html.twig', array('session' => $session->get('user'), 'quickForm' => $quickForm->createView(), 'form' => $form->createView(), 'messageString' => $messageString, 'messageClass' => $messageClass, 'activeCategory' => 1, 'activeProvince' => 0, 'activeCity' => 0, 'categories' => $menu->getCategories(), 'places' => $menu->getPlaces(), 'isProvince' => $menu->isProvince()));
 }
コード例 #6
0
 /**
  * @Route("/rejestracja,{user},{code}")
  */
 public function emailAction(Request $request, $user, $code)
 {
     $session = $request->getSession();
     $cookieLogin = new CookieLogin($em = $this->getDoctrine()->getManager());
     $cookieLogin->setCookieLogin($session);
     $quickForm = new QuickForm($this, $request);
     $messageString = '';
     $messageClass = 'bad';
     $registerForm = new RegisterForm();
     $form = $this->createForm(RegisterFormType::class, $registerForm);
     $userLogin = $this->getDoctrine()->getRepository('AppBundle:User')->isUserLogin($user);
     if ($userLogin && $code == $userLogin->getKey()) {
         if ($userLogin->getActive()) {
             $messageString .= 'Konto użytkownika jest już aktywne.<br />';
         } elseif ($this->getDoctrine()->getRepository('AppBundle:User')->setUserActive($userLogin->getId())) {
             $messageString .= 'Konto użytkownika zostało aktywowane.<br />';
             $messageClass = 'ok';
         } else {
             $messageString .= 'Aktywacja konta użytkownika nie powiodła się.<br />';
         }
     } else {
         $messageString .= 'Podany kod aktywacyjny jest niepoprawny.<br />';
     }
     $menu = new Menu($em, 1, 0);
     return $this->render('register/register.html.twig', array('session' => $session->get('user'), 'quickForm' => $quickForm->createView(), 'form' => $form->createView(), 'messageString' => $messageString, 'messageClass' => $messageClass, 'activeCategory' => 1, 'activeProvince' => 0, 'activeCity' => 0, 'categories' => $menu->getCategories(), 'places' => $menu->getPlaces(), 'isProvince' => $menu->isProvince()));
 }
コード例 #7
0
 /**
  * @Route(
  *     "/szukanie,{formSearch},firma,{formName},ulica,{formStreet},kod,{formPostcode},miejsce,{formProvince},{formCity},sortowanie,{formSort},{formDescend},zlecenia,{formOrder},komentarze,{formComment},strona,{formLevel}",
  *     name="searchpage",
  *     defaults={
  *         "formSearch" = 0,
  *         "formName" = "",
  *         "formStreet" = "",
  *         "formPostcode" = "",
  *         "formProvince" = 0,
  *         "formCity" = 0,
  *         "formSort" = 1,
  *         "formDescend" = 1,
  *         "formOrder" = 1,
  *         "formComment" = 0,
  *         "formLevel" = 1
  *     },
  *     requirements={
  *         "formSearch": "\d+",
  *         "formName": "[^/]*",
  *         "formStreet": "[^/]*",
  *         "formPostcode": "[^/]*",
  *         "formProvince": "\d+",
  *         "formCity": "\d+",
  *         "formSort": "\d+",
  *         "formDescend": "\d+",
  *         "formOrder": "\d+",
  *         "formComment": "\d+",
  *         "formLevel": "\d+"
  *     }
  * )
  */
 public function fullSearchAction(Request $request, $formSearch, $formName, $formStreet, $formPostcode, $formProvince, $formCity, $formSort, $formDescend, $formOrder, $formComment, $formLevel)
 {
     $config = new Config();
     $session = $request->getSession();
     $cookieLogin = new CookieLogin($em = $this->getDoctrine()->getManager());
     $cookieLogin->setCookieLogin($session);
     $quickForm = new QuickForm($this, $request);
     $messageString = '';
     $messageClass = 'bad';
     $firms = null;
     $pageNavigator = null;
     if ($quickForm->getName()) {
         header('Location: ' . $config->getUrl() . '/szukanie,1,firma,' . $quickForm->getName() . ',ulica,' . $formStreet . ',kod,' . $formPostcode . ',miejsce,' . $formProvince . ',' . $formCity . ',sortowanie,' . $formSort . ',' . $formDescend . ',zlecenia,' . $formOrder . ',komentarze,' . $formComment . ',strona,' . $formLevel);
         exit;
     }
     $mainForm = new MainForm();
     $mainForm->setComment($formComment);
     $commentForm = $this->createForm(MainFormType::class, $mainForm);
     $commentForm->handleRequest($request);
     if ($commentForm->isSubmitted() && $commentForm->isValid()) {
         $formComment = $mainForm->getComment();
         header('Location: ' . $config->getUrl() . '/szukanie,1,firma,' . $formName . ',ulica,' . $formStreet . ',kod,' . $formPostcode . ',miejsce,' . $formProvince . ',' . $formCity . ',sortowanie,' . $formSort . ',' . $formDescend . ',zlecenia,' . $formOrder . ',komentarze,' . $formComment . ',strona,1');
         exit;
     }
     $searchForm = new SearchForm();
     $searchForm->setProvince($formProvince);
     $searchFormType = new SearchFormType($this, 0);
     $form = $this->createForm($searchFormType, $searchForm);
     $form->handleRequest($request);
     $selectedProvince = $searchForm->getProvince();
     unset($searchForm);
     unset($form);
     $searchForm = new SearchForm();
     $searchForm->setName($formName);
     $searchForm->setStreet($formStreet);
     $searchForm->setPostcode($formPostcode);
     $searchForm->setProvince($formProvince);
     $searchForm->setCity($formCity);
     $searchFormType = new SearchFormType($this, $selectedProvince);
     $form = $this->createForm($searchFormType, $searchForm);
     if ($quickForm->getName()) {
         $form->get('name')->setData($quickForm->getName());
         $quickForm->clearForm();
     } else {
         $form->handleRequest($request);
     }
     if ($form->isSubmitted()) {
         $validator = $this->get('validator');
         $errors = $validator->validate($searchForm);
         if (count($errors) > 0) {
             foreach ($errors as $error) {
                 $messageString .= $error->getMessage() . '<br />';
             }
         } else {
             $formName = $searchForm->getName();
             $formStreet = $searchForm->getStreet();
             $formPostcode = $searchForm->getPostcode();
             $formProvince = $searchForm->getProvince();
             $formCity = $searchForm->getCity();
             header('Location: ' . $config->getUrl() . '/szukanie,1,firma,' . $formName . ',ulica,' . $formStreet . ',kod,' . $formPostcode . ',miejsce,' . $formProvince . ',' . $formCity . ',sortowanie,' . $formSort . ',' . $formDescend . ',zlecenia,' . $formOrder . ',komentarze,' . $formComment . ',strona,' . $formLevel);
             exit;
         }
     }
     if ($formSearch == 1) {
         $firms = $em->getRepository('AppBundle:Firm')->getSearchList($formName, $formStreet, $formPostcode, $formProvince, $formCity, $formSort, $formDescend, $formOrder, $formComment, $formLevel, 100);
         $pageNavigator = $em->getRepository('AppBundle:Firm')->searchNavigator($config->getUrl(), $formName, $formStreet, $formPostcode, $formProvince, $formCity, $formSort, $formDescend, $formOrder, $formComment, $formLevel, 100);
         if (!$firms && $formLevel > 1) {
             header('Location: ' . $config->getUrl() . '/szukanie,1,firma,' . $formName . ',ulica,' . $formStreet . ',kod,' . $formPostcode . ',miejsce,' . $formProvince . ',' . $formCity . ',sortowanie,' . $formSort . ',' . $formDescend . ',zlecenia,' . $formOrder . ',komentarze,' . $formComment . ',strona,1');
             exit;
         }
     }
     $menu = new Menu($em, 1, 0);
     return $this->render('search/search.html.twig', array('session' => $session->get('user'), 'quickForm' => $quickForm->createView(), 'commentForm' => $commentForm->createView(), 'form' => $form->createView(), 'messageString' => $messageString, 'messageClass' => $messageClass, 'selectedCity' => $searchForm->getCity(), 'activeCategory' => 1, 'activeProvince' => 0, 'activeCity' => 0, 'formName' => $formName, 'formStreet' => $formStreet, 'formPostcode' => $formPostcode, 'formProvince' => $formProvince, 'formCity' => $formCity, 'formSort' => $formSort, 'formDescend' => $formDescend, 'formOrder' => $formOrder, 'formComment' => $formComment, 'formLevel' => $formLevel, 'categories' => $menu->getCategories(), 'places' => $menu->getPlaces(), 'isProvince' => $menu->isProvince(), 'firms' => $firms, 'pageNavigator' => $pageNavigator));
 }