contact.php 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. <?php
  2. /** @var yii\web\View $this */
  3. /** @var yii\bootstrap4\ActiveForm $form */
  4. /** @var app\models\ContactForm $model */
  5. use yii\bootstrap4\ActiveForm;
  6. use yii\bootstrap4\Html;
  7. use yii\captcha\Captcha;
  8. $this->title = 'Contact';
  9. $this->params['breadcrumbs'][] = $this->title;
  10. ?>
  11. <div class="site-contact">
  12. <h1><?= Html::encode($this->title) ?></h1>
  13. <?php if (Yii::$app->session->hasFlash('contactFormSubmitted')): ?>
  14. <div class="alert alert-success">
  15. Thank you for contacting us. We will respond to you as soon as possible.
  16. </div>
  17. <p>
  18. Note that if you turn on the Yii debugger, you should be able
  19. to view the mail message on the mail panel of the debugger.
  20. <?php if (Yii::$app->mailer->useFileTransport): ?>
  21. Because the application is in development mode, the email is not sent but saved as
  22. a file under <code><?= Yii::getAlias(Yii::$app->mailer->fileTransportPath) ?></code>.
  23. Please configure the <code>useFileTransport</code> property of the <code>mail</code>
  24. application component to be false to enable email sending.
  25. <?php endif; ?>
  26. </p>
  27. <?php else: ?>
  28. <p>
  29. If you have business inquiries or other questions, please fill out the following form to contact us.
  30. Thank you.
  31. </p>
  32. <div class="row">
  33. <div class="col-lg-5">
  34. <?php $form = ActiveForm::begin(['id' => 'contact-form']); ?>
  35. <?= $form->field($model, 'name')->textInput(['autofocus' => true]) ?>
  36. <?= $form->field($model, 'email') ?>
  37. <?= $form->field($model, 'subject') ?>
  38. <?= $form->field($model, 'body')->textarea(['rows' => 6]) ?>
  39. <?= $form->field($model, 'verifyCode')->widget(Captcha::className(), [
  40. 'template' => '<div class="row"><div class="col-lg-3">{image}</div><div class="col-lg-6">{input}</div></div>',
  41. ]) ?>
  42. <div class="form-group">
  43. <?= Html::submitButton('Submit', ['class' => 'btn btn-primary', 'name' => 'contact-button']) ?>
  44. </div>
  45. <?php ActiveForm::end(); ?>
  46. </div>
  47. </div>
  48. <?php endif; ?>
  49. </div>