contact.php 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  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. <h1><?php echo Html::encode($this->title); ?></h1>
  14. <?php if (Yii::$app->session->hasFlash('contactFormSubmitted')): ?>
  15. <div class="alert alert-success">
  16. Thank you for contacting us. We will respond to you as soon as possible.
  17. </div>
  18. <?php return; endif; ?>
  19. <p>
  20. If you have business inquiries or other questions, please fill out the following form to contact us. Thank you.
  21. </p>
  22. <div class="row">
  23. <div class="col-lg-5">
  24. <?php $form = ActiveForm::begin(array('id' => 'contact-form')); ?>
  25. <?php echo $form->field($model, 'name')->textInput(); ?>
  26. <?php echo $form->field($model, 'email')->textInput(); ?>
  27. <?php echo $form->field($model, 'subject')->textInput(); ?>
  28. <?php echo $form->field($model, 'body')->textArea(array('rows' => 6)); ?>
  29. <?php echo $form->field($model, 'verifyCode')->widget(Captcha::className(), array(
  30. 'options' => array('class' => 'form-control'),
  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-actions">
  34. <?php echo Html::submitButton('Submit', array('class' => 'btn btn-primary')); ?>
  35. </div>
  36. <?php ActiveForm::end(); ?>
  37. </div>
  38. </div>