コード例 #1
0
function handle()
{
    include_once 'model/coupon_logic.php';
    global $search_bar_coupon_name, $search_bar_coupon_category, $search_bar_coupon_name_bool, $search_bar_coupon_category_bool, $array_of_coupons_after_search;
    global $search_bar_coupon_distance, $search_bar_coupon_distance_bool;
    global $user_location_longitude;
    global $user_location_latitude;
    if ($search_bar_coupon_name_bool) {
        $array_of_coupons_after_search = search_coupons_by_name($search_bar_coupon_name);
        if ($search_bar_coupon_distance_bool) {
            $array_of_coupons_after_search = array_values(array_filter($array_of_coupons_after_search, "filter_by_loc"));
        }
    } else {
        if ($search_bar_coupon_distance_bool) {
            $array_of_coupons_after_search = array_values(array_filter($array_of_coupons_after_search, "filter_by_loc"));
        }
    }
}
コード例 #2
0
function handle()
{
    global $search_bar_coupon_name, $search_bar_coupon_category, $search_bar_coupon_name_bool, $search_bar_coupon_category_bool, $array_of_coupons_after_search;
    global $section, $sub_section, $item;
    global $search_bar_coupon_distance, $search_bar_coupon_distance_bool;
    global $user_location_longitude;
    global $user_location_latitude;
    global $connected_user_name;
    if ($section == "home" && $sub_section == "search") {
        if ($search_bar_coupon_name_bool) {
            $array_of_coupons_after_search = search_coupons_by_name($search_bar_coupon_name);
            if ($search_bar_coupon_category_bool) {
                $array_of_coupons_after_search = array_values(array_filter($array_of_coupons_after_search, "filter_by_cat"));
            }
            if ($search_bar_coupon_distance_bool) {
                $array_of_coupons_after_search = array_values(array_filter($array_of_coupons_after_search, "filter_by_loc"));
            }
        } else {
            if ($search_bar_coupon_category_bool) {
                $array_of_coupons_after_search = search_coupons_by_category($search_bar_coupon_category);
                if ($search_bar_coupon_distance_bool) {
                    $array_of_coupons_after_search = array_values(array_filter($array_of_coupons_after_search, "filter_by_loc"));
                }
            } else {
                if ($search_bar_coupon_distance_bool) {
                    $array_of_coupons_after_search = array_values(array_filter($array_of_coupons_after_search, "filter_by_loc"));
                }
            }
        }
    } else {
        if ($section == "purchase_confirmation" && $item != "") {
            client_buy_coupon($connected_user_name, $item);
        } else {
            if ($section == "MyCoupons") {
                if ($sub_section == "unused") {
                    $array_of_coupons_after_search = search_coupons_by_user_unused($connected_user_name);
                } else {
                    $array_of_coupons_after_search = search_coupons_by_user($connected_user_name);
                }
            }
        }
    }
}