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

class m_contents_setting extends CI_Model{

	// 생성자, 해당 모델이 생성될때 항상 실행되는 초기화작업
	function __construct(){
		parent::__construct();

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


	#---------------------------------------------------------------------------
    # PURPOSE :	contents_setting select
    # CREATE  :	2018-02-22
    #---------------------------------------------------------------------------
	function contents_setting_select($req_data){
         # request
	    $idx = $req_data;

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

        return $row;

    }

    #---------------------------------------------------------------------------
    # PURPOSE :	contents_setting update
    # CREATE  :	2018-02-22
    #---------------------------------------------------------------------------
	function contents_setting_update($req_data){
	    # request
        $idx                    = $req_data['idx'];
        $is_duplication         = $req_data['is_duplication'];
        $no_duplication_setting = $req_data['no_duplication_setting'];
        $stat_time              = $req_data['stat_time'];


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

        $update_data = array('is_duplication' => $is_duplication,
                             'no_duplication_setting' => $no_duplication_setting,
                             'stat_time' => $stat_time,
                             'update_id' => $user_id,
                             'update_date' => $now_date
        );
        if(isset($req_data['etc_char1'])==true) {
            $update_data['etc_char1'] = $req_data['etc_char1'];
        }
        $this->db->where('idx', $idx);
        $row = $this->db->update('contents_setting', $update_data);
        return $row;


    }
}
?>
