</table> </div> <?php $bulan = date('m'); if ($bulan < 7) { $smt = 2; //jika th 2(1-6) maka tahun-1/tahun-2 2012/2013 $th_ajar = date('Y') - 1 . '/' . date('Y'); } elseif ($bulan < 13 && $bulan > 6) { $smt = 1; //jika th 1(7-12) maka tahun/tahun+1 2012/2013 $th_ajar = date('Y') . '/' . (date('Y') + 1); } $nilai = Nilai::model()->countByAttributes(array('nis' => $_GET['id'])); $total = Yii::app()->db->createCommand("select sum(na) from nilai where nis='" . $_GET['id'] . "' and th_ajar='" . $th_ajar . "' and semester='" . $smt . "';")->queryScalar(); $rata = round($total / $nilai); //Pembulatan ke atas (round) untuk nilai rata-rata. $this->widget('bootstrap.widgets.TbGridView', array('id' => 'nilai-grid', 'dataProvider' => $model->groupsiswa(), 'type' => 'striped condensed', 'enableSorting' => false, 'template' => "{items}", 'columns' => array(array('header' => 'No', 'value' => '$row+1', 'htmlOptions' => array('style' => 'width: 20px')), array('header' => 'Mata Pelajaran', 'name' => 'kodeMapel.kodeMapel.mapel', 'htmlOptions' => array('style' => 'width: 220px')), array('header' => 'KKM', 'footer' => 'Jumlah Nilai: ', 'name' => 'kodeMapel.kodeMapel.kkm', 'htmlOptions' => array('style' => 'width: 80px')), array('name' => 'na', 'header' => 'Nilai', 'class' => 'bootstrap.widgets.TbTotalSumColumn', 'htmlOptions' => array('style' => 'width: 80px;')), array('header' => 'Nilai Rata-rata Kelas', 'name' => 'kodeMapel.kodeMapel.kkm', 'htmlOptions' => array('style' => 'width: 150px'))))); ?> <small> Jumlah Nilai Prestasi Hasil Belajar: <?php echo $total; ?> <br> Rata-rata Hasil Belajar: <?php echo $rata; ?> </small>
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)); }
public function ratakelas() { $bulan = date('m'); if ($bulan < 7) { $smt = 2; //jika th 2(1-6) maka tahun-1/tahun-2 2012/2013 $th_ajar = date('Y') - 1 . '/' . date('Y'); } elseif ($bulan < 13 && $bulan > 6) { $smt = 1; //jika th 1(7-12) maka tahun/tahun+1 2012/2013 $th_ajar = date('Y') . '/' . (date('Y') + 1); } $nilai = Nilai::model()->findAll(array('condition' => "nis='" . $_GET['id'] . "'", 'order' => 'kode_mapel ASC')); foreach ($nilai as $i => $ii) { $model = new Nilai(); $rata2 = Yii::app()->db->createCommand("select sum(na)/count(na) from nilai where kode_mapel='" . $ii['kode_mapel'] . "' and th_ajar='" . $th_ajar . "' and semester='" . $smt . "';")->queryScalar(); echo $rata2 . "<br>"; } }
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. */ public function loadModel() { if ($this->_model === null) { if (isset($_GET['id'])) { $this->_model = Nilai::model()->findbyPk($_GET['id']); } if ($this->_model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } } return $this->_model; }
/** * @param int id_kur * @param string kode_mk * @param string ta * @param string nim * @soap */ public function deleteNilai($id_kur, $kode_mk, $ta, $nim) { Nilai::model()->deleteAll("ID_KUR = '" . $id_kur . "' and KODE_MK = '" . $kode_mk . "' and TA = '" . $ta . "' and NIM = '" . $nim . "'"); }
</table> </div> <?php $bulan = date('m'); if ($bulan < 7) { $smt = 2; //jika th 2(1-6) maka tahun-1/tahun-2 2012/2013 $th_ajar = date('Y') - 1 . '/' . date('Y'); } elseif ($bulan < 13 && $bulan > 6) { $smt = 1; //jika th 1(7-12) maka tahun/tahun+1 2012/2013 $th_ajar = date('Y') . '/' . (date('Y') + 1); } $nilai = Nilai::model()->countByAttributes(array('nis' => $_GET['id'], 'semester' => (string) $smt, 'th_ajar' => (string) $th_ajar)); $total = Yii::app()->db->createCommand("select sum(na) from nilai where nis='" . $_GET['id'] . "' and th_ajar='" . $th_ajar . "' and semester='" . $smt . "';")->queryScalar(); $rata = round($total / $nilai); //Pembulatan ke atas (round) untuk nilai rata-rata. ?> <?php $this->widget('bootstrap.widgets.TbExtendedGridView', array('id' => 'nilai-grid', 'dataProvider' => $model->groupsiswa(), 'type' => 'striped bordered condensed', 'enableSorting' => false, 'template' => "{items}", 'columns' => array(array('header' => 'No', 'value' => '$row+1', 'htmlOptions' => array('style' => 'width: 20px')), array('header' => 'Mata Pelajaran', 'name' => 'kodeMapel.kodeMapel.mapel', 'htmlOptions' => array('style' => 'width: 600px')), array('header' => 'KKM', 'footer' => 'Jumlah Nilai: ', 'name' => 'kodeMapel.kodeMapel.kkm', 'htmlOptions' => array('style' => 'width: 80px')), array('name' => 'na', 'header' => 'Nilai', 'class' => 'bootstrap.widgets.TbTotalSumColumn', 'htmlOptions' => array('style' => 'width: 80px;')), array('header' => 'Nilai Rata-rata Kelas', 'name' => 'kodeMapel.kodeMapel.kkm', 'htmlOptions' => array('style' => 'width: 150px'))))); ?> Jumlah Nilai Prestasi Hasil Belajar: <?php echo $total; ?> <br> Rata-rata Hasil Belajar: <?php echo $rata; ?>
<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 } else { ?>
/** * Returns the data model based on the primary key given in the GET variable. * If the data model is not found, an HTTP exception will be raised. * @param integer the ID of the model to be loaded */ public function loadModel($id) { $model = Nilai::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public function actionNilai() { $mahasiswa = Mahasiswa::model()->findAll(); $error = false; foreach ($mahasiswa as $mhs) { if (isset($_POST[$mhs->NIM])) { foreach ($_POST[$mhs->NIM] as $mk => $value) { $nilai = Nilai::model()->findByAttributes(array('NIM' => $mhs->NIM, 'kode_mk' => $mk)); if ($nilai) { $input = $nilai; } else { $input = new Nilai(); $input->NIM = $mhs->NIM; $input->kode_mk = $mk; } $input->Nilai = $value; if (!$input->save()) { $error = true; } } } if (!$error) { Yii::app()->user->setFlash('status', '<div class="alert alert-success">Data telah Tersimpan</div>'); } else { Yii::app()->user->setFlash('status', '<div class="alert alert-success">Data Gagal Tersimpan</div>'); } } $this->render('nilai', array('mahasiswa' => $mahasiswa)); }