当前位置: 首页>>代码示例>>PHP>>正文


PHP ContactForm::contact方法代码示例

本文整理汇总了PHP中app\models\ContactForm::contact方法的典型用法代码示例。如果您正苦于以下问题:PHP ContactForm::contact方法的具体用法?PHP ContactForm::contact怎么用?PHP ContactForm::contact使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在app\models\ContactForm的用法示例。


在下文中一共展示了ContactForm::contact方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: 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->render('contact', ['model' => $model]);
 }
开发者ID:HaseProgram,项目名称:royalteams,代码行数:8,代码来源:SiteController.php

示例2: actionIndex

 public function actionIndex()
 {
     $model = new ContactForm();
     if ($model->load(Yii::$app->request->post()) && $model->contact(Setting::get('admin_email'))) {
         Yii::$app->session->setFlash('contactFormSubmitted');
         return $this->refresh();
     }
     return $this->render('index', ['contactForm' => $model]);
 }
开发者ID:egor-pisarev,项目名称:avtodelo22,代码行数:9,代码来源:SiteController.php

示例3: actionIndex

 public function actionIndex()
 {
     $model = new ContactForm();
     if ($model->load(Yii::$app->request->post())) {
         if ($model->contact(Yii::$app->params['contactEmail'])) {
             echo json_encode(['success' => true, 'message' => 'Thank you! Your message has been sent, we\'ll get back to you shortly :)']);
         } else {
             echo json_encode(['success' => false, 'message' => 'An unknown error has occured while sending your message. Please check back soon or email us directly to mailto:' . Yii::$app->params['contactEmail']]);
         }
         exit;
     }
     return $this->render('index', ['allProjects' => $this->getProjects(), 'projectCategories' => $this->getProjectCategories(), 'team' => $this->getTeamMembers(), 'cf' => $model]);
 }
开发者ID:yiidottech,项目名称:site,代码行数:13,代码来源:SiteController.php

示例4: 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', Yii::t('app', 'Thank you for contacting us. We will respond to you as soon as possible.'));
         } else {
             Yii::$app->session->setFlash('error', Yii::t('app', 'There was an error sending email.'));
         }
         return $this->refresh();
     }
     return $this->render('contact', ['model' => $model]);
 }
开发者ID:hlcborg,项目名称:SainsburysScraper,代码行数:18,代码来源:SiteController.php

示例5: actionContact

 public function actionContact()
 {
     $model = new ContactForm();
     if (!Yii::$app->user->isGuest) {
         $model->name = Yii::$app->user->identity->name;
         $model->email = Yii::$app->user->identity->email;
     }
     if ($model->load(Yii::$app->request->post()) && $model->contact(Yii::$app->params['supportEmail'])) {
         Yii::$app->session->setFlash('contactFormSubmitted');
         return $this->refresh();
     } else {
         return $this->render('contact', ['model' => $model]);
     }
 }
开发者ID:Sywooch,项目名称:notes,代码行数:14,代码来源:SiteController.php

示例6: actionMail

 public function actionMail()
 {
     $model = new ContactForm();
     if ($model->load(Yii::$app->request->post()) && $model->contact(Yii::$app->params['adminEmail'])) {
         Yii::$app->session->setFlash('contactFormSubmitted');
         return $this->refresh();
     }
     //if ($form->load(Yii::$app->request->post())){
     $listaMails = "No se ha seleccionado ningun mail.";
     if (isset($_REQUEST['enviar_a'])) {
         $listaMails = $_REQUEST['enviar_a'];
     }
     return $this->render('mail', ['listaMails' => $listaMails, 'model' => $model]);
 }
开发者ID:bay122,项目名称:PCM,代码行数:14,代码来源:AlumnosController.php

示例7: actionContact

 public function actionContact()
 {
     $model = new ContactForm();
     if ($model->load(Yii::$app->request->post()) && $model->contact(Yii::$app->params['adminEmail'])) {
         $post = file_get_contents("php://input");
         $data = json_encode($post);
         print_r($data);
         exit;
         Yii::$app->session->setFlash('contactFormSubmitted');
         return $this->refresh();
     } else {
         return $this->render('contact', ['model' => $model]);
     }
 }
开发者ID:hirenbhut93,项目名称:testdemo,代码行数:14,代码来源:SiteController.php

示例8: 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 {
         if (!Yii::$app->user->isGuest) {
             $model->email = Yii::$app->user->identity->username;
             if (Yii::$app->user->identity->family_member_id) {
                 $model->name = Yii::$app->user->identity->familyMember->name . ' (Família ' . Yii::$app->user->identity->family->name . ' )';
             }
         }
         return $this->render('contact', ['model' => $model]);
     }
 }
开发者ID:afernandes465,项目名称:memoboard,代码行数:16,代码来源:SiteController.php

示例9: actionContact

 /**
  * @return string|\yii\web\Response
  */
 public function actionContact()
 {
     $page = Shop::page(Pages::CONTACT);
     $model = new ContactForm();
     if (!Yii::$app->user->isGuest) {
         /** @var User $identity */
         $identity = Yii::$app->user->identity;
         $model->name = $identity->name;
         $model->email = $identity->email;
     }
     if ($model->load(Yii::$app->request->post()) && $model->contact(Settings::value('general', 'shopEmail'))) {
         Yii::$app->session->setFlash('contactFormSubmitted');
         return $this->refresh();
     }
     return $this->render('contact', ['model' => $model, 'page' => $page]);
 }
开发者ID:vetoni,项目名称:toko,代码行数:19,代码来源:SiteController.php

示例10: testContact

 /**
  * Test contact.
  */
 public function testContact()
 {
     $model = new ContactForm();
     $model->attributes = ['name' => 'Tester', 'email' => 'tester@example.com', 'subject' => 'very important letter subject', 'body' => 'body of current message'];
     $model->contact('admin@example.com');
     $this->specify('email should be send', function () {
         expect('email file should exist', file_exists($this->getMessageFile()))->true();
     });
     $this->specify('message should contain correct data', function () use($model) {
         $emailMessage = file_get_contents($this->getMessageFile());
         expect('email should contain user name', $emailMessage)->contains($model->name);
         expect('email should contain sender email', $emailMessage)->contains($model->email);
         expect('email should contain subject', $emailMessage)->contains($model->subject);
         expect('email should contain body', $emailMessage)->contains($model->body);
     });
 }
开发者ID:elevatesolutions,项目名称:proverbs,代码行数:19,代码来源:ContactFormTest.php

示例11: actionContact

 public function actionContact()
 {
     if (Yii::$app->user->can('siteContact')) {
         $model = new ContactForm();
         if ($model->load(Yii::$app->request->post()) && $model->contact(Yii::$app->params['adminEmail'])) {
             Yii::$app->session->setFlash('contactFormSubmitted');
             return $this->refresh();
         }
         return $this->render('contact', ['model' => $model]);
     } else {
         if (Yii::$app->user->isGuest) {
             Yii::$app->user->loginRequired();
         } else {
             throw new ForbiddenHttpException(Yii::t('yii', 'You are not allowed to perform this action.'));
         }
     }
 }
开发者ID:pyw5pkU9PcdW,项目名称:COMP3421,代码行数:17,代码来源:SiteController.php

示例12: actionContact

 public function actionContact()
 {
     $user = User::findOne(Yii::$app->user->id);
     $contact = new \app\models\Contact();
     $model = new ContactForm();
     if ($model->email == null) {
         $model->email = $user->parent->identity;
     }
     if ($model->load(Yii::$app->request->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.');
         $contact->user_id = $user->id;
         $contact->email = $model->email;
         $contact->subject = $model->subject;
         $contact->body = $model->body;
         $contact->date = date('Y-m-d h:i:s');
         $contact->status = 0;
         $contact->save();
         return $this->refresh();
     }
     return $this->render('contact', ['model' => $model, 'user' => $user]);
 }
开发者ID:livingdreams,项目名称:kidcrossing,代码行数:21,代码来源:SiteController.php

示例13: ContactForm

$contact_form = NULL;
$user = '';
/* @var $this \yii\web\View */
/* @var $content string */
use yii\helpers\Html;
use yii\bootstrap\Nav;
use yii\bootstrap\NavBar;
use app\assets\AppAsset;
use yii\widgets\Pjax;
use yii\bootstrap\Modal;
use app\models\LoginForm;
use app\models\RegistrationForm;
use app\models\ContactForm;
$contact_model = new ContactForm();
if ($contact_model->load(Yii::$app->request->post()) && $contact_model->contact(Yii::$app->params['adminEmail'])) {
    Yii::$app->session->setFlash('contactFormSubmitted');
}
$login_model = new LoginForm();
if ($login_model->load(Yii::$app->request->post()) && $login_model->login()) {
    return $this->goBack();
}
$reg_model = new RegistrationForm();
AppAsset::register($this);
?>

<?php 
$this->beginPage();
?>
<!DOCTYPE html>
<html lang="<?php 
开发者ID:HaseProgram,项目名称:royalteams,代码行数:30,代码来源:main.php

示例14: actionContact

 public function actionContact()
 {
     $this->layout = 'frontoffice';
     $model = new ContactForm();
     if ($model->load(Yii::$app->request->post()) && $model->contact(Yii::$app->params['admincorreo'])) {
         Yii::$app->session->setFlash('contactFormSubmitted');
         return $this->refresh();
     } else {
         return $this->render('contact', ['model' => $model]);
     }
 }
开发者ID:piwi93,项目名称:eloferton,代码行数:11,代码来源:SiteController.php

示例15: actionContact

 public function actionContact()
 {
     $model = new ContactForm();
     if ($model->load(Yii::$app->request->post())) {
         $cont = $model->contact(Yii::$app->params['adminEmail']);
         if ($cont == 'enviado') {
             echo "1";
         } else {
             echo $cont;
         }
     } else {
         echo "no post";
     }
 }
开发者ID:frankpaul142,项目名称:mosaico,代码行数:14,代码来源:SiteController.php


注:本文中的app\models\ContactForm::contact方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。