<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
 * 二手房后台系统共用函数文件
 *
 * @package     CodeIgniter
 * @subpackage  Helpers
 * @category    Helpers
 * @author      HOUSE365 ESF Dev Team
 * @link        http://nj.sell.house365.com/
 */


/**
 * 获取二手房的房源详情页地址
 * @param   mixed  $row 房源信息,必须含有id
 * @return  stirng 二手房房源详情页地址
 * @update  2014/5/30 esf dev team
 */
if( !function_exists('get_sellinfo_url') )
{
    function get_sellinfo_url($row)
    {   
        $url = '';
        if( is_array( $row ) ) 
        {
            $rowid = !empty( $row['ID'] ) ? $row['ID'] : 0;
        }
        else
        {   
            $rowid = intval($row) > 0 ? intval($row) : 0;
        }
        
        $url = GB_SELL_URL."/s_".$rowid.".html?update=1"; 

        return $url;
    }
}


/**
 * 获取求购详情页地址
 * @param   int  $rowid 房源信息id
 * @return  stirng
 * @update  2014/5/30 esf dev team
 */
if( !function_exists('get_buyinfo_url') )
{
    function get_buyinfo_url($rowid)
    {   
        //求购详情页地址
        $url = '';
        //求购信息编号
        $id = 0;
        
        $id = intval($rowid) > 0 ? intval($rowid) : 0;
        
        $url = $GB_SELL_URL."/b_".$id.".html";
        
        return $url;
    }
}


/**
 * 获取租房的房源地址
 * @param array  $row 房源信息,必须含有id
 * @return stirng
 * @update  2014/5/30 esf dev team
 */
if(!function_exists('get_rentinfo_url'))
{
    function get_rentinfo_url($row) //房源地址
    {
        $url = '';
        
        if( is_array( $row ) ) 
        {
            $rowid = !empty( $row['ID'] ) ? $row['ID'] : 0;
        }
        else
        {   
            $rowid = intval($row) > 0 ? intval($row) : 0;
        }
        
        //$url = GB_RENT_URL."/rentinfo.php?id=".$rowid."&update=1";
        $url = GB_RENT_URL."/r_".$rowid.".html?update=1";

        return $url;
    }
}


/**
 * 获取问答地址
 * @param int  $qid 问题编号
 * @return stirng
 * @update  2014/5/30 esf dev team
 */
if(!function_exists('get_questioninfo_url'))
{
    function get_questioninfo_url($qid)
    {   
        $url = '';
        $qid = intval($qid);
        
        //问答详情页地址
        $url = GB_SELL_URL."/ask_".$qid.".html";
        
        return $url;
    }
}


/**
 * 获取小区详情页地址
 * @param int  $blockid 小区编号id
 * @return stirng
 * @update  2014/5/30 esf dev team
 */
if(!function_exists('get_blockinfo_url'))
{
    function get_blockinfo_url($blockid)
    {   
        $url = '';
        $blockid = intval($blockid);
        
		if( $blockid > 0)
		{
			$url = GB_SELL_URL."/community_id".$blockid."/";
		}

        return $url;
    }
}



/**
 * 获取学校详情页地址
 * @param int  $blockid 小区编号id
 * @return stirng
 * @update  2014/5/30 esf dev team
 */
if(!function_exists('get_schoolinfo_url'))
{
    function get_schoolinfo_url($schoolid)
    {   
        $url = '';
        $schoolid = intval($schoolid);
        
		if( $schoolid > 0)
		{
			$url = GB_SELL_URL."/school_id".$schoolid."/";
		}

        return $url;
    }
}
/* End of file common_url_helper.php */
/* Location: ./applications/helpers/common_url_helper.php */