contact.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. use yii\helpers\Html;
  3. use yii\widgets\ActiveForm;
  4. use yii\captcha\Captcha;
  5. /**
  6. * @var yii\base\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. 'options' => ['class' => 'form-control'],
  32. 'template' => '<div class="row"><div class="col-lg-3">{image}</div><div class="col-lg-6">{input}</div></div>',
  33. ]); ?>
  34. <div class="form-group">
  35. <?=Html::submitButton('Submit', ['class' => 'btn btn-primary']); ?>
  36. </div>
  37. <?php ActiveForm::end(); ?>
  38. </div>
  39. </div>
  40. <?php endif; ?>
  41. </div>