Example #1
0
<?php

$usuario_core->validateUser();
$eventos = getEventos();
if (isset($_GET["id"])) {
    $config = getConfiguracionById($_GET["id"]);
    $eventosConfiguracion = getProductosByConfiguracion($_GET["id"]);
    if ($eventos && $eventosConfiguracion) {
        foreach ($eventosConfiguracion as $ec) {
            foreach ($eventos as $e) {
                if ($e->id == $ec->eventoId) {
                    if ($ec->favorito) {
                        $e->favorito = 1;
                    }
                    $e->selected = 1;
                    break;
                }
            }
        }
    }
    $smarty->assign('configuracion', $config);
    $smarty->assign('edit', true);
} else {
    $smarty->assign('edit', false);
}
$smarty->assign('productos', $eventos);
$smarty->display('admin/configuracion/gestion.tpl');
Example #2
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;
    }
}