emprit

CI-cetak

Nov 3rd, 2012
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.57 KB | None | 0 0
  1. ------------VIEW---------------
  2. <?php
  3. $i=0;
  4. foreach ($query as $row){
  5. $i++;
  6. echo    "<tr class='odd gradeX'>";
  7. echo    "<td><center>$i</center></td>";
  8. echo    "<td>GE_$row->no_urut</td>";
  9. echo    "<td>$row->nama_lengkap</td>";
  10. echo    "<td>$row->tempat_lahir, $row->tgl_lahir</td>";
  11. echo    "<td>$row->jk</td>";
  12. echo    "<td>$row->alamat</td>";
  13. echo    "<td>$row->kota, $row->country</td>";
  14. echo    "<td>$row->agama</td>";
  15. echo    "<td>$row->telp</td>";
  16. echo    "<td>$row->email</td>";
  17. echo      "<td><a href='cetak_admin/{$row->no_urut}'>Cetak</a></td>";
  18. echo  "</tr>";
  19. }
  20. ?>
  21.  
  22. ----------Controller-----------
  23.  
  24. function cetak_admin($no_urut){
  25.         require_once(APPPATH . 'third_party/tcpdf/config/lang/eng.php');
  26.         require_once(APPPATH . 'third_party/tcpdf/tcpdf.php');
  27.        
  28.         $no_urut = $this->session->userdata('no_urut');
  29.         $query = $this->pelamar_model->data_pelamar($no_urut);
  30.         $this->load->helper('chapps'); 
  31.        
  32. // create new PDF document
  33. $pdf = new TCPDF('P','cm','A4');
  34.  
  35. // add a page
  36. $pdf->AddPage();
  37.  
  38. // set document information
  39. $pdf->SetCreator(PDF_CREATOR);
  40. $pdf->SetAuthor('Emprit');
  41. $pdf->SetTitle('Biodata Pelamar');
  42. $pdf->SetSubject('Biodata untuk '.$this->session->userdata('username'));
  43.  
  44. $pdf->SetFont('times', '', 12);
  45.  
  46. $row=$query->row();
  47. $pdf->Cell(5,0.5,'No Urut Pelamar',0,0,'L');
  48. $pdf->Cell(0.2,0.5,':',0,0,'C');
  49. $pdf->Cell(10,0.5,'GE_'.$row->no_urut,0,1,'L');
  50.  
  51. --------------MODEL------------------
  52. public function data_pelamar($no_urut) {
  53.     $query=$this->db->where('no_urut',$no_urut)->get('biodata_pelamar');
  54.     return $query->result();
  55.     }
Advertisement
Add Comment
Please, Sign In to add comment