ceklog(); $this->load->library('pdf_kartu_ujian'); $this->load->library('rhrpt'); $this->load->library('rhlib'); } function ceklog() { $user = $this->session->userdata("user_id1unla"); if($user==""){ redirect('user/login'); } } function get_par_val($table,$fieldName,$condition){ return $this->rhlib->get_par_val($table,$fieldName,$condition); } function get_row_pars2($table,$fields,$condition){ return $this->rhlib->get_row_pars2($table,$fields,$condition); } function get_ujian($kdprodi,$kdstsemester,$idjnsujian,$idkelas,$thnmasuk,$idsemester,$userid){ $KEDUA= $this->load->database('second', TRUE); /* $sql="SELECT * FROM tv_jadwalujian WHERE kdprodi='$kdprodi' and kdstsemester='$kdstsemester' and idjnsujian='$idjnsujian' and idkelas ='$idkelas' and kdmk IN(select kdmk from nilai a where a.kdstsemester='$kdstsemester' and a.kdprodi='$kdprodi' and a.nim = '$userid' and a.idstsetuju=1 and a.nidu=(SELECT nidu from struprogdet b WHERE b.kdstsemester = '$kdstsemester' and b.kdprodi = '$kdprodi' and b.kdmk = a.kdmk and b.idkelas ='$idkelas' and b.nidu=a.nidu and b.idjnsdosen='1')) ORDER BY tglujian"; */ $sql="SELECT n.kdmk , m.nmmkind , j.nmkelas , j.tglujian , j.mulai , j.selesai , j.nmdosdgngelar FROM nilai n LEFT JOIN matakuliah m ON m.kdmk = n.kdmk AND m.kdprodi = n.kdprodi LEFT JOIN absenmhs a ON a.kdmk = n.kdmk AND a.kdprodi = n.kdprodi AND a.kdstsemester = n.kdstsemester AND a.nidu = n.nidu AND a.nim = n.nim LEFT JOIN tv_jadwalujian j ON j.kdmk = n.kdmk AND j.kdprodi = n.kdprodi AND j.kdstsemester = '$kdstsemester' AND j.idkelas = a.idkelas AND j.idjnsujian = '$idjnsujian' WHERE n.nim = '$userid' AND n.kdstsemester = '$kdstsemester' AND n.idstsetuju = '1' AND n.is_konversi is NULL ORDER BY j.tglujian, n.kdmk"; $query = $KEDUA->query($sql); $data = array(); if ($query->num_rows() > 0) { $data = $query->result(); } return $data; } 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"; return $namahari; } 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 get_rows($kdprodi,$kdstsemester,$idjnsujian,$idkelas,$thnmasuk,$idsemester,$userid){ $data = $this->get_ujian($kdprodi,$kdstsemester,$idjnsujian,$idkelas,$thnmasuk,$idsemester,$userid); $rows = ""; $no = 0; $tglujian = ""; $hariujian = ""; $heightcol = "height=\"20\""; if ($data) { foreach($data as $item) { $no++; $tglujian = ($item->tglujian) ? date("d/m/Y",strtotime($item->tglujian)):"-"; $hariujian = ($item->tglujian) ? $this->set_hari($item->tglujian):"-"; $rows .= " ".$no. " ".$hariujian. " ".$tglujian." ".$item->nmmkind." ".$item->mulai." - ".$item->selesai." ".$item->nmkelas." "; } } else { $rows = " BELUM ADA JADWAL UJIAN "; } return $rows; } function get_kartu_ujian($userid,$kdprodi,$kdstsemester,$idjnsujian){ $row_mhs = $this->get_row_pars2("vv_mahasiswa_profile2","nim,nmmhs,nmprodi,thnmasuk","nim='$userid'"); $nim = $row_mhs->nim; $nmmhs = $row_mhs->nmmhs; $nmprodi = $row_mhs->nmprodi; $thnmasuk = $row_mhs->thnmasuk; $row_kelas_semester = $this->get_row_pars2("v_stmhssemester","nmthnakademik,nmkelas,idkelas,idsemester","nim='$userid' AND kdstsemester='$kdstsemester'"); if ($row_kelas_semester) { $semester = $row_kelas_semester->nmthnakademik; $kelas = $row_kelas_semester->nmkelas; $idkelas = $row_kelas_semester->idkelas; $idsemester = $row_kelas_semester->idsemester; } else { $semester = ""; $kelas = ""; $idkelas = ""; $idsemester = ""; } $row_jujian = $this->get_row_pars2("jujian","kdjnsujian,nmjnsujian","idjnsujian='$idjnsujian'"); $kdujian = $row_jujian->kdjnsujian; $nmujian = $row_jujian->nmjnsujian; $this->pdf_kartu_ujian->SetCreator(PDF_CREATOR); // set default header data $this->pdf_kartu_ujian->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH,PDF_HEADER_TITLE,PDF_HEADER_STRING); $this->pdf_kartu_ujian->setPrintHeader(true); $this->pdf_kartu_ujian->setPrintFooter(false); // set header and footer fonts $this->pdf_kartu_ujian->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', 10)); $this->pdf_kartu_ujian->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA)); // set default monospaced font $this->pdf_kartu_ujian->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED); // set margins $this->pdf_kartu_ujian->SetMargins('5', '27', '5'); $this->pdf_kartu_ujian->SetHeaderMargin('10'); $this->pdf_kartu_ujian->SetFooterMargin(PDF_MARGIN_FOOTER); // set auto page breaks $this->pdf_kartu_ujian->SetAutoPageBreak(TRUE, '10'); // set image scale factor $this->pdf_kartu_ujian->setImageScale(PDF_IMAGE_SCALE_RATIO); // set some language-dependent strings (optional) // --------------------------------------------------------- // setting page format $page_format = array( 'MediaBox' => array ('llx' => 0, 'lly' => 0, 'urx' => 150, 'ury' => 150), 'Dur' => 3, 'trans' => array( 'D' => 1.5, 'S' => 'Split', 'Dm' => 'V', 'M' => 'O' ), //'Rotate' => 90, 'PZ' => 1, ); $this->pdf_kartu_ujian->SetCellPadding(0); // add a page $resolution= array(150.60, 150.70); //$this->pdf_kartu_ujian->AddPage('L',$page_format); $this->pdf_kartu_ujian->AddPage('P','B5'); $this->pdf_kartu_ujian->SetFont('helvetica', 'B', 7); $this->pdf_kartu_ujian->Write(0, 'KARTU PESERTA UJIAN', '', 0, 'C', true, 0, false, false, 0); $this->pdf_kartu_ujian->SetFont('helvetica', '', 7); $html = '

NPM : '.$nim.' Kelas (Utama) : '.$kelas.'
Nama : '.$nmmhs.' Jenis Ujian : '.$kdujian.' ('.$nmujian.')
Program Studi : '.$nmprodi.' Tahun Akademik - Semester : '.$semester.'
'; $this->pdf_kartu_ujian->writeHTML($html, true, 0, true, 0); $rows_jadwal_ujian = $this->get_rows($kdprodi,$kdstsemester,$idjnsujian,$idkelas,$thnmasuk,$idsemester,$userid); $tbl = << $rows_jadwal_ujian
No Hari Tanggal Matakuliah Waktu Kelas Paraf Pengawas

EOD; $this->pdf_kartu_ujian->writeHTML($tbl,true,false,false,false); $this->pdf_kartu_ujian->Write(0, 'Catatan : Kartu peserta harap dibawa selama ujian berlangsung', '', 0, 'L', true, 0, false, false, 0); $this->pdf_kartu_ujian->Write(0, '', '', 0, 'L', true, 0, false, false, 0); $this->pdf_kartu_ujian->Cell(40,4,'',0,0,'C'); $this->pdf_kartu_ujian->Cell(60,4,'',0,0,'C'); $this->pdf_kartu_ujian->Cell(60,4,'Mahasiswa,',0,1,'C'); $this->pdf_kartu_ujian->Cell(60,5,'',0,1,'C'); $this->pdf_kartu_ujian->Cell(60,5,'',0,1,'C'); $this->pdf_kartu_ujian->Cell(40,4,'',0,0,'C'); $this->pdf_kartu_ujian->Cell(60,4,'',0,0,'C'); $this->pdf_kartu_ujian->Cell(60,4,$nmmhs,0,1,'C'); $this->pdf_kartu_ujian->Output('kartu_ujian.pdf', 'I'); } } ?>