本文整理汇总了PHP中app\models\ContactForm类的典型用法代码示例。如果您正苦于以下问题:PHP ContactForm类的具体用法?PHP ContactForm怎么用?PHP ContactForm使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ContactForm类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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()) && $model->validate()) {
\Yii::$app->session->setFlash('contactFormSubmitted');
return $this->refresh();
} else {
return $this->render('index', ['model' => $model]);
}
}
开发者ID:xiaohongyang,项目名称:yii_shop,代码行数:10,代码来源:Test2Controller.php
示例4: actionForm
public function actionForm()
{
$model = new ContactForm();
if ($model->load(Yii::$app->request->post())) {
if ($model->validate()) {
return $this->render('entry-confirm', ['model' => $model]);
return;
}
}
return $this->render('form', ['model' => $model]);
}
开发者ID:rostiknaz,项目名称:yii2,代码行数:11,代码来源:SiteController.php
示例5: 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]);
}
开发者ID:karliv,项目名称:construction_company,代码行数:12,代码来源:MainController.php
示例6: actionContact
/**
* @param null|\app\core\admpages\models\Page $modelPage
* @return string|\yii\web\Response
*/
public function actionContact($modelPage = null)
{
$model = new ContactForm();
if ($model->load(Yii::$app->request->post()) && $model->validate()) {
if ($model->sendEmail()) {
Yii::$app->session->setFlash('success', Yii::t("app/contacts", "Thank you for contacting us. We will respond to you as soon as possible.", ['dot' => false]));
return $this->refresh();
}
Yii::$app->session->setFlash('error', Yii::t("app/contacts", "There was an error sending email.", ['dot' => false]));
}
return $this->render('contact', ['model' => $model, 'modelPage' => $modelPage]);
}
开发者ID:pavlinter,项目名称:yii2-app-core,代码行数:16,代码来源:PagesController.php
示例7: 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
示例8: 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
示例9: actionContact
public function actionContact()
{
$model = new ContactForm();
if (Yii::$app->request->isAjax && $model->load(Yii::$app->request->post())) {
Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
// Validate all but captcha:
return FnActiveForm::validate($model);
}
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]);
}
开发者ID:foundationize,项目名称:yii2,代码行数:14,代码来源:SiteController.php
示例10: 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
示例11: 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', '感谢您与我们联系。 我们将尽快回复您.');
} else {
Yii::$app->session->setFlash('error', '送电子邮件时出现错误。');
}
return $this->refresh();
} else {
return $this->render('contact', ['model' => $model]);
}
}
开发者ID:hehbhehb,项目名称:hongsong,代码行数:14,代码来源:SiteController.php
示例12: 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
示例13: 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
示例14: 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', 'Dank u voor uw bericht. Wij zullen zo spoedig mogelijk contact met u opnemen.');
} else {
Yii::$app->session->setFlash('error', 'Er ging iets fout met het versturen');
}
return $this->refresh();
} else {
return $this->render('contact', ['model' => $model, 'page' => 'page-contact']);
}
//return $this->render('contact', ['page' => 'page-contact']);
}
开发者ID:amavis442,项目名称:vpjuristen,代码行数:15,代码来源:SiteController.php
示例15: actionContact
public function actionContact()
{
$model = new ContactForm();
if ($model->load(Yii::$app->request->post())) {
$model->name = $_POST['ContactForm']['name'];
$model->message = $_POST['ContactForm']['message'];
$model->phone = $_POST['ContactForm']['phone'];
if ($model->save()) {
Yii::$app->response->redirect(array('site/contact', 'model' => $model));
}
return $this->refresh();
} else {
return $this->render('contact', ['model' => $model]);
}
}
开发者ID:Evkazolinium,项目名称:yiiBasicTest,代码行数:15,代码来源:SiteController.php
示例16: 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
示例17: testContact
public function testContact()
{
$model = new ContactForm();
$model->attributes = ['name' => 'Tester', 'email' => '[email protected]', 'subject' => 'very important letter subject', 'body' => 'body of current message'];
$model->sendEmail('[email protected]');
$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:Humanized,项目名称:viajero,代码行数:16,代码来源:ContactFormTest.php
示例18: 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
示例19: actionContactajax
public function actionContactajax()
{
// FORMAT_HTML , FORMAT_JSON , FORMAT_JSONP , FORMAT_RAW , FORMAT_XML
Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
$model = new ContactForm();
$isModelLoaded = $model->load(['ContactForm' => Yii::$app->request->post()]);
if ($isModelLoaded && $model->validate()) {
// SET email variables
$body = "";
$body .= "From: " . $model->name . "<br/>";
$body .= "E-mail: " . $model->email . "<br/>";
$body .= "Phone: " . $model->phone . "<br/>";
$model->body = $body . "<br/>" . strip_tags($model->body) . "<br/>";
$model->subject = "[Contact-Form] " . $model->subject;
// SET email settings
$mail = new ChronoMailer("utf-8");
$mail->From(Yii::$app->params['adminEmail']);
$mail->To(Yii::$app->params['adminEmail']);
$mail->Cc(Yii::$app->params['partnerEmail']);
//$mail->Bcc(Yii::$app->params['partnerEmail']);
$mail->Subject($model->subject);
$mail->Body($model->body, 'html');
// OPTIONAL SEND-METHOD :: SMTP
//$mail->smtp_on( 'smtp.copaco.com.py', 'gramacchi', 'ybudxrvv', '587');
//$mail->smtp_on( 'smtp-mail.outlook.com', '[email protected]', 'password', '587');
// SET SMTP TYPE
if ($mail->Send()) {
return 'success';
} else {
return $mail->status_mail['message'];
}
}
$msg = "";
//$msg .= "Yii::app->request->isAjax = ".Yii::$app->request->isAjax.'<br/>';
//$msg .= "isModelLoaded = ".$isModelLoaded.'<br/>';
foreach ($model->errors as $errorField => $errorList) {
if (is_string($errorList)) {
$msg .= $errorField . ' : ' . $errorList . '<br/>';
} elseif (is_array($errorList)) {
foreach ($errorList as $errorMsg) {
$msg .= $errorField . ' : ' . $errorMsg . '<br/>';
}
}
}
return $msg;
}
开发者ID:juanchi008,项目名称:playa_auto,代码行数:46,代码来源:SiteController.php
示例20: actionOrder
public function actionOrder()
{
$app = Yii::$app;
$order_partial = '_services';
if (!$app->request->isAjax) {
throw new \yii\web\NotFoundHttpException();
}
$model = new ContactForm(['scenario' => 'order']);
if ($app->request->isPost && $model->load($app->request->post())) {
if ($model->sendOrderEmail()) {
$model = new ContactForm(['scenario' => 'order']);
$order_partial = '_order';
}
$this->ivars['order_model'] = $model;
}
return $this->renderPartial($order_partial);
}
开发者ID:secondsano,项目名称:mebel,代码行数:17,代码来源:SiteController.php
注:本文中的app\models\ContactForm类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论