<?php 



class M_template_email extends CI_Model{	



    



    function __construct() {



        parent::__construct();



    }



    function kode_user(){



        return $this->session->userdata("kode_user");



    }



    function ambil_email(){



        $kode_user = $this->kode_user();



        $sql = "SELECT email FROM tb_user WHERE kode_user = '$kode_user'";



        return $this->db->query($sql);



    }



    function select_data_template_email(){



        $sql = "SELECT * FROM tb_template_email";



        return $this->db->query($sql);



    }



    function ambil_header_footer(){



        $sql = "SELECT * FROM tb_template_email";



        return $this->db->query($sql);



    }



    function update_header_footer($data){



        $sql = "UPDATE `tb_template_email` SET `header_email`='$data[header]',`footer_email`='$data[footer]' WHERE id_template_email='$data[id_template_email]'";



        return $this->db->query($sql);



    }



    function update_adm_reg($data){



        $sql = "UPDATE `tb_template_email` SET `sjk_adm_reg`='$data[sjk_adm_reg]',`msg_adm_reg`='$data[msg_adm_reg]' WHERE id_template_email='$data[id_template_email]'";



        return $this->db->query($sql);



    }



    function update_user_reg($data){



        $sql = "UPDATE `tb_template_email` SET `sjk_user_reg`='$data[sjk_user_reg]',`msg_user_reg`='$data[msg_user_reg]' WHERE id_template_email='$data[id_template_email]'";



        return $this->db->query($sql);



    }



    function update_user_reg_acc($data){



        $sql = "UPDATE `tb_template_email` SET `sjk_user_reg_acc`='$data[sjk_user_reg_acc]',`msg_user_reg_acc`='$data[msg_user_reg_acc]' WHERE id_template_email='$data[id_template_email]'";



        return $this->db->query($sql);



    }



    function update_user_reg_rjk($data){



        $sql = "UPDATE `tb_template_email` SET `sjk_user_reg_rjk`='$data[sjk_user_reg_rjk]',`msg_user_reg_rjk`='$data[msg_user_reg_rjk]' WHERE id_template_email='$data[id_template_email]'";



        return $this->db->query($sql);



    }



    function update_user_acc_pka($data){



        $sql = "UPDATE `tb_template_email` SET `sjk_user_acc_pka`='$data[sjk_user_acc_pka]',`msg_user_acc_pka`='$data[msg_user_acc_pka]' WHERE id_template_email='$data[id_template_email]'";



        return $this->db->query($sql);



    }



    function update_user_rev_pka($data){



        $sql = "UPDATE `tb_template_email` SET `sjk_user_rev_pka`='$data[sjk_user_rev_pka]',`msg_user_rev_pka`='$data[msg_user_rev_pka]' WHERE id_template_email='$data[id_template_email]'";



        return $this->db->query($sql);



    }



    function update_adm_send_ev_pka($data){



        $sql = "UPDATE `tb_template_email` SET `sjk_adm_send_ev_pka`='$data[sjk_adm_send_ev_pka]',`msg_adm_send_ev_pka`='$data[msg_adm_send_ev_pka]' WHERE id_template_email='$data[id_template_email]'";



        return $this->db->query($sql);



    }



    function update_user_rev_ev_pka($data){



        $sql = "UPDATE `tb_template_email` SET `sjk_user_rev_ev_pka`='$data[sjk_user_rev_ev_pka]',`msg_user_rev_ev_pka`='$data[msg_user_rev_ev_pka]' WHERE id_template_email='$data[id_template_email]'";



        return $this->db->query($sql);



    }



    function update_user_acc_ev_pka($data){



        $sql = "UPDATE `tb_template_email` SET `sjk_user_acc_ev_pka`='$data[sjk_user_acc_ev_pka]',`msg_user_acc_ev_pka`='$data[msg_user_acc_ev_pka]' WHERE id_template_email='$data[id_template_email]'";



        return $this->db->query($sql);



    }



}