<?php

/**
 * 前台 酒店图片 模块 Model
 * ============================================================================
 * zhuna_php 住哪网酒店分销联盟程序php版　BY Tmac PHP MVC framework
 * $Author: zhaojianjun $  <zwttmac@qq.com>
 * $Id: hotelpicture.class.php 157 2012-02-16 05:27:40Z zhaojianjun $
 * http://un.zhuna.cn；
 */
class hotelpicture extends Model
{

    private $db;
    private $hotel_table;

    /**
     * 初始化变量　定义私有变量
     */
    public function _init()
    {
        //连接数据库
        $this->db = $this->connect();
        $this->hotel_table = DB_PREFIX . 'hotel';
    }

    /**
     * 真实点评图片
     * @param <type> $hotelpictures
     * @return <type>
     */
    public function dianping_pic($hotelpictures, $hotel_id)
    {
        $nofind_dianping_pic = '';
        $result = array();
        $picurl = $GLOBALS['TmacConfig']['config']['picurl'];
        $hotelpictures_array = explode('@_@', $hotelpictures);
        if (count($hotelpictures_array) > 1) {
            $hotelpictures_array[1] = substr($hotelpictures_array[1], 0, strrpos($hotelpictures_array[1], ','));
            $pic_ary = explode(',', $hotelpictures_array[1]);
            $result = array();
            if (count($pic_ary)> 1) {
                foreach ($pic_ary AS $k => $v) {
	                $pic_array = explode(':', $v);
	                $result[$k]['pic_name'] = $pic_array[0];
	                $result[$k]['pic_name_cut'] = Functions::cut_str($pic_array[0], 12);
	                $result[$k]['pic_z_url'] = $picurl . '/uppic/temupload/' . $hotel_id . '/z_' . $pic_array[1];
	                $result[$k]['pic_x_url'] = $picurl . '/uppic/temupload/' . $hotel_id . '/x_' . $pic_array[1];
                }            	
            }else {
            	$nofind_dianping_pic = '暂时没有图片点评!';
            }
            

        } else {
            $nofind_dianping_pic = '暂时没有图片点评!';
        }
        $result['rs'] = $result;
        $result['nofind'] = $nofind_dianping_pic;
        return $result;
    }

}