public function addAction()
 {
     $form = new Front_Form_Contact();
     if ($this->_request->isPost()) {
         $data = $this->_request->getPost();
         if ($form->isValid($data)) {
             $dataFiltrees = $form->getValues();
             $contact = new Application_Model_Contact();
             $contact->setPrenom($dataFiltrees['prenom'])->setNom($dataFiltrees['nom'])->setEmail($dataFiltrees['email'])->setTelephone($dataFiltrees['telephone']);
             $this->mapper->insert($contact);
             $this->_flashMessenger->addMessage('Le contact ' . $contact->getPrenom() . ' a bien été créé');
             $this->_redirector->gotoRouteAndExit(['controller' => 'contact'], null, true);
         }
     }
     $this->view->contactForm = $form;
 }
Esempio n. 2
0
 public function contactAction()
 {
     $general = new Application_Model_General();
     $data_webite = $general->getGeneral();
     $data = $data_webite[0];
     $this->view->website_address = $data['website_address'];
     $this->view->website_phone = $data['website_phone'];
     $this->view->website_email = $data['website_email'];
     $this->view->website_ville = $data['website_ville'];
     $this->view->website_code_postal = $data['website_code_postal'];
     $this->view->website_pays = $data['website_pays'];
     if ($this->_request->isPost()) {
         $contact = new Application_Model_Contact();
         $nom = $_POST['nom'];
         $prenom = $_POST['prenom'];
         $object = $_POST['object'];
         $mailUser = $_POST['mail'];
         $message = $_POST['message'];
         $contact->sendMail($nom, $prenom, $object, $mailUser, $message);
         mail($mailUser, $object, $message);
         $this->view->mail = "Votre message à bien été envoyé.";
     }
 }
 public function testInitialsPropertiesAreNull()
 {
     $contact = new Application_Model_Contact();
     $this->assertNull($contact->getId());
     $this->assertNull($contact->getPrenom());
     $this->assertNull($contact->getNom());
     $this->assertNull($contact->getEmail());
     $this->assertNull($contact->getTelephone());
 }
 public function insert(Application_Model_Contact $contact)
 {
     $data = [];
     $data['prenom'] = $contact->getPrenom();
     $data['nom'] = $contact->getNom();
     $data['email'] = $contact->getEmail();
     $data['telephone'] = $contact->getTelephone();
     $id = $this->dbTable->insert($data);
     $contact->setId($id);
 }
Esempio n. 5
0
 /**
  * @Created By : Mahipal Singh Adhikari
  * @Created On : 8-Dec-2010
  * @Description: Used to display contact us page and send mails to Site Administrator
  */
 public function contactAction()
 {
     $identifire = $this->view->actionName;
     $page = new Application_Model_Page();
     $preview = false;
     $preview = $this->_getParam("preview");
     $page = $page->getStaticContent($identifire);
     $this->view->preview = $preview;
     $this->view->status = $page->getStatus();
     $this->view->title = $page->getTitle();
     $this->view->content = $page->getContent();
     $this->view->headTitle()->setSeparator(' - ');
     if ($page->getMetaTitle() == "") {
         $this->view->headTitle()->set($page->getTitle());
     } else {
         $this->view->headTitle()->set($page->getMetaTitle());
     }
     //append meta title and keywords
     $this->view->headMeta()->appendName('keywords', $page->getMetaKeyword());
     $this->view->headMeta()->appendName('description', $page->getMetaDescription());
     $this->view->headMeta()->appendName('title', $page->getMetaTitle());
     //submit information
     $form = new Application_Form_Contact();
     $elements = $form->getElements();
     $form->clearDecorators();
     foreach ($elements as $element) {
         $element->removeDecorator('label');
         $element->removeDecorator('dd');
     }
     $this->view->form = $form;
     if ($this->getRequest()->isPost()) {
         $params = $this->getRequest()->getPost();
         if ($form->isValid($params)) {
             //set user id if logged in else set 0 as default
             $user_id = 0;
             $userNs = new Zend_Session_Namespace('members');
             $user_id = $userNs->userId;
             //create contact model object
             $contactM = new Application_Model_Contact();
             //set values
             $contactM->setContactName($this->_getParam('contact_name'));
             $contactM->setContactEmail($this->_getParam('contact_email'));
             $contactM->setContactReason(nl2br($this->_getParam('contact_reason')));
             $contactM->setUserId($user_id);
             $contactM->setStatus(1);
             //save data
             $contact_id = $contactM->save();
             $message = "";
             if ($contact_id > 0) {
                 //send email to admin
                 $settings = new Admin_Model_GlobalSettings();
                 $admin_email = $settings->settingValue('admin_email');
                 //$admin_email = "*****@*****.**";
                 //set sender information
                 $mailOptions['sender_name'] = ucwords($this->_getParam('contact_name'));
                 $mailOptions['sender_email'] = $this->_getParam('contact_email');
                 $mailOptions['sender_comments'] = $this->_getParam('contact_reason');
                 //set receiver information
                 $mailOptions['receiver_email'] = $admin_email;
                 //$mailOptions['receiver_name']	= "Administrator";
                 //create mail class object and send the email
                 $Mail = new Base_Mail();
                 $Mail->sendContactusEmail($mailOptions);
                 $message = "Thanks! We have your feedback and will try and get in touch with you as soon as possible.";
             } else {
                 $message = "Error occured while sending email.";
             }
             //set falsh message and redirect user
             $_SESSION["flash_msg"] = $message;
             $this->_redirect($this->view->seoUrl('/index/contact/'));
         }
         //end of if
     }
     //end if
 }
Esempio n. 6
0
 private function setModel($row)
 {
     $model = new Application_Model_Contact();
     $model->setId($row->id)->setContactName($row->contact_name)->setContactEmail($row->contact_email)->setContactReason($row->contact_reason)->setUserId($row->user_id)->setCreated($row->created)->setModified($row->modified)->setStatus($row->status);
     return $model;
 }