/** * Displays a particular model. * @param integer $id the ID of the model to be displayed */ public function actionView($id) { //Berita Acara Daftar Hadir $daftarhadir = new BeritaAcaraDaftarHadir('search'); $daftarhadir->unsetAttributes(); // clear any default values if (isset($_GET['BeritaAcaraDaftarHadir'])) { $daftarhadir->attributes = $_GET['BeritaAcaraDaftarHadir']; } $this->render('view', array('model' => $this->loadModel($id), 'daftarhadir' => $daftarhadir->searchByIdJadwal($id))); }
?> </td> <?php $DistinctTanggal = Yii::app()->db->createCommand('SELECT DISTINCT mj.TANGGAL FROM berita_acara_daftar_hadir badh JOIN d_jadwal dj ON badh.ID_DETAIL_JADWAL = dj.ID JOIN m_jadwal mj ON dj.ID_JADWAL = mj.ID WHERE mj.TA = "' . $TAjaran . '" and dj.KODE_MK = "' . $mata_kuliah . '" and mj.KELAS = "' . $kelas . '"')->queryAll(); foreach ($DistinctTanggal as $itemDTanggal) { $countSessionByDate = Yii::app()->db->createCommand('SELECT DISTINCT dj.SESSION FROM berita_acara_daftar_hadir badh JOIN d_jadwal dj ON badh.ID_DETAIL_JADWAL = dj.ID JOIN m_jadwal mj ON dj.ID_JADWAL = mj.ID WHERE mj.TANGGAL = "' . $itemDTanggal['TANGGAL'] . '" AND dj.KODE_MK="' . $mata_kuliah . '" and mj.KELAS = "' . $kelas . '"')->queryAll(); foreach ($countSessionByDate as $itemCSBD) { ?> <td border="0.5" width="30" align="center"> <?php // $hasil = BeritaAcaraDaftarHadir::model()->findAllBySql(" SELECT * FROM berita_acara_daftar_hadir badh JOIN d_jadwal dj ON badh.`ID_DETAIL_JADWAL`=dj.`ID` JOIN m_jadwal mj ON dj.`ID_JADWAL`=mj.`ID` // WHERE mj.`TA`= '$TAjaran' AND dj.`KODE_MK` = '$mata_kuliah' AND mj.`KELAS` = '$kelas'"); $modelnim = $modelN['NIM']; $tggl = $itemDTanggal['TANGGAL']; $sesi = $itemCSBD['SESSION']; $modelStatus = BeritaAcaraDaftarHadir::model()->findBySql("SELECT * FROM berita_acara_daftar_hadir badh JOIN d_jadwal dj ON badh.`ID_DETAIL_JADWAL`=dj.`ID` JOIN m_jadwal mj ON dj.`ID_JADWAL`=mj.`ID`\n WHERE mj.`TA`= '{$TAjaran}' AND dj.`KODE_MK` = '{$mata_kuliah}' AND mj.`KELAS` = '{$kelas}' AND badh.NIM = '{$modelnim}' AND mj.TANGGAL = '{$tggl}' AND dj.SESSION = '{$sesi}'"); // if (!empty($modelStatus->STATUS)) { echo $modelStatus->STATUS == "A" ? "-" : "Hadir"; } ?> </td> <?php } } ?> </tr> <?php $no++; } ?>
<?php $kelas = "41B"; $mata_kuliah = "IF411111"; $model = BeritaAcaraDaftarHadir::model()->findAllByAttributes(array('TANGGAL' => $message, 'KODE_MK' => $mata_kuliah)); $model2 = Jadwal::model()->findAllByAttributes(array('TANGGAL' => $message, 'KODE_MK' => $mata_kuliah)); $model3 = BeritaAcaraDaftarHadir::model()->findAllByAttributes(array('TANGGAL' => $message, 'KODE_MK' => $mata_kuliah)); $mkul = Kurikulum::model()->findByAttributes(array('KODE_MK' => $mata_kuliah)); $dosen = Pengajar::model()->findByAttributes(array('KODE_MK' => $mata_kuliah)); $criteriaDataIb = new CDbCriteria(); $criteriaDataIb->condition = 'KODE_MK = :kodemk'; $criteriaDataIb->order = 'ID DESC'; $criteriaDataIb->limit = 1; $criteriaDataIb->params = array('kodemk' => $mata_kuliah); $tajaran = Jadwal::model()->find($criteriaDataIb); $imagePath = Yii::getPathOfAlias('application.icons'); $baseUrl = Yii::app()->assetManager->publish($imagePath); ?> <table> <tr> <td> Institut Teknologi Del <br/> Jl. Sisingamangaraja, Sitoluama, Laguboti <br/> Toba Samosir, Sumatera Utara 22381 <br/> Telp. 0632-331234 </td> <td></td> </tr> <tr> <td> <h4><b>Daftar Hadir Mahasiswa Semester 1 T.A 2013/2014</b></h4>
$sesi = $itemQuerySesi['SESSION']; $cekT[$indexSesi] = Yii::app()->db->createCommand("SELECT distinct ID_DETAIL_JADWAL FROM berita_acara_daftar_hadir badh\n JOIN d_jadwal dj ON badh.`ID_DETAIL_JADWAL`=dj.`ID`\n JOIN m_jadwal mj ON dj.`ID_JADWAL`=mj.`ID`\n WHERE mj.`TA`= '{$TA}' AND dj.`KODE_MK` = '{$Kode}'\n AND DJ.`SESSION` = '{$sesi}' AND mj.`KELAS` = '{$Kelas}'\n AND mj.`TANGGAL` LIKE '{$tanggal_Baru}' and dj.AKTIFITAS = 'Teori'")->queryAll(); if ($cekT[$indexSesi]) { foreach ($cekT[$indexSesi] as $itemJadwal) { $ID_dJadwal = $itemJadwal["ID_DETAIL_JADWAL"]; $hadirDinT[$indekDinHadirT] = (int) BeritaAcaraDaftarHadir::model()->countByAttributes(array('ID_DETAIL_JADWAL' => $ID_dJadwal, 'STATUS' => 'H')); $absenDinT[$indekDinHadirT] = (int) BeritaAcaraDaftarHadir::model()->countByAttributes(array('ID_DETAIL_JADWAL' => $ID_dJadwal, 'STATUS' => 'A')); $indekDinHadirT++; } } $cekP[$indexSesi] = Yii::app()->db->createCommand("SELECT distinct ID_DETAIL_JADWAL FROM berita_acara_daftar_hadir badh\n JOIN d_jadwal dj ON badh.`ID_DETAIL_JADWAL`=dj.`ID`\n JOIN m_jadwal mj ON dj.`ID_JADWAL`=mj.`ID`\n WHERE mj.`TA`= '{$TA}' AND dj.`KODE_MK` = '{$Kode}'\n AND DJ.`SESSION` = '{$sesi}' AND mj.`KELAS` = '{$Kelas}'\n AND mj.`TANGGAL` LIKE '{$tanggal_Baru}' and dj.AKTIFITAS = 'Praktikum'")->queryAll(); if ($cekP[$indexSesi]) { foreach ($cekP[$indexSesi] as $itemJadwal) { $ID_dJadwal = $itemJadwal["ID_DETAIL_JADWAL"]; $hadirDinP[$indekDinHadirP] = (int) BeritaAcaraDaftarHadir::model()->countByAttributes(array('ID_DETAIL_JADWAL' => $ID_dJadwal, 'STATUS' => 'H')); $absenDinP[$indekDinHadirP] = (int) BeritaAcaraDaftarHadir::model()->countByAttributes(array('ID_DETAIL_JADWAL' => $ID_dJadwal, 'STATUS' => 'A')); $indekDinHadirP++; } } $indexSesi++; } } else { $listHariSesi = null; $hadirDinT = null; $hadirDinP = null; $absenDinT = null; $absenDinP = null; } } } else { echo "Silahkan pilih tanggal / hari lainnya";
<?php /* * To change this license header, choose License Headers in Project Properties. * To change this template file, choose Tools | Templates * and open the template in the editor. */ BeritaAcaraDaftarHadir::$tempID = $message; $temp = explode("-", $message); $Kode = $temp[0]; $Kelas = $temp[1]; $TA = $temp[2]; $mk = Kurikulum::model()->findByAttributes(array('KODE_MK' => $Kode)); $myValue = "Load content Ajax"; ?> <table> <tr> <td colspan="2" align="center" valign="middle"><center> <?php $this->widget('ext.simple-calendar-chart.SimpleCalendarWidget'); ?> </center> </td> </tr> <tr> <td colspan="2" align="center" valign="middle"> Data pada Current Date tidak ditemukan ! </td> </tr> </table>
/** * 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)); }
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)); }