コード例 #1
0
 public function create()
 {
     $instructors = DB::table('users')->where('user_role', '2')->lists('user_name', 'user_id');
     $course_times = Course_time::lists('course_time_name', 'course_time_id');
     $semesters = Semester::lists('semester_name', 'semester_id');
     return view('courses.create')->with('instructors', $instructors)->with('semesters', $semesters)->with('course_times', $course_times);
 }
コード例 #2
0
ファイル: Absensi.php プロジェクト: hermitpopcorn/arkxiii
 public static function get_absensi($id_siswa, $id_semester = false)
 {
     if (!$id_semester) {
         $id_semester = Semester::get_active_semester()->id;
     }
     return self::where('id_siswa', $id_siswa)->where('id_semester', $id_semester)->first();
 }
コード例 #3
0
ファイル: Pkl.php プロジェクト: hermitpopcorn/arkxiii
 public static function get_catatan($id_siswa, $mitra, $lokasi, $id_semester = null)
 {
     if (!$id_semester) {
         $id_semester = Semester::get_active_semester()->id;
     }
     return self::where('id_siswa', $id_siswa)->where('mitra', $mitra)->where('lokasi', $lokasi)->where('id_semester', $id_semester)->first();
 }
コード例 #4
0
 public function mass(Request $request)
 {
     if (!$request->ajax()) {
         abort(404);
     }
     $semester = Semester::get_active_semester()->id;
     if (!($prevSemester = Semester::get_previous_semester())) {
         return response("Semester sebelumnya tidak dapat ditemukan.", 422);
     }
     $prevSemester = $prevSemester->id;
     if ($request->input('type') == 2) {
         $backup = null;
         try {
             $backup = Mengajar::reset($semester);
         } catch (Exception $e) {
             return response("Penghapusan aturan asosiasi gagal dilakukan.", 422);
         }
         return response("Penghapusan berhasil.", 200);
     }
     if ($request->input('type') == 1) {
         $copy = null;
         try {
             $copy = Mengajar::copy($prevSemester, $semester);
         } catch (Exception $e) {
             return response("Penyalinan aturan asosiasi dari semester sebelumnya gagal dilakukan.", 422);
         }
         return response("Proses penyamaan selesai. {$copy['success']} entri asosiasi berhasil disamakan." . ($copy['fail'] > 0 ? " {$copy['fail']} entri gagal disamakan karena entri sudah ada atau tidak ditemukannya kelas." : ""), 200);
     }
 }
コード例 #5
0
 public function setup(Request $request)
 {
     // Set semester
     $new = new Semester();
     $new->semester = $request->input('semester');
     $new->tahun_ajaran = $request->input('tahun_ajaran');
     $new->aktif = 1;
     $new->save();
     $input = $request->except(['_token', 'semester', 'tahun_ajaran']);
     // Set pengaturan
     foreach ($input as $key => $value) {
         Pengaturan::vset($key, $value);
     }
     // Cek apakah mata pelajaran wali kelas sudah ada, kalau belum, tambah
     $wk = Mapel::where('kelompok', 'WK')->get();
     if (!$wk) {
         App\Mapel::create(['nama' => 'Wali kelas', 'singkat' => 'WALI', 'kelompok' => 'WK']);
     }
     return redirect()->route('kelas.jurusan')->with('message', "Data semester dan informasi sekolah telah dikonfigurasi.");
 }
コード例 #6
0
ファイル: Mengajar.php プロジェクト: hermitpopcorn/arkxiii
 /**
  * Mengecek apakah ada guru yang belum mendapat asosiasi pengajaran
  * @param  integer  $semester  ID dari semester yang ingin dicek. Secara default menggunakan ID semester yang aktif
  * @return integer             Jumlah guru yang belum mendapat asosiasi
  */
 public static function check($semester = null)
 {
     $guru = Guru::where('staf', 0)->orWhere('staf', 2)->get()->count();
     if ($guru < 1) {
         return -1;
     }
     $asosiasi = self::join('guru', 'guru.id', '=', 'mengajar.id_guru')->where('mengajar.id_semester', $semester ? $semester : Semester::get_active_semester()->id)->where(function ($q) {
         $q->where('staf', 0)->orWhere('staf', 2);
     })->groupBy('guru.id')->get()->count();
     return $guru - $asosiasi;
 }
コード例 #7
0
ファイル: Prestasi.php プロジェクト: hermitpopcorn/arkxiii
 public static function get_table_data($request = null)
 {
     $semester = Semester::get_active_semester()->id;
     if ($request != null) {
         if ($request->input('semester')) {
             $semester = $request->input('semester');
         }
     }
     $data = self::select(DB::raw("\n            siswa.nis as `NIS`,\n            siswa.nama as `Nama`, nilai_prestasi.prestasi as `Prestasi`,\n            nilai_prestasi.keterangan as `Keterangan`,\n            nilai_prestasi.id as `id`\n        "))->join('siswa', 'siswa.id', '=', 'nilai_prestasi.id_siswa')->where('id_semester', $semester)->get()->toArray();
     return ['data' => $data];
 }
コード例 #8
0
 /**
  * Store a newly created resource in storage.
  *
  * @param  \Illuminate\Http\Request $request
  * @return \Illuminate\Http\Response
  */
 public function store(saveCourseRequest $request)
 {
     $course = new Course($request->except(['department', 'semester']));
     $department = Department::where('code', $request->input('department'))->first();
     $semester = Semester::find($request->input('semester'));
     $course->department()->associate($department);
     $course->semester()->associate($semester);
     $course->save();
     $request->session()->flash('status', 'Course was saved successful!');
     return back();
 }
コード例 #9
0
ファイル: Mapel.php プロジェクト: hermitpopcorn/arkxiii
 public static function get_details($id)
 {
     $mapel = self::find($id);
     if (!$mapel) {
         return false;
     }
     $details = ['id' => $id, 'nama' => $mapel->nama, 'singkat' => $mapel->singkat, 'kelompok' => $mapel->kelompok];
     $kb = $mapel->ketuntasan_belajar->where('id_semester', Semester::get_active_semester()->id)->first();
     if ($kb) {
         $details = array_merge($details, ['kb_tingkat_1p' => $kb->kb_tingkat_1p, 'kb_tingkat_1k' => $kb->kb_tingkat_1k, 'kb_tingkat_2p' => $kb->kb_tingkat_2p, 'kb_tingkat_2k' => $kb->kb_tingkat_2k, 'kb_tingkat_3p' => $kb->kb_tingkat_3p, 'kb_tingkat_3k' => $kb->kb_tingkat_3k]);
     }
     return $details;
 }
コード例 #10
0
ファイル: NilaiAkhir.php プロジェクト: hermitpopcorn/arkxiii
 public static function get_all_nilai($siswa, $mapel_list)
 {
     $data = [];
     $tingkat = $siswa->kelas_link->tingkat;
     foreach ($mapel_list as $entry) {
         $id_mapel = $entry->id_mapel;
         $mapel = Mapel::find($id_mapel);
         $nilai = self::get_nilai($siswa->id, $id_mapel);
         $kb = $mapel->ketuntasan_belajar->where('id_semester', Semester::get_active_semester()->id)->first();
         if ($kb) {
             if ($tingkat == 1) {
                 $kbp = $kb->kb_tingkat_1p;
             } elseif ($tingkat == 2) {
                 $kbp = $kb->kb_tingkat_2p;
             } elseif ($tingkat == 3) {
                 $kbp = $kb->kb_tingkat_3p;
             } else {
                 $kbp = NULL;
             }
         }
         $data[$mapel->kelompok][$mapel->nama]['pengetahuan']['kb'] = $kbp;
         $data[$mapel->kelompok][$mapel->nama]['pengetahuan']['angka'] = $nilai ? $nilai->nilai_pengetahuan : NULL;
         $data[$mapel->kelompok][$mapel->nama]['pengetahuan']['predikat'] = $nilai ? self::predikat($nilai->nilai_pengetahuan) : NULL;
         $data[$mapel->kelompok][$mapel->nama]['pengetahuan']['deskripsi'] = $nilai ? $nilai->deskripsi_pengetahuan : NULL;
         if ($kb) {
             if ($tingkat == 1) {
                 $kbk = $kb->kb_tingkat_1k;
             } elseif ($tingkat == 2) {
                 $kbk = $kb->kb_tingkat_2k;
             } elseif ($tingkat == 3) {
                 $kbk = $kb->kb_tingkat_3k;
             } else {
                 $kbk = NULL;
             }
         }
         $data[$mapel->kelompok][$mapel->nama]['keterampilan']['kb'] = $kbk;
         $data[$mapel->kelompok][$mapel->nama]['keterampilan']['angka'] = $nilai ? $nilai->nilai_keterampilan : NULL;
         $data[$mapel->kelompok][$mapel->nama]['keterampilan']['predikat'] = $nilai ? self::predikat($nilai->nilai_keterampilan) : NULL;
         $data[$mapel->kelompok][$mapel->nama]['keterampilan']['deskripsi'] = $nilai ? $nilai->deskripsi_keterampilan : NULL;
     }
     return $data;
 }
コード例 #11
0
 public static function copy($previousSemester = null, $currentSemester = null)
 {
     $previousSemester = $previousSemester ? $previousSemester : Semester::get_previous_semester()->id;
     $currentSemester = $currentSemester ? $currentSemester : Semester::get_active_semester()->id;
     $now = \Carbon\Carbon::now();
     $prevKB = KetuntasanBelajar::where('id_semester', '=', $previousSemester)->get()->toArray();
     $fail = 0;
     $success = 0;
     foreach ($prevKB as $KB) {
         try {
             KetuntasanBelajar::where('id_mapel', $KB['id_mapel'])->where('id_semester', $currentSemester)->delete();
             KetuntasanBelajar::insert(['id_mapel' => $KB['id_mapel'], 'id_semester' => $currentSemester, 'kb_tingkat_1p' => $KB['kb_tingkat_1p'], 'kb_tingkat_1k' => $KB['kb_tingkat_1k'], 'kb_tingkat_2p' => $KB['kb_tingkat_2p'], 'kb_tingkat_2k' => $KB['kb_tingkat_2k'], 'kb_tingkat_3p' => $KB['kb_tingkat_3p'], 'kb_tingkat_3k' => $KB['kb_tingkat_3k']]);
         } catch (\Illuminate\Database\QueryException $e) {
             $fail++;
             continue;
         }
         $success++;
     }
     return ['fail' => $fail, 'success' => $success];
 }
コード例 #12
0
 public function handle($request, Closure $next)
 {
     // Lanjut saja jika belum login
     if ($this->auth->guest()) {
         return $next($request);
     }
     if ($request->is('keluar')) {
         return $next($request);
     }
     // Aplikasi baru diinstall
     if (Semester::all()->count() < 1) {
         if (!$request->is('setup')) {
             return redirect()->to('setup');
         }
     }
     $activeSemester = Semester::get_active_semesters();
     if ($activeSemester->count() == 1) {
         // Semua lancar
         return $next($request);
     } elseif ($activeSemester->count() > 1) {
         // Ada kesalahan di mana semester aktif lebih dari 1
         if ($request->ajax()) {
             return;
         }
         if (!$request->is('panel')) {
             return redirect()->to('panel');
         } else {
             \Session::flash('alert', 'Ada lebih dari satu semester yang aktif. Disarankan untuk tidak mengakses / mengubah data sampai masalah ini diselesaikan.');
             return $next($request);
         }
     } elseif ($activeSemester->count() <= 0 && Semester::all()->count() > 0) {
         \Session::flash('warning', 'Aplikasi sedang dalam proses pergantian semester. Data tidak bisa diubah dalam saat ini.');
         return $next($request);
     }
     return $next($request);
 }
コード例 #13
0
 public function upload_save(Request $request)
 {
     $this->validate($request, ['excel' => 'required']);
     $inputFileName = $request->excel;
     try {
         $inputFileType = PHPExcel_IOFactory::identify($inputFileName);
         $objReader = PHPExcel_IOFactory::createReader($inputFileType);
         $objPHPExcel = $objReader->load($inputFileName);
     } catch (Exception $e) {
         die('Error loading file "' . pathinfo($inputFileName, PATHINFO_BASENAME) . '": ' . $e->getMessage());
     }
     $sheet = $objPHPExcel->getSheet(0);
     $highestRow = $sheet->getHighestRow();
     $highestColumn = $sheet->getHighestColumn();
     $start = false;
     $data_count = 0;
     $errors = 0;
     $semester = Semester::get_active_semester()->id;
     $id_siswa = null;
     for ($row = 1; $row <= $highestRow; $row++) {
         $rowData = $sheet->rangeToArray('A' . $row . ':' . $highestColumn . $row, NULL, TRUE, FALSE);
         if (!$start) {
             if ($rowData[0][0] == "1" || $rowData[0][0] == "1.") {
                 $start = true;
             }
         }
         if ($start) {
             if (empty($rowData[0][3]) || empty($rowData[0][4])) {
                 continue;
             }
             $data_count++;
             $new = new Ekskul();
             if (!empty($rowData[0][1])) {
                 $siswa = Siswa::where('nis', $rowData[0][1])->first();
                 if (!$siswa) {
                     $errors++;
                     $id_siswa = null;
                     continue;
                 }
                 $id_siswa = $siswa->id;
             } else {
                 if ($id_siswa == null) {
                     continue;
                 }
             }
             $created = null;
             $check = Ekskul::where('ekstrakurikuler', $rowData[0][3])->where('id_siswa', $id_siswa)->where('id_semester', $semester);
             $old = $check->first();
             if ($old) {
                 $created = $old->created_at;
                 $check->delete();
             }
             $new->id_siswa = $id_siswa;
             $new->id_semester = $semester;
             $new->ekstrakurikuler = $rowData[0][3];
             $new->nilai = $rowData[0][4];
             if ($created) {
                 $new->created_at = $created;
             }
             try {
                 $new->save();
             } catch (\Illuminate\Database\QueryException $e) {
                 $errors++;
             }
         }
     }
     if (!$start) {
         $message = "Tidak ada data ditemukan. Pastikan kolom nomor ada pada kolom A dan dimulai dengan angka 1.";
     } else {
         $message = "Upload file selesai. Terbaca ada {$data_count} data. ";
         $message .= $errors > 0 ? "Ada masalah dengan {$errors} data, dan tidak dapat dimasukkan ke dalam database." : "Semua data berhasil ditambahkan.";
     }
     return redirect()->route('nilai.ekskul')->with('message', $message);
 }
コード例 #14
0
ファイル: Store.php プロジェクト: hermitpopcorn/arkxiii
 /**
  * Regenerate the CSRF token value.
  *
  * @return void
  */
 public function regenerateToken()
 {
     $this->put('_token', Str::random(40) . Semester::get_active_semester()->id);
 }
コード例 #15
0
 public function upload_save(Request $request)
 {
     $this->validate($request, ['excel' => 'required']);
     $inputFileName = $request->excel;
     try {
         $inputFileType = PHPExcel_IOFactory::identify($inputFileName);
         $objReader = PHPExcel_IOFactory::createReader($inputFileType);
         $objPHPExcel = $objReader->load($inputFileName);
     } catch (Exception $e) {
         die('Error loading file "' . pathinfo($inputFileName, PATHINFO_BASENAME) . '": ' . $e->getMessage());
     }
     $data_count = 0;
     $errors = 0;
     $semester = Semester::get_active_semester()->id;
     foreach ($objPHPExcel->getWorksheetIterator() as $sheet) {
         $highestRow = $sheet->getHighestRow();
         $highestColumn = $sheet->getHighestColumn();
         $start = false;
         for ($row = 1; $row <= $highestRow; $row++) {
             $rowData = $sheet->rangeToArray('A' . $row . ':' . $highestColumn . $row, NULL, TRUE, FALSE);
             if (!$start) {
                 // Start check
                 if ($rowData[0][0] == "1" || $rowData[0][0] == "1.") {
                     $start = true;
                 }
             }
             if ($start) {
                 $id_siswa = null;
                 $data_count++;
                 if (!empty($rowData[0][1])) {
                     $siswa = Siswa::where('nis', $rowData[0][1])->first();
                     if (!$siswa) {
                         $errors++;
                         $id_siswa = null;
                         continue;
                     }
                     $id_siswa = $siswa->id;
                 }
                 if (!$id_siswa) {
                     continue;
                 }
                 $new = new Absensi();
                 $created = null;
                 $check = Absensi::where('id_siswa', $id_siswa)->where('id_semester', $semester);
                 $old = $check->first();
                 if ($old) {
                     $created = $old->created_at;
                     $check->delete();
                 }
                 $new->id_siswa = $id_siswa;
                 $new->id_semester = $semester;
                 $new->sakit = $rowData[0][3] !== null ? $rowData[0][3] : null;
                 $new->izin = $rowData[0][4] !== null ? $rowData[0][4] : null;
                 $new->alpa = $rowData[0][5] !== null ? $rowData[0][5] : null;
                 if ($created) {
                     $new->created_at = $created;
                 }
                 try {
                     $new->save();
                 } catch (\Illuminate\Database\QueryException $e) {
                     $errors++;
                 }
             }
         }
     }
     $message = "Upload file selesai. Terbaca ada {$data_count} data. ";
     $message .= $errors > 0 ? "Ada masalah dengan {$errors} data, dan tidak dapat dimasukkan ke dalam database." : "Semua data berhasil ditambahkan.";
     return redirect()->route('absensi')->with('message', $message);
 }
コード例 #16
0
 public function newSemester(Request $request, Semester $semester)
 {
     $semester->semester = $request->input('semester');
     $semester->session_id = $request->input('session');
     $saved = $semester->save();
     if ($saved) {
         return redirect()->back()->with('info', 'Semester saved succesfully');
     }
     return redirect()->back()->with('info', 'An unknown error occured. Please try again.');
 }
コード例 #17
0
 public function mass(Request $request)
 {
     if (!$request->ajax()) {
         abort(404);
     }
     $this->validate($request, ['type' => 'required|integer']);
     $semester = Semester::get_active_semester()->id;
     if (!($prevSemester = Semester::get_previous_semester())) {
         return response("Semester sebelumnya tidak dapat ditemukan.", 422);
     }
     $prevSemester = $prevSemester->id;
     if ($request->type == 1 || $request->type == 2) {
         $targets = Mapel::get_unset_kb();
         foreach ($targets as $target) {
             $new = new KetuntasanBelajar();
             $new->id_mapel = $target->id;
             $new->id_semester = $semester;
             if ($target->kelompok == 'A' | $target->kelompok == 'B' | $target->kelompok == 'C1') {
                 $n = 60;
             } elseif ($target->kelompok == 'C2' | $target->kelompok == 'C3') {
                 $n = 70;
             }
             $new->kb_tingkat_1p = $n;
             $new->kb_tingkat_2p = $n;
             $new->kb_tingkat_3p = $n;
             $new->kb_tingkat_1k = $n;
             $new->kb_tingkat_2k = $n;
             $new->kb_tingkat_3k = $n;
             $new->save();
         }
     }
     if ($request->type == 2) {
         $targets = Mapel::get_set_kb();
         foreach ($targets as $target) {
             $new = KetuntasanBelajar::where('id_mapel', '=', $target->id)->where('id_semester', '=', $semester)->first();
             $new->id_semester = $semester;
             if ($target->kelompok == 'A' | $target->kelompok == 'B' | $target->kelompok == 'C1') {
                 $n = 60;
             } elseif ($target->kelompok == 'C2' | $target->kelompok == 'C3') {
                 $n = 70;
             }
             KetuntasanBelajar::where('id_mapel', '=', $target->id)->where('id_semester', '=', $semester)->update(['kb_tingkat_1p' => $n, 'kb_tingkat_2p' => $n, 'kb_tingkat_3p' => $n, 'kb_tingkat_1k' => $n, 'kb_tingkat_2k' => $n, 'kb_tingkat_3k' => $n]);
         }
     }
     if ($request->input('type') == 3) {
         $copy = null;
         try {
             $copy = KetuntasanBelajar::copy($prevSemester, $semester);
         } catch (Exception $e) {
             return response("Penyalinan aturan ketuntasan belajar dari semester sebelumnya gagal dilakukan.", 422);
         }
     }
     return 'KB berhasil diubah secara massal.';
 }
コード例 #18
0
 public function change(Request $request)
 {
     $this->validate($request, ['id' => 'required|exists:semester']);
     Semester::where('aktif', 1)->update(['aktif' => 0]);
     $aktivasi = Semester::find($request->input('id'));
     $aktivasi->aktif = 1;
     $aktivasi->save();
     return redirect()->route('semester.ganti')->with('message', "Semester berhasil diaktifkan.");
 }
コード例 #19
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit(Group $group)
 {
     $user = User::findOrFail(1);
     $school = $user->school;
     $schoolyear = Schoolyear::orderBy('id', 'DESC')->first();
     $semesters = Semester::all()->lists('nombre', 'id');
     $users = User::where('school_id', '=', $user->school_id)->lists('name', 'id');
     //$group = Group::findOrFail($id);
     return view('group.edit', compact('user', 'schoolyear', 'semesters', 'users', 'group'));
 }
コード例 #20
0
 public function findSemester($id)
 {
     return Semester::find($id);
 }
コード例 #21
0
ファイル: PlansController.php プロジェクト: zheralfin/oras
 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(PlanRequest $request, $id)
 {
     $input = $request->except('_method', '_token');
     $plan = Plan::findOrFail($id);
     $recent_number_year = $plan->number_year;
     $recent_number_semester = $plan->number_semester;
     if ($plan->update($input)) {
         for ($year = 1; $year <= $input['number_year']; $year++) {
             for ($sem = 1; $sem <= $input['number_semester']; $sem++) {
                 $semester = array("plan_id" => $plan->id, "year" => $year, "number" => $sem);
                 $existing = Semester::where($semester)->first();
                 if (empty($existing)) {
                     Semester::create($semester);
                 }
             }
         }
         if ($recent_number_year > $input['number_year'] || $recent_number_semester > $input['number_semester']) {
             DB::table('semesters')->where('plan_id', '=', $plan->id)->where(function ($query) use($input) {
                 $query->orWhere('year', '>', $input['number_year'])->orWhere('number', '>', $input['number_semester']);
             })->delete();
         }
         return redirect('/plans');
     }
 }
コード例 #22
0
 public function index()
 {
     $pass['semester_list'] = Semester::get_daftar_semester(true);
     $pass['mapel_list'] = Mapel::get_daftar_mapel(true);
     return view('ralat.form', $pass);
 }
コード例 #23
0
 public function upload_save(Request $request)
 {
     $this->validate($request, ['id_mapel' => 'required|exists:mapel,id', 'excel' => 'required']);
     $inputFileName = $request->excel;
     try {
         $inputFileType = PHPExcel_IOFactory::identify($inputFileName);
         $objReader = PHPExcel_IOFactory::createReader($inputFileType);
         $objPHPExcel = $objReader->load($inputFileName);
     } catch (Exception $e) {
         die('Error loading file "' . pathinfo($inputFileName, PATHINFO_BASENAME) . '": ' . $e->getMessage());
     }
     $data_count = 0;
     $errors = 0;
     $semester = Semester::get_active_semester()->id;
     foreach ($objPHPExcel->getWorksheetIterator() as $sheet) {
         $highestRow = $sheet->getHighestRow();
         $highestColumn = $sheet->getHighestColumn();
         $start = false;
         $id_mapel = $request->input('id_mapel');
         for ($row = 1; $row <= $highestRow; $row++) {
             $rowData = $sheet->rangeToArray('A' . $row . ':' . $highestColumn . $row, NULL, TRUE, FALSE);
             if (!$start) {
                 // Start check
                 if ($rowData[0][0] == "1" || $rowData[0][0] == "1.") {
                     $start = true;
                 }
                 // Mapel set
                 foreach ($rowData[0] as $colNum => $colVal) {
                     if (strpos(strtolower($colVal), 'mata pelajaran:') !== FALSE || strpos(strtolower($colVal), 'mapel:') !== FALSE) {
                         $c = Mapel::where('nama', 'LIKE', $rowData[0][$colNum + 1])->first();
                         if ($c) {
                             $id_mapel = $c->id;
                         }
                     }
                 }
             }
             if ($start) {
                 $id_siswa = null;
                 $data_count++;
                 if (!empty($rowData[0][1])) {
                     $siswa = Siswa::where('nis', $rowData[0][1])->first();
                     if (!$siswa) {
                         $errors++;
                         $id_siswa = null;
                         continue;
                     }
                     $id_siswa = $siswa->id;
                 }
                 if (!$id_siswa) {
                     continue;
                 }
                 $new = new NilaiAkhir();
                 $created = null;
                 $check = NilaiAkhir::where('id_mapel', $id_mapel)->where('id_siswa', $id_siswa)->where('id_semester', $semester);
                 $old = $check->first();
                 if ($old) {
                     $created = $old->created_at;
                     $check->delete();
                 }
                 $new->id_siswa = $id_siswa;
                 $new->id_mapel = $id_mapel;
                 $new->id_semester = $semester;
                 $new->nilai_pengetahuan = $rowData[0][3] ? $rowData[0][3] : null;
                 $new->deskripsi_pengetahuan = $rowData[0][4] ? $rowData[0][4] : null;
                 $new->nilai_keterampilan = $rowData[0][5] ? $rowData[0][5] : null;
                 $new->deskripsi_keterampilan = $rowData[0][6] ? $rowData[0][6] : null;
                 if ($created) {
                     $new->created_at = $created;
                 }
                 try {
                     $new->save();
                 } catch (\Illuminate\Database\QueryException $e) {
                     $errors++;
                 }
             }
         }
     }
     $message = "Upload file selesai. Terbaca ada {$data_count} data. ";
     $message .= $errors > 0 ? "Ada masalah dengan {$errors} data, dan tidak dapat dimasukkan ke dalam database." : "Semua data berhasil ditambahkan.";
     return redirect()->route('nilai.akhir')->with('message', $message);
 }
コード例 #24
0
ファイル: Ekskul.php プロジェクト: hermitpopcorn/arkxiii
 public static function get_stats($semester = null)
 {
     $semester = $id_semester ? $id_semester : Semester::get_active_semester()->id;
     return ['siswa' => self::where('id_semester', $semester)->groupBy('id_siswa')->get()->count(), 'nilai' => self::where('id_semester', $semester)->get()->count()];
 }
コード例 #25
0
ファイル: Kelas.php プロジェクト: hermitpopcorn/arkxiii
 public function get_wali_kelas()
 {
     $g = Mengajar::join('mapel', 'mengajar.id_mapel', '=', 'mapel.id')->where('mengajar.id_kelas', $this->id)->where('mapel.kelompok', 'WK')->where('mengajar.id_semester', Semester::get_active_semester()->id)->first();
     return $g ? Guru::find($g->id_guru) : false;
 }
コード例 #26
0
 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $semesters = Semester::all()->lists('nombre', 'id');
     $subject = Subject::findOrFail($id);
     return view('subject.edit', compact('subject', 'semesters'));
 }
 /**
  * Show the form for editing the specified resource.
  *
  * @param  Inscription  $inscription
  * @return Response
  */
 public function edit(Inscription $inscription)
 {
     $this->authorize('edit', $inscription);
     //$inscription = Inscription::findOrFail($id);
     $semesters = Semester::all()->lists('nombre', 'id');
     $inscription->student['semester_id'] = $inscription->semester_id;
     //incrustar valor para vincularlo a formulario
     $inscription->student['group_id'] = $inscription->group_id;
     $groups = Group::where('semester_id', $inscription->semester_id)->lists('nombre', 'id');
     return view('inscription.edit', compact('inscription', 'semesters', 'groups'));
 }
コード例 #28
0
ファイル: Semester.php プロジェクト: bigschlong69/capstoneAll
 public static function now()
 {
     $date = date('c');
     $semester = Semester::where('semester_startdate', '<', $date)->where('semester_enddate', '>', $date);
     return $semester;
 }
コード例 #29
0
 public function pkl()
 {
     $pass['semester_list'] = Semester::get_daftar_semester(true);
     $pass['kelas_list'] = Kelas::get_daftar_kelas(false, false);
     return view('nilai.lama.pkl', $pass);
 }
コード例 #30
0
ファイル: User.php プロジェクト: bigschlong69/capstoneAll
 public function courses_taught_active()
 {
     $semester = Semester::now()->first()->getID();
     //echo get_class($semester);
     return $this->hasMany('App\\Course', 'course_instructor', 'user_id')->where('semester_id', $semester);
 }