ceklog(); $this->load->library('pdf_daftarusm'); $this->load->library('rhrpt'); $this->load->library('rhlib'); } function ceklog() { $user = $this->session->userdata("user_id1unla"); if($user==""){ redirect('user/login'); } } function get_bilangan($num){ return $this->rhlib->get_bilangan($num); } function get_par_val($table,$fieldName,$condition){ return $this->rhlib->get_par_val($table,$fieldName,$condition); } function get_row_pars($table,$fields,$condition){ return $this->rhlib->get_row_pars($table,$fields,$condition); } function TanggalIndo($date){ $BulanIndo = array("Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember"); $tahun = substr($date, 0, 4); $bulan = substr($date, 4, 2); $tgl = substr($date, 6, 2); $result =$tgl . " " . $BulanIndo[(int)$bulan-1] . " ". $tahun; return($result); } function set_hari($tanggal){ $namahari = date('l', strtotime($tanggal)); if ($namahari == "Sunday") $namahari = "Minggu"; else if ($namahari == "Monday") $namahari = "Senin"; else if ($namahari == "Tuesday") $namahari = "Selasa"; else if ($namahari == "Wednesday") $namahari = "Rabu"; else if ($namahari == "Thursday") $namahari = "Kamis"; else if ($namahari == "Friday") $namahari = "Jumat"; else if ($namahari == "Saturday") $namahari = "Sabtu"; else $namahari = ''; return $namahari; } function get_ruangan(){ $KEDUA= $this->load->database('second', TRUE); $q = $KEDUA->query("SELECT idruangan,concat(nmruangan ,' - ', klpruangan.nmklpruangan) as nmruangan FROM ruangan LEFT JOIN klpruangan ON ruangan.idklpruangan = klpruangan.idklpruangan"); $result = array(); if ($q->num_rows() > 0) { foreach($q->result() as $row) { $result[$row->idruangan]=$row->nmruangan; } } return $result; } function get_data($idjadwalusm,$idstmskmhs=null,$idtempat=null){ if ($idstmskmhs==1) { if ($idtempat==null) { $where = " AND pmb.idstmskmhs<>'2'"; $where2 = " AND p.idstmskmhs<>'2'"; } else { $where = " AND pmb.idruangan='$idtempat' AND pmb.idstmskmhs<>'2'"; $where2 = " AND d.idruangan='$idtempat' AND p.idstmskmhs<>'2'"; } } else if($idstmskmhs==2) { if ($idtempat==null) { $where = " AND pmb.idstmskmhs='2'"; $where2 = " AND p.idstmskmhs='2'"; } else { $where = " AND fakultas.kdfakultas='$idtempat' AND pmb.idstmskmhs='2'"; $where2 = " AND fk.kdfakultas='$idtempat' AND p.idstmskmhs='2'"; } } else { $where = ""; } $query = $this->db->query("SELECT pmb.nopmb , pmb.nama , pmb.kdjk , concat(`pmb`.`tptlahir`, ', ', `pmb`.`tgllahir`) AS tmpttgllhr , `stmskmhs`.`nmstmskmhs` AS `nmstmskmhs` , `jadwalusm`.`nmjadwalusm` AS `nmjadwalusm` , date_format(`jadwalusm`.`tglusm`,'%d/%m/%Y') AS `tglusm` , concat(`jadwalusm`.`jamusmdari`, ' s/d ', `jadwalusm`.`jamusmsampai`) AS jamusm , pmb.kdprodi1 , prodi.nmprodi AS prodi1 , pmb.idstmskmhs , fakultas.kdfakultas , fakultas.nmfakultas , pmb.idruangan , 1 AS isown FROM pmb LEFT JOIN `stmskmhs` ON `stmskmhs`.`idstmskmhs` = `pmb`.`idstmskmhs` LEFT JOIN jadwalpmb ON pmb.idjadwalpmb = jadwalpmb.idjadwalpmb AND jadwalpmb.idstatus = 1 LEFT JOIN `jadwalusm` ON `jadwalusm`.`idjadwalpmb` = pmb.`idjadwalpmb` AND `jadwalusm`.idstmskmhs = '$idstmskmhs' LEFT JOIN prodi ON pmb.kdprodi1 = prodi.kdprodi LEFT JOIN fakultas ON prodi.kdfakultas = fakultas.kdfakultas WHERE pmb.idstpmb=1 AND `jadwalusm`.idjadwalusm='$idjadwalusm'".$where. "UNION SELECT d.nopmb , p.nama , NULL , NULL , NULL , NULL , NULL , NULL , NULL , NULL , p.idstmskmhs , fk.kdfakultas , fk.nmfakultas , d.idruangan , 0 AS isown FROM daftarusmsusulan d LEFT JOIN pmb p ON p.nopmb = d.nopmb LEFT JOIN prodi pr ON p.kdprodi1 = pr.kdprodi LEFT JOIN fakultas fk ON pr.kdfakultas = fk.kdfakultas WHERE d.idjadwalusmsusulan='$idjadwalusm'".$where2); $result = array(); if ($query->num_rows() > 0) { $result = $query->result(); } return $result; } function get_rows_peserta($idjadwalusm,$idstmskmhs){ $data = $this->get_data($idjadwalusm,$idstmskmhs); $dataruangan = $this->get_ruangan(); $rows = ""; $tempat = ""; $no=1; $mark= ""; foreach($data as $item) { $tempat = ($item->idstmskmhs==2) ? 'FAKULTAS '.$item->nmfakultas:$dataruangan[$item->idruangan]; if ($item->isown) { $mark= " "; } else { $mark= "* "; } $rows .= " ".$no.". ".$mark.$item->nopmb." ".$item->nama." ".$tempat." "; $no++; } return $rows; } function get_rows_hadir($idjadwalusm,$idstmskmhs,$idtempat){ $data = $this->get_data($idjadwalusm,$idstmskmhs,$idtempat); $rows = ""; $tempat = ""; $no=1; $height = "height=\"30\""; $mark= ""; foreach($data as $item) { if ($item->isown) { $mark= " "; } else { $mark= "* "; } $rows .= " ".$no.". ".$mark.$item->nopmb." ".$item->nama." ".$item->prodi1." "; $no++; } return $rows; } function daftarpeserta($idjadwalusm,$idstmskmhs){ $nmjadwalusm = $this->get_par_val("jadwalusm","nmjadwalusm","idjadwalusm='$idjadwalusm'"); $datahead['title'] = 'DAFTAR PESERTA'; $datahead['nmjadwalusm'] = $nmjadwalusm; $pdf = new Pdf_daftarusm; $pdf->SetCreator(PDF_CREATOR); $pdf->addHeaderParams($datahead); // set default header data $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH,PDF_HEADER_TITLE,PDF_HEADER_STRING); $pdf->setPrintHeader(true); $pdf->setPrintFooter(false); // set header and footer fonts $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', 10)); $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); // set default monospaced font $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); // set margins $pdf->SetMargins('20', '47', '20'); $pdf->SetHeaderMargin('10'); $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); // set auto page breaks $pdf->SetAutoPageBreak(TRUE, '8.3'); // set image scale factor $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); // set some language-dependent strings (optional) // --------------------------------------------------------- $pdf->SetCellPadding(0); // add a page $pdf->AddPage('P','F4'); $pdf->SetFont('helvetica', '', 8); $rows_peserta = $this->get_rows_peserta($idjadwalusm,$idstmskmhs); $tbl = << No. No. PMB Nama Tempat / Ruangan $rows_peserta
* Keterangan : Peserta yang mengikuti ujian susulan EOD; $pdf->writeHTML($tbl,true,false,false,false); $pdf->Output('daftarpesertausm.pdf', 'I'); } //=================================================================================================== function daftarhadir($idjadwalusm,$idstmskmhs,$idtempat,$before=1,$between=4){ $jadwalusm = $this->get_row_pars("jadwalusm","nmjadwalusm,tglusm,CONCAT(TIME_FORMAT(jamusmdari, '%H:%i'),' - ',TIME_FORMAT(jamusmsampai, '%H:%i')) as jam","idjadwalusm='$idjadwalusm'"); $nmjadwalusm = $jadwalusm->nmjadwalusm; $hari = $this->set_hari($jadwalusm->tglusm); $tgl = $this->TanggalIndo(date("Ymd",strtotime($jadwalusm->tglusm))); $jam = $jadwalusm->jam; if ($idstmskmhs==1) { $dataruangan = $this->get_ruangan(); $nmtempat = $dataruangan[$idtempat]; } else if($idstmskmhs==2) { $nmtempat = $this->get_par_val("fakultas","CONCAT('FAKULTAS ',nmfakultas)","kdfakultas='$idtempat'"); } $datahead['title'] = 'DAFTAR HADIR'; $datahead['nmjadwalusm'] = $nmjadwalusm; $datahead['waktu'] = $hari.', '.$tgl; $datahead['jam'] = $jam; $datahead['nmtempat'] = $nmtempat; $pdf = new Pdf_daftarusm; $pdf->SetCreator(PDF_CREATOR); $pdf->addHeaderParams($datahead); // set default header data $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH,PDF_HEADER_TITLE,PDF_HEADER_STRING); $pdf->setPrintHeader(true); $pdf->setPrintFooter(false); // set header and footer fonts $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', 10)); $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); // set default monospaced font $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); // set margins $pdf->SetMargins('10', '60', '10'); $pdf->SetHeaderMargin('10'); $pdf->SetFooterMargin(PDF_MARGIN_FOOTER); // set auto page breaks $pdf->SetAutoPageBreak(TRUE, '11.3'); // set image scale factor $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO); // set some language-dependent strings (optional) // --------------------------------------------------------- $pdf->SetCellPadding(0); // add a page $pdf->AddPage('P','F4'); $pdf->SetFont('helvetica', '', 8); $rows_hadir = $this->get_rows_hadir($idjadwalusm,$idstmskmhs,$idtempat); $tbl = << $rows_hadir
No. No. PMB Nama Prog Studi Tanda Tangan Nilai

* Keterangan : Peserta yang mengikuti ujian susulan EOD; $pdf->writeHTML($tbl,true,false,false,false); $pdf->Cell(110,5,'',0,0,'L'); $pdf->Cell(76,5,'Pengawas',0,1,'C'); for($a=1;$a<$between;$a++){ $pdf->Cell(110,5,'',0,1,'C');//space } $pdf->Cell(110,5,'',0,0,'L'); $pdf->Cell(76,5,'_________________________________',0,1,'C'); $pdf->Output('daftarhadirusm.pdf', 'I'); } } ?>