contact.php 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  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. Application is in debug mode, message was logged under <code><?= Yii::getAlias(Yii::$app->mail->fileTransportPath); ?> </code>.
  19. You can also view it in debug module on mail panel.
  20. </div>
  21. <?php else: ?>
  22. <p>
  23. If you have business inquiries or other questions, please fill out the following form to contact us. Thank you.
  24. </p>
  25. <div class="row">
  26. <div class="col-lg-5">
  27. <?php $form = ActiveForm::begin(['id' => 'contact-form']); ?>
  28. <?= $form->field($model, 'name') ?>
  29. <?= $form->field($model, 'email') ?>
  30. <?= $form->field($model, 'subject') ?>
  31. <?= $form->field($model, 'body')->textArea(['rows' => 6]) ?>
  32. <?= $form->field($model, 'verifyCode')->widget(Captcha::className(), [
  33. 'template' => '<div class="row"><div class="col-lg-3">{image}</div><div class="col-lg-6">{input}</div></div>',
  34. ]) ?>
  35. <div class="form-group">
  36. <?= Html::submitButton('Submit', ['class' => 'btn btn-primary']) ?>
  37. </div>
  38. <?php ActiveForm::end(); ?>
  39. </div>
  40. </div>
  41. <?php endif; ?>
  42. </div>