本文整理汇总了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]);
}
示例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]);
}
示例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]);
}
示例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]);
}
示例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]);
}
}
示例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]);
}
示例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]);
}
}
示例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]);
}
}
示例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]);
}
示例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);
});
}
示例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.'));
}
}
}
示例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]);
}
示例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
示例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]);
}
}
示例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";
}
}