<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
 * Rent_match_base_model CLASS
 *
 * 出售多图管理类
 *
 * @package         zsb
 * @subpackage      Models
 * @category        Models
 * @author          xz
 */

//加载父类
load_m("house_attr_model");
class Sell_attr_model extends House_attr_model {
    
    /**
     * 类初始化
     */
    public function __construct() 
    {
        parent::__construct();
                
        //初始化查询字段
        $select_fileds = array('id' , 'infotype' , 'uid' , 'esta' , 'address' , 
                               'isreal' , 'remark' , 'isstar' , 'istag' , 'nofee');
        $this->set_select_fields($select_fileds);
    }
    
    
    /**
      * 根据房源编号获取房源信息
      *
      * @access	protected
      * @param	array $select_fields 需要查询的字段
      * @return	array    
      */
    protected function get_houseinfo_by_id( $select_fields )
    {
        $houseinfo_data = array();

        //设置的房源编号
        $rowid = $this->get_rowid();
        
        if( $rowid  > 0 )
        {
            $this->load->model('sell_base_model');
            $this->sell_base_model->set_select_fields($select_fields);
            $houseinfo_data = $this->sell_base_model->find_by_id($rowid);
            
            //字段大小写统一
            if( is_array( $houseinfo_data ) && !empty( $houseinfo_data ) )
            {   
                //加载数组辅助类
                $this->load->helper('common_array');
                $houseinfo_data = array_key_to_case($houseinfo_data);
            }
        }
        
        $this->house_info = $houseinfo_data;
    }
    
    
    /**
     * 更新房源属性值
     *
     * @access  protected
     * @param   array $update_info  需要更新的字段键值对
     * @param   array $ids  房源编号
     * @return  boolean  是否更新成功
     */
    protected function update_house_atrr_val( $update_info , $ids )
    {
        $result = FALSE;
        
        if(is_array($update_info) && !empty($update_info) && $ids != '')
        {   
            $this->load->model('sell_base_model');
            $result_update = $this->sell_base_model->update( $update_info , $ids );
            $result = $result_update > 0 ? TRUE : FALSE ;
        }

        return $result;
    }
}
/* End of file sell_attr_model.php */
/* Location: ./applications/models/sell_attr_model.php */