/** * Creates data provider instance with search query applied * * @param array $params * * @return ActiveDataProvider */ public function search($params) { $query = Ruang::find(); $dataProvider = new ActiveDataProvider(['query' => $query]); $this->load($params); if (!$this->validate()) { // uncomment the following line if you do not want to return any records when validation fails // $query->where('0=1'); return $dataProvider; } $query->andFilterWhere(['id' => $this->id]); $query->andFilterWhere(['like', 'nama', $this->nama]); return $dataProvider; }
public function index() { $tgl = Date('Y-m-d'); $jam = Date('H:i:s'); $pengawas = $this->getPengawas(); $mengawasi = DB::table('view_detail_jadwal')->where('pengawas', $pengawas->nip)->where('tgl_ujian', $tgl)->where('jam', '<=', $jam)->where('selesai', '>=', $jam)->first(); if (count($mengawasi) > 0) { Session::put('id', $mengawasi->id); $ruang = Ruang::find($mengawasi->id_ruang); $mapel = Mapel::find($mengawasi->kd_mapel); return View('pengawas.index')->with('pengawas', $pengawas)->with('mengawasi', $mengawasi)->with('ruang', $ruang)->with('mapel', $mapel); } else { if (Session::has('id')) { $mengawasi = viewDetailJadwal::find(Session::get('id')); $ruang = Ruang::find($mengawasi->id_ruang); $mapel = Mapel::find($mengawasi->kd_mapel); return View('pengawas.index')->with('pengawas', $pengawas)->with('mengawasi', $mengawasi)->with('ruang', $ruang)->with('mapel', $mapel); } else { return View('pengawas.sudah_selesai'); } } }
public function simpan_peserta(Request $request) { $kelas = $request->input('kelas'); $ruang = $request->input('ruang'); $sesi = $request->input('sesi'); $kuota = Ruang::find($ruang); $siswaInpeserta = DB::select("select * from view_peserta_ujian \n where id_ruang='{$ruang}' and kd_kelas='{$kelas}'"); //jika kuota di ruang ujian ini lebih dari siswa yang sudah ada if (count($siswaInpeserta) <= $kuota->kouta) { //masih bisa ditambahkan if ($request->has('nis')) { $nis = $request->input('nis'); foreach ($nis as $key => $value) { $peserta = array('nis' => $value, 'id_ruang' => $ruang, 'no_meja' => count($siswaInpeserta) + 1); DB::table('peserta_ujian')->insert($peserta); } } Session::flash('pesan', "Data Berhasil disimpan"); return Redirect::to('admin/atur-peserta/' . $ruang); } else { Session::flash('pesan', "Data Gagal disimpan"); } // return Redirect::to('admin/atur-peserta/1'); }
/** * @return \yii\db\ActiveQuery */ public function getRuang() { return $this->hasOne(Ruang::className(), ['id' => 'ruang_id']); }
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; } }
/** * Finds the Ruang model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Ruang the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Ruang::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
public function detail_jadwal($id) { $djadwal = Djadwal::find($id); $kelas = Kelas::all(); $ruang = Ruang::all(); $pengawas = Pengawas::all(); return View('admin.jadwal.detail_jadwal')->with('jadwal', $djadwal)->with('kelas', $kelas)->with('ruang', $ruang)->with('pengawas', $pengawas); }
/** * Remove the specified resource from storage. * * @param int $id * @return \Illuminate\Http\Response */ public function destroy($id) { $ruang = Ruang::find($id); $ruang->delete(); Session::flash('pesan', "Data Berhasil dihapus"); return Redirect::to('admin/ruang'); }