Exemplo n.º 1
0
 public function cetak_guru(Request $request)
 {
     $type = $request->input('type');
     $guru = Guru::all();
     switch ($type) {
         case 'pdf':
             $data['guru'] = Guru::all();
             $pdf = PDF::loadView('admin.laporan.cetak_guru', $data)->setOrientation('landscape');
             return $pdf->stream();
             break;
         case 'excel':
             Excel::create('Data Guru', function ($excel) use($guru) {
                 //set properties
                 $excel->setTitle('Data Guru')->setCreator('Jamal Apriadi, S.Kom');
                 $excel->sheet('Laporan Nilai Siswa', function ($sheet) use($guru) {
                     $row = 1;
                     $sheet->row($row, array('No.', 'NIP', 'Nama', 'Mata Pelajaran'));
                     foreach ($guru as $s) {
                         $sheet->row(++$row, array($s->nip, $s->nama, $s->mapel->nm_mapel));
                     }
                 });
             })->export('xls');
             break;
         default:
             # code...
             break;
     }
 }
Exemplo n.º 2
0
 /**
  * Creates data provider instance with search query applied
  *
  * @param array $params
  *
  * @return ActiveDataProvider
  */
 public function search($params)
 {
     $query = Guru::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(['tgl_lahir' => $this->tgl_lahir]);
     $query->andFilterWhere(['wali_kelas' => $this->wali_kelas]);
     $query->andFilterWhere(['like', 'nip', $this->nip])->andFilterWhere(['like', 'password', $this->password])->andFilterWhere(['like', 'nama', $this->nama])->andFilterWhere(['like', 'alamat', $this->alamat])->andFilterWhere(['like', 'agama', $this->agama])->andFilterWhere(['like', 'email', $this->email])->andFilterWhere(['like', 'jns_kelamin', $this->jns_kelamin])->andFilterWhere(['like', 'tempat_lahir', $this->tempat_lahir])->andFilterWhere(['like', 'no_telp', $this->no_telp])->andFilterWhere(['like', 'foto', $this->foto]);
     return $dataProvider;
 }
Exemplo n.º 3
0
 public function getDelete($id)
 {
     $data = ['status' => Guru::remove($id)];
     return response()->json($data);
 }
Exemplo n.º 4
0
 public static function guru()
 {
     $listData = ArrayHelper::map(Guru::find()->all(), 'nip', 'nama');
     return $listData;
 }
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getNipGuru()
 {
     return $this->hasOne(Guru::className(), ['nip' => 'nip']);
 }
Exemplo n.º 6
0
 /**
  * Finds the Guru model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param string $id
  * @return Guru the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Guru::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }
Exemplo n.º 7
0
 public function getGuru()
 {
     $guru = Guru::find($this->getNip());
     return $guru;
 }
Exemplo n.º 8
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $guru = Guru::find($id);
     //cek detail_jadwal
     $detail = DB::table('soal')->where('author', $id)->count();
     if ($detail > 0) {
         Session::flash('pesan', "Data Guru tidak dapat dihapus");
         return Redirect::back();
     }
     $guru->delete();
     Session::flash('pesan', "Data berhasil dihapus");
     return Redirect::to('admin/guru');
 }
Exemplo n.º 9
0
 /**
  * Remove the specified resource from storage.
  *
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function destroy($id)
 {
     $guru = Guru::find($id);
     $guru->delete();
     Session::flash('pesan', "Data berhasil dihapus");
     return Redirect::to('admin/guru');
 }