Ejemplo n.º 1
0
 /**
  * Send message to razzded user
  */
 private function sendNotifiRazzd()
 {
     $userModel = new \frontend\models\User();
     $userName = $userModel->getFullname(Yii::$app->user->id);
     $notifi = \Yii::createObject(['class' => Notification::className(), 'uid' => $this->responder_uid, 'message' => 'YOU HAVE BEEN RAZZD BY ' . $userName, 'link' => '<a href="/razz/respond/' . $this->id . '" class="btn">RESPOND</a>', 'created_at' => time()]);
     $notifi->save();
     $userModel = new \frontend\models\User();
     $razdator = $userModel->getFullname(Yii::$app->user->id);
     $vis_a_vis = \frontend\models\User::findOne(['email' => $this->email]);
     $mailer = new \common\helpers\Mandrill($sendTo = $this->email, $subject = 'YOU HAVE BEEN RAZZD BY ' . ucfirst($razdator), $local_tpl_name = null, $sender = null, ['from_name' => '[Notification generator]', 'mandrill_template_name' => 'you-have-been-razzd', 'vars' => ['razee' => ucfirst($vis_a_vis->username), 'header' => $this->title, 'message' => $this->message, 'description' => $this->description, 'razdator' => ucfirst($razdator), 'link' => '<a href="' . Yii::$app->getUrlManager()->createAbsoluteUrl(["razz/respond/" . $this->id]) . '" class="btn">RESPOND</a>']]);
     $result = $mailer->sendWithMandrillTemplate();
     $mess = (string) $result;
     unset($userModel);
 }