Exemplo n.º 1
0
 public function save()
 {
     $model = new ConsultationRequest();
     $model->email = $this->email;
     $model->name = $this->name;
     $model->phone = $this->phone;
     $model->skype = $this->skype;
     $model->text = $this->text;
     if ($model->save(FALSE)) {
         $this->emailSubject = 'Замовлення консультації з сайту РЕЗИДЕНТ';
         $this->receiverEmail = Yii::app()->params['emails']['notificationReceiver'];
         $this->emailViewFile = 'consultation';
         $this->emailParams = array('name' => $model->getName(), 'email' => $model->getEmail(FALSE, TRUE), 'message' => $model->getText(), 'phone' => $this->phone, 'skype' => $this->skype);
         $this->senderEmail = Yii::app()->params['emails']['defaultSender'];
         if ($this->sendEmail()) {
             if (!empty($this->email)) {
                 $this->notificationSubject = 'Повідомлення від сайту http://rezydent.com.ua';
                 $this->notificationViewFile = 'sender-notification';
                 $this->notificationParams = array();
                 $this->notificationReceiver = $this->email;
                 $this->notificationSender = Yii::app()->params['emails']['defaultSender'];
                 $this->sendSenderNotification();
             }
         }
     }
 }