Esempio n. 1
0
 /**
  * Finds the Peserta model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Peserta the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Peserta::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Esempio n. 2
0
 public function searchByEvent($id)
 {
     $query = Peserta::find();
     // add conditions that should always apply here
     $dataProvider = new ActiveDataProvider(['query' => $query]);
     // grid filtering conditions
     $query->innerJoin('absensi', 'absensi.id_peserta = peserta.id');
     $query->andFilterWhere(['id_event' => $id]);
     return $dataProvider;
 }
Esempio n. 3
0
 public function actionSend2()
 {
     //broadcast semua
     $email = new Email();
     if ($email->load(Yii::$app->request->post()) && $email->validate()) {
         $peserta = Peserta::find()->all();
         foreach ($peserta as $key) {
             $temp = $key->email;
             echo $temp;
             $content_template = $email->content;
             //mengambil subjek dari email yang akan dikirimkan
             $subject_template = $email->subject;
             $subject = str_replace("{nama}", $key->nama, $subject_template);
             $content = str_replace("{nama}", $key->nama, $content_template);
             echo "</br>";
             Yii::$app->mailer->compose()->setFrom(Yii::$app->params['adminEmail'])->setHtmlBody($content)->setSubject($subject)->setTo($temp)->send();
         }
     }
 }
Esempio n. 4
0
 public function cetak_peserta(Request $request)
 {
     $type = $request->input('type');
     $idruang = $request->input('ruang');
     $ruang = Ruang::find($idruang);
     $peserta = Peserta::where('id_ruang', $idruang)->get();
     switch ($type) {
         case 'pdf':
             $data['ruang'] = Ruang::find($idruang);
             $data['peserta'] = Peserta::where('id_ruang', $idruang)->get();
             $pdf = PDF::loadView('admin.laporan.cetak-peserta', $data);
             return $pdf->stream();
             break;
         case 'excel':
             Excel::create('Data Peserta', function ($excel) use($ruang, $peserta) {
                 //set properties
                 $excel->setTitle('Data Peserta')->setCreator('Jamal Apriadi, S.Kom');
                 $excel->sheet('Laporan Nilai Siswa', function ($sheet) use($ruang, $peserta) {
                     $row = 1;
                     $sheet->row($row, array('NISN', 'No. Peserta', 'Nama', 'Kelas', 'Password'));
                     foreach ($peserta as $s) {
                         $sheet->row(++$row, array($s->nis, $s->siswa->no_peserta, $s->siswa->nama, $s->siswa->kd_kelas, $s->siswa->password_asli));
                     }
                 });
             })->export('xls');
             break;
         default:
             # code...
             break;
     }
 }
Esempio n. 5
0
 public function waktu_habis()
 {
     $siswa = $this->getSiswa();
     $peserta = Peserta::where('nis', $siswa->nis)->first();
     $jadwal = Session::get('jadwal');
     $detailjadwal = Session::get('detailjadwal');
     DB::table('soal_siswa')->where('id_jadwal', $jadwal)->where('id_detail_jadwal', $detailjadwal)->where('nis', $this->getNis())->update(['selesai' => 'Y']);
     Session::flash('pesan', "Terima Kasih anda telah menyelesaikan ujian");
     Session::forget('jadwal');
     Session::forget('detailjadwal');
     return View('siswa.telah_selesai')->with('siswa', $siswa)->with('peserta', $peserta);
 }
 public function delete_atur_peserta(Request $request)
 {
     if ($request->has('pilih')) {
         $pilih = $request->input('pilih');
         foreach ($pilih as $key => $value) {
             Peserta::find($value)->delete();
         }
         Session::flash('pesan', "Data Berhasil dihapus");
     }
     return Redirect::back();
 }
Esempio n. 7
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdPeserta()
 {
     return $this->hasOne(Peserta::className(), ['id' => 'id_peserta']);
 }