コード例 #1
0
 /**
  * Creates a new Peserta model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Peserta();
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         return $this->redirect(['view', 'id' => $model->id]);
     } else {
         return $this->render('create', ['model' => $model]);
     }
 }
コード例 #2
0
 /**
  * Creates a new Peserta model.
  * If creation is successful, the browser will be redirected to the 'view' page.
  * @return mixed
  */
 public function actionCreate()
 {
     $model = new Peserta();
     $this->layout = 'frontend.php';
     if ($model->load(Yii::$app->request->post()) && $model->save()) {
         $subject = "Pendaftaran Seminar di Unpar Career Expo";
         $content = "Dear {$model->nama}, <br>\n            Terima kasih telah mendaftar di seminar Unpar Career Expo November 2015. <br>\n            Berikut adalah daftar seminar yang Anda ikuti:<br><br>\n            <ul>\n            ";
         foreach ($model->eventsData as $event) {
             $content .= "<li><span class='event-detail'><b>{$event->nama}</b><br>{$event->deskripsi}<br><small>{$event->jadwal}</small></span><br><br></li>";
         }
         $content .= "</ul><br><br>\n            <b>Lokasi Seminar: </b><br>\n            Universitas Katolik Parahyangan <br>\n            Jl. Ciumbuleuit No. 94 <br>\n            Bandung - 40141 <br>\n            Gedung Rektorat <br>\n            Ruang Operation Room <br><br>\n            Sampai jumpat di acara seminarnya. Jika memerlukan bantuan silakan hubungi kami di:<br>\n            +62-22-2032655 ext. 100120 / 100126 <br>\n            Dian - 0857 4105 3212<br><br>\n            Best regards,<br>Panitia Unpar Career Expo & Seminar";
         Yii::$app->mailer->compose()->setFrom(Yii::$app->params['adminEmail'])->setHtmlBody($content)->setSubject($subject)->setTo($model->email)->send();
         Yii::$app->session->setFlash('success', 'Pendaftaran berhasil! Terima kasih.');
         return $this->refresh();
     } else {
         $model_event = Event::find()->all();
         return $this->render('create', ['model' => $model, 'model_event' => $model_event]);
     }
 }