Пример #1
0
<?php

require '../modules/Request.php';
if (isset($_GET['action'])) {
    switch ($_GET['action']) {
        case 'list_city':
            $r = new Request();
            $city = $r->get_city_list($_POST['id']);
            foreach ($city as $c) {
                echo "<option value=" . $c['id'] . ">" . $c['en_name'] . "</option>";
            }
            break;
        case 'get_hotel':
            $r = new Request();
            $hotels = $r->get_hotel_list($_POST['id']);
            echo "<option value='0'></option>";
            foreach ($hotels as $h) {
                echo "<option value=" . $h['id'] . ">" . $h['en_name'] . "</option>";
            }
            break;
        case 'get_room':
            $r = new Request();
            $rooms = $r->get_roomtype_list($_POST['id']);
            echo "<option value='0'></option>";
            foreach ($rooms as $r) {
                echo "<option value=" . $r['id'] . ">" . $r['name'] . "</option>";
            }
            break;
    }
} else {
    echo 'error';
Пример #2
0
        foreach ($c as $k => $cty) {
            $cities[$k]['id'] = $k;
            $cities[$k]['name'] = $cty->name;
            $cities[$k]['en_name'] = $cty->en_name;
            $cities[$k]['lat'] = $cty->lat;
            $cities[$k]['lat'] = $cty->long;
        }
        return $cities;
    }
    function get_airports()
    {
        $airports = $this->sendRequest('iata_airport', '[]');
        foreach ($airports as $k => $airpot_item) {
            $airport[$k]['id'] = $k;
            $airport[$k]['en_name'] = $airpot_item->en_name;
            $airport[$k]['name'] = $airpot_item->name;
            $airport[$k]['iata'] = $airpot_item->iata;
        }
        return $airport;
    }
}
if (isset($_POST['country_id'])) {
    $request = new Request();
    $country_ID = $_POST['country_id'];
    $city_list = $request->get_city_list($_POST['country_id']);
    $city_item_source = '';
    foreach ($city_list as $city_item) {
        $city_item_source .= '<option value="' . $city_item['id'] . '">' . (!empty($city_item['name']) ? $city_item['name'] . '/' : '') . (!empty($city_item['en_name']) ? $city_item['en_name'] : '') . '</option>';
    }
    echo $city_item_source;
}