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

class m_ad_detail extends CI_Model{

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

        $this->load->database();
	}

    var $ad_page_tb_name = 'ad_page'; // 광고 페이지 테이블 이름
    var $ad_code_tb_name = 'ad_detail'; // 광고 코드 테이블 이름

    #---------------------------------------------------------------------------
    # PURPOSE :	
    # CREATE  :	
    #---------------------------------------------------------------------------
	function detail_list(){

	    # request
        $sql1 = "SELECT a.idx, b.page_name, b.ad_pos_name, a.ad_code, a.ad_file, a.ad_option FROM $this->ad_code_tb_name AS a JOIN  $this->ad_page_tb_name AS b ON a.ad_idx = b.idx";

        $res1 = $this->db->query($sql1);
        
        $i = 0;
        $return_data = array();
        foreach($res1->result_array() as $row) {
            $return_data['row'][$i] = $row;
            $i++;
        }

        // $array = json_decode(json_encode($row1), true);

        return $return_data;
    }

    #---------------------------------------------------------------------------
    # PURPOSE :	비밀번호 수정
    # CREATE  :	2018-02-19
    #---------------------------------------------------------------------------
	// function member_passwd_update($req_data){
	//     # request
    //     $new_user_pwd   = $req_data['new_user_pwd'];
    //     $user_id        = $this->session->userdata('Adm_Id');

    //     $sql1 = "update admin 
    //                 set user_pwd = MD5('".$new_user_pwd."')
    //               where is_del = 'N' and user_id ='".$user_id."'";
    //     $this->db->query($sql1);

    // }


    #---------------------------------------------------------------------------
    # PURPOSE :	admin where user_id count
    # CREATE  :	2018-03-14
    #---------------------------------------------------------------------------
	// function admin_where_partner_id_count($req_data){
	//     # request
    //     $user_id          = $req_data;

    //     $this->db->where('user_id', $user_id);
    //     $this->db->from('admin');
    //     $row = $this->db->count_all_results();

    //     return $row;
    // }



}
?>
