/** * This is the default 'index' action that is invoked * when an action is not explicitly requested by users. */ public function actionIndex() { //$this->layout='//layouts/mainFixed'; // renders the view file 'protected/views/site/index.php' // using the default layout 'protected/views/layouts/main.php' $model = new Nilai('search'); $model->unsetAttributes(); // clear any default values $this->render('index', array('model' => $model)); }
public function saveAll($nilais, $dupak_id) { foreach ($nilais as $n) { $nilai = new Nilai(); $nilai->attributes = $n; $nilai->dupak_id = $dupak_id; var_dump($nilai->attributes); if (!$nilai->save()) { return false; } } return true; }
public function simpanNilai(Nilai $nilaiObj) { $nomorSiswa = $nilaiObj->getSiswa()->getNomorSiswa(); $idMataPelajaran = $nilaiObj->getMataPelajaran()->getIdMataPelajaran(); $nilai = $nilaiObj->getNilai(); $idTahunAjaran = $nilaiObj->getTahunAjaran()->getIdTahunAjaran(); $ps = $this->connection->prepare("INSERT INTO nilai(nomor_siswa,id_mata_pelajaran,nilai,id_tahun_ajaran) \n \tvalue(:nomorSiswa,:idMataPelajaran,:nilai,:idTahunAjaran) "); $ps->bindParam(":nomorSiswa", $nomorSiswa, PDO::PARAM_INT); $ps->bindParam(":idMataPelajaran", $idMataPelajaran, PDO::PARAM_INT); $ps->bindParam(":nilai", $nilai, PDO::PARAM_INT); $ps->bindParam("idTahunAjaran", $idTahunAjaran, PDO::PARAM_INT); $ps->execute(); $this->connection = null; }
/** * Finds the Nilai model based on its primary key value. * If the model is not found, a 404 HTTP exception will be thrown. * @param integer $id * @return Nilai the loaded model * @throws NotFoundHttpException if the model cannot be found */ protected function findModel($id) { if (($model = Nilai::findOne($id)) !== null) { return $model; } else { throw new NotFoundHttpException('The requested page does not exist.'); } }
public function get_current_ipk($pb) { $sql = "SELECT SEM_NIL_PB as SEM_NIL_PB, IPK_NIL_PB as IPK_NIL_PB FROM " . $this->_tb_nilai . " WHERE KD_PB=" . $pb->get_kd_pb(); $sql .= " AND SEM_NIL_PB=(SELECT MAX(SEM_NIL_PB) FROM " . $this->_tb_nilai . " WHERE KD_PB=" . $pb->get_kd_pb() . ")"; // echo $sql."</br>"; $result = $this->_db->select($sql); $nilai = new Nilai($this->registry); foreach ($result as $v) { $nilai->set_kode($v['KD_NIL_PB']); $nilai->set_pb($v['KD_PB']); $nilai->set_ips($v['IPS_NIL_PB']); $nilai->set_ipk($v['IPK_NIL_PB']); $nilai->set_semester($v['SEM_NIL_PB']); } return $nilai; }
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)); }
</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>
/** * 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; }
public function actionArsip() { $this->layout = '//layouts/column1'; $model = new Nilai('search'); $model->unsetAttributes(); // clear any default values if (isset($_GET['Nilai'])) { if ($_GET['Nilai']['nis'] == 0 && $_GET['Nilai']['nis'] != null) { $model->attributes = $_GET['Nilai']; Yii::app()->user->setFlash('warning', 'Data gagal diproses. <b>NIS</b> tidak boleh kosong atau 0'); } else { $model->attributes = $_GET['Nilai']; Yii::app()->user->setFlash('success', 'Data berhasil diproses. Tekan tombol <strong>CETAK</strong> untuk melihat raport!'); } } else { $model->nis = 0; } $this->render('arsip', array('model' => $model)); }
</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; }
print "Lulus"; } else { print "Tidak Lulus"; } echo "<br>"; // OOP class Nilai { // Ini namanya Class protected $cek_nilai; public function setNilai($nilai) { // Ini namanya Method (Function dalam class) // $nilai namanya property (Variable dalam class) if ($nilai >= 50) { $this->cek_nilai = "Lulus"; } else { $this->cek_nilai = "Tidak Lulus"; } } public function getNilai() { // Ini namanya Method (Function dalam class) return $this->cek_nilai; } } $obj = new Nilai(); // Ini namanya object $obj->setNilai(50); echo $obj->getNilai(); // Execute
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)); }
public function cetak_profil($id) { $pb = new Penerima($this->registry); //mendapatkan informasi pb $st = new SuratTugas($this->registry); //mendapatkan informasi surat tugas $el = new ElemenBeasiswa($this->registry); //mendapatkan pembayaran $bank = new Bank($this->registry); //mendapatkan nama bank $jst = new JenisSuratTugas($this->registry); //mendapatkan jenis surat tugas $jur = new Jurusan($this->registry); $univ = new Universitas($this->registry); $nilai = new Nilai($this->registry); $cuti = new Cuti($this->registry); $mas = new MasalahPenerima($this->registry); $pemb = new PemberiBeasiswa(); $beaya = new Biaya(); $role = Session::get('role'); $pb->set_kd_pb($id); $this->view->d_pb = $pb->get_penerima_by_id($pb, $this->kd_user); if ($role == 3) { $this->view->d_pb = $pb->get_penerima_by_id($pb); } $st->set_kd_st($this->view->d_pb->get_st()); $this->view->d_st = $st->get_surat_tugas_by_id($st, $this->kd_user); if ($role == 3) { $this->view->d_st = $st->get_surat_tugas_by_id($st); } $pemb = $pemb->get_by_id($this->view->d_st->get_pemberi()); $this->view->d_pemb = $pemb->nama_pemberi; $this->view->d_bank = $bank->get_bank_id($this->view->d_pb->get_bank()); $jur->set_kode_jur($this->view->d_pb->get_jur()); $this->view->d_jur = $jur->get_jur_by_id($jur); $jst->set_kode($this->view->d_st->get_jenis_st()); $this->view->d_jst = $jst->get_jst_by_id($jst); $this->view->d_univ = $univ->get_univ_by_jur($this->view->d_jur->get_kode_jur()); $this->view->d_nil = $nilai->get_nilai($pb); $this->view->d_cur_ipk = $nilai->get_current_ipk($pb); $this->view->d_cuti = $cuti->get_cuti($this->kd_user, $pb); if ($role == 3) { $this->view->d_cuti = $cuti->get_cuti(0, $pb); } $this->view->d_rwt_beas = $pb->get_penerima_by_column($pb, $this->kd_user, 'nip', true); if ($role == 3) { $this->view->d_rwt_beas = $pb->get_penerima_by_column($pb, 0, 'nip', true); } $elem = $el->get_elem_per_pb($pb, false); $bea = $beaya->get_cost_per_pb($pb, false); $this->view->d_mas = $mas->get_masalah($pb); $d_bea = array(); /* * sementara versi dummy dulu ye :p */ foreach ($elem as $v) { $d = new BiayaPenerimaBeasiswa(); $is_jadup = $v->get_kd_r() == 'tunjangan hidup'; $is_buku = $v->get_kd_r() == 'buku'; $nama = $v->get_kd_r(); if ($is_jadup) { $nama .= " " . $v->get_bln() . " " . $v->get_thn(); } if ($is_buku) { $bulan = Tanggal::bulan_num($v->get_bln()); $bulan = $bulan == 1 ? 'ganjil' : 'genap'; $nama .= " semester " . $bulan . " " . $v->get_thn(); } $d->set_nama_biaya($nama); $d->set_jumlah_biaya($v->get_total_bayar()); $d_bea[] = $d; } foreach ($bea as $v) { $d = new BiayaPenerimaBeasiswa(); $d->set_nama_biaya($v->nama_tagihan); $d->set_jumlah_biaya($v->biaya_per_pegawai); $d_bea[] = $d; } $this->view->d_bea = $d_bea; $this->view->load('profil/cetak_profil'); }
public function viewNilaiGraph() { $ta = isset($_GET['ta']) ? addslashes($_GET['ta']) : TahunAjaran::ta(); $murid_id = $_GET['murid_id']; $matapelajaranID = $_GET['matapelajaranID']; $nilai = new Nilai($ta, "", $matapelajaranID, ""); $return['webClass'] = __CLASS__; $return['method'] = __FUNCTION__; $return['ta'] = $ta; $return['murid_id'] = $murid_id; $return['matapelajaranID'] = $matapelajaranID; $return['graph'] = $nilai->getNilaiNachSubject($murid_id, $matapelajaranID, $ta); Mold::both("studentsetup/graphnilai", $return); }
/** * @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 . "'"); }