コード例 #1
0
 /**
  * Handles the sending the message - storing it in the database
  *
  * @todo Refactor this to send an email
  */
 public function sendAction()
 {
     if ($this->request->isPost() == true) {
         $forward = 'index/index';
         $name = $this->request->getPost('name', 'string');
         $email = $this->request->getPost('email', 'email');
         $comments = $this->request->getPost('comments', 'string');
         $name = strip_tags($name);
         $comments = strip_tags($comments);
         $contact = new Contact();
         $contact->name = $name;
         $contact->email = $email;
         $contact->comments = $comments;
         $contact->createdAt = new Phalcon_Db_RawValue('now()');
         if ($contact->save() == false) {
             foreach ($contact->getMessages() as $message) {
                 Flash::error((string) $message, 'alert alert-error');
             }
             $forward = 'contact/index';
         } else {
             $message = 'Thank you for your input. If your message requires ' . 'a reply, we will contact you as soon as possible.';
             Flash::success($message, 'alert alert-success');
         }
     } else {
         $forward = 'contact/index';
     }
     return $this->_forward($forward);
 }
コード例 #2
0
ファイル: Flash.php プロジェクト: mattvb91/cphalcon
 public function success($message)
 {
     return parent::success($message);
 }