public function actionKuisioner() { $this->load(); $matkul = Matakuliah::model()->findAll(); if (BidangKeahlian::model()->findByAttributes(array('NIM' => $this->identitas->NIM))) { $this->redirect(Yii::app()->request->baseUrl . '/mahasiswa/rekomendasi'); } $prioritas = array(); if (isset($_POST['soal1'])) { $hardware = false; $data = Nilai::model()->findAllByAttributes(array('NIM' => $this->identitas->NIM)); $nilai = array(); foreach ($data as $value) { $indeks[$value->kode_mk] = $value->Nilai; $nilai += $indeks; } $hardware = Nilai::model()->hardware($nilai); $si = Nilai::model()->si($nilai); $jaringan = Nilai::model()->jaringan($nilai); $pemrograman = Nilai::model()->pemrograman($nilai); $multimedia = Nilai::model()->multimedia($nilai); $prioritas = array('1' => $_POST['soal1'], '2' => $_POST['soal2'], '3' => $_POST['soal3'], '4' => $_POST['soal4'], '5' => $_POST['soal5']); $suka = $_POST['suka']; $benci = $_POST['benci']; if ($suka < 7) { $prioritas['1'] = '5'; $like = '1'; } else { if ($suka >= 7 && $suka < 11) { $prioritas['2'] = '5'; $like = '2'; } else { if ($suka >= 11 && $suka < 16) { $prioritas['5'] = '5'; $like = '5'; } else { if ($suka >= 16 && $suka < 19) { $prioritas['3'] = '5'; $like = '3'; } else { $prioritas['4'] = '5'; $like = '4'; } } } } foreach ($prioritas as $bidang => $indeks) { if ($bidang != $like && $indeks == '5') { $prioritas[$bidang] = '4'; } } if ($benci < 7) { $prioritas['1'] = '1'; } else { if ($benci >= 7 && $benci < 11) { $prioritas['2'] = '1'; } else { if ($benci >= 11 && $benci < 16) { $prioritas['5'] = '1'; } else { if ($benci >= 16 && $benci < 19) { $prioritas['3'] = '1'; } else { $prioritas['4'] = '1'; } } } } if ($_POST['soal6'] == 'ya') { if (!$hardware) { unset($prioritas['4']); } if (!$jaringan) { unset($prioritas['2']); } if (!$si) { unset($prioritas['5']); } if (!$pemrograman) { unset($prioritas['1']); } if (!$multimedia) { unset($prioritas['3']); } } arsort($prioritas); $keahlian = new BidangKeahlian(); $keahlian->NIM = $this->identitas->NIM; $keahlian->bidang_keahlian = ''; $i = 1; foreach ($prioritas as $bidang => $value) { if ($i <= 2) { $keahlian->bidang_keahlian .= $bidang; if ($i == 1) { $keahlian->bidang_keahlian .= ';'; } $i++; } } if ($keahlian->save()) { $this->redirect(Yii::app()->request->baseUrl . '/mahasiswa/rekomendasi'); } } $this->render('kuisioner', array("matkul" => $matkul)); }
<th>Rangkaian Digital</th> <th>Organisasi Komputer</th> <th>Sistem Informasi</th> </tr> </thead> <tbody> <?php foreach ($mahasiswa as $mhs) { ?> <tr> <td><?php echo $mhs->NIM; ?> </td> <?php $matkul = Matakuliah::model()->findAll(); foreach ($matkul as $mk) { $nilai = Nilai::model()->findByAttributes(array('NIM' => $mhs->NIM, 'kode_mk' => $mk->kode_mk)); if ($nilai) { ?> <td><input type="text" name="<?php echo $mhs->NIM; ?> [<?php echo $mk->kode_mk; ?> ]" value="<?php echo $nilai->Nilai; ?> "></td> <?php
public function getDetail() { if (Input::has('kode_jadwal')) { $kode_jadwal = Input::get('kode_jadwal'); $mk = Jadwal::where("ID_JADWAL", "=", $kode_jadwal); if ($mk->count() == 1) { $hari = $mk->get()[0]->HARI; $arr_hari = array("SENIN", "SELASA", "RABU", "KAMIS", "JUMAT", "SABTU", "MINGGU"); $str_hari = $arr_hari[$hari]; $variables = array("NAMA_MK" => $mk->get()[0]->matakuliah->MATA_KULIAH, "KODE_MK" => $mk->get()[0]->matakuliah->KODE, "NAMA_DOSEN" => $mk->get()[0]->dosen->DOSEN, "KODE_DOSEN" => $mk->get()[0]->dosen->KODE_DOSEN, "RUANGAN" => $mk->get()[0]->ruang->RUANG, "ID_RUANG" => $mk->get()[0]->ruang->ID_RUANG, "KETERANGAN" => $mk->get()[0]->KETERANGAN, "JAM_MULAI" => $mk->get()[0]->JAM_MULAI, "JAM_AKHIR" => $mk->get()[0]->JAM_AKHIR, "JAM_AKHIR" => $mk->get()[0]->JAM_AKHIR, "HARI" => $str_hari); return View::make('cdetail_jadwal', $variables); } } else { if (Input::has('kode_dosen')) { $kode_dosen = Input::get('kode_dosen'); $dosen = Dosen::where("KODE_DOSEN", "=", $kode_dosen); if ($dosen->count() == 1) { $jadwals = array(); $jadwals_count = array(); for ($i = 0; $i < 7; $i++) { $jadwals[$i] = Jadwal::whereRaw("KODE_DOSEN = ? AND HARI = ?", array($kode_dosen, $i))->get()->sortBy("JAM_MULAI"); $jadwals_count[$i] = count($jadwals[$i]); } $variables = array("NAMA_DOSEN" => $dosen->get()[0]->DOSEN, "KODE_DOSEN" => $dosen->get()[0]->KODE_DOSEN, "JADWALS" => $jadwals, "JADWALS_COUNT" => $jadwals_count); // var_dump($jadwals); return View::make('cdetail_dosen', $variables); } } else { if (Input::has('kode_mk')) { $kode_matakuliah = Input::get('kode_mk'); $matakuliah = Matakuliah::where("KODE", "=", $kode_matakuliah); if ($matakuliah->count() == 1) { $jadwals = array(); $jadwals_count = array(); for ($i = 0; $i < 7; $i++) { $jadwals[$i] = Jadwal::whereRaw("KODE = ? AND HARI = ?", array($kode_matakuliah, $i))->get()->sortBy("JAM_MULAI"); $jadwals_count[$i] = count($jadwals[$i]); } $variables = array("MATAKULIAH" => $matakuliah->get()[0]->MATA_KULIAH, "KODE_MATAKULIAH" => $matakuliah->get()[0]->KODE, "JADWALS" => $jadwals, "JADWALS_COUNT" => $jadwals_count); return View::make('cdetail_matakuliah', $variables); } } else { if (Input::has('id_ruang')) { $id_ruang = Input::get('id_ruang'); $ruangan = Ruang::where("ID_RUANG", "=", $id_ruang); if ($ruangan->count() == 1) { $jadwals = array(); $jadwals_count = array(); for ($i = 0; $i < 7; $i++) { $jadwals[$i] = Jadwal::whereRaw("ID_RUANG = ? AND HARI = ?", array($id_ruang, $i))->get()->sortBy("JAM_MULAI"); $jadwals_count[$i] = count($jadwals[$i]); } $variables = array("RUANGAN" => $ruangan->get()[0]->RUANG, "ID_RUANG" => $ruangan->get()[0]->ID_RUANG, "JADWALS" => $jadwals, "JADWALS_COUNT" => $jadwals_count); return View::make('cdetail_ruang', $variables); } } else { if (Input::has('hari')) { $hari = Input::get('hari'); $jadwal = Jadwal::whereRaw("HARI=?", array($hari)); if ($jadwal->count() > 0) { $variables = array("jadwals" => $jadwal, "HARI" => $hari); return View::make('cdetail_hari', $variables); } } } } } } // return View::make('cdetail_jadwal'); }
echo "<h2>" . $hari[$i] . "</h2>"; $jadwals = Jadwal::whereRaw("ID_RUANG=? && HARI = ?", array($ruangan->ID_RUANG, $i)); foreach ($jadwals->get()->sortBy("JAM_MULAI") as $j) { echo $j->matakuliah->MATA_KULIAH . "(" . $j->matakuliah->KODE . ")<br/>"; echo "<small>" . $j->dosen->DOSEN . "(" . $j->dosen->KODE_DOSEN . ")</small><br/>"; echo $j->JAM_MULAI . "-" . $j->JAM_AKHIR . " " . $j->ruang->RUANG . "<br/>"; echo "kelas:" . $j->kelas->NAMA_KELAS . "</br>"; echo "keterangan:" . $j->KETERANGAN . "</br>"; echo "<hr/>"; } } } }); Route::get('getmatakuliah', function () { $kode_mk = Input::get("mk"); $matakuliah = Matakuliah::whereRaw("KODE=?", array($kode_mk))->first(); if ($matakuliah != null) { echo "<h1>" . $matakuliah->MATA_KULIAH . "</h1>"; $hari = array("Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu", "Minggu"); for ($i = 0; $i < count($hari); $i++) { echo "<h2>" . $hari[$i] . "</h2>"; $jadwals = Jadwal::whereRaw("KODE=? && HARI = ?", array($matakuliah->KODE, $i)); foreach ($jadwals->get()->sortBy("JAM_MULAI") as $j) { echo $j->matakuliah->MATA_KULIAH . "(" . $j->matakuliah->KODE . ")<br/>"; echo "<small>" . $j->dosen->DOSEN . "(" . $j->dosen->KODE_DOSEN . ")</small><br/>"; echo $j->JAM_MULAI . "-" . $j->JAM_AKHIR . " " . $j->ruang->RUANG . "<br/>"; echo "kelas:" . $j->kelas->NAMA_KELAS . "</br>"; echo "keterangan:" . $j->KETERANGAN . "</br>"; echo "<hr/>"; } }