示例#1
0
     $precio = $moneda . number_format($precio, 2, ',', ' ');
     $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);
示例#2
0
<?php

$logged = $usuario_core->validateUser();
if ($logged) {
    $idiomas = getAllIdiomas();
    $smarty->assign('idiomas', $idiomas);
    if (isset($_GET["id"])) {
        $destino = getDestino($_GET["id"]);
        $smarty->assign('destino', $destino);
        $smarty->assign('edit', true);
    } else {
        $smarty->assign('edit', false);
    }
    $smarty->display('admin/destino/gestion.tpl');
}
示例#3
0
function getAfiliadoDestinos($idAfiliado)
{
    try {
        $afiliado = DAOFactory::getAfiliadoDAO()->load($idAfiliado);
        $hoteles = DAOFactory::getAfiliadoHotelDAO()->queryByAfiliadoId($idAfiliado);
        $destinos_keys = array();
        foreach ($hoteles as $hotelAfiliado) {
            $hotel = getSimpleHotel($hotelAfiliado->hotelId);
            if (!in_array($hotel->destinoId, $destinos_keys)) {
                if ($hotel->destinoId) {
                    $destinos_keys[] = $hotel->destinoId;
                }
            }
        }
        $destinos = array();
        foreach ($destinos_keys as $destino_key) {
            $destinos[] = getDestino($destino_key);
        }
        return $destinos;
    } catch (Exception $e) {
        return false;
    }
}
示例#4
0
function getHotelById($id, $convertirMonedas = true)
{
    try {
        $hotel = DAOFactory::getHotelDAO()->load($id);
        $hotel->direccion = getDireccionByHotel($hotel->id);
        if ($hotel->configuracionId) {
            $configuracion = DAOFactory::getConfiguracionDAO()->load($hotel->configuracionId);
        }
        if ($hotel->configuracionId) {
            $hotel->config = getConfiguracionById($hotel->configuracionId);
        }
        if ($hotel->campaniaId) {
            $hotel->campania = getCampania($hotel->campaniaId);
            if ($hotel->campania->empresaId) {
                $hotel->empresa = getEmpresaById($hotel->campania->empresaId);
            }
            if ($hotel->campania->empresaDistribuidoraId) {
                $hotel->distribuidor = getEmpresaById($hotel->campania->empresaDistribuidoraId);
            }
        }
        $hotel->idiomas = getAllIdiomas();
        $hotel->monedas = getMonedasByHotelId($hotel->id);
        $hotel->condiciones = getCondicionesByHotelId($hotel->id);
        if ($hotel->nombre && strlen(trim($hotel->nombre)) > 2 && $hotel->nombre[0] == '{' && $hotel->nombre[strlen($hotel->nombre) - 1] == '}') {
            $hotel->nombre = json_decode(trim($hotel->nombre))->es;
        }
        if ($hotel->descripcionCorta && strlen(trim($hotel->descripcionCorta)) > 0) {
            $hotel->descripcionesCortas = json_decode(trim($hotel->descripcionCorta));
        }
        if ($hotel->descripcionLarga && strlen(trim($hotel->descripcionLarga)) > 0) {
            $hotel->descripcionesLargas = json_decode(trim($hotel->descripcionLarga));
        }
        if ($hotel->informacionCompra && strlen(trim($hotel->informacionCompra)) > 0) {
            $hotel->informacionesCompra = json_decode(trim($hotel->informacionCompra));
        }
        if ($hotel->tituloSeo && strlen(trim($hotel->tituloSeo)) > 0) {
            $hotel->titulosSeo = json_decode(trim($hotel->tituloSeo));
        }
        if ($hotel->keywordsSeo && strlen(trim($hotel->keywordsSeo)) > 0) {
            $hotel->jkeywordsSeo = json_decode(trim($hotel->keywordsSeo));
        }
        $hotel->fechas = DAOFactory::getHotelFechasDAO()->queryByHotelId($hotel->id);
        if ($hotel->logoId) {
            $hotel->logo = DAOFactory::getArchivoDAO()->load($hotel->logoId);
        }
        $hotel->dominios = DAOFactory::getHotelDominiosDAO()->queryByHotelId($hotel->id);
        $hotel->promociones = DAOFactory::getPromocionDAO()->queryByHotelId($hotel->id);
        if ($hotel->promociones) {
            $hotel->promocionActual = false;
            foreach ($hotel->promociones as $p) {
                $now = time();
                if ($now >= strtotime($p->inicio) && $now <= strtotime($p->fin) + 24 * 60 * 60) {
                    $hotel->promocionActual = $p;
                }
            }
        }
        if ($hotel->monedaId) {
            $hotel->moneda = getMoneda($hotel->monedaId);
        }
        global $money;
        $preciosMinimos = DAOFactory::getHotelPrecioDAO()->queryByHotelId($hotel->id);
        if ($preciosMinimos && count($preciosMinimos)) {
            $precio_minimo_val = $preciosMinimos[0]->precioMinimo;
            if ($convertirMonedas) {
                $precio_moneda_seleccionada = convertFromMonedaToMoneda($precio_minimo_val, $hotel->moneda->codigo, $money);
                $preciosMinimos[0]->precioMinimo = $precio_moneda_seleccionada;
            } else {
                $preciosMinimos[0]->precioMinimo = $precio_minimo_val;
            }
            $hotel->precioMinimo = $preciosMinimos[0];
        }
        $hotel->blacklist = DAOFactory::getBlacklistDAO()->queryByHotelId($hotel->id);
        if ($hotel->destinoId) {
            $hotel->destino = getDestino($hotel->destinoId);
            if ($hotel->destino->descripcion) {
                $hotel->destino->descripciones = json_decode($hotel->destino->descripcion);
            }
            if ($hotel->mostrarHotelesRelacionados) {
                $hoteles = DAOFactory::getHotelDAO()->queryByDestinoId($hotel->destinoId);
                $keys = array_rand($hoteles, count($hoteles) > 10 ? 10 : count($hoteles));
                if (!is_array($keys)) {
                    $keys = array($keys);
                }
                $relacionados = array();
                foreach ($keys as $k) {
                    $h = $hoteles[$k];
                    if ($h->id != $hotel->id) {
                        $precioMinimo = DAOFactory::getHotelPrecioDAO()->queryByHotelId($h->id);
                        $logoHotel = getHotelLogo($h->id);
                        if ($precioMinimo && count($precioMinimo)) {
                            $precio_minimo_val = $precioMinimo[0]->precioMinimo;
                            $precio_moneda_seleccionada = convertFromMonedaToMoneda($precio_minimo_val, $hotel->moneda->codigo, $money);
                            $precioMinimo[0]->precioMinimo = $precio_moneda_seleccionada;
                            $h->precioMinimo = $precioMinimo[0];
                            $h->logo = $logoHotel;
                        }
                        $h->campania = DAOFactory::getCampaniaDAO()->load($h->campaniaId);
                        if (strlen($logoHotel->ruta) > 0) {
                            $relacionados[] = $h;
                        }
                    }
                }
                $hotel->relacionados = $relacionados;
            }
        }
        return $hotel;
    } catch (Exception $e) {
        return false;
    }
}
示例#5
0
             $result['msg'] = 'error';
             $result['data'] = 'Archivo no encontrado.';
         }
     } else {
         $result['msg'] = 'error';
         $result['data'] = 'Apartamento o adjunto no encontrado.';
     }
 } else {
     if (strcmp($action, "search") == 0) {
         $term = $_POST['term'];
         $destinos = searchDestinos($term);
         $result = array('msg' => 'ok', 'lista' => $destinos);
     } else {
         if (strcmp($action, "get") == 0) {
             $id = $_POST['id'];
             $destino = getDestino($id);
             $result = array('msg' => 'ok', 'destino' => $destino);
         } else {
             if ($_FILES) {
                 if (is_uploaded_file($_FILES['file']['tmp_name'])) {
                     $iWidth = 0;
                     $iHeight = 0;
                     $iJpgQuality = 90;
                     $FileName = md5(time() . rand());
                     $sTempFileName = 'cache/' . $FileName;
                     //$st = opendir('cache/teatros/'. $_POST['edificioId'], "a");
                     move_uploaded_file($_FILES['file']['tmp_name'], $sTempFileName);
                     @chmod($sTempFileName, 0644);
                     if (file_exists($sTempFileName) && filesize($sTempFileName) > 0) {
                         $aSize = getimagesize($sTempFileName);
                         // try to obtain image info