Exemplo n.º 1
0
 public function add($data)
 {
     if (Model_Bulletin::checkMail($data['email'])) {
         return false;
     }
     $db = JO_Db::getDefaultAdapter();
     $db->insert('bulletin_emails', array('firstname' => $data['fname'], 'lastname' => $data['lname'], 'email' => $data['email'], 'bulletin_subscribe' => 'true'));
 }
Exemplo n.º 2
0
 public function bulletinAction()
 {
     $this->noViewRenderer(true);
     $request = $this->getRequest();
     if ($request->isPost()) {
         $error = array();
         if (!Model_Users::ValidMail($request->getPost('bulletin_email'))) {
             JO_Session::set('msg_error_bulletin', $this->translate('You must fill valid email'));
             JO_Session::set('data_bulletin', $request->getParams());
         } elseif (!Model_Bulletin::checkMail($request->getPost('bulletin_email'))) {
             Model_Bulletin::add(array('fname' => $request->getPost('bulletin_fname'), 'lname' => $request->getPost('bulletin_lname'), 'email' => $request->getPost('bulletin_email')));
             JO_Session::set('msg_success_bulletin', $this->translate('You have been successfully added into our newsletter'));
         } else {
             JO_Session::set('msg_error_bulletin', $this->translate('The email is already in our newsletter'));
             JO_Session::set('data_bulletin', $request->getParams());
         }
     }
     $this->redirect($request->getServer('HTTP_REFERER') . '#bulletin');
 }