Esempio n. 1
0
 function print_leave()
 {
     //call session
     $data['id_users'] = $this->session->userdata('id_users');
     $data['user_type'] = $this->session->userdata('user_type');
     if ($data['user_type'] == 'staff') {
         //get users details staff
         $table = 'users';
         $tableNameToJoin = array('staff');
         $tableRelation = array('users.id_users = staff.id_users');
         $where = array('users.id_users' => $data['id_users']);
         $data['rsProfile'] = $this->m_query->get_specified_row($table, $where, $tableNameToJoin, $tableRelation);
     } else {
         redirect('users/login', 'refresh');
     }
     $id_apply_leave = $this->uri->segment(4);
     //get tahun semasa
     $table_year = date("Y");
     //get staff id_users
     $table = 'apply_leave';
     $tableNameToJoin = array('staff', 'leave_staff');
     $tableRelation = array('staff.id_users = apply_leave.id_users', 'apply_leave.id_users = leave_staff.id_users');
     $where = array('apply_leave.id_apply_leave' => $id_apply_leave, 'leave_staff.table_year' => $table_year);
     $data['detail_staff'] = $this->m_query->get_specified_row($table, $where, $tableNameToJoin, $tableRelation);
     if ($data['detail_staff']['gender'] == 'Female') {
         $table = "apply_leave";
         $tableNameToJoin = array('staff', 'leave_name_female');
         $tableRelation = array('apply_leave.id_users = staff.id_users', 'apply_leave.leave_code = leave_name_female.leave_code');
         $where = array('id_apply_leave' => $id_apply_leave);
         $data['apply_leave'] = $this->m_query->get_specified_row($table, $where, $tableNameToJoin, $tableRelation);
     } else {
         if ($data['detail_staff']['gender'] == 'Male') {
             $table = "apply_leave";
             $tableNameToJoin = array('staff', 'leave_name_male');
             $tableRelation = array('apply_leave.id_users = staff.id_users', 'apply_leave.leave_code = leave_name_male.leave_code');
             $where = array('id_apply_leave' => $id_apply_leave);
             $data['apply_leave'] = $this->m_query->get_specified_row($table, $where, $tableNameToJoin, $tableRelation);
         }
     }
     $p = new pdf();
     $p->load_view('admin/v_print_leave', $data);
     $p->set_paper('c4', 'potrait');
     $p->render();
     $p->stream("download.pdf", array('Attachment' => 0));
     $p->stream("maklumat_permohonan.pdf");
 }
Esempio n. 2
0
<?php

require '../vendor/autoload.php';
/* JABH creamos una funcion en App
define('DOMPDF_ENABLE_AUTOLOAD', false);
require_once '../vendor/dompdf/dompdf/dompdf_config.inc.php';

*/
$data = array('nombre' => 'Jonny Alexander Berrio', 'curso' => 'Laravel 5');
/* JABH creamos una funcion en App

ob_start();
extract($data);
include '../templates/pdf/certificate-2.php';
$html= ob_get_clean();

*/
require_once '../app/template.php';
$html = template::render('pdf/certificate-2', $data);
/* JABH creamos una funcion en App
$dompdf = new DOMPDF();
$dompdf->load_html($html);
$dompdf->render();
$dompdf->stream("sample.pdf");
*/
require_once '../app/pdf.php';
pdf::render('certificate-2', $html);