function searchHoteles($params = array()) { $result = array('result' => 'error', 'msg' => '', 'data' => null); $term = $params['term']; $start = 0; if (isset($params['start'])) { $start = intval($params['start']); } $hotelId = 0; if (isset($params['hotelId'])) { $hotelId = $params['hotelId']; } $itemsByPage = 10; if (isset($params['itemsByPage'])) { $itemsByPage = intval($params['itemsByPage']); } $hoteles = getHotelesCampaniasActivas($term, isset($params['paginar_otros']) ? 0 : $start, $itemsByPage, $hotelId); if (count($hoteles) == 4) { foreach ($hoteles as $hotel) { if ($hotel['nombre'] == $term && $hotel['destino']['nombre']) { $un_hotel = $hotel; break; } } } if (isset($un_hotel)) { $hoteles = getHotelesCampaniasActivas($un_hotel['destino']['nombre'], $start, $itemsByPage, $un_hotel['id']); } $result = array('result' => 'ok', 'hoteles' => $hoteles); if ($un_hotel) { $result['un_hotel'] = $un_hotel; } return json_encode($result); }
$aparts[$k]['precio'] = $precio; } $_SESSION['apartamentos'] = $aparts; //$limit = 2; $limit = 3; if (!count($aparts)) { //$limit = 10; //cambiado a 3 por el nuevo diseño $limit = 3; } //guardar busqueda $data_busqueda = array('hotelId' => $hotel->id, 'inicio' => date('Y-m-d', $inicio), 'fin' => date('Y-m-d', $salida), 'tiempoCreacion' => date('Y-m-d H:i:s'), 'url' => "http://" . $_SERVER["SERVER_NAME"]); insertBusquedaDisponibilidad($data_busqueda); if ($hotel->destinoId) { $destino = getDestino($hotel->destinoId); $hoteles = getHotelesCampaniasActivas($destino->nombre, 0, $limit, $hotel->id); $smarty->assign('hoteles', $hoteles); } $subaptos = array(); $indice = 0; foreach ($aparts as $key => $apt) { if ($apt['descripcion']) { $subaptos[$key] = array(); $indice = $key; } else { $subaptos[$indice][] = $apt; } } $smarty->assign('condiciones', $condicionesS); $smarty->assign('pensiones', $pensionesS); $smarty->assign('paxes', $paxesS);
<?php $hoteles = getHotelesCampaniasActivas(); $smarty->assign('hoteles', $hoteles); $locations = getLocationsHotelesCampaniasActivas(''); $smarty->assign('locations', json_encode($locations)); $precios = getPreciosHoteles(''); $count = count($precios); $cant = $count > 6 ? 6 : $count; $rangosPrecios = array(); for ($i = 1; $i <= $cant; $i++) { $rangosPrecios[] = $precios[intval($count / $cant) * $i]; } $smarty->assign('precios', $rangosPrecios); $estrellas = getCalidadHoteles(''); if ($estrellas && count($estrellas) > 1) { $smarty->assign('estrellas', $estrellas); } $smarty->display('admin/hoteles.tpl');
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); $html = $smarty->fetch('admin/hoteles_filtros.tpl'); $result = array('msg' => 'ok', 'html' => $html, 'hoteles' => $hoteles); if (!isset($_POST['paginar_otros']) && !$start) { $locations = getLocationsHotelesCampaniasActivas($term); $result['locations'] = $locations; } } if (strcmp($action, 'informacionMapa') == 0) { $id = $_POST['id']; $hotel = getHotelById($id); $smarty->assign('hotel', $hotel); $html = $smarty->fetch('admin/hotel_info.tpl'); $result = array('msg' => 'ok', 'html' => $html);