contact.php 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  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. <?php else: ?>
  20. <p>
  21. If you have business inquiries or other questions, please fill out the following form to contact us. Thank you.
  22. </p>
  23. <div class="row">
  24. <div class="col-lg-5">
  25. <?php $form = ActiveForm::begin(['id' => 'contact-form']); ?>
  26. <?= $form->field($model, 'name') ?>
  27. <?= $form->field($model, 'email') ?>
  28. <?= $form->field($model, 'subject') ?>
  29. <?= $form->field($model, 'body')->textArea(['rows' => 6]) ?>
  30. <?= $form->field($model, 'verifyCode')->widget(Captcha::className(), [
  31. 'template' => '<div class="row"><div class="col-lg-3">{image}</div><div class="col-lg-6">{input}</div></div>',
  32. ]) ?>
  33. <div class="form-group">
  34. <?= Html::submitButton('Submit', ['class' => 'btn btn-primary']) ?>
  35. </div>
  36. <?php ActiveForm::end(); ?>
  37. </div>
  38. </div>
  39. <?php endif; ?>
  40. </div>