<?
defined('BASEPATH') OR exit('No direct script access allowed');

class m_comment_setting extends CI_Model{

	function __construct(){
		parent::__construct();

        $this->load->database();
        $this->load->library('session');
	}

	#---------------------------------------------------------------------------
    # PURPOSE :	comment_setting select
    # CREATE  :	2018-02-23
    #---------------------------------------------------------------------------
	function comment_setting_select($req_data){
	    # request
        $setting_type   = $req_data['setting_type'];

        $this->db->where('setting_type', $setting_type);
        $this->db->from('comment_setting');
        $res = $this->db->get();
        $row = $res->result_array();

        return $row;

    }

    #---------------------------------------------------------------------------
    # PURPOSE :	comment_setting update
    # CREATE  :	2018-02-23
    #---------------------------------------------------------------------------
	function comment_setting_update($req_data){
        # request
        $setting_type               = $req_data['setting_type'];
        $best_comment_like_count    = $req_data['best_comment_like_count'];
        $max_best_comment_count     = $req_data['max_best_comment_count'];
        $block_call_count           = $req_data['block_call_count'];
        $block_call_type            = $req_data['block_call_type'];
        $block_blind_conent         = $req_data['block_blind_conent'];
        $block_del_conent           = $req_data['block_del_conent'];
        $self_del_contnet           = $req_data['self_del_contnet'];

        $user_id    = $this->session->userdata('Adm_Id');
        $now_date   = date("Y-m-d H:i:s");

        $update_data = array('best_comment_like_count' => $best_comment_like_count,
                             'max_best_comment_count' => $max_best_comment_count,
                             'block_call_count' => $block_call_count,
                             'block_call_type' => $block_call_type,
                             'block_blind_conent' => $block_blind_conent,
                             'block_del_conent' => $block_del_conent,
                             'self_del_contnet' => $self_del_contnet,
                             'update_id' => $user_id,
                             'update_date' => $now_date
        );
        $this->db->where('setting_type', $setting_type);
        $row = $this->db->update('comment_setting', $update_data);

        return $row;

    }


    #---------------------------------------------------------------------------
    # PURPOSE :	comment_setting list
    # CREATE  :	2018-03-13
    #---------------------------------------------------------------------------
	function comment_setting_list(){
        $this->db->from('comment_setting');
        $res = $this->db->get();
        $row = $res->result_array();

        return $row;

    }


    #---------------------------------------------------------------------------
    # PURPOSE :	select
    # CREATE  :	2018-04-11
    #---------------------------------------------------------------------------
	function contents_setting_select($idx){

        $this->db->where('idx', $idx);
        $this->db->from('contents_setting');

        $res = $this->db->get();
        $row = $res->row_array();


        return $row;
    }
    

    #---------------------------------------------------------------------------
    # PURPOSE :	select
    # CREATE  :	2018-05-10
    #---------------------------------------------------------------------------
	function comment_setting_where_content_idx_select($content_idx){

        $this->db->where('setting_type', $content_idx);
        $this->db->from('comment_setting');
        $res = $this->db->get();
        $row = $res->row_array();

        return $row;
    }






}
?>
