예제 #1
0
function findHotelesDestinos($params = array())
{
    $result = array('result' => 'error', 'msg' => '', 'data' => null);
    $term = $params['term'];
    $resultados = buscarHotelesAndDestinosActivos($term);
    $result = array('result' => 'ok', 'data' => $resultados);
    return json_encode($result);
}
예제 #2
0
<?php

$result = array('msg' => 'error', 'data' => 'Acción no valida');
$action = $_POST['action'];
if (strcmp($action, 'search') == 0) {
    $term = $_POST['term'];
    $resultados = buscarHotelesAndDestinosActivos($term, $_POST['nodestinos']);
    $result = array('msg' => 'ok', 'lista' => $resultados);
}
if (strcmp($action, 'filter') == 0) {
    $term = $_POST['term'];
    $start = $_POST['start'];
    $hotelId = 0;
    if (isset($_POST['hotelId'])) {
        $hotelId = $_POST['hotelId'];
    }
    //$hoteles = getHotelesCampaniasActivas($term, ((isset($_POST['paginar_otros'])) ? 0 : $start), 10, $hotelId, $_POST);
    $hoteles = getHotelesCampaniasActivas($term, isset($_POST['paginar_otros']) ? 0 : $start, 9, $hotelId, $_POST);
    if (count($hoteles) == 4) {
        foreach ($hoteles as $hotel) {
            if ($hotel['nombre'] == $term && $hotel['destino']['nombre']) {
                $un_hotel = $hotel;
                $smarty->assign('un_hotel', $un_hotel);
                break;
            }
        }
    }
    if (isset($un_hotel)) {
        $hoteles = getHotelesCampaniasActivas($un_hotel['destino']['nombre'], $start, 10, $un_hotel['id'], $_POST);
    }
    $smarty->assign('hoteles', $hoteles);