예제 #1
0
 public static function getBodyText($calenderEvent, $companyOntvanger, $companyAanbieder, $contractdeal)
 {
     //afhankelijk van de gebruikte code_title wordt een bepaalde email verzonden
     $model = EmailMessages::findOne(['code_title' => $calenderEvent->code_title]);
     self::$CONTACTPERSOONAANBIEDER = $companyAanbieder->profile->full_name;
     self::$FNAAMAANBIEDER = $companyAanbieder->name;
     self::$TELEFOONAANBIEDER = $companyAanbieder->telephone;
     self::$CPONTVANGER = $companyOntvanger->profile->full_name;
     self::$DIENST = CalendarCodeTitles::findOne(['code_title' => $calenderEvent->code_title])->title;
     self::$AANVANGSTIJD = date("d-m-Y", strtotime($calenderEvent->start)) . ' om ' . $contractdeal->aanvangstijd;
     self::$RPFLINK = '<a href=http://www.werkmetspoor.nl' . Url::base() . '/index.php/calendar-events/mijnkalender?_id=' . $calenderEvent->user_id . '&_dd=' . substr($calenderEvent->start, 0, 10) . '>www.werkmetspoor.nl</a>';
     self::$PLAATS = $contractdeal->city;
     self::$LOKATIE = $contractdeal->location;
     $bodytext = $model->body;
     return preg_replace_callback('/\\{([A-Z]+)\\}/', function ($matches) {
         $a = '';
         switch ($matches[0]) {
             case '{CONTACTPERSOONAANBIEDER}':
                 $a = self::$CONTACTPERSOONAANBIEDER;
                 break;
             case '{FNAAMAANBIEDER}':
                 $a = self::$FNAAMAANBIEDER;
                 break;
             case '{TELEFOONAANBIEDER}':
                 $a = self::$TELEFOONAANBIEDER;
                 break;
             case '{CPONTVANGER}':
                 $a = self::$CPONTVANGER;
                 break;
             case '{DIENST}':
                 $a = self::$DIENST;
                 break;
             case '{AANVANGSTIJD}':
                 $a = self::$AANVANGSTIJD;
                 break;
             case '{RPFLINK}':
                 $a = self::$RPFLINK;
                 break;
             case '{PLAATS}':
                 $a = self::$PLAATS;
                 break;
             case '{LOKATIE}':
                 $a = self::$LOKATIE;
                 break;
             default:
                 $a = '';
         }
         return $a;
     }, $bodytext);
 }
예제 #2
0
 public static function getBodyText($calenderEvent, $companyOntvanger, $companyAanbieder, $contractdeal)
 {
     //afhankelijk van de gebruikte code_title wordt een bepaalde email verzonden
     $model = EmailMessages::findOne(['code_title' => $calenderEvent->code_title]);
     $CONTACTPERSOONAANBIEDER = $companyAanbieder->profile->full_name;
     $FNAAMAANBIEDER = $companyAanbieder->name;
     $TELEFOONAANBIEDER = $companyAanbieder->telephone;
     $CPONTVANGER = $companyOntvanger->profile->full_name;
     $DIENST = CalendarCodeTitles::findOne(['code_title' => $calenderEvent->code_title])->title;
     $AANVANGSTIJD = date("d-m-Y", strtotime($calenderEvent->start)) . ' om ' . $contractdeal->aanvangstijd;
     $RPFLINK = '<a href=https://rail4people-jaccos.c9.io/' . Url::base() . '/index.php/calendar-events/mijnkalender?_id=' . $calenderEvent->user_id . '&_dd=' . substr($calenderEvent->start, 0, 10) . '>www.werkmetspoor.nl</a>';
     $PLAATS = $contractdeal->city;
     $LOKATIE = $contractdeal->location;
     $bodytext = $model->body;
     return preg_replace('/\\{([A-Z]+)\\}/e', "\$\$1", $bodytext);
 }
 public function actionUpdate()
 {
     //at update a $_POST is coming in here
     $calenderEvent = CalendarEvents::updateEvent($_POST);
     //als er nog geen contract_deal (event van Avail => Contr)  is aangelegd voor deze gebruiker dan wordt deze hier aangemaakt
     if (!ContractDeals::findOne(['event_id' => $calenderEvent->id])) {
         ContractDeals::newContractDeal($calenderEvent);
     }
     if (1 == 1) {
         // als er een contract wordt aangeboden wordt er een email verstuurd naar beide partijen
         // dus de code titel moet ziin ddContr of ndContr voordat er gemaild wordt
         if (strpos($calenderEvent->code_title, 'Contr') >= 0) {
             //email naar company CP ontvangende partij.
             $contractdeal = ContractDeals::findOne(['event_id' => $calenderEvent->id]);
             $company = Company::findOne(['user_id' => $contractdeal->user_id]);
             //$user_to            = User::findOne(['id'=>$contractdeal->user_id]);
             $userContactperson = User::findOne(['id' => $company->user_id]);
             //user_id = contactperson
             $emailBodyText = EmailMessages::getBodyText($calenderEvent->code_title, $company->name, $user_to->username);
             print_r($emailBodyText);
             exit;
             Yii::$app->mailer->compose()->setTo($userContactperson->email)->setFrom([$userContactperson->email => $userContactperson->email])->setSubject('RPF | Contract aangeboden door ' . $company->name)->setHtmlBody($emailBodyText)->send();
         } else {
             if ($calenderEvent->code_title == 'ddAccep' || $calenderEvent->code_title == 'ndAccep') {
                 Yii::$app->mailer->compose()->setTo('*****@*****.**')->setFrom(['*****@*****.**' => 'RailPeopleFirst'])->setSubject('Contract geaccepteerd...')->setTextBody('Het contract is geaccepteerd door...')->send();
             }
         }
     }
 }
예제 #4
0
 /**
  * Finds the EmailMessages model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return EmailMessages the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = EmailMessages::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
예제 #5
0
<?php

use yii\helpers\Html;
use yii\widgets\ActiveForm;
use yii\helpers\ArrayHelper;
use app\models\EmailMessages;
use dosamigos\ckeditor\CKEditor;
/* @var $this yii\web\View */
/* @var $model amnah\yii2\user\models\Abonnement */
/* @var $form yii\widgets\ActiveForm */
$dataList = ArrayHelper::map(EmailMessages::find()->where(['partof' => 'Abonnementen'])->asArray()->all(), 'id', 'name');
?>

<div class="abonnement-form">

    <?php 
$form = ActiveForm::begin();
?>
    <?php 
echo $form->field($model, 'name')->textInput(['maxlength' => 100]);
?>
 
     <?php 
echo $form->field($model, 'description')->widget(CKEditor::className(), ['options' => ['rows' => 20], 'preset' => 'basic']);
?>

    
    
    <?php 
echo $form->field($model, 'prijs')->textInput(['maxlength' => 10]);
?>