예제 #1
0
 /**
  * Displays a view
  *
  * @return void|\Cake\Network\Response
  * @throws \Cake\Network\Exception\NotFoundException When the view file could not
  *   be found or \Cake\View\Exception\MissingTemplateException in debug mode.
  */
 public function display()
 {
     $path = func_get_args();
     $count = count($path);
     if (!$count) {
         return $this->redirect('/');
     }
     $page = $subpage = null;
     if (!empty($path[0])) {
         $page = $path[0];
     }
     if (!empty($path[1])) {
         $subpage = $path[1];
     }
     $this->set(compact('page', 'subpage'));
     /* contact form */
     $contact = new ContactForm();
     if ($this->request->is('post')) {
         if ($contact->execute($this->request->data)) {
             $this->Flash->success('Bedankt om contact op te nemen met ons, we reageren zo snel mogelijk.');
         } else {
             $this->Flash->error('Er is een probleem opgetreden bij het verzenden van de mail. Probeer later opnieuw');
         }
     }
     $this->set('contact', $contact);
     /* render page */
     try {
         $this->render(implode('/', $path));
     } catch (MissingTemplateException $e) {
         if (Configure::read('debug')) {
             throw $e;
         }
         throw new NotFoundException();
     }
 }
예제 #2
0
 public function index()
 {
     $contact = new ContactForm();
     if ($this->request->is('post')) {
         if ($contact->execute($this->request->data())) {
             $this->Flash->success(__('Mensagem enviada com sucesso'));
         } else {
             $this->Flash->error(__('Erro ao enviar a mensagem'));
         }
     }
     $this->set('contact', $contact);
 }
 public function index()
 {
     $contact = new ContactForm();
     if ($this->request->is('post')) {
         if ($contact->execute($this->request->data)) {
             $this->Flash->success('Order submitted successfully and its value is ' . $contact->getPrice());
         } else {
             $contact->setErrors(["email" => ["_required" => "Your email is required"]]);
             $this->Flash->error('There was a problem submitting your form.');
         }
     }
     $this->set('contact', $contact);
 }
 public function index()
 {
     $this->viewBuilder()->layout('site');
     $contact = new ContactForm();
     if ($this->request->is('post')) {
         if ($contact->execute($this->request->data)) {
             $this->Flash->success('Bedankt om contact op te nemen met ons, we reageren zo snel mogelijk.');
         } else {
             $this->Flash->error('Er is een probleem opgetreden bij het verzenden van de mail.');
         }
     }
     $this->set('contact', $contact);
 }
 public function index()
 {
     $contact = new ContactForm();
     if ($this->request->is('post')) {
         if ($contact->execute($this->request->data)) {
             $this->Flash->success('Your message has been sent; we\'ll get back to you soon!');
             $this->request->data['name'] = null;
             $this->request->data['email'] = null;
             $this->request->data['body'] = null;
         } else {
             $this->Flash->error('There was a problem submitting your form.');
         }
     }
     $this->set('contact', $contact);
 }
예제 #6
0
 public function send()
 {
     $this->disabledlayout();
     $return = array();
     $return['status'] = 'danger';
     $return['error_msg'] = "";
     $contact = new ContactForm();
     if ($this->request->is('post')) {
         if ($contact->execute($this->request->data) == 'true') {
             $this->Flash->success('Nós entraremos em contato com você em breve.');
         } else {
             $return['error_msg'] = $contact->execute($this->request->data);
             $return['dialog'] = $this->Flash->error('Houve um problema ao enviar o formulário.');
         }
     }
     echo json_encode($return);
 }
 public function index()
 {
     $contact = new ContactForm();
     $contact->setErrors(["email" => ["_required" => "Your email is required"]]);
     if ($this->request->is('post')) {
         if ($contact->execute($this->request->data)) {
             $this->Flash->success('We will get back to you soon.');
         } else {
             echo $this->request->data['body'];
             //$this->Flash->error('There was a problem submitting your form.');
         }
     }
     if ($this->request->is('get')) {
         //Values from the User Model e.g.
         $this->request->data['name'] = 'John Doe';
         $this->request->data['email'] = '*****@*****.**';
     }
     $this->set('contact', $contact);
 }
 public function contact()
 {
     $contact = new ContactForm();
     if ($this->request->is('post')) {
         if ($contact->execute($this->request->data)) {
             // Form Saver
             $this->loadModel('ContactFormSubmissions');
             $ip = $this->request->env('REMOTE_ADDR');
             $agent = $this->request->env('HTTP_USER_AGENT');
             $this->request->data['ip_address'] = $ip;
             $this->request->data['browser_agent'] = $agent;
             $contact_form_data = $this->ContactFormSubmissions->newEntity($this->request->data);
             $this->ContactFormSubmissions->save($contact_form_data);
             // Form Saver
             $this->redirect('/pages/thank-you/');
         } else {
             $this->Flash->error('There was a problem submitting your form.');
         }
     }
     $this->set('contact', $contact);
 }