Example #1
0
 public function handleErrorSubmit()
 {
     $message = new ContactMessage();
     $message->setName($this->getRequestParameter('name'));
     $message->setEmail($this->getRequestParameter('email'));
     $message->setMessage($this->getRequestParameter('message'));
     $this->message = $message;
     $this->setTemplate('index');
     myToolkit::prependPageTitle('Contact Us');
     return sfView::SUCCESS;
 }
 public function actionView()
 {
     /** @var $messageModel ContactMessage */
     $messageModel = ContactMessage::model()->findByPk(getParam('id'));
     if ($messageModel->is_new) {
         $messageModel->is_new = 0;
         $messageModel->save();
     }
     $this->render('view', array('model' => $messageModel));
 }
Example #3
0
 public function save()
 {
     $model = new ContactMessage();
     $model->email = $this->email;
     $model->name = $this->name;
     $model->text = $this->message;
     if ($model->save(FALSE)) {
         $this->emailSubject = 'Контактне повідомлення з сайту РЕЗИДЕНТ';
         $this->receiverEmail = Yii::app()->params['emails']['notificationReceiver'];
         $this->emailViewFile = 'contact';
         $this->emailParams = array('name' => $this->name, 'email' => $this->email, 'message' => $this->message);
         $this->senderEmail = Yii::app()->params['emails']['defaultSender'];
         if ($this->sendEmail()) {
             $this->notificationSubject = 'Повідомлення від сайту http://rezydent.com.ua';
             $this->notificationViewFile = 'sender-notification';
             $this->notificationParams = array();
             $this->notificationReceiver = $this->email;
             $this->notificationSender = Yii::app()->params['emails']['defaultSender'];
             $this->sendSenderNotification();
         }
     }
 }
Example #4
0
?>
</div>
    <div class="grayline1"></div>
    <div class="spacerblock_20"></div>
    <div class="mainheader">
        <div class="pad20">
            <span class="headline11"><?php 
echo _('Welcome to the ') . $do_user->company . _(' portal');
?>
</span>
        </div>
    </div>
    <div class="contentfull">
	    <div class="vpad10">
            <?php 
$contact_message = new ContactMessage();
$personalized_message = $contact_message->getPersonalizedMessage($idcontact, $iduser_for_feed);
if ($personalized_message) {
    echo $contact_message->displayPersonalizedMessage($personalized_message);
} else {
    $msg = new Message();
    $msg->setData(array("user_firstname" => $do_user->firstname, "user_lastname" => $do_user->lastname, "user_company" => $do_user->company));
    $msg->getMessage("welcome client portal");
    $msg->setCanClose("no");
    echo $msg->displayMessage();
}
?>
	    </div>
        <div class="grayline2"></div>
        <div class="headline_fuscia"><?php 
echo _('Add a Note or File');
Example #5
0
					    <ul>
                          <li><?php 
    echo $e_generate_url->getLink("Send the address link by email");
    ?>
</li> 
						  <li><?php 
    echo $e_generate_new_url->getLink(_('Generate a new address link'));
    ?>
 </li>
						  <li><?php 
    echo $e_stop_sharing_notes->getLink(_('Stop sharing'));
    ?>
</li>
						  <li>
							<?php 
    $do_contact_msg = new ContactMessage();
    $pers_msg = $do_contact_msg->getPersonalizedMessage($_SESSION['do_contact_portal']->idcontact, $_SESSION['do_User']->iduser);
    ?>
							<a href="#" onclick="showMsgBox(); return false;"><?php 
    echo _('Set a personalized message');
    ?>
</a>
							<div id="portal_msg" style="display:none;">
								<?php 
    $e_portal_msg = new Event("ContactMessage->eventSetPersonalizedMessage");
    $e_portal_msg->addParam("idcontact", $_SESSION['do_contact_portal']->idcontact);
    echo $e_portal_msg->getFormHeader();
    echo $e_portal_msg->getFormEvent();
    ?>
								<textarea name="per_msg" rows="3" cols="50"><?php 
    if ($pers_msg) {
 /**
  * Submit the form
  *
  * @param $data
  * @param $form
  * @return bool|SS_HTTPResponse
  */
 public function Submit($data, $form)
 {
     $recaptchaResponse = $recaptchaResponse = $data['g-recaptcha-response'];
     /** @var Form $form */
     $data = $form->getData();
     /** Set the form state */
     Session::set('FormInfo.Form_' . $this->name . '.data', $data);
     /**
      * reCAPTCHA
      * Based on https://github.com/google/recaptcha
      */
     if ($this->controller->data()->ReCaptchaSiteKey && $this->controller->data()->ReCaptchaSecretKey) {
         $recaptcha = new \ReCaptcha\ReCaptcha($this->controller->data()->ReCaptchaSecretKey);
         $resp = $recaptcha->verify($recaptchaResponse);
         if ($resp->isSuccess()) {
             /**
              * Verified
              */
         } else {
             /**
              * Not Verified
              *
              * @var HTMLText $errors
              */
             $errors = HTMLText::create();
             $html = '';
             /**
              * Error code reference
              * https://developers.google.com/recaptcha/docs/verify
              */
             foreach ($resp->getErrorCodes() as $code) {
                 switch ($code) {
                     case 'missing-input-secret':
                         $html .= _t('ContactForm.RecaptchaMissingInputSecret', 'The secret parameter is missing.');
                         break;
                     case 'invalid-input-secret':
                         $html .= _t('ContactForm.RecaptchaInvalidInputSecret', 'The secret parameter is invalid or malformed.');
                         break;
                     case 'missing-input-response':
                         $html .= _t('ContactForm.RecaptchaMissingInputResponse', 'Please check the reCAPTCHA below to confirm you\'re human.');
                         break;
                     case 'invalid-input-response':
                         $html .= _t('ContactForm.RecaptchaInvalidInputResponse', 'The response parameter is invalid or malformed.');
                         break;
                     default:
                         $html .= _t('ContactForm.RecaptchaDefaultError', 'There was an error submitting the reCAPTCHA, please try again.');
                 }
             }
             $errors->setValue($html);
             $this->controller->setFlash(_t('ContactForm.RecaptchaFormError', 'Your message has not been sent, please fill out all of the <strong>required fields.</strong>'), 'warning');
             $form->addErrorMessage('ReCaptcha', $errors, 'bad', false);
             return $this->controller->redirect($this->controller->Link());
         }
     }
     /** -----------------------------------------
      * Email
      * ----------------------------------------*/
     $data['Logo'] = SiteConfig::current_site_config()->LogoImage();
     $From = $data['Email'];
     $To = $this->controller->data()->MailTo;
     $Subject = SiteConfig::current_site_config()->Title . _t('ContactForm.EmailSubject', ' - Contact message');
     /** @var Email $email */
     $email = Email::create($From, $To, $Subject);
     if ($cc = $this->controller->data()->MailCC) {
         $email->setCc($cc);
     }
     if ($bcc = $this->controller->data()->MailBCC) {
         $email->setBcc($bcc);
     }
     $email->setTemplate('ContactEmail')->populateTemplate($data)->send();
     if ($this->controller->data()->SubmitText) {
         $submitText = $this->controller->data()->SubmitText;
     } else {
         $submitText = _t('ContactForm.SubmitText', 'Thank you for contacting us, we will get back to you as soon as possible.');
     }
     $this->controller->setFlash($submitText, 'success');
     /** -----------------------------------------
      * Records
      * ----------------------------------------*/
     /** @var ContactMessage $contactMessage */
     $contactMessage = ContactMessage::create();
     $form->saveInto($contactMessage);
     $contactMessage->write();
     /** Clear the form state */
     Session::clear('FormInfo.Form_' . $this->name . '.data');
     return $this->controller->redirect($this->controller->data()->Link('?success=1'));
 }