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->render('contact', ['model' => $model]);
 }
 public function actionIndex()
 {
     $model = new ContactForm();
     if ($model->load(Yii::$app->request->post()) && $model->contact(Setting::get('admin_email'))) {
         Yii::$app->session->setFlash('contactFormSubmitted');
         return $this->refresh();
     }
     return $this->render('index', ['contactForm' => $model]);
 }
 public function actionIndex()
 {
     $model = new ContactForm();
     if ($model->load(\Yii::$app->request->post()) && $model->validate()) {
         \Yii::$app->session->setFlash('contactFormSubmitted');
         return $this->refresh();
     } else {
         return $this->render('index', ['model' => $model]);
     }
 }
Example #4
0
 public function actionForm()
 {
     $model = new ContactForm();
     if ($model->load(Yii::$app->request->post())) {
         if ($model->validate()) {
             return $this->render('entry-confirm', ['model' => $model]);
             return;
         }
     }
     return $this->render('form', ['model' => $model]);
 }
 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]);
 }
 /**
  * @param null|\app\core\admpages\models\Page $modelPage
  * @return string|\yii\web\Response
  */
 public function actionContact($modelPage = null)
 {
     $model = new ContactForm();
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         if ($model->sendEmail()) {
             Yii::$app->session->setFlash('success', Yii::t("app/contacts", "Thank you for contacting us. We will respond to you as soon as possible.", ['dot' => false]));
             return $this->refresh();
         }
         Yii::$app->session->setFlash('error', Yii::t("app/contacts", "There was an error sending email.", ['dot' => false]));
     }
     return $this->render('contact', ['model' => $model, 'modelPage' => $modelPage]);
 }
Example #7
0
 public function actionIndex()
 {
     $model = new ContactForm();
     if ($model->load(Yii::$app->request->post())) {
         if ($model->contact(Yii::$app->params['contactEmail'])) {
             echo json_encode(['success' => true, 'message' => 'Thank you! Your message has been sent, we\'ll get back to you shortly :)']);
         } else {
             echo json_encode(['success' => false, 'message' => 'An unknown error has occured while sending your message. Please check back soon or email us directly to mailto:' . Yii::$app->params['contactEmail']]);
         }
         exit;
     }
     return $this->render('index', ['allProjects' => $this->getProjects(), 'projectCategories' => $this->getProjectCategories(), 'team' => $this->getTeamMembers(), 'cf' => $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()) {
         if ($model->contact(Yii::$app->params['adminEmail'])) {
             Yii::$app->session->setFlash('success', Yii::t('app', 'Thank you for contacting us. We will respond to you as soon as possible.'));
         } else {
             Yii::$app->session->setFlash('error', Yii::t('app', 'There was an error sending email.'));
         }
         return $this->refresh();
     }
     return $this->render('contact', ['model' => $model]);
 }
Example #9
0
 public function actionContact()
 {
     $model = new ContactForm();
     if (Yii::$app->request->isAjax && $model->load(Yii::$app->request->post())) {
         Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
         // Validate all but captcha:
         return FnActiveForm::validate($model);
     }
     if ($model->load(Yii::$app->request->post()) && $model->contact(Yii::$app->params['adminEmail'])) {
         Yii::$app->session->setFlash('contactFormSubmitted');
         return $this->refresh();
     }
     return $this->render('contact', ['model' => $model]);
 }
Example #10
0
 public function actionContact()
 {
     $model = new ContactForm();
     if (!Yii::$app->user->isGuest) {
         $model->name = Yii::$app->user->identity->name;
         $model->email = Yii::$app->user->identity->email;
     }
     if ($model->load(Yii::$app->request->post()) && $model->contact(Yii::$app->params['supportEmail'])) {
         Yii::$app->session->setFlash('contactFormSubmitted');
         return $this->refresh();
     } else {
         return $this->render('contact', ['model' => $model]);
     }
 }
Example #11
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]);
     }
 }
Example #12
0
 public function actionMail()
 {
     $model = new ContactForm();
     if ($model->load(Yii::$app->request->post()) && $model->contact(Yii::$app->params['adminEmail'])) {
         Yii::$app->session->setFlash('contactFormSubmitted');
         return $this->refresh();
     }
     //if ($form->load(Yii::$app->request->post())){
     $listaMails = "No se ha seleccionado ningun mail.";
     if (isset($_REQUEST['enviar_a'])) {
         $listaMails = $_REQUEST['enviar_a'];
     }
     return $this->render('mail', ['listaMails' => $listaMails, 'model' => $model]);
 }
Example #13
0
 public function actionContact()
 {
     $model = new ContactForm();
     if ($model->load(Yii::$app->request->post()) && $model->contact(Yii::$app->params['adminEmail'])) {
         $post = file_get_contents("php://input");
         $data = json_encode($post);
         print_r($data);
         exit;
         Yii::$app->session->setFlash('contactFormSubmitted');
         return $this->refresh();
     } else {
         return $this->render('contact', ['model' => $model]);
     }
 }
Example #14
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', 'Dank u voor uw bericht. Wij zullen zo spoedig mogelijk contact met u opnemen.');
         } else {
             Yii::$app->session->setFlash('error', 'Er ging iets fout met het versturen');
         }
         return $this->refresh();
     } else {
         return $this->render('contact', ['model' => $model, 'page' => 'page-contact']);
     }
     //return $this->render('contact', ['page' => 'page-contact']);
 }
 public function actionContact()
 {
     $model = new ContactForm();
     if ($model->load(Yii::$app->request->post())) {
         $model->name = $_POST['ContactForm']['name'];
         $model->message = $_POST['ContactForm']['message'];
         $model->phone = $_POST['ContactForm']['phone'];
         if ($model->save()) {
             Yii::$app->response->redirect(array('site/contact', 'model' => $model));
         }
         return $this->refresh();
     } else {
         return $this->render('contact', ['model' => $model]);
     }
 }
Example #16
0
 /**
  * @return string|\yii\web\Response
  */
 public function actionContact()
 {
     $page = Shop::page(Pages::CONTACT);
     $model = new ContactForm();
     if (!Yii::$app->user->isGuest) {
         /** @var User $identity */
         $identity = Yii::$app->user->identity;
         $model->name = $identity->name;
         $model->email = $identity->email;
     }
     if ($model->load(Yii::$app->request->post()) && $model->contact(Settings::value('general', 'shopEmail'))) {
         Yii::$app->session->setFlash('contactFormSubmitted');
         return $this->refresh();
     }
     return $this->render('contact', ['model' => $model, 'page' => $page]);
 }
Example #17
0
 public function testContact()
 {
     $model = new ContactForm();
     $model->attributes = ['name' => 'Tester', 'email' => '*****@*****.**', 'subject' => 'very important letter subject', 'body' => 'body of current message'];
     $model->sendEmail('*****@*****.**');
     $this->specify('email should be send', function () {
         expect('email file should exist', file_exists($this->getMessageFile()))->true();
     });
     $this->specify('message should contain correct data', function () use($model) {
         $emailMessage = file_get_contents($this->getMessageFile());
         expect('email should contain user name', $emailMessage)->contains($model->name);
         expect('email should contain sender email', $emailMessage)->contains($model->email);
         expect('email should contain subject', $emailMessage)->contains($model->subject);
         expect('email should contain body', $emailMessage)->contains($model->body);
     });
 }
 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 {
         if (!Yii::$app->user->isGuest) {
             $model->email = Yii::$app->user->identity->username;
             if (Yii::$app->user->identity->family_member_id) {
                 $model->name = Yii::$app->user->identity->familyMember->name . ' (Família ' . Yii::$app->user->identity->family->name . ' )';
             }
         }
         return $this->render('contact', ['model' => $model]);
     }
 }
Example #19
0
 public function actionContactajax()
 {
     // FORMAT_HTML , FORMAT_JSON , FORMAT_JSONP , FORMAT_RAW , FORMAT_XML
     Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
     $model = new ContactForm();
     $isModelLoaded = $model->load(['ContactForm' => Yii::$app->request->post()]);
     if ($isModelLoaded && $model->validate()) {
         // SET email variables
         $body = "";
         $body .= "From: " . $model->name . "<br/>";
         $body .= "E-mail: " . $model->email . "<br/>";
         $body .= "Phone: " . $model->phone . "<br/>";
         $model->body = $body . "<br/>" . strip_tags($model->body) . "<br/>";
         $model->subject = "[Contact-Form] " . $model->subject;
         // SET email settings
         $mail = new ChronoMailer("utf-8");
         $mail->From(Yii::$app->params['adminEmail']);
         $mail->To(Yii::$app->params['adminEmail']);
         $mail->Cc(Yii::$app->params['partnerEmail']);
         //$mail->Bcc(Yii::$app->params['partnerEmail']);
         $mail->Subject($model->subject);
         $mail->Body($model->body, 'html');
         // OPTIONAL SEND-METHOD :: SMTP
         //$mail->smtp_on( 'smtp.copaco.com.py', 'gramacchi', 'ybudxrvv', '587');
         //$mail->smtp_on( 'smtp-mail.outlook.com', '*****@*****.**', 'password', '587');
         // SET SMTP TYPE
         if ($mail->Send()) {
             return 'success';
         } else {
             return $mail->status_mail['message'];
         }
     }
     $msg = "";
     //$msg .= "Yii::app->request->isAjax = ".Yii::$app->request->isAjax.'<br/>';
     //$msg .= "isModelLoaded = ".$isModelLoaded.'<br/>';
     foreach ($model->errors as $errorField => $errorList) {
         if (is_string($errorList)) {
             $msg .= $errorField . ' : ' . $errorList . '<br/>';
         } elseif (is_array($errorList)) {
             foreach ($errorList as $errorMsg) {
                 $msg .= $errorField . ' : ' . $errorMsg . '<br/>';
             }
         }
     }
     return $msg;
 }
Example #20
0
 public function actionOrder()
 {
     $app = Yii::$app;
     $order_partial = '_services';
     if (!$app->request->isAjax) {
         throw new \yii\web\NotFoundHttpException();
     }
     $model = new ContactForm(['scenario' => 'order']);
     if ($app->request->isPost && $model->load($app->request->post())) {
         if ($model->sendOrderEmail()) {
             $model = new ContactForm(['scenario' => 'order']);
             $order_partial = '_order';
         }
         $this->ivars['order_model'] = $model;
     }
     return $this->renderPartial($order_partial);
 }
Example #21
0
 public function actionContact()
 {
     if (Yii::$app->user->can('siteContact')) {
         $model = new ContactForm();
         if ($model->load(Yii::$app->request->post()) && $model->contact(Yii::$app->params['adminEmail'])) {
             Yii::$app->session->setFlash('contactFormSubmitted');
             return $this->refresh();
         }
         return $this->render('contact', ['model' => $model]);
     } else {
         if (Yii::$app->user->isGuest) {
             Yii::$app->user->loginRequired();
         } else {
             throw new ForbiddenHttpException(Yii::t('yii', 'You are not allowed to perform this action.'));
         }
     }
 }
Example #22
0
 public function actionContact()
 {
     $this->layout = 'page';
     $model = new ContactForm();
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         $message = new Message();
         $message->fullname = $model->fullname;
         $message->subject = $model->subject;
         $message->email = $model->email;
         $message->message = $model->message;
         $message->date = time();
         $message->insert();
         Yii::$app->session->setFlash('contactFormSubmitted');
         return $this->refresh();
     } else {
         $customData = CustomData::find()->where(['key' => 'contact'])->one();
         $contactData = json_decode($customData->value, TRUE);
         return $this->render('contact', ['model' => $model, 'contactData' => $contactData]);
     }
 }
 public function actionContact()
 {
     $user = User::findOne(Yii::$app->user->id);
     $contact = new \app\models\Contact();
     $model = new ContactForm();
     if ($model->email == null) {
         $model->email = $user->parent->identity;
     }
     if ($model->load(Yii::$app->request->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.');
         $contact->user_id = $user->id;
         $contact->email = $model->email;
         $contact->subject = $model->subject;
         $contact->body = $model->body;
         $contact->date = date('Y-m-d h:i:s');
         $contact->status = 0;
         $contact->save();
         return $this->refresh();
     }
     return $this->render('contact', ['model' => $model, 'user' => $user]);
 }
Example #24
0
 /**
  * Обрабатываем контактную форму
  * @return string|\yii\web\Response
  */
 public function actionContacts()
 {
     /* Создаем экземпляр класса */
     $model = new ContactForm();
     if (Yii::$app->request->get()) {
         $model->name = Yii::$app->getRequest()->getQueryParam('name');
         $model->email = Yii::$app->getRequest()->getQueryParam('email');
         $model->body = Yii::$app->getRequest()->getQueryParam('text');
         $model->subject = 'subj';
         if ($model->contact(Yii::$app->params['adminEmail'])) {
             return true;
         } else {
             return Yii::$app->params['adminEmail'];
         }
     } else {
         return false;
     }
 }
Example #25
0
<?php

$contact_form = NULL;
$user = '';
/* @var $this \yii\web\View */
/* @var $content string */
use yii\helpers\Html;
use yii\bootstrap\Nav;
use yii\bootstrap\NavBar;
use app\assets\AppAsset;
use yii\widgets\Pjax;
use yii\bootstrap\Modal;
use app\models\LoginForm;
use app\models\RegistrationForm;
use app\models\ContactForm;
$contact_model = new ContactForm();
if ($contact_model->load(Yii::$app->request->post()) && $contact_model->contact(Yii::$app->params['adminEmail'])) {
    Yii::$app->session->setFlash('contactFormSubmitted');
}
$login_model = new LoginForm();
if ($login_model->load(Yii::$app->request->post()) && $login_model->login()) {
    return $this->goBack();
}
$reg_model = new RegistrationForm();
AppAsset::register($this);
?>

<?php 
$this->beginPage();
?>
<!DOCTYPE html>
Example #26
0
 public function actionContact()
 {
     $this->layout = 'frontoffice';
     $model = new ContactForm();
     if ($model->load(Yii::$app->request->post()) && $model->contact(Yii::$app->params['admincorreo'])) {
         Yii::$app->session->setFlash('contactFormSubmitted');
         return $this->refresh();
     } else {
         return $this->render('contact', ['model' => $model]);
     }
 }
Example #27
0
 public function actionContact()
 {
     $model = new ContactForm();
     if ($model->load(Yii::$app->request->post())) {
         $cont = $model->contact(Yii::$app->params['adminEmail']);
         if ($cont == 'enviado') {
             echo "1";
         } else {
             echo $cont;
         }
     } else {
         echo "no post";
     }
 }