<?php

/**
 * 前台 酒店地标 模块 Model
 * ============================================================================
 * zhuna_php 住哪网酒店分销联盟程序php版　BY Tmac PHP MVC framework
 * $Author: zhangwentao $  <zwttmac@qq.com>
 * $Id: hotellable.class.php 7 2011-11-09 01:24:46Z zhangwentao $
 * http://un.zhuna.cn；
 */
class hotellable extends Model
{

    private $lable_model;

    /**
     * 初始化变量　定义私有变量
     */
    public function _init()
    {
        //连接数据库
//        $this->connect();
        $this->lable_model = Tmac::model('lable');
    }

    public function getPointArray($nearbypoints)
    {
        $point_ary = explode(',', $nearbypoints);
        $point_array = array();
        if (is_array($point_ary)) {
            foreach ($point_ary AS $k => $v) {
                $point_tmp = explode(':', $v);
                $point_array[$k]['name'] = $point_tmp[0];
                $point_array[$k]['name_urlencode'] = urlencode($point_tmp[0]);
                $point_array[$k]['lable_name'] = $this->lable_model->getClassname($point_tmp[1]);
            }
        }
        return $point_array;
    }

    /**
     * 通过star取星级
     * @param <type> $star
     * @return int
     */
    public function hotelRankNameNum($star)
    {
        If ($star > 6 and $star < 17) {
            $hotelranknamenum = 2; //经济型
        } elseif ($star > 4 and $star < 7) {
            $hotelranknamenum = 3; //舒适型
        } elseif ($star > 2 and $star < 5) {
            $hotelranknamenum = 4; //高档型
        } elseif ($star > 0 and $star < 3) {
            $hotelranknamenum = 5; //豪华型}
        }
        return $hotelranknamenum;
    }

    /**
     * 通过star取星级名字
     * @param <type> $star
     * @return string 
     */
    public function hotelRankName($star)
    {
        If ($star > 6 and $star < 17) {
            $hotelrankname = "二星级"; //经济型
        } elseIf ($star > 4 and $star < 7) {
            $hotelrankname = "三星级"; //舒适型
        } elseIf ($star > 2 and $star < 5) {
            $hotelrankname = "四星级"; //高档型
        } elseIf ($star > 0 and $star < 3) {
            $hotelrankname = "五星级"; //豪华型
        }
        return $hotelrankname;
    }

}