本文整理汇总了PHP中frontend\models\ContactForm类的典型用法代码示例。如果您正苦于以下问题:PHP ContactForm类的具体用法?PHP ContactForm怎么用?PHP ContactForm使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ContactForm类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionContact
public function actionContact()
{
$model = new ContactForm();
if ($model->load(\Yii::$app->request->post()) && $model->validate()) {
\Yii::$app->common->sendMail($model->subject, $model->body);
}
return $this->render('contact', ['model' => $model]);
}
示例2: submit
/**
* @param array $contactData
*/
public function submit(array $contactData)
{
$contactForm = new ContactForm();
foreach ($contactData as $field => $value) {
$inputType = $field === 'body' ? 'textarea' : 'input';
$this->actor->fillField($inputType . '[name="' . $contactForm->formName() . '[' . $field . ']"]', $value);
}
$this->actor->click('contact-button');
}
示例3: actionContact
public function actionContact()
{
$model = new ContactForm();
if ($model->load($_POST) && $model->contact(Yii::$app->params['adminEmail'])) {
Yii::$app->session->setFlash('success', 'Thank you for contacting us. We will respond to you as soon as possible.');
return $this->refresh();
} else {
return $this->render('contact', array('model' => $model));
}
}
示例4: actionContact
public function actionContact()
{
$model = new ContactForm();
if ($model->load(Yii::$app->request->post()) && $model->contact(Yii::$app->params['adminEmail'])) {
Yii::$app->session->setFlash('contactFormSubmitted');
return $this->refresh();
} else {
return $this->render('contact', ['model' => $model]);
}
}
示例5: actionFeedback
public function actionFeedback()
{
$model = new ContactForm();
if (Yii::$app->request->isAjax && $model->load(Yii::$app->request->post()) && $model->validate()) {
if ($model->sendEmail(Yii::$app->settings->get('main.supportEmail'))) {
return 'Спасибо за ваше сообщение, мы обязательно ответим вам в ближайшее время.';
} else {
return 'Что то пошло не так :( Попробуйте позднее';
}
}
return 'Что то пошло не так :(';
}
示例6: actionContact
public function actionContact()
{
$model = new ContactForm();
if ($model->load(\Yii::$app->request->post()) && $model->validate()) {
$body = " <div>Body: <b> " . $model->body . " </b></div>";
$body .= " <div>Email: <b> " . $model->email . " </b></div>";
\Yii::$app->common->sendMail($model->subject, $body);
print "Send success";
die;
}
return $this->render("contact", ['model' => $model]);
}
示例7: actionContact
public function actionContact()
{
$model = new ContactForm();
if ($model->load(\Yii::$app->request->post()) && $model->validate()) {
$body = '<div>Body: <b>' . $model->body . ' </b></div>';
$body .= '<div>Email: <b>' . $model->email . ' </b></div>';
\Yii::$app->common->sendMail($model->subject, $body);
print 'Send success';
}
return $this->render('contact', ['model']);
//return $this->render('inner');
}
示例8: actionContact
/**
* Contact.
*/
public function actionContact()
{
$model = new ContactForm();
if ($model->load(\Yii::$app->request->post()) && $model->validate()) {
$success = $model->sendEmail(\Yii::$app->params['adminEmail']);
if ($success) {
\Yii::$app->session->setFlash('success', 'Your message has been sent!');
$this->refresh('#form');
}
}
return $this->render('contact', ['model' => $model]);
}
示例9: actionContact
/**
* Displays the contact static page and sends the contact email.
*
* @return string|\yii\web\Response
*/
public function actionContact()
{
$model = new ContactForm();
if ($model->load(Yii::$app->request->post()) && $model->validate()) {
if ($model->contact(Yii::$app->params['adminEmail'])) {
Yii::$app->session->setFlash('success', 'Thank you for contacting us. We will respond to you as soon as possible.');
} else {
Yii::$app->session->setFlash('error', 'There was an error sending email.');
}
return $this->refresh();
}
return $this->render('contact', ['model' => $model]);
}
示例10: actionContact
public function actionContact()
{
$model = new ContactForm();
if ($model->load(Yii::$app->request->post())) {
if ($model->contact(Yii::$app->params['adminEmail'])) {
Yii::$app->getSession()->setFlash('alert', ['body' => Yii::t('frontend', 'Thank you for contacting us. We will respond to you as soon as possible.'), 'options' => ['class' => 'alert-success']]);
return $this->refresh();
} else {
Yii::$app->getSession()->setFlash('alert', ['body' => \Yii::t('frontend', 'There was an error sending email.'), 'options' => ['class' => 'alert-danger']]);
}
}
return $this->render('contact', ['model' => $model]);
}
示例11: actionContact
/**
* Displays the contact static page and sends the contact email.
*
* @return string|\yii\web\Response
*/
public function actionContact()
{
$model = new ContactForm();
if (!$model->load(Yii::$app->request->post()) || !$model->validate()) {
return $this->render('contact', ['model' => $model]);
}
if (!$model->sendEmail(Yii::$app->params['adminEmail'])) {
Yii::$app->session->setFlash('error', Yii::t('app', 'There was some error while sending email.'));
return $this->refresh();
}
Yii::$app->session->setFlash('success', Yii::t('app', 'Thank you for contacting us. We will respond to you as soon as possible.'));
return $this->refresh();
}
示例12: actionContact
public function actionContact()
{
$model = new ContactForm();
if ($model->load(Yii::$app->request->post()) && $model->validate()) {
if ($model->sendEmail(Yii::$app->params['adminEmail'])) {
Yii::$app->session->setFlash('success', 'Terima kasih sudah menghubungi kami. Pertanyaan anda akan kami jawab secepatnya.. ');
} else {
Yii::$app->session->setFlash('error', 'Maaf pesan gagal dikirim.coba ulangi lagi.');
}
return $this->refresh();
} else {
return $this->render('contact', ['model' => $model]);
}
}
示例13: actionContact
/**
* Displays contact page.
*
* @return mixed
*/
public function actionContact()
{
$model = new ContactForm();
if ($model->load(Yii::$app->request->post()) && $model->validate()) {
if ($model->sendEmail(Yii::$app->params['adminEmail'])) {
Yii::$app->session->setFlash('success', ['type' => 'success', 'duration' => 12000, 'icon' => 'fa fa-envelope', 'message' => 'Thank you for contacting us. We will respond to you as soon as possible.', 'title' => 'Sending Message']);
} else {
Yii::$app->session->setFlash('error', ['type' => 'danger', 'duration' => 12000, 'icon' => 'fa fa-envelope', 'message' => 'There was an error sending email.', 'title' => 'Sending Message']);
}
return $this->refresh();
} else {
return $this->render('contact', ['model' => $model]);
}
}
示例14: actionContact
/**
* Displays contact page.
*
* @return mixed
*/
public function actionContact()
{
$model = new ContactForm();
if ($model->load(Yii::$app->request->post()) && $model->validate()) {
if ($model->sendEmail(Yii::$app->params['adminEmail'])) {
Yii::$app->session->setFlash('success', 'Cảm ơn bạn đã liên hệ với chúng tôi. Chúng tôi sẽ liên hệ lại với bạn trong thời gian sớm nhất.');
} else {
Yii::$app->session->setFlash('error', 'Có lỗi trong quá trình gửi mail.');
}
return $this->refresh();
} else {
return $this->render('contact', ['model' => $model]);
}
}
示例15: actionContact
/**
* Displays contact page.
*
* @return mixed
*/
public function actionContact()
{
$model = new ContactForm();
if ($model->load(Yii::$app->request->post()) && $model->validate()) {
if ($model->sendEmail(Yii::$app->params['adminEmail'])) {
Yii::$app->session->setFlash('success', Yii::t('c/radiata/contact', 'Thank you'));
} else {
Yii::$app->session->setFlash('error', Yii::t('c/radiata/contact', 'Errors'));
}
return $this->refresh();
} else {
return $this->render('contact', ['model' => $model]);
}
}