当前位置: 首页>>代码示例>>PHP>>正文


PHP TravelHelper::checkTableDuplicate方法代码示例

本文整理汇总了PHP中TravelHelper::checkTableDuplicate方法的典型用法代码示例。如果您正苦于以下问题:PHP TravelHelper::checkTableDuplicate方法的具体用法?PHP TravelHelper::checkTableDuplicate怎么用?PHP TravelHelper::checkTableDuplicate使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TravelHelper的用法示例。


在下文中一共展示了TravelHelper::checkTableDuplicate方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _get_car_cant_order_by_id

 static function _get_car_cant_order_by_id($car_id, $check_in, $check_out, $order_item_id = '')
 {
     if (!TravelHelper::checkTableDuplicate('st_cars')) {
         return true;
     }
     global $wpdb;
     $string = "";
     if (!empty($order_item_id)) {
         $string = " AND order_item_id NOT IN ('{$order_item_id}') ";
     }
     $sql = "SELECT\r\n\t\t\tst_booking_id as car_id,\r\n\t\t\tmt.meta_value as number_car,\r\n\t\t\tmt.meta_value - COUNT(st_booking_id) as car_free\r\n\t\t\tFROM {$wpdb->prefix}st_order_item_meta\r\n\t\t\tINNER JOIN {$wpdb->prefix}postmeta as mt ON mt.post_id = st_booking_id AND mt.meta_key = 'number_car'\r\n\t\t\tWHERE\r\n\t\t\tst_booking_post_type = 'st_cars'\r\n\t\t\tAND status NOT IN ('trash', 'canceled')\r\n\t\t\tAND st_booking_id = '{$car_id}'\r\n\t\t\tAND (\r\n\t\t\t\t({$check_in} < check_in_timestamp AND {$check_out} > check_out_timestamp)\r\n\t\t\t\tOR(\r\n\t\t\t\t{$check_in} BETWEEN check_in_timestamp AND check_out_timestamp\r\n\t\t\t)\r\n\t\t\t\tOR(\r\n\t\t\t\t{$check_out} BETWEEN check_in_timestamp AND check_out_timestamp\r\n\t\t\t)\r\n\t\t\t)\r\n\t\t\t{$string}\r\n\t\t\tGROUP BY st_booking_id\r\n\t\t\tHAVING (mt.meta_value - COUNT(st_booking_id) <= 0)";
     $result = $wpdb->get_results($sql, ARRAY_A);
     if (is_array($result) && count($result)) {
         return false;
     }
     return true;
 }
开发者ID:DaddyFool,项目名称:travelTest,代码行数:17,代码来源:car.helper.php

示例2: _save_post

 public function _save_post($id)
 {
     if (!TravelHelper::checkTableDuplicate('st_hotel')) {
         return;
     }
     if (isset($_GET['post_type']) && $_GET['post_type'] == 'st_hotel' && isset($_GET['section']) && $_GET['section'] == 'edit_order_item' && isset($_GET['order_item_id'])) {
         $item_id = $_GET['order_item_id'];
         $status = $_POST['status'];
         if ($status == 'canceled') {
             $status = 'trash';
         }
         global $wpdb;
         $table = $wpdb->prefix . 'st_order_item_meta';
         $data = array('status' => $status);
         $where = array('order_item_id' => $item_id);
         $rs = $wpdb->update($table, $data, $where);
     }
 }
开发者ID:DaddyFool,项目名称:travelTest,代码行数:18,代码来源:class.admin.normal.checkout.php

示例3: _get_where_query

 function _get_where_query($where)
 {
     if (!TravelHelper::checkTableDuplicate('st_holidays')) {
         return $where;
     }
     global $wpdb;
     if (isset($_REQUEST['location_id']) && !empty($_REQUEST['location_id'])) {
         $location_id = STInput::get('location_id', '');
         $list = TravelHelper::getLocationByParent($location_id);
         if (is_array($list) && count($list)) {
             $where .= " AND (";
             $where_tmp = "";
             foreach ($list as $item) {
                 if (empty($where_tmp)) {
                     $where_tmp .= "tb.multi_location LIKE '%_{$item}_%'";
                 } else {
                     $where_tmp .= " OR tb.multi_location LIKE '%_{$item}_%'";
                 }
             }
             $list = implode(',', $list);
             $where_tmp .= " OR tb.id_location IN ({$list})";
             $where .= $where_tmp . ")";
         } else {
             $where .= " AND (tb.multi_location LIKE '%_{$location_id}_%' OR tb.id_location IN ('{$location_id}')) ";
         }
     } elseif (isset($_REQUEST['location_name']) && !empty($_REQUEST['location_name'])) {
         $location_name = STInput::get('location_name', '');
         $ids_location = TravelerObject::_get_location_by_name($location_name);
         if (is_array($ids_location) && count($ids_location)) {
             $ids_location_tmp = array();
             foreach ($ids_location as $item) {
                 $list = TravelHelper::getLocationByParent($item);
                 if (is_array($list) && count($list)) {
                     foreach ($list as $item) {
                         $ids_location_tmp[] = $item;
                     }
                 }
             }
             if (count($ids_location_tmp)) {
                 $ids_location = $ids_location_tmp;
             }
         }
         if (is_array($ids_location) && count($ids_location)) {
             $where .= " AND ((";
             $where_tmp = "";
             foreach ($ids_location as $item) {
                 if (empty($where_tmp)) {
                     $where_tmp .= "tb.multi_location LIKE '%_{$item}_%'";
                 } else {
                     $where_tmp .= " OR tb.multi_location LIKE '%_{$item}_%'";
                 }
             }
             $ids_location = implode(',', $ids_location);
             $where_tmp .= " OR tb.id_location IN ({$ids_location})";
             $where .= $where_tmp . ")";
             $where .= " OR (tb.address LIKE '%{$location_name}%'";
             $where .= " OR {$wpdb->prefix}posts.post_title LIKE '%{$location_name}%'))";
         } else {
             if (!empty($_REQUEST['search_all'])) {
                 $where .= " AND (tb.address LIKE '%{$location_name}%'";
                 $where .= " OR {$wpdb->prefix}posts.post_title LIKE '%{$location_name}%')";
             }
         }
     } elseif (isset($_REQUEST['address']) && !empty($_REQUEST['address'])) {
         $address = STInput::request('address', '');
         $value = STInput::request('address');
         $value = explode(",", $value);
         if (!empty($value[0]) and !empty($value[2])) {
             $where .= " AND ( tb.address LIKE '%{$value[0]}%' OR tb.address LIKE '%{$value[2]}%')";
         } else {
             $where .= " AND ( tb.address LIKE '%{$address}%')";
         }
     }
     if (isset($_REQUEST['item_id']) and !empty($_REQUEST['item_id'])) {
         $item_id = STInput::request('item_id', '');
         $where .= " AND ({$wpdb->prefix}posts.ID = '{$item_id}')";
     }
     if (isset($_REQUEST['item_name']) and !empty($_REQUEST['item_name'])) {
         $item_name = STInput::request('item_name', '');
         $where .= " AND ({$wpdb->prefix}posts.post_title LIKE '%{$item_name}%')";
     }
     if (isset($_REQUEST['people']) && !empty($_REQUEST['people'])) {
         $people = STInput::get('people', 1);
         $where .= " AND (tb.max_people >= {$people})";
     }
     if (isset($_REQUEST['duration']) && !empty($_REQUEST['duration'])) {
         $duration = intval(STInput::get('duration', 1));
         $today = time();
         $where .= "AND (\r\n                        (\r\n                            tb.duration_day = {$duration}\r\n                            AND tb.type_holiday = 'daily_holiday'\r\n                        )\r\n                    )";
         /*$where .= "AND (
               (
                   tb.duration_day >= {$duration}
                   AND tb.type_holiday = 'daily_holiday'
               )
               OR (
                   (
                      (UNIX_TIMESTAMP(STR_TO_DATE(tb.check_out, '%Y-%m-%d')) - UNIX_TIMESTAMP(STR_TO_DATE(tb.check_in, '%Y-%m-%d'))) / (60*60*24) + 1
                   ) >= {$duration}
               )
           )";*/
//.........这里部分代码省略.........
开发者ID:DaddyFool,项目名称:travelTest,代码行数:101,代码来源:class.holiday.php

示例4: _update_duplicate_data

 function _update_duplicate_data($id, $data)
 {
     if (!TravelHelper::checkTableDuplicate('st_hotel')) {
         return;
     }
     if (get_post_type($id) == 'hotel_room') {
         $hotel_id = get_post_meta($id, 'room_parent', true);
         $price_avg = get_post_meta($hotel_id, 'price_avg', true);
         if (!$price_avg) {
             return;
         }
         $data = array('multi_location' => get_post_meta($hotel_id, 'multi_location', true), 'id_location' => get_post_meta($hotel_id, 'id_location', true), 'address' => get_post_meta($hotel_id, 'address', true), 'rate_review' => get_post_meta($hotel_id, 'rate_review', true), 'hotel_star' => get_post_meta($hotel_id, 'hotel_star', true), 'price_avg' => $price_avg, 'hotel_booking_period' => get_post_meta($hotel_id, 'hotel_booking_period', true), 'map_lat' => get_post_meta($hotel_id, 'map_lat', true), 'map_lng' => get_post_meta($hotel_id, 'map_lng', true));
         $where = array('post_id' => $hotel_id);
         TravelHelper::updateDuplicate('st_hotel', $data, $where);
     }
 }
开发者ID:DaddyFool,项目名称:travelTest,代码行数:16,代码来源:class.admin.room.php

示例5: _get_where_query_tab_location

 /**
  * @update 1.1.8
  */
 function _get_where_query_tab_location($where)
 {
     // if in location tab location id = get_the_ID();
     $location_id = get_the_ID();
     if (!TravelHelper::checkTableDuplicate('st_activity')) {
         return $where;
     }
     $list = TravelHelper::getLocationByParent($location_id);
     if (is_array($list) && count($list)) {
         $where .= " AND (";
         $where_tmp = "";
         foreach ($list as $item) {
             if (empty($where_tmp)) {
                 $where_tmp .= "tb.multi_location LIKE '%_{$item}_%'";
             } else {
                 $where_tmp .= " OR tb.multi_location LIKE '%_{$item}_%'";
             }
         }
         $list = implode(',', $list);
         $where_tmp .= " OR tb.id_location IN ({$list})";
         $where .= $where_tmp . ")";
     } else {
         $where .= " AND (tb.multi_location LIKE '%_{$location_id}_%' OR tb.id_location IN ('{$location_id}')) ";
     }
     return $where;
 }
开发者ID:DaddyFool,项目名称:travelTest,代码行数:29,代码来源:class.activity.php

示例6: _get_where_query

 function _get_where_query($where)
 {
     if (!TravelHelper::checkTableDuplicate('st_rental')) {
         return $where;
     }
     global $wpdb;
     if ($location_id = STInput::get('location_id') and STInput::get('location_id') or get_post_type(get_the_ID()) == 'location') {
         if (!$location_id) {
             $location_id = get_the_ID();
         }
         $list = TravelHelper::getLocationByParent($location_id);
         if (is_array($list) && count($list)) {
             $where .= " AND (";
             $where_tmp = "";
             foreach ($list as $item) {
                 if (empty($where_tmp)) {
                     $where_tmp .= "tb.multi_location LIKE '%_{$item}_%'";
                 } else {
                     $where_tmp .= " OR tb.multi_location LIKE '%_{$item}_%'";
                 }
             }
             $list = implode(',', $list);
             $where_tmp .= " OR tb.location_id IN ({$list})";
             $where .= $where_tmp . ")";
         } else {
             $where .= " AND (tb.multi_location LIKE '%_{$location_id}_%' OR tb.location_id IN ('{$location_id}')) ";
         }
     } elseif ($location_name = STInput::request('location_name')) {
         $ids_location = TravelerObject::_get_location_by_name($location_name);
         if (is_array($ids_location) && count($ids_location)) {
             $ids_location_tmp = array();
             foreach ($ids_location as $item) {
                 $list = TravelHelper::getLocationByParent($item);
                 if (is_array($list) && count($list)) {
                     foreach ($list as $item) {
                         $ids_location_tmp[] = $item;
                     }
                 }
             }
             if (count($ids_location_tmp)) {
                 $ids_location = $ids_location_tmp;
             }
         }
         if (!empty($ids_location)) {
             $where .= " AND ((";
             $where_tmp = "";
             foreach ($ids_location as $id) {
                 if (empty($where_tmp)) {
                     $where_tmp .= " tb.multi_location LIKE '%_{$id}_%' ";
                 } else {
                     $where_tmp .= " OR tb.multi_location LIKE '%_{$id}_%' ";
                 }
             }
             $ids_location = implode(',', $ids_location);
             $where_tmp .= " OR (tb.location_id IN ({$ids_location})";
             $where .= $where_tmp . ")";
             $where .= " OR (tb.address LIKE '%{$location_name}%'";
             $where .= " OR {$wpdb->prefix}posts.post_title LIKE '%{$location_name}%')))";
         } else {
             if (!empty($_REQUEST['search_all'])) {
                 $where .= " AND (tb.address LIKE '%{$location_name}%'";
                 $where .= " OR {$wpdb->prefix}posts.post_title LIKE '%{$location_name}%')";
             }
         }
     } elseif ($address = STInput::request('address', '')) {
         $value = STInput::request('address');
         $value = explode(",", $value);
         if (!empty($value[0]) and !empty($value[2])) {
             $where .= " AND (tb.address LIKE '%{$value[0]}%' OR tb.address LIKE '%{$value[2]}%')";
         } else {
             $where .= " AND (tb.address LIKE '%{$address}%')";
         }
     }
     if (isset($_GET['start']) && isset($_GET['end']) and !empty($_GET['start']) and !empty($_GET['end'])) {
         $check_in = date('Y-m-d', strtotime(TravelHelper::convertDateFormat($_GET['start'])));
         $check_out = date('Y-m-d', strtotime(TravelHelper::convertDateFormat($_GET['end'])));
         $today = date('m/d/Y');
         $period = TravelHelper::dateDiff($today, $check_in);
         $adult_number = STInput::get('adult_number', 0);
         if (intval($adult_number) < 0) {
             $adult_number = 0;
         }
         $children_number = STInput::get('children_num', 0);
         if (intval($children_number) < 0) {
             $children_number = 0;
         }
         $list_rental = RentalHelper::_rentalValidate($check_in, $check_out, $adult_number, $children_number, 1);
         if (!is_array($list_rental) || count($list_rental) <= 0) {
             $list_rental = "''";
         } else {
             $list_rental = implode(',', $list_rental);
         }
         $where .= " AND {$wpdb->posts}.ID NOT IN ({$list_rental}) AND CAST(tb.rentals_booking_period AS UNSIGNED) <= {$period}";
     }
     if ($star = STInput::get('star_rate')) {
         $stars = STInput::get('star_rate', 1);
         $stars = explode(',', $stars);
         $all_star = array();
         if (!empty($stars) && is_array($stars)) {
             foreach ($stars as $val) {
//.........这里部分代码省略.........
开发者ID:DaddyFool,项目名称:travelTest,代码行数:101,代码来源:class.rental.php

示例7: get_min_max_price

 static function get_min_max_price($post_type = 'st_hotel')
 {
     if (empty($post_type) || !TravelHelper::checkTableDuplicate($post_type)) {
         return array('price_min' => 0, 'price_max' => 500);
     }
     global $wpdb;
     $sql = "\r\n                select \r\n                    min(CAST(price_avg as DECIMAL)) as min,\r\n                    max(CAST(price_avg as DECIMAL)) as max\r\n                from {$wpdb->prefix}st_hotel";
     $results = $wpdb->get_results($sql, OBJECT);
     $price_min = $results[0]->min;
     $price_max = $results[0]->max;
     if (empty($price_min)) {
         $price_min = 0;
     }
     if (empty($price_max)) {
         $price_max = 500;
     }
     return array('min' => ceil($price_min), 'max' => ceil($price_max));
 }
开发者ID:DaddyFool,项目名称:travelTest,代码行数:18,代码来源:class.hotel.php

示例8: add_query_arg

            } else {
                //$link = home_url(esc_url('?s=&post_type=st_hotel&location_id='.get_the_ID()));
                //$link = home_url(esc_url('?s=&post_type=st_holidays&location_id='.get_the_ID()."&pick-up=".get_the_title()));
                $link = add_query_arg(array('s' => '', 'post_type' => 'st_holidays', 'location_id' => get_the_ID(), 'pick-up' => get_the_title()), home_url('/'));
            }
            if ($offer <= 1) {
                $offer_string = sprintf(__('%d Holiday from %s', ST_TEXTDOMAIN), $offer, $min_price);
            } else {
                $offer_string = sprintf(__('%d Holidays from %s', ST_TEXTDOMAIN), $offer, $min_price);
            }
            echo '<li><a href="' . $link . '"><i class="fa fa-bolt"></i> ' . $offer_string . '</a></li>';
        }
    }
}
$activity = new STActivity();
if ($activity->is_available() && TravelHelper::checkTableDuplicate('st_activity')) {
    $info = new STLocation();
    $info = $info->get_info_by_post_type(get_the_ID(), 'st_activity');
    $min_price = $info['min_max_price']['price_min'];
    $min_price = TravelHelper::format_money($min_price);
    if (empty($min_price) or !$min_price) {
        $min_price = __("Free", ST_TEXTDOMAIN);
    }
    if (is_array($info) && count($info)) {
        $offer = $info['offers'];
        if (!empty($offer)) {
            $page_search = st_get_page_search_result('st_activity');
            if (!empty($page_search) and get_post_type($page_search) == 'page') {
                //$link = add_query_arg(array('location_id'=>get_the_ID()),get_the_permalink($page_search));
                $link = add_query_arg(array('location_id' => get_the_ID(), 'pick-up' => get_the_title()), get_the_permalink($page_search));
            } else {
开发者ID:DaddyFool,项目名称:travelTest,代码行数:31,代码来源:html.php

示例9: _get_query_join

 static function _get_query_join($join)
 {
     $st_type = $_SESSION['el_st_type'];
     if (!TravelHelper::checkTableDuplicate($st_type)) {
         return $join;
     }
     global $wpdb;
     $table = $wpdb->prefix . $st_type;
     $join .= " INNER JOIN {$table} as tb ON {$wpdb->prefix}posts.ID = tb.post_id";
     return $join;
 }
开发者ID:DaddyFool,项目名称:travelTest,代码行数:11,代码来源:st-list-map-new.php

示例10: get_min_max_price

 static function get_min_max_price($post_type)
 {
     if (empty($post_type) || !TravelHelper::checkTableDuplicate($post_type)) {
         return array('price_min' => 0, 'price_max' => 500);
     }
     $meta_key = 'sale_price';
     if ($post_type == 'st_hotel') {
         $meta_key = 'price_avg';
     }
     $location_text = "id_location";
     if ($post_type == 'st_rental') {
         $location_text = 'location_id';
     }
     global $wpdb;
     $sql = "\r\n            select \r\n                min(CAST({$meta_key} as DECIMAL)) as min,\r\n                max(CAST({$meta_key} as DECIMAL)) as max";
     if ($post_type == 'st_tours' || $post_type == 'st_holidays' || $post_type == 'st_activity') {
         /*$sql = "
           select 
               min(CAST(child_price as Decimal)) , 
               min(CAST(adult_price as Decimal)), 
               max(CAST(child_price as Decimal)) , 
               max(CAST(adult_price as Decimal)) 
           " ;*/
         $sql = "\r\n            select \r\n                min(CAST(adult_price as Decimal)), \r\n                max(CAST(adult_price as Decimal)) \r\n            ";
     }
     $sql .= " from {$wpdb->prefix}{$post_type} ";
     $join = "";
     $where = "";
     $join .= " join {$wpdb->posts} on {$wpdb->posts}.ID = {$wpdb->prefix}{$post_type}.post_id ";
     $join = STLocation::edit_join_wpml($join, $post_type);
     $sql .= $join;
     $where = " where (1=1 ) ";
     $where .= "and \r\n                (\r\n                    {$wpdb->posts}.post_status = 'publish'\r\n                )\r\n                    ";
     $where = STLocation::edit_where_wpml($where);
     $sql .= $where;
     //echo $sql;
     $results = $wpdb->get_results($sql, OBJECT);
     $array_price = array();
     if ($post_type == 'st_tours' || $post_type == 'st_holidays' || $post_type == 'st_activity') {
         foreach ($results[0] as $key => $value) {
             $array_price[] = $value;
         }
         $price_min = min($array_price);
         $price_max = max($array_price);
     } else {
         $price_min = $results[0]->min;
         $price_max = $results[0]->max;
     }
     if (!$price_max) {
         $price_max = 500;
     }
     // default 0 500
     return array('price_min' => ceil($price_min), 'price_max' => ceil($price_max));
 }
开发者ID:DaddyFool,项目名称:travelTest,代码行数:54,代码来源:class.travelobject.php

示例11: _get_holiday_cant_order

 static function _get_holiday_cant_order($holiday_id, $check_in)
 {
     if (!TravelHelper::checkTableDuplicate('st_holidays')) {
         return '';
     }
     global $wpdb;
     $sql = "SELECT\r\n\t\t\t\tst_booking_id AS holiday_id,\r\n\t\t\t\tmt.meta_value AS max_people,\r\n\t\t\t\tmt.meta_value - SUM(\r\n\t\t\t\t\tDISTINCT (adult_number + child_number + infant_number)\r\n\t\t\t\t) AS free_people\r\n\t\t\tFROM\r\n\t\t\t\t{$wpdb->prefix}st_order_item_meta\r\n\t\t\tINNER JOIN {$wpdb->prefix}postmeta AS mt ON mt.post_id = st_booking_id\r\n\t\t\tAND mt.meta_key = 'max_people'\r\n\t\t\tWHERE\r\n\t\t\tst_booking_id = '{$holiday_id}'\r\n\t\t\tAND\r\n\t\t\t\tst_booking_post_type = 'st_holidays'\r\n\t\t\tAND (\r\n\t\t\t\tSTR_TO_DATE('{$check_in}', '%m/%d/%Y') = STR_TO_DATE(check_in, '%m/%d/%Y')\r\n\t\t\t)\r\n\t\t\tAND status NOT IN ('trash', 'canceled')\r\n\t\t\tGROUP BY st_booking_id\r\n\t\t\tHAVING\r\n\t\t\tmax_people - SUM(\r\n\t\t\t\t\tDISTINCT (adult_number + child_number + infant_number)\r\n\t\t\t\t) <= 0";
     $result = $wpdb->get_col($sql, 0);
     $list_date = array();
     if (is_array($result) && count($result)) {
         $list_date = $result;
     }
     return $list_date;
 }
开发者ID:DaddyFool,项目名称:travelTest,代码行数:14,代码来源:availability.helper.php

示例12: _get_minmax

 static function _get_minmax($holiday_id, $year)
 {
     if (!TravelHelper::checkTableDuplicate('st_holidays')) {
         return '';
     }
     // st_holiday
     global $wpdb;
     $sql = "SELECT\r\n\t\t\t\tMIN(check_in_timestamp) AS check_in,\r\n\t\t\t\tMAX(check_out_timestamp) AS check_out\r\n\t\t\tFROM\r\n\t\t\t\t{$wpdb->prefix}st_order_item_meta\r\n\t\t\tINNER JOIN {$wpdb->prefix}st_holidays AS mt ON mt.post_id = st_booking_id\r\n\t\t\tWHERE\r\n\t\t\t\tst_booking_post_type = 'st_holidays'\r\n\t\t\tAND mt.type_holiday = 'daily_holiday'\r\n\t\t\tAND st_booking_id = '{$holiday_id}'\r\n\t\t\tAND YEAR (\r\n\t\t\t\tFROM_UNIXTIME(check_in_timestamp)\r\n\t\t\t) = {$year}\r\n\t\t\tAND YEAR (\r\n\t\t\t\tFROM_UNIXTIME(check_out_timestamp)\r\n\t\t\t) = {$year}\r\n\t\t\tAND status NOT IN ('trash', 'canceled')";
     $min_max = $wpdb->get_row($sql, ARRAY_A);
     return $min_max;
 }
开发者ID:DaddyFool,项目名称:travelTest,代码行数:11,代码来源:holiday.helper.php

示例13: _get_query_join

 static function _get_query_join($join)
 {
     if (!TravelHelper::checkTableDuplicate('st_rental')) {
         return $join;
     }
     global $wpdb;
     $table = $wpdb->prefix . 'st_rental';
     $join .= " INNER JOIN {$table} as tb ON {$wpdb->prefix}posts.ID = tb.post_id";
     return $join;
 }
开发者ID:DaddyFool,项目名称:travelTest,代码行数:10,代码来源:st-list-rental.php

示例14: _get_query_where

 static function _get_query_where($where)
 {
     if (!TravelHelper::checkTableDuplicate('st_holidays')) {
         return $where;
     }
     global $wpdb;
     $only_featured_location = $_SESSION['el_only_featured_location'];
     $st_location = $_SESSION['el_st_location'];
     $featured = $_SESSION['el_featured'];
     if ($only_featured_location == 'yes') {
         if (is_array($featured) && count($featured)) {
             $where .= " AND (";
             $where_tmp = "";
             foreach ($featured as $item) {
                 if (empty($where_tmp)) {
                     $where_tmp .= " tb.multi_location LIKE '%_{$item}_%'";
                 } else {
                     $where_tmp .= " OR tb.multi_location LIKE '%_{$item}_%'";
                 }
             }
             $featured = implode(',', $featured);
             $where_tmp .= " OR tb.id_location IN ({$featured})";
             $where .= $where_tmp . ")";
         }
     } else {
         if (!empty($st_location)) {
             $list = TravelHelper::getLocationByParent($st_location);
             if (is_array($list) && count($list)) {
                 $where .= " AND (";
                 $where_tmp = "";
                 foreach ($list as $item) {
                     if (empty($where_tmp)) {
                         $where_tmp .= "tb.multi_location LIKE '%_{$item}_%'";
                     } else {
                         $where_tmp .= " OR tb.multi_location LIKE '%_{$item}_%'";
                     }
                 }
                 $list = implode(',', $list);
                 $where_tmp .= " OR tb.id_location IN ({$list})";
                 $where .= $where_tmp . ")";
             } else {
                 $where .= " AND (tb.multi_location LIKE '%_{$st_location}_%' OR tb.id_location IN ('{$st_location}')) ";
             }
         }
     }
     return $where;
 }
开发者ID:DaddyFool,项目名称:travelTest,代码行数:47,代码来源:st-list-holiday.php

示例15: _get_query_where

 static function _get_query_where($where)
 {
     $post_type = $_SESSION['el_post_type'];
     if (!TravelHelper::checkTableDuplicate($post_type)) {
         return $where;
     }
     global $wpdb;
     $location_field = 'id_location';
     if ($post_type == 'st_rental') {
         $location_field = 'location_id';
     }
     $location_id = get_the_ID();
     $list = TravelHelper::getLocationByParent($location_id);
     if (is_array($list) && count($list)) {
         $where .= " AND (";
         $where_tmp = "";
         foreach ($list as $item) {
             if (empty($where_tmp)) {
                 $where_tmp .= "tb.multi_location LIKE '%_{$item}_%'";
             } else {
                 $where_tmp .= " OR tb.multi_location LIKE '%_{$item}_%'";
             }
         }
         $list = implode(',', $list);
         $where_tmp .= " OR tb.{$location_field} IN ({$list})";
         $where .= $where_tmp . ")";
     } else {
         $where .= " AND (tb.multi_location LIKE '%_{$location_id}_%' OR tb.{$location_field} IN ('{$location_id}')) ";
     }
     return $where;
 }
开发者ID:DaddyFool,项目名称:travelTest,代码行数:31,代码来源:class.location.php


注:本文中的TravelHelper::checkTableDuplicate方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。