Exemplo n.º 1
0
 public function actionContact()
 {
     $model = new ContactForm();
     if ($model->load(\Yii::$app->request->post()) && $model->validate()) {
         \Yii::$app->common->sendMail($model->subject, $model->body);
     }
     return $this->render('contact', ['model' => $model]);
 }
Exemplo n.º 2
0
 public function actionContact()
 {
     $model = new ContactForm();
     if ($model->load(Yii::$app->request->post()) && $model->contact(Yii::$app->params['adminEmail'])) {
         Yii::$app->session->setFlash('contactFormSubmitted');
         return $this->refresh();
     } else {
         return $this->render('contact', ['model' => $model]);
     }
 }
Exemplo n.º 3
0
 public function actionContact()
 {
     $model = new ContactForm();
     if ($model->load($_POST) && $model->contact(Yii::$app->params['adminEmail'])) {
         Yii::$app->session->setFlash('success', 'Thank you for contacting us. We will respond to you as soon as possible.');
         return $this->refresh();
     } else {
         return $this->render('contact', array('model' => $model));
     }
 }
Exemplo n.º 4
0
 /**
  * Contact.
  */
 public function actionContact()
 {
     $model = new ContactForm();
     if ($model->load(\Yii::$app->request->post()) && $model->validate()) {
         $success = $model->sendEmail(\Yii::$app->params['adminEmail']);
         if ($success) {
             \Yii::$app->session->setFlash('success', 'Your message has been sent!');
             $this->refresh('#form');
         }
     }
     return $this->render('contact', ['model' => $model]);
 }
Exemplo n.º 5
0
 public function actionFeedback()
 {
     $model = new ContactForm();
     if (Yii::$app->request->isAjax && $model->load(Yii::$app->request->post()) && $model->validate()) {
         if ($model->sendEmail(Yii::$app->settings->get('main.supportEmail'))) {
             return 'Спасибо за ваше сообщение, мы обязательно ответим вам в ближайшее время.';
         } else {
             return 'Что то пошло не так :( Попробуйте позднее';
         }
     }
     return 'Что то пошло не так :(';
 }
Exemplo n.º 6
0
 public function actionContact()
 {
     $model = new ContactForm();
     if ($model->load(\Yii::$app->request->post()) && $model->validate()) {
         $body = '<div>Body: <b>' . $model->body . ' </b></div>';
         $body .= '<div>Email: <b>' . $model->email . ' </b></div>';
         \Yii::$app->common->sendMail($model->subject, $body);
         print 'Send success';
     }
     return $this->render('contact', ['model']);
     //return $this->render('inner');
 }
Exemplo n.º 7
0
 public function actionContact()
 {
     $model = new ContactForm();
     if ($model->load(\Yii::$app->request->post()) && $model->validate()) {
         $body = " <div>Body: <b> " . $model->body . " </b></div>";
         $body .= " <div>Email: <b> " . $model->email . " </b></div>";
         \Yii::$app->common->sendMail($model->subject, $body);
         print "Send success";
         die;
     }
     return $this->render("contact", ['model' => $model]);
 }
 public function actionContact()
 {
     $model = new ContactForm();
     if ($model->load(Yii::$app->request->post())) {
         if ($model->contact(Yii::$app->params['adminEmail'])) {
             Yii::$app->getSession()->setFlash('alert', ['body' => Yii::t('frontend', 'Thank you for contacting us. We will respond to you as soon as possible.'), 'options' => ['class' => 'alert-success']]);
             return $this->refresh();
         } else {
             Yii::$app->getSession()->setFlash('alert', ['body' => \Yii::t('frontend', 'There was an error sending email.'), 'options' => ['class' => 'alert-danger']]);
         }
     }
     return $this->render('contact', ['model' => $model]);
 }
 /**
  * Displays the contact static page and sends the contact email.
  *
  * @return string|\yii\web\Response
  */
 public function actionContact()
 {
     $model = new ContactForm();
     if (!$model->load(Yii::$app->request->post()) || !$model->validate()) {
         return $this->render('contact', ['model' => $model]);
     }
     if (!$model->sendEmail(Yii::$app->params['adminEmail'])) {
         Yii::$app->session->setFlash('error', Yii::t('app', 'There was some error while sending email.'));
         return $this->refresh();
     }
     Yii::$app->session->setFlash('success', Yii::t('app', 'Thank you for contacting us. We will respond to you as soon as possible.'));
     return $this->refresh();
 }
 /**
  * Displays the contact static page and sends the contact email.
  *
  * @return string|\yii\web\Response
  */
 public function actionContact()
 {
     $model = new ContactForm();
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         if ($model->contact(Yii::$app->params['adminEmail'])) {
             Yii::$app->session->setFlash('success', 'Thank you for contacting us. We will respond to you as soon as possible.');
         } else {
             Yii::$app->session->setFlash('error', 'There was an error sending email.');
         }
         return $this->refresh();
     }
     return $this->render('contact', ['model' => $model]);
 }
Exemplo n.º 11
0
 /**
  * Displays contact page.
  *
  * @return mixed
  */
 public function actionContact()
 {
     $model = new ContactForm();
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         if ($model->sendEmail(Yii::$app->params['adminEmail'])) {
             Yii::$app->session->setFlash('success', 'Cảm ơn bạn đã liên hệ với chúng tôi. Chúng tôi sẽ liên hệ lại với bạn trong thời gian sớm nhất.');
         } else {
             Yii::$app->session->setFlash('error', 'Có lỗi trong quá trình gửi mail.');
         }
         return $this->refresh();
     } else {
         return $this->render('contact', ['model' => $model]);
     }
 }
Exemplo n.º 12
0
 /**
  * Displays contact page.
  *
  * @return mixed
  */
 public function actionContact()
 {
     $model = new ContactForm();
     if ($model->load(Yii::$app->request->post())) {
         if ($model->sendEmail(Yii::$app->params['adminEmail'])) {
             Yii::$app->session->setFlash('success', 'Спасибо за обращение, мы ответим на ваше сообщение так быстро на сколько это возможно');
         } else {
             Yii::$app->session->setFlash('error', 'Произошла ошибка отправки письма');
         }
         return $this->refresh();
     } else {
         return $this->render('contact', ['model' => $model]);
     }
 }
Exemplo n.º 13
0
 public function actionContact()
 {
     $model = new ContactForm();
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         if ($model->sendEmail(Yii::$app->params['adminEmail'])) {
             Yii::$app->session->setFlash('success', 'Obrigado pelo seu contacto! Recebrá uma resposta brevemente.');
         } else {
             Yii::$app->session->setFlash('error', 'Ocorreu um erro ao enviar o email!');
         }
         return $this->refresh();
     } else {
         return $this->render('contact', ['model' => $model]);
     }
 }
Exemplo n.º 14
0
 /**
  * Displays contact page.
  *
  * @return mixed
  */
 public function actionContact()
 {
     $model = new ContactForm();
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         if ($model->sendEmail(Yii::$app->params['adminEmail'])) {
             Yii::$app->session->setFlash('success', ['type' => 'success', 'duration' => 12000, 'icon' => 'fa fa-envelope', 'message' => 'Thank you for contacting us. We will respond to you as soon as possible.', 'title' => 'Sending Message']);
         } else {
             Yii::$app->session->setFlash('error', ['type' => 'danger', 'duration' => 12000, 'icon' => 'fa fa-envelope', 'message' => 'There was an error sending email.', 'title' => 'Sending Message']);
         }
         return $this->refresh();
     } else {
         return $this->render('contact', ['model' => $model]);
     }
 }
Exemplo n.º 15
0
 /**
  * Displays contact page.
  *
  * @return mixed
  */
 public function actionContact()
 {
     $model = new ContactForm();
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         if ($model->sendEmail(Yii::$app->params['adminEmail'])) {
             Yii::$app->session->setFlash('success', Yii::t('c/radiata/contact', 'Thank you'));
         } else {
             Yii::$app->session->setFlash('error', Yii::t('c/radiata/contact', 'Errors'));
         }
         return $this->refresh();
     } else {
         return $this->render('contact', ['model' => $model]);
     }
 }
Exemplo n.º 16
0
 /**
  * Displays contact page.
  *
  * @return mixed
  */
 public function actionContact()
 {
     $model = new ContactForm();
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         if ($model->sendEmail(Yii::$app->params['adminEmail'])) {
             Yii::$app->session->setFlash('success', 'Спасибо за Ваше сообщение. Мы ответим вам при первой возможности.');
         } else {
             Yii::$app->session->setFlash('error', 'При отправке сообщения произошла ошибка.');
         }
         return $this->refresh();
     } else {
         return $this->render('contact', ['model' => $model]);
     }
 }
Exemplo n.º 17
0
 public function actionContact()
 {
     $model = new ContactForm();
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         if ($model->sendEmail(Yii::$app->params['adminEmail'])) {
             Yii::$app->session->setFlash('success', 'Terima kasih sudah menghubungi kami. Pertanyaan anda akan kami jawab secepatnya.. ');
         } else {
             Yii::$app->session->setFlash('error', 'Maaf pesan gagal dikirim.coba ulangi lagi.');
         }
         return $this->refresh();
     } else {
         return $this->render('contact', ['model' => $model]);
     }
 }
Exemplo n.º 18
0
 /**
  * Displays contact page.
  *
  * @return mixed
  */
 public function actionContact()
 {
     $model = new ContactForm();
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         if ($model->sendEmail(Yii::$app->params['adminEmail'])) {
             Yii::$app->session->setFlash('success', 'Спасибо за обращение к нам. Мы ответим вам как можно скорее.');
         } else {
             Yii::$app->session->setFlash('error', 'Ошибка отправки электронной почты.');
         }
         return $this->refresh();
     } else {
         return $this->render('contact', ['model' => $model]);
     }
 }
Exemplo n.º 19
0
 public function actionContact()
 {
     $model = new ContactForm();
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         if ($model->sendEmail(Yii::$app->params['adminEmail'])) {
             Yii::$app->session->setFlash('success', "Дякую, що написали нам. Ми зв'яжимось з вами.");
         } else {
             Yii::$app->session->setFlash('error', 'Виникла помилка при відправці листа. Будь ласка спробуйте пізніше');
         }
         return $this->refresh();
     } else {
         return $this->render('contact', ['model' => $model]);
     }
 }
Exemplo n.º 20
0
 /**
  * Displays contact page.
  *
  * @return mixed
  */
 public function actionContact()
 {
     $model = new ContactForm();
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         if ($model->sendEmail(Yii::$app->params['adminEmail'])) {
             Yii::$app->session->setFlash('success', '感谢你联系我们。我们将尽快回复你。');
         } else {
             Yii::$app->session->setFlash('error', '发送的电子邮件有一个错误。');
         }
         return $this->refresh();
     } else {
         return $this->render('contact', ['model' => $model]);
     }
 }
Exemplo n.º 21
0
 public function actionContact()
 {
     $model = new ContactForm();
     if ($model->load(Yii::$app->getRequest()->getBodyParams(), '') && $model->validate()) {
         if ($model->sendEmail(Yii::$app->params['adminEmail'])) {
             $response = ['flash' => ['class' => 'success', 'message' => 'Thank you for contacting us. We will respond to you as soon as possible.']];
         } else {
             $response = ['flash' => ['class' => 'error', 'message' => 'There was an error sending email.']];
         }
         return $response;
     } else {
         $model->validate();
         return $model;
     }
 }
Exemplo n.º 22
0
 public function actionContact()
 {
     $model = new ContactForm();
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         if ($model->sendEmail()) {
             Yii::$app->getSession()->setFlash('success', ['type' => 'success', 'duration' => 5000, 'icon' => 'glyphicon glyphicon-envelope', 'message' => 'Muchas gracias por contactarnos. Le responderemos a la brevedad', 'title' => 'Contacto', 'positonY' => 'top', 'positonX' => 'center']);
             return $this->goHome();
         } else {
             Yii::$app->getSession()->setFlash('danger', ['type' => 'danger', 'duration' => 5000, 'icon' => 'glyphicon glyphicon-exclamation-sign', 'message' => 'Ocurrió un error al enviar el mail. Por favor, comuníquese con info@remisesramallo.com.ar', 'title' => 'Contacto', 'positonY' => 'top', 'positonX' => 'center']);
             return $this->goHome();
         }
     } else {
         return $this->renderAjax('contact', ['model' => $model]);
     }
 }
Exemplo n.º 23
0
 /**
  * Displays contact page.
  *
  * @return mixed
  */
 public function actionContact()
 {
     $this->pageDescription = 'Если у вас есть деловое предложение или другие вопросы, пожалуйста, заполните форму на странице, чтобы связаться с нами.';
     $model = new ContactForm();
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         if ($model->sendEmail(Yii::$app->params['infoEmail'])) {
             Yii::$app->session->setFlash('success', 'Ваше сообщение было отправлено.<br/> Наши сотрудники в кратчайшее время свяжуться с Вами по электронной почте, которая была указана в форме. Благодарим Вас за обращение к нам.');
         } else {
             Yii::$app->session->setFlash('error', 'Oшибка отправки электронной почты.');
         }
         return $this->refresh();
     } else {
         return $this->render('contact', ['model' => $model]);
     }
 }
Exemplo n.º 24
0
 public function actionContact()
 {
     $this->layout = 'inner';
     $model = new ContactForm();
     if (Yii::$app->request->isAjax && $model->load(\Yii::$app->request->post())) {
         Yii::$app->response->format = Response::FORMAT_JSON;
         return ActiveForm::validate($model);
     }
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         $body = " <div>Body: <b> " . $model->body . " </b></div>";
         $body .= " <div>Email: <b> " . $model->email . " </b></div>";
         Yii::$app->common->sendMail($model->subject, $body);
         print 'Send success';
         die;
     }
     return $this->render('contact', ['model' => $model]);
 }
Exemplo n.º 25
0
 /**
  * Contact Us page render
  *
  * @param $page
  * @return string
  * @throws Mandrill_Error
  * @throws \Exception
  */
 private function renderContactUs($page)
 {
     $model = new ContactForm();
     $mess = '';
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         $settings = new Settings();
         /** @var string $sendTo - address which collects feedback from customers
          *  @fixme change this emails
          */
         try {
             $support = $settings->getConfigurationParamByKey('support_email');
         } catch (\yii\base\Exception $e) {
             $support = null;
         }
         try {
             $support = $settings->getConfigurationParamByKey('admin_email');
         } catch (\yii\base\Exception $e) {
             $admin = null;
         }
         if (!$support) {
             $sendTo = \Yii::$app->params['supportEmail'];
         } else {
             $sendTo = $support;
         }
         if (!$admin) {
             $replyTo = \Yii::$app->params['adminEmail'];
         } else {
             $replyTo = $admin;
         }
         $name = Yii::$app->request->post("ContactForm")['name'];
         $body = Yii::$app->request->post("ContactForm")['body'];
         $usermail = Yii::$app->request->post("ContactForm")['email'];
         $subject_internal = Yii::$app->request->post("ContactForm")['subject'];
         $subject = "New Feedback from {$name} ({$usermail})";
         $mailer = new \common\helpers\Mandrill($sendTo, $subject, $local_tpl_name = null, $sender = null, ['from_name' => '[Auto-generated]', 'reply_to' => $replyTo, 'mandrill_template_name' => 'contactrazzd', 'vars' => ['header' => $subject_internal, 'body' => $body, 'usermail' => $usermail]]);
         $result = $mailer->sendWithMandrillTemplate();
         $mess = (string) $result;
         if ($result) {
             Yii::$app->session->setFlash('success', 'Your message has been sent.');
         } else {
             Yii::$app->session->setFlash('error', 'Is there something wrong. Contact Support.');
         }
         $model = new ContactForm();
     }
     return $this->render('contact_us', ['page' => $page, 'model' => $model]);
 }
Exemplo n.º 26
0
 public function actionContact()
 {
     $session = Yii::$app->session;
     $session->remove('category');
     $model = new ContactForm();
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         if ($model->sendEmail(Yii::$app->params['adminEmail'])) {
             Yii::$app->session->setFlash('success', 'Thank you for contacting us. We will respond to you as soon as possible.');
         } else {
             Yii::$app->session->setFlash('error', 'There was an error sending email.');
         }
         return $this->refresh();
     } else {
         $data = Config::find()->select('content, title, description, keyword')->where('com="contact"')->one();
         return $this->render('contact', ['model' => $model, 'data' => $data]);
     }
 }
Exemplo n.º 27
0
 public function actionContact($type = null)
 {
     $model = new ContactForm();
     $viewName = 'contact';
     if ($model->load(Yii::$app->request->post()) && $model->send(Yii::$app->params['adminEmail'])) {
         Yii::$app->session->setFlash('info', Yii::t('front', 'Your message was successfuly submitted. Thank you!'));
         return $this->refresh();
     } else {
         if ($type == 'pdf') {
             /** @noinspection PhpUndefinedFieldInspection */
             $pdf = Yii::$app->pdf;
             $pdf->content = $this->renderPartial('pdf/' . $viewName);
             $pdf->options['title'] = Yii::t('front', 'Contacts');
             $pdf->methods['SetFooter'] = ['{PAGENO}'];
             return $pdf->render();
         } else {
             return $this->render($viewName, compact('model'));
         }
     }
 }
Exemplo n.º 28
0
 public function actionContact()
 {
     $model = new ContactForm();
     //ajax request
     if ($_SERVER['REQUEST_METHOD'] == 'POST') {
         Yii::$app->response->format = 'json';
         if ($model->load(Yii::$app->request->post()) && $model->validate()) {
             if ($model->sendEmail(Yii::$app->params['contactEmail'])) {
                 return ['message' => Yii::t('app', 'Thank you. We will respond to you as soon as possible.'), 'status' => 'success'];
             } else {
                 return ['message' => Yii::t('app', 'There was an error sending email.'), 'status' => 'error'];
             }
         } else {
             return ['message' => Yii::t('app', 'There was an error during processing your inputs.'), 'status' => 'error'];
         }
         //otherwise show form
     } else {
         return $this->render('contact', ['model' => $model]);
     }
 }
 /**
  * Displays a single FLanguecenter model.
  * @param integer $id
  * @return mixed
  */
 public function actionView($id, $slug = null)
 {
     $this->layout = '@frontend/views/layouts/layout-frontend.php';
     $langue = $this->findModel($id);
     if ($slug != $langue->slug) {
         return $this->redirect(['languecenter/view', 'id' => $id, 'slug' => $langue->slug]);
     }
     $langue->number++;
     $langue->save();
     $contact = new ContactForm();
     $rate = new FRateCenter();
     $rate->value = round($langue->rate);
     if ($contact->load(Yii::$app->request->post()) && $contact->validate()) {
         if ($contact->sendEmail($langue->email)) {
             Yii::$app->session->setFlash('success-email', Yii::t('frontend', 'Thank you for contacting us. We will respond to you as soon as possible.'));
         } else {
             Yii::$app->session->setFlash('error-email', Yii::t('frontend', 'There was an error sending email.'));
         }
         // die('hello1');
         return $this->refresh();
     }
     return $this->render('view', ['rate' => $rate, 'model' => $langue, 'contact' => $contact]);
 }
Exemplo n.º 30
0
 /**
  * Displays contact page.
  *
  * @return mixed
  */
 public function actionContact()
 {
     $model = new ContactForm();
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         if ($model->sendEmail(Yii::$app->params['adminEmail'])) {
             Yii::$app->session->setFlash('success', 'Gracias por contactarnos. Le responderemos lo más pronto posible.');
         } else {
             Yii::$app->session->setFlash('error', 'Se produjo un error al enviar el e-mail');
         }
         return $this->refresh();
     } else {
         return $this->render('contact', ['model' => $model]);
     }
 }