Update Terbaru

parent c40fa6ec
...@@ -4,11 +4,21 @@ ...@@ -4,11 +4,21 @@
<editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/> <editor-bookmarks xmlns="http://www.netbeans.org/ns/editor-bookmarks/2" lastBookmarkId="0"/>
<open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2"> <open-files xmlns="http://www.netbeans.org/ns/projectui-open-files/2">
<group> <group>
<file>file:/C:/xampp/htdocs/Test/smartcard/protected/models/DJadwal.php</file> <file>file:/C:/xampp/htdocs/Test/smartcard/protected/controllers/SiteController.php</file>
<file>file:/C:/xampp/htdocs/Test/smartcard/protected/controllers/JadwalController.php</file>
<file>file:/C:/xampp/htdocs/Test/smartcard/protected/views/site/login.php</file>
<file>file:/C:/xampp/htdocs/Test/smartcard/protected/views/beritaAcaraDaftarHadir/LaporanBeritaAcaraKuliah.php</file>
<file>file:/C:/xampp/htdocs/Test/smartcard/protected/models/Excel.php</file>
<file>file:/C:/xampp/htdocs/Test/smartcard/protected/views/beritaAcaraDaftarHadir/searchBeritaAcaraDaftarHadir.php</file>
<file>file:/C:/xampp/htdocs/Test/smartcard/protected/views/site/upload.php</file>
<file>file:/C:/xampp/htdocs/Test/smartcard/protected/views/site/excelpath.php</file>
<file>file:/C:/xampp/htdocs/Test/smartcard/protected/controllers/DJadwalController.php</file>
<file>file:/C:/xampp/htdocs/Test/smartcard/protected/controllers/DimController.php</file>
<file>file:/C:/xampp/htdocs/Test/smartcard/protected/views/site/index.php</file>
<file>file:/C:/xampp/htdocs/Test/smartcard/protected/views/site/excel.php</file> <file>file:/C:/xampp/htdocs/Test/smartcard/protected/views/site/excel.php</file>
<file>file:/C:/xampp/htdocs/Test/smartcard/protected/controllers/MJadwalController.php</file> <file>file:/C:/xampp/htdocs/Test/smartcard/protected/controllers/BeritaAcaraDaftarHadirController.php</file>
<file>file:/C:/xampp/htdocs/Test/smartcard/protected/views/mJadwal/view.php</file> <file>file:/C:/xampp/htdocs/Test/smartcard/protected/controllers/KelasController.php</file>
<file>file:/C:/xampp/htdocs/Test/smartcard/protected/views/dJadwal/view.php</file> <file>file:/C:/xampp/htdocs/Test/smartcard/protected/controllers/BeritaAcaraKuliahController.php</file>
</group> </group>
</open-files> </open-files>
</project-private> </project-private>
...@@ -71,7 +71,6 @@ class BeritaAcaraDaftarHadirController extends Controller { ...@@ -71,7 +71,6 @@ class BeritaAcaraDaftarHadirController extends Controller {
)); ));
} }
/** /**
* Specifies the access control rules. * Specifies the access control rules.
* This method is used by the 'accessControl' filter. * This method is used by the 'accessControl' filter.
...@@ -276,46 +275,50 @@ class BeritaAcaraDaftarHadirController extends Controller { ...@@ -276,46 +275,50 @@ class BeritaAcaraDaftarHadirController extends Controller {
} }
} }
public function actionValidate($rfid, $nim) { public function actionValidate(/* $rfid, $nim ,$datetime*/) {
$tanggal = date('Y-m-d'); // $tanggal = date('Y-m-d H:m:s');
$waktu = date('H:i:s'); // echo $tanggal->format('Y-m-d');
$sql = "SELECT * FROM jadwal WHERE ((RUANGAN='$rfid' AND TANGGAL ='$tanggal') AND ('$waktu' BETWEEN jadwal.`START_TIME` AND jadwal.`END_TIME`)) //
AND KELAS IN (SELECT KELAS FROM registrasi WHERE registrasi.`NIM`='$nim' ORDER BY SEM DESC)"; $dt = new DateTime();
echo $dt->format('Y-m-d H:i:s');
$list = Yii::app()->db->createCommand($sql)->queryAll(); // $waktu = date('H:i:s');
if ($list) { // $sql = "SELECT * FROM jadwal WHERE ((RUANGAN='$rfid' AND TANGGAL ='$tanggal') AND ('$waktu' BETWEEN jadwal.`START_TIME` AND jadwal.`END_TIME`))
$kehadiran = BeritaAcaraDaftarHadir::model()->findByAttributes( //AND KELAS IN (SELECT KELAS FROM registrasi WHERE registrasi.`NIM`='$nim' ORDER BY SEM DESC)";
array( //
'WEEK' => $list[0]['WEEK'], // $list = Yii::app()->db->createCommand($sql)->queryAll();
'TANGGAL' => $list[0]['TANGGAL'], // if ($list) {
'SESSION' => $list[0]['SESSION'], // $kehadiran = BeritaAcaraDaftarHadir::model()->findByAttributes(
'START_TIME' => $list[0]['START_TIME'], // array(
'END_TIME' => $list[0]['END_TIME'], // 'WEEK' => $list[0]['WEEK'],
'KODE_MK' => $list[0]['KODE_MK'], // 'TANGGAL' => $list[0]['TANGGAL'],
'NIM' => $nim, // 'SESSION' => $list[0]['SESSION'],
) // 'START_TIME' => $list[0]['START_TIME'],
); // 'END_TIME' => $list[0]['END_TIME'],
// 'KODE_MK' => $list[0]['KODE_MK'],
if ($this->cekKehadiran($kehadiran->STATUS)) { // 'NIM' => $nim,
$kehadiran->STATUS = 'H'; // )
$kehadiran->WAKTU_ABSEN = $waktu; // );
$kehadiran->save(); //
echo "Berhasil"; // if ($this->cekKehadiran($kehadiran->STATUS)) {
} else { // $kehadiran->STATUS = 'H';
echo "Gagal"; // $kehadiran->WAKTU_ABSEN = $waktu;
} // $kehadiran->save();
// echo "Berhasil";
// $this->render('index', array( // } else {
// 'dataProvider' => $dataProvider, // echo "Gagal";
// )); // }
} else { //
// var_dump($list); //// $this->render('index', array(
// $this->render('admin', array( //// 'dataProvider' => $dataProvider,
// 'model' => $model, //// ));
// )); // } else {
echo "Gagal"; //// var_dump($list);
} //// $this->render('admin', array(
//// 'model' => $model,
//// ));
// echo "Gagal";
// }
} }
} }
...@@ -116,6 +116,149 @@ class SiteController extends Controller { ...@@ -116,6 +116,149 @@ class SiteController extends Controller {
$this->render('excel'); $this->render('excel');
} }
public function createJadwal($arr, $masterjadwal) {
// foreach ($arr as $hit) {
// echo $hit . "<BR>";
// }
// print_r($arr);
// echo "<BR>";
// echo $id;
// echo "Pretty Fly";
$detail = new DJadwal;
$detail->SESSION = $arr[0];
$detail->KODE_MK = $arr[1];
if (!empty($detail->KODE_MK)) {
$detail->RUANGAN = $arr[3];
$detail->ID_JADWAL = $masterjadwal->ID;
$detail->START_TIME = $this->start_time($detail->SESSION);
$detail->END_TIME = $this->end_time($detail->SESSION);
$detail->AKTIFITAS = $this->cekAktifitas($arr[2]);
// MAHASISWA
$sql = "SELECT DISTINCT(nilai.NIM),nilai.`SEM` FROM nilai JOIN registrasi ON nilai.`NIM` = registrasi.`NIM` WHERE KODE_MK LIKE '$detail->KODE_MK' AND registrasi.`TA` = $masterjadwal->TA AND registrasi.`KELAS` LIKE '$masterjadwal->KELAS'";
$list = Yii::app()->db->createCommand($sql)->queryAll();
//PENGAJAR
$sql_pengajar = "SELECT * FROM pengajar WHERE TA LIKE '$masterjadwal->TA' AND ID_KUR LIKE '$masterjadwal->ID_KUR' AND KODE_MK LIKE '$detail->KODE_MK' ORDER BY ROLE ASC";
$list_pengajar = Yii::app()->db->createCommand($sql_pengajar)->queryAll();
echo "<BR>" . $sql_pengajar . "<BR>";
$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);
}
}
}
public function start_time($session) {
switch ($session) {
case 1:
return "08:00:00";
break;
case 2:
return "09:00:00";
break;
case 3:
return "10:00:00";
break;
case 4:
return "11:00:00";
break;
case 5:
return "13:00:00";
break;
case 6:
return "14:00:00";
break;
case 7:
return "15:00:00";
break;
case 8:
return "16:00:00";
break;
}
}
public function end_time($session) {
switch ($session) {
case 1:
return "09:00:00";
break;
case 2:
return "10:00:00";
break;
case 3:
return "11:00:00";
break;
case 4:
return "13:00:00";
break;
case 5:
return "14:00:00";
break;
case 6:
return "15:00:00";
break;
case 7:
return "16:00:00";
break;
case 8:
return "17:00:00";
break;
}
}
public function cekAktifitas($test) {
if ($test == "T")
return "Teori";
else if ($test == "P")
return "Praktikum";
else
return "Mandiri";
}
public function cekMaster($masterjadwal) {
echo $masterjadwal->TA;
}
public function actionUpload() {
$model = new Excel;
if (isset($_POST['Excel'])) {
$model->attributes = $_POST['Excel'];
$fileName = CUploadedFile::getInstance($model, 'excelfile');
if ($model->validate()) {
$fileName->saveAs(Yii::app()->basePath . '/../jadwal/' . $fileName);
$this->redirect(array('Jadwalxlsx', 'path' => Yii::app()->basePath . '/../jadwal/' . $fileName));
}
}
$this->render('upload', array('model' => $model));
}
public function actionJadwalxlsx($path) {
$this->render('excelpath', array('path' => $path));
}
} }
<?php
class Excel extends CFormModel {
public $excelfile;
// ... other attributes
public function rules() {
return array(
array('excelfile', 'file', 'types' => 'xlsx'),
);
}
public function attributeLabels() {
return array(
'excelfile' => 'Upload File (.xlsx)',
);
}
}
?>
\ No newline at end of file
...@@ -122,7 +122,7 @@ $baseUrl = Yii::app()->assetManager->publish($imagePath); ...@@ -122,7 +122,7 @@ $baseUrl = Yii::app()->assetManager->publish($imagePath);
<?php <?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(); $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) { 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'] . '"')->queryAll(); $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) { foreach ($countSessionByDate as $itemCSBD) {
?> ?>
<td border="0.5" width="60" align="center" style="font-size: 10px;"><?php echo $itemDTanggal['TANGGAL']; ?></td> <td border="0.5" width="60" align="center" style="font-size: 10px;"><?php echo $itemDTanggal['TANGGAL']; ?></td>
...@@ -136,7 +136,7 @@ $baseUrl = Yii::app()->assetManager->publish($imagePath); ...@@ -136,7 +136,7 @@ $baseUrl = Yii::app()->assetManager->publish($imagePath);
<?php <?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(); $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) { foreach ($DistinctTanggal as $itemDTanggal) {
$countSessionByDate = Yii::app()->db->createCommand('SELECT DISTINCT dj.START_TIME 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'] . '"')->queryAll(); $countSessionByDate = Yii::app()->db->createCommand('SELECT DISTINCT dj.START_TIME 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) { foreach ($countSessionByDate as $itemCSBD) {
?> ?>
<td border="0.5" width="50" align="center"><?php echo $itemCSBD['START_TIME']; ?></td> <td border="0.5" width="50" align="center"><?php echo $itemCSBD['START_TIME']; ?></td>
...@@ -150,7 +150,7 @@ $baseUrl = Yii::app()->assetManager->publish($imagePath); ...@@ -150,7 +150,7 @@ $baseUrl = Yii::app()->assetManager->publish($imagePath);
<?php <?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(); $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) { 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'] . '"')->queryAll(); $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) { foreach ($countSessionByDate as $itemCSBD) {
?> ?>
<td border="0.5" width="30" align="center"><?php echo $itemCSBD['SESSION'] ?></td> <td border="0.5" width="30" align="center"><?php echo $itemCSBD['SESSION'] ?></td>
...@@ -176,20 +176,23 @@ $baseUrl = Yii::app()->assetManager->publish($imagePath); ...@@ -176,20 +176,23 @@ $baseUrl = Yii::app()->assetManager->publish($imagePath);
<?php <?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(); $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) { 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'] . '"')->queryAll(); $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) { foreach ($countSessionByDate as $itemCSBD) {
?> ?>
<td border="0.5" width="30" align="center"> <td border="0.5" width="30" align="center">
<?php <?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` // $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'"); // WHERE mj.`TA`= '$TAjaran' AND dj.`KODE_MK` = '$mata_kuliah' AND mj.`KELAS` = '$kelas'");
$modelnim = $modelN['NIM']; $modelnim = $modelN['NIM'];
$tggl = $itemDTanggal['TANGGAL']; $tggl = $itemDTanggal['TANGGAL'];
$sesi = $itemCSBD['SESSION']; $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` $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`
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'"); 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"); echo ($modelStatus->STATUS == "A" ? "-" : "Hadir");
};
?> ?>
</td> </td>
<?php <?php
......
...@@ -73,7 +73,8 @@ foreach ($list as $item) { ...@@ -73,7 +73,8 @@ foreach ($list as $item) {
WHERE STATUS = "A" AND mj.WEEK = "' . $item['WEEK'] . '" WHERE STATUS = "A" AND mj.WEEK = "' . $item['WEEK'] . '"
AND dj.SESSION = "' . $item['SESSION'] . '" AND dj.SESSION = "' . $item['SESSION'] . '"
AND dj.KODE_MK = "' . $Kode_MK . '" AND dj.KODE_MK = "' . $Kode_MK . '"
AND mj.KELAS = "' . $Kelas . '"')->queryAll(); AND mj.KELAS = "' . $Kelas . '"
AND mj.TANGGAL="' . $item['TANGGAL'] . '"')->queryAll();
$jmlHadirH_temp[$index] = Yii::app()->db->createCommand(' $jmlHadirH_temp[$index] = Yii::app()->db->createCommand('
SELECT COUNT(*) SELECT COUNT(*)
...@@ -81,7 +82,8 @@ foreach ($list as $item) { ...@@ -81,7 +82,8 @@ foreach ($list as $item) {
WHERE STATUS = "H" AND mj.WEEK = "' . $item['WEEK'] . '" WHERE STATUS = "H" AND mj.WEEK = "' . $item['WEEK'] . '"
AND dj.SESSION = "' . $item['SESSION'] . '" AND dj.SESSION = "' . $item['SESSION'] . '"
AND dj.KODE_MK = "' . $Kode_MK . '" AND dj.KODE_MK = "' . $Kode_MK . '"
AND mj.KELAS = "' . $Kelas . '"')->queryAll(); AND mj.KELAS = "' . $Kelas . '"
AND mj.TANGGAL="' . $item['TANGGAL'] . '"')->queryAll();
$index++; $index++;
} }
......
...@@ -90,37 +90,6 @@ $form = $this->beginWidget('booster.widgets.TbActiveForm', array( ...@@ -90,37 +90,6 @@ $form = $this->beginWidget('booster.widgets.TbActiveForm', array(
</TABLE> </TABLE>
<?php //echo $form->datePickerGroup($model,'TANGGAL',array('widgetOptions'=>array('options'=>array(),'htmlOptions'=>array('class'=>'span5')), 'prepend'=>'<i class="glyphicon glyphicon-calendar"></i>', 'append'=>'Click on Month/Year to select a different Month/Year.')); ?>
<?php //echo $form->textFieldGroup($model,'START_TIME',array('widgetOptions'=>array('htmlOptions'=>array('class'=>'span5')))); ?>
<?php //echo $form->textFieldGroup($model,'END_TIME',array('widgetOptions'=>array('htmlOptions'=>array('class'=>'span5')))); ?>
<?php //echo $form->textAreaGroup($model,'TOPIK', array('widgetOptions'=>array('htmlOptions'=>array('rows'=>6, 'cols'=>50, 'class'=>'span8')))); ?>
<?php //echo $form->textFieldGroup($model,'RUANGAN',array('widgetOptions'=>array('htmlOptions'=>array('class'=>'span5','maxlength'=>100)))); ?>
<?php //echo $form->textFieldGroup($model,'AKTIFITAS',array('widgetOptions'=>array('htmlOptions'=>array('class'=>'span5','maxlength'=>15)))); ?>
<?php //echo $form->textFieldGroup($model,'PIC',array('widgetOptions'=>array('htmlOptions'=>array('class'=>'span5','maxlength'=>20)))); ?>
<?php //echo $form->dropDownListGroup($model,'TIPE_KULIAH', array('widgetOptions'=>array('data'=>array("Regular"=>"Regular","Pengganti"=>"Pengganti",), 'htmlOptions'=>array('class'=>'input-large')))); ?>
<?php //echo $form->textAreaGroup($model,'METODE', array('widgetOptions'=>array('htmlOptions'=>array('rows'=>6, 'cols'=>50, 'class'=>'span8')))); ?>
<?php //echo $form->textAreaGroup($model,'ALAT_BANTU', array('widgetOptions'=>array('htmlOptions'=>array('rows'=>6, 'cols'=>50, 'class'=>'span8')))); ?>
<?php //echo $form->textAreaGroup($model,'CATATAN', array('widgetOptions'=>array('htmlOptions'=>array('rows'=>6, 'cols'=>50, 'class'=>'span8')))); ?>
<?php //echo $form->textFieldGroup($model,'LAST_UPDATE',array('widgetOptions'=>array('htmlOptions'=>array('class'=>'span5','maxlength'=>20)))); ?>
<?php //echo $form->textFieldGroup($model,'USER_ID',array('widgetOptions'=>array('htmlOptions'=>array('class'=>'span5','maxlength'=>15)))); ?>
<?php //echo $form->textFieldGroup($model,'WS',array('widgetOptions'=>array('htmlOptions'=>array('class'=>'span5','maxlength'=>15)))); ?>
<?php $this->endWidget(); ?> <?php $this->endWidget(); ?>
<?php <?php
set_time_limit(0);
// //
//$file_path = dirname(__FILE__) . '\Jadual.xlsx'; //$file_path = dirname(__FILE__) . '\Jadual.xlsx';
// //
...@@ -37,71 +38,108 @@ $objPHPExcel = $objReader->load($file); //$file --> your filepath and filename ...@@ -37,71 +38,108 @@ $objPHPExcel = $objReader->load($file); //$file --> your filepath and filename
// echo '</tr>' . "\n"; // echo '</tr>' . "\n";
//} //}
//echo '</table>' . "\n"; //echo '</table>' . "\n";
$counter = 0;
foreach ($objPHPExcel->getWorksheetIterator() as $worksheet) { foreach ($objPHPExcel->getWorksheetIterator() as $worksheet) {
$worksheetTitle = $worksheet->getTitle(); $worksheetTitle = $worksheet->getTitle();
if ($worksheetTitle == "31B") { if ($worksheetTitle == "31B") {
break; break;
} }
//
//
//
$beritahadir = new BeritaAcaraDaftarHadir; // $beritahadir = new BeritaAcaraDaftarHadir;
//
$highestRow = $worksheet->getHighestRow(); // e.g. 10 // $highestRow = $worksheet->getHighestRow(); // e.g. 10
$highestColumn = $worksheet->getHighestColumn(); // e.g 'F' $highestColumn = $worksheet->getHighestColumn(); // e.g 'F'
$highestColumnIndex = PHPExcel_Cell::columnIndexFromString($highestColumn); $highestColumnIndex = PHPExcel_Cell::columnIndexFromString($highestColumn);
$nrColumns = ord($highestColumn) - 64; // $nrColumns = ord($highestColumn) - 64;
//
echo "<br>The worksheet " . $worksheetTitle . " has "; // echo "<br>The worksheet " . $worksheetTitle . " has ";
//
echo $nrColumns . ' columns (A-' . $highestColumn . ') '; // echo $nrColumns . ' columns (A-' . $highestColumn . ') ';
echo ' and ' . $highestRow . ' row.'; // echo ' and ' . $highestRow . ' row.';
echo '<br>Data: <table border="1"><tr>'; // echo '<br>Data: <table border="1"><tr>';
//
//
for ($row = 1; $row <= $highestRow; ++$row) { // for ($row = 1; $row <= $highestRow; ++$row) {
echo '<tr>'; // echo '<tr>';
for ($col = 0; $col < $highestColumnIndex; ++$col) { // for ($col = 0; $col < $highestColumnIndex; ++$col) {
$cell = $worksheet->getCellByColumnAndRow($col, $row); // $cell = $worksheet->getCellByColumnAndRow($col, $row);
$val = $cell->getValue(); // $val = $cell->getValue();
$dataType = PHPExcel_Cell_DataType::dataTypeForValue($val); // $dataType = PHPExcel_Cell_DataType::dataTypeForValue($val);
//
// $masterjadwal = new MJadwal; // $masterjadwal = new MJadwal;
// $masterjadwal->KELAS = $worksheetTitle; // $masterjadwal->KELAS = $worksheetTitle;
// $masterjadwal->WEEK = $worksheet->getCellByColumnAndRow(1, 1)->getValue(); // $masterjadwal->WEEK = $worksheet->getCellByColumnAndRow(1, 1)->getValue();
// $masterjadwal->TA = $worksheet->getCellByColumnAndRow(1, 2)->getValue(); // $masterjadwal->TA = $worksheet->getCellByColumnAndRow(1, 2)->getValue();
// $masterjadwal->ID_KUR = $worksheet->getCellByColumnAndRow(1, 3)->getValue(); // $masterjadwal->ID_KUR = $worksheet->getCellByColumnAndRow(1, 3)->getValue();
//
if (PHPExcel_Shared_Date::isDateTime($worksheet->getCellByColumnAndRow($col, $row))) { // if (PHPExcel_Shared_Date::isDateTime($worksheet->getCellByColumnAndRow($col, $row))) {
echo '<td>' . PHPExcel_Style_NumberFormat::ToFormattedString($cell->getValue(), "YYYY-MM-DD") . '</td>'; // echo '<td>' . PHPExcel_Style_NumberFormat::ToFormattedString($cell->getValue(), "YYYY-MM-DD") . '</td>';
$masterjadwal->TANGGAL = PHPExcel_Style_NumberFormat::ToFormattedString($cell->getValue(), "YYYY-MM-DD"); // $masterjadwal->TANGGAL = PHPExcel_Style_NumberFormat::ToFormattedString($cell->getValue(), "YYYY-MM-DD");
//$masterjadwal->save(); ////$masterjadwal->save();
$row = $row + 2; // $row = $row + 2;
$col = $col - 2; // $col = $col - 2;
echo '<tr></tr>'; // echo '<tr></tr>';
} elseif ($dataType != "null" && $val != "Tanggal") { // } elseif ($dataType != "null" && $val != "Tanggal") {
echo '<td>' . $val . '</td>'; // if ($row == 1 || $row == 2 || $row == 3) {
$detailjadwal = new DJadwal; // continue;
$detailjadwal->ID_JADWAL = $masterjadwal->ID; // }
//
if ($col == 0) { //// echo '<td>' . $val . " " . $row . " " . $col . " " . '</td>';
$detailjadwal->SESSION = $val; //// while ($counter >= 8) {
} elseif ($col == 1) { //// echo "if41" . $counter ;
$detailjadwal->KODE_MK = $val; //// echo '<td>' . $val . " " . $row . " " . $col . " " . '</td>';
} elseif ($col == 2) { //// $counter++;
$detailjadwal->RUANGAN = $val; //// }
} else { //// $counter = 0;
$detailjadwal->AKTIFITAS = $detailjadwal->getAktifitas($val); //// $detailjadwal = new DJadwal;
} //// $detailjadwal->ID_JADWAL = $masterjadwal->ID;
//// if ($col == 0) {
$beritakuliah = new BeritaAcaraKuliah; //// $detailjadwal->SESSION = $val;
//// } elseif ($col == 1) {
//// $detailjadwal->KODE_MK = $val;
//// } elseif ($col == 2) {
//// $detailjadwal->RUANGAN = $val;
//// } else {
//// $detailjadwal->AKTIFITAS = $detailjadwal->getAktifitas($val);
//// }
////
//// $beritakuliah = new BeritaAcaraKuliah;
// }
// }
// echo '</tr>';
// }
// echo '</table>';
$detail_jadwal;
for ($i = 5; $i < 50; $i = $i + 11) {
echo "<BR/>";
// echo "Tanggal : " . PHPExcel_Style_NumberFormat::ToFormattedString($worksheet->getCellByColumnAndRow(1, $i)->getValue(), "YYYY-MM-DD");
$masterjadwal = new MJadwal;
$masterjadwal->KELAS = $worksheetTitle;
$masterjadwal->WEEK = $worksheet->getCellByColumnAndRow(1, 1)->getValue();
$masterjadwal->TA = $worksheet->getCellByColumnAndRow(1, 2)->getValue();
$masterjadwal->ID_KUR = $worksheet->getCellByColumnAndRow(1, 3)->getValue();
echo $masterjadwal->KELAS . "<BR>";
$masterjadwal->TANGGAL = PHPExcel_Style_NumberFormat::ToFormattedString($worksheet->getCellByColumnAndRow(1, $i)->getValue(), "YYYY-MM-DD");
echo $masterjadwal->TANGGAL;
$masterjadwal->save();
for ($j = $i + 2; $j < $i + 10; $j++) {
for ($col = 0; $col < $highestColumnIndex; ++$col) {
$detail_jadwal[$col] = $worksheet->getCellByColumnAndRow($col, $j)->getValue();
// echo $worksheet->getCellByColumnAndRow($col, $j)->getValue();
// echo "<BR>";
} }
// $this->cekMaster($masterjadwal);
$this->createJadwal($detail_jadwal, $masterjadwal);
} }
echo '</tr>';
} }
echo '</table>';
} }
?> ?>
<?php
?>
<?php
set_time_limit(0);
//
//$file_path = dirname(__FILE__) . '\Jadual.xlsx';
//
//$sheet_array = Yii::app()->yexcel->readActiveSheet($file_path);
//
//echo "<table>";
//
//foreach ($sheet_array as $row) {
// echo "<tr>";
// foreach ($row as $column)
// echo "<td>$column.'BOS</td>";
// echo "</tr>";
//}
//
//echo "</table>";
//or
//echo first cell of excel file
$file = $path;
Yii::import('application.vendors.phpexcel.PHPExcel', true);
$objReader = PHPExcel_IOFactory::createReader('Excel2007');
//$objReader->setReadDataOnly('true');
$objPHPExcel = $objReader->load($file); //$file --> your filepath and filename
//$objWorksheet = $objPHPExcel->getActiveSheet();
//$highestRow = $objWorksheet->getHighestRow(); // e.g. 10
//$highestColumn = $objWorksheet->getHighestColumn(); // e.g 'F'
//$highestColumnIndex = PHPExcel_Cell::columnIndexFromString($highestColumn); // e.g. 5
//echo '<table>' . "\n";
//for ($row = 1; $row <= $highestRow; ++$row) {
// echo '<tr>' . "\n";
// for ($col = 0; $col <= $highestColumnIndex; ++$col) {
// echo '<td>' . $objWorksheet->getCellByColumnAndRow($col, $row)->getValue() . '</td>' . "\n";
// }
// echo '</tr>' . "\n";
//}
//echo '</table>' . "\n";
$counter = 0;
foreach ($objPHPExcel->getWorksheetIterator() as $worksheet) {
$worksheetTitle = $worksheet->getTitle();
if ($worksheetTitle == "33MI") {
break;
}
//
//
//
// $beritahadir = new BeritaAcaraDaftarHadir;
//
// $highestRow = $worksheet->getHighestRow(); // e.g. 10
$highestColumn = $worksheet->getHighestColumn(); // e.g 'F'
$highestColumnIndex = PHPExcel_Cell::columnIndexFromString($highestColumn);
// $nrColumns = ord($highestColumn) - 64;
//
// echo "<br>The worksheet " . $worksheetTitle . " has ";
//
// echo $nrColumns . ' columns (A-' . $highestColumn . ') ';
// echo ' and ' . $highestRow . ' row.';
// echo '<br>Data: <table border="1"><tr>';
//
//
// for ($row = 1; $row <= $highestRow; ++$row) {
// echo '<tr>';
// for ($col = 0; $col < $highestColumnIndex; ++$col) {
// $cell = $worksheet->getCellByColumnAndRow($col, $row);
// $val = $cell->getValue();
// $dataType = PHPExcel_Cell_DataType::dataTypeForValue($val);
//
// $masterjadwal = new MJadwal;
// $masterjadwal->KELAS = $worksheetTitle;
// $masterjadwal->WEEK = $worksheet->getCellByColumnAndRow(1, 1)->getValue();
// $masterjadwal->TA = $worksheet->getCellByColumnAndRow(1, 2)->getValue();
// $masterjadwal->ID_KUR = $worksheet->getCellByColumnAndRow(1, 3)->getValue();
//
// if (PHPExcel_Shared_Date::isDateTime($worksheet->getCellByColumnAndRow($col, $row))) {
// echo '<td>' . PHPExcel_Style_NumberFormat::ToFormattedString($cell->getValue(), "YYYY-MM-DD") . '</td>';
// $masterjadwal->TANGGAL = PHPExcel_Style_NumberFormat::ToFormattedString($cell->getValue(), "YYYY-MM-DD");
////$masterjadwal->save();
// $row = $row + 2;
// $col = $col - 2;
// echo '<tr></tr>';
// } elseif ($dataType != "null" && $val != "Tanggal") {
// if ($row == 1 || $row == 2 || $row == 3) {
// continue;
// }
//
//// echo '<td>' . $val . " " . $row . " " . $col . " " . '</td>';
//// while ($counter >= 8) {
//// echo "if41" . $counter ;
//// echo '<td>' . $val . " " . $row . " " . $col . " " . '</td>';
//// $counter++;
//// }
//// $counter = 0;
//// $detailjadwal = new DJadwal;
//// $detailjadwal->ID_JADWAL = $masterjadwal->ID;
//// if ($col == 0) {
//// $detailjadwal->SESSION = $val;
//// } elseif ($col == 1) {
//// $detailjadwal->KODE_MK = $val;
//// } elseif ($col == 2) {
//// $detailjadwal->RUANGAN = $val;
//// } else {
//// $detailjadwal->AKTIFITAS = $detailjadwal->getAktifitas($val);
//// }
////
//// $beritakuliah = new BeritaAcaraKuliah;
// }
// }
// echo '</tr>';
// }
// echo '</table>';
$detail_jadwal;
for ($i = 5; $i < 50; $i = $i + 11) {
echo "<BR/>";
// echo "Tanggal : " . PHPExcel_Style_NumberFormat::ToFormattedString($worksheet->getCellByColumnAndRow(1, $i)->getValue(), "YYYY-MM-DD");
$masterjadwal = new MJadwal;
$masterjadwal->KELAS = $worksheetTitle;
$masterjadwal->WEEK = $worksheet->getCellByColumnAndRow(1, 1)->getValue();
$masterjadwal->TA = $worksheet->getCellByColumnAndRow(1, 2)->getValue();
$masterjadwal->ID_KUR = $worksheet->getCellByColumnAndRow(1, 3)->getValue();
echo $masterjadwal->KELAS . "<BR>";
$masterjadwal->TANGGAL = PHPExcel_Style_NumberFormat::ToFormattedString($worksheet->getCellByColumnAndRow(1, $i)->getValue(), "YYYY-MM-DD");
echo $masterjadwal->TANGGAL;
$masterjadwal->save();
for ($j = $i + 2; $j < $i + 10; $j++) {
for ($col = 0; $col < $highestColumnIndex; ++$col) {
$detail_jadwal[$col] = $worksheet->getCellByColumnAndRow($col, $j)->getValue();
// echo $worksheet->getCellByColumnAndRow($col, $j)->getValue();
// echo "<BR>";
}
// $this->cekMaster($masterjadwal);
$this->createJadwal($detail_jadwal, $masterjadwal);
}
}
}
?>
<?php
?>
<div class="well">
<center>
<?php
$form = $this->beginWidget('booster.widgets.TbActiveForm', array(
'id' => 'mjadwal-form',
'enableAjaxValidation' => false,
'htmlOptions' => array('enctype' => 'multipart/form-data'),
));
// ...
//echo $form->labelEx($model, 'excelfile');
//echo $form->fileField($model, 'excelfile');
//echo $form->error($model, 'excelfile');
echo $form->fileFieldGroup($model, 'excelfile', array(
'wrapperHtmlOptions' => array(
'class' => 'col-sm-5',
),
)
);
// ...
$this->widget('booster.widgets.TbButton', array(
'buttonType' => 'submit',
'context' => 'primary',
'label' => 'Submit',
));
$this->endWidget();
?>
</center>
</div>
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment