$namaDosen[$indexNama] = $itemNamaP['NAMA']; $indexNama++; } $indexPengajar++; } $namaDosenMK = ""; if ($indexNama == 3) { $namaDosenMK = "" . $namaDosen[0] . " / " . $namaDosen[1] . " / " . $namaDosen[2]; } else { if ($indexNama == 2) { $namaDosenMK = "" . $namaDosen[0] . " / " . $namaDosen[1]; } else { $namaDosenMK = "" . $namaDosen[0]; } } $jumlahData = BeritaAcaraKuliah::model()->countByAttributes(array('KODE_MK' => $Kode_MK, 'KELAS' => $Kelas, 'TA' => $T_A)); $list = Yii::app()->db->createCommand('select * from berita_acara_kuliah where KODE_MK = "' . $Kode_MK . '" and KELAS = "' . $Kelas . '" and TA = "' . $T_A . '" and SEM = "' . $sem . '"')->queryAll(); //var_dump($jmlHadir); $mingguSesi = array(); $waktu_mulai = array(); $waktu_selesai = array(); $tanggal = array(); $hari = array(); $ruangan = array(); $tipe_kuliah = array(); $topik = array(); $jmlHadirH_temp = array(); $jmlAbsenA_temp = array(); $tipe_reguler = ""; $tipe_pengganti = ""; $index = 0;
$namaDosen[$indexNama] = $itemNamaP['NAMA']; $indexNama++; } $indexPengajar++; } $namaDosenMK = ""; if ($indexNama == 3) { $namaDosenMK = "" . $namaDosen[0] . " / " . $namaDosen[1] . " / " . $namaDosen[2]; } else { if ($indexNama == 2) { $namaDosenMK = "" . $namaDosen[0] . " / " . $namaDosen[1]; } else { $namaDosenMK = "" . $namaDosen[0]; } } $jumlahData = BeritaAcaraKuliah::model()->countBySql('select COUNT(*) from berita_acara_kuliah bak JOIN d_jadwal dj ON bak.ID_DETAIL_JADWAL = dj.ID JOIN m_jadwal mj ON dj.ID_JADWAL = mj.ID where dj.KODE_MK = "' . $Kode_MK . '" and mj.KELAS = "' . $Kelas . '" and mj.TA = "' . $T_A . '"'); $list = Yii::app()->db->createCommand('select * from berita_acara_kuliah bak JOIN d_jadwal dj ON bak.ID_DETAIL_JADWAL = dj.ID JOIN m_jadwal mj ON dj.ID_JADWAL = mj.ID where dj.KODE_MK = "' . $Kode_MK . '" and mj.KELAS = "' . $Kelas . '" and mj.TA = "' . $T_A . '"')->queryAll(); //var_dump($jmlHadir); $mingguSesi = array(); $waktu_mulai = array(); $waktu_selesai = array(); $tanggal = array(); $hari = array(); $ruangan = array(); $tipe_kuliah = array(); $topik = array(); $jmlHadirH_temp = array(); $jmlAbsenA_temp = array(); $tipe_reguler = ""; $tipe_pengganti = ""; $index = 0;
/** * Updates a particular model. * If update is successful, the browser will be redirected to the 'view' page. * @param integer $id the ID of the model to be updated */ public function actionUpdate($id) { $model = $this->loadModel($id); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['Jadwal'])) { $criteria = new CDbCriteria(); $criteria->addCondition("WEEK = '{$model->WEEK}'"); $criteria->addCondition("TANGGAL = '{$model->TANGGAL}'"); $criteria->addCondition("TA = '{$model->TA}'"); $criteria->addCondition("ID_KUR = '{$model->ID_KUR}'"); $criteria->addCondition("KODE_MK = '{$model->KODE_MK}'"); $daftarhadir = BeritaAcaraDaftarHadir::model()->findAll($criteria); $criteria1 = new CDbCriteria(); $criteria1->addCondition("WEEK = '{$model->WEEK}'"); $criteria1->addCondition("TANGGAL = '{$model->TANGGAL}'"); $criteria1->addCondition("TA = '{$model->TA}'"); $criteria1->addCondition("ID_KUR = '{$model->ID_KUR}'"); $criteria1->addCondition("KODE_MK = '{$model->KODE_MK}'"); $acarakuliah = BeritaAcaraKuliah::model()->find($criteria); $model->attributes = $_POST['Jadwal']; $sql_pengajar = "SELECT * FROM pengajar WHERE TA LIKE '{$model->TA}' AND ID_KUR LIKE '{$model->ID_KUR}' AND KODE_MK LIKE '{$model->KODE_MK}' ORDER BY ROLE ASC"; $list_pengajar = Yii::app()->db->createCommand($sql_pengajar)->queryAll(); $model->PIC = $list_pengajar[0]['DOSEN_ID']; foreach ($daftarhadir as $s) { $s['WEEK'] = $model->WEEK; $s['TANGGAL'] = $model->TANGGAL; $s['SESSION'] = $model->SESSION; $s['START_TIME'] = $this->start_time($model->SESSION); $s['END_TIME'] = $this->end_time($model->SESSION); $s['TA'] = $model->TA; $s['ID_KUR'] = $model->ID_KUR; $s['KODE_MK'] = $model->KODE_MK; if ($s->validate()) { $s->save(); } else { echo CHtml::errorSummary($daftarhadir); } } $acarakuliah->WEEK = $model->WEEK; $acarakuliah->SESSION = $model->SESSION; $acarakuliah->TA = $model->TA; $acarakuliah->ID_KUR = $model->ID_KUR; $acarakuliah->KODE_MK = $model->KODE_MK; $acarakuliah->KELAS = $model->KELAS; $acarakuliah->TANGGAL = $model->TANGGAL; $acarakuliah->START_TIME = $this->start_time($model->SESSION); $acarakuliah->END_TIME = $this->end_time($model->SESSION); $acarakuliah->RUANGAN = $model->RUANGAN; $acarakuliah->AKTIFITAS = $model->AKTIFITAS; $acarakuliah->PIC = $model->PIC; if ($acarakuliah->validate()) { $acarakuliah->save(); } else { echo CHtml::errorSummary($acarakuliah); } if ($model->validate()) { $model->save(); } else { echo CHtml::errorSummary($model); } $this->redirect(array('view', 'id' => $model->ID)); } $this->render('update', array('model' => $model)); }
<h3>Kelas</h3></CENTER> <TD> </TR> <TR ALIGN="CENTER"> <TD ALIGN="CENTER"> <CENTER> <?php $data = CHtml::listData(Jadwal::model()->findAll(), 'TA', 'TA'); echo $form->dropDownListGroup($model, 'TA', array('wrapperHtmlOptions' => array('class' => 'col-sm-5'), 'widgetOptions' => array('data' => $data, 'htmlOptions' => array()))); ?> </CENTER> </TD> <TD ALIGN="CENTER"><CENTER> <?php $data = CHtml::listData(BeritaAcaraKuliah::model()->findAll(), 'SEM', 'SEM'); echo $form->dropDownListGroup($model, 'SEM', array('wrapperHtmlOptions' => array('class' => 'col-sm-5'), 'widgetOptions' => array('data' => $data, 'htmlOptions' => array()))); ?> </CENTER> </TD> <TD ALIGN="CENTER"><CENTER> <?php //echo $form->textFieldGroup($model,'ID_KUR',array('widgetOptions'=>array('htmlOptions'=>array('class'=>'span5')))); ?> <?php $data = CHtml::listData(Jadwal::model()->findAll(), 'KODE_MK', 'KODE_MK'); echo $form->dropDownListGroup($model, 'KODE_MK', array('wrapperHtmlOptions' => array('class' => 'col-sm-5'), 'widgetOptions' => array('data' => $data, 'htmlOptions' => array()))); ?> </CENTER>
/** * 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 = BeritaAcaraKuliah::model()->findByPk($id); if ($model === null) { throw new CHttpException(404, 'The requested page does not exist.'); } return $model; }
public function actionCreatejadwal($kbk) { $model = new MJadwal(); $djadwal = new DJadwal(); $kbkmodel = RefKbk::model()->findByPk($kbk); // Uncomment the following line if AJAX validation is needed // $this->performAjaxValidation($model); if (isset($_POST['MJadwal'])) { $model->attributes = $_POST['MJadwal']; if ($model->save()) { if (isset($_POST['DJadwal'])) { for ($i = 0; $i < 8; $i++) { if (!isset($_POST["formsesi{$i}"])) { echo $i; $detail = new DJadwal(); $detail->KODE_MK = $_POST['DJadwal'][$i]['KODE_MK']; $detail->RUANGAN = $_POST['DJadwal'][$i]['RUANGAN']; $detail->AKTIFITAS = $_POST['DJadwal'][$i]['AKTIFITAS']; $detail->SESSION = $i + 1; $detail->ID_JADWAL = $model->ID; $detail->START_TIME = $this->start_time($i + 1); $detail->END_TIME = $this->end_time($i + 1); // MAHASISWA $sql = "SELECT DISTINCT(nilai.NIM),nilai.`SEM` FROM nilai JOIN registrasi ON nilai.`NIM` = registrasi.`NIM` WHERE KODE_MK LIKE \n'{$detail->KODE_MK}' AND registrasi.`TA` = {$model->TA} AND registrasi.`KELAS` LIKE '{$model->KELAS}'"; $list = Yii::app()->db->createCommand($sql)->queryAll(); //PENGAJAR $sql_pengajar = "SELECT * FROM pengajar WHERE TA LIKE '{$model->TA}' AND ID_KUR LIKE '{$model->ID_KUR}' AND KODE_MK LIKE '{$detail->KODE_MK}' ORDER BY ROLE ASC"; $list_pengajar = Yii::app()->db->createCommand($sql_pengajar)->queryAll(); $detail->PIC = $list_pengajar[0]['DOSEN_ID']; if ($detail->validate()) { $detail->save(); foreach ($list as $s) { $daftarhadir = new BeritaAcaraDaftarHadir(); $daftarhadir->ID_DETAIL_JADWAL = $detail->ID; $daftarhadir->NIM = $s['NIM']; if ($daftarhadir->validate()) { $daftarhadir->save(); } else { echo CHtml::errorSummary($daftarhadir); } } $kuliah = new BeritaAcaraKuliah(); $kuliah->ID_DETAIL_JADWAL = $detail->ID; $kuliah->TIPE_KULIAH = 1; if ($kuliah->validate()) { $kuliah->save(); } else { echo CHtml::errorSummary($kuliah); } } else { echo CHtml::errorSummary($detail); } } } } $this->redirect(array('view', 'id' => $model->ID)); } else { echo CHtml::errorSummary($model); } } $this->render('createjadwal', array('model' => $model, 'djadwal' => $djadwal, 'kbk' => $kbkmodel)); }