contact.php 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  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. </div>
  19. <p>
  20. Note that if you turn on the Yii debugger, you should be able
  21. to view the mail message on the mail panel of the debugger.
  22. <?php if (Yii::$app->mail->useFileTransport): ?>
  23. Because the application is in development mode, the email is not sent but saved as
  24. a file under <code><?= Yii::getAlias(Yii::$app->mail->fileTransportPath) ?></code>.
  25. Please configure the <code>useFileTransport</code> property of the <code>mail</code>
  26. application component to be false to enable email sending.
  27. <?php endif; ?>
  28. </p>
  29. <?php else: ?>
  30. <p>
  31. If you have business inquiries or other questions, please fill out the following form to contact us. Thank you.
  32. </p>
  33. <div class="row">
  34. <div class="col-lg-5">
  35. <?php $form = ActiveForm::begin(['id' => 'contact-form']); ?>
  36. <?= $form->field($model, 'name') ?>
  37. <?= $form->field($model, 'email') ?>
  38. <?= $form->field($model, 'subject') ?>
  39. <?= $form->field($model, 'body')->textArea(['rows' => 6]) ?>
  40. <?= $form->field($model, 'verifyCode')->widget(Captcha::className(), [
  41. 'template' => '<div class="row"><div class="col-lg-3">{image}</div><div class="col-lg-6">{input}</div></div>',
  42. ]) ?>
  43. <div class="form-group">
  44. <?= Html::submitButton('Submit', ['class' => 'btn btn-primary', 'name' => 'contact-button']) ?>
  45. </div>
  46. <?php ActiveForm::end(); ?>
  47. </div>
  48. </div>
  49. <?php endif; ?>
  50. </div>