contact.php 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <?php
  2. use yii\helpers\Html;
  3. use yii\widgets\ActiveForm;
  4. use yii\captcha\Captcha;
  5. /**
  6. * @var yii\web\View $this
  7. * @var yii\widgets\ActiveForm $form
  8. * @var app\models\ContactForm $model
  9. */
  10. $this->title = 'Contact';
  11. $this->params['breadcrumbs'][] = $this->title;
  12. ?>
  13. <div class="site-contact">
  14. <h1><?= Html::encode($this->title) ?></h1>
  15. <?php if (Yii::$app->session->hasFlash('contactFormSubmitted')): ?>
  16. <div class="alert alert-success">
  17. Thank you for contacting us. We will respond to you as soon as possible.
  18. <?php if (Yii::$app->mail->useFileTransport): ?>
  19. Application is in debug mode, message was logged under <code><?= Yii::getAlias(Yii::$app->mail->fileTransportPath); ?> </code>.
  20. <?php endif; ?>
  21. You can also view message in debug module on mail panel.
  22. </div>
  23. <?php else: ?>
  24. <p>
  25. If you have business inquiries or other questions, please fill out the following form to contact us. Thank you.
  26. </p>
  27. <div class="row">
  28. <div class="col-lg-5">
  29. <?php $form = ActiveForm::begin(['id' => 'contact-form']); ?>
  30. <?= $form->field($model, 'name') ?>
  31. <?= $form->field($model, 'email') ?>
  32. <?= $form->field($model, 'subject') ?>
  33. <?= $form->field($model, 'body')->textArea(['rows' => 6]) ?>
  34. <?= $form->field($model, 'verifyCode')->widget(Captcha::className(), [
  35. 'template' => '<div class="row"><div class="col-lg-3">{image}</div><div class="col-lg-6">{input}</div></div>',
  36. ]) ?>
  37. <div class="form-group">
  38. <?= Html::submitButton('Submit', ['class' => 'btn btn-primary']) ?>
  39. </div>
  40. <?php ActiveForm::end(); ?>
  41. </div>
  42. </div>
  43. <?php endif; ?>
  44. </div>