Пример #1
0
function tipoComida()
{
    $idRestaurante = $_GET['i'];
    if (validarAdministrador() || validarRestauranteLoggeadoId($idRestaurante)) {
        require_once 'modulos/restaurantes/modelos/RestauranteModelo.php';
        require_once 'modulos/restaurantes/modelos/RestauranteModelo.php';
        $restaurante = getRestaurante($idRestaurante);
        $tiposComida = getTipoComidaRestaurante($idRestaurante);
        require_once 'modulos/restaurantes/vistas/tiposComidaRestaurante.php';
    } else {
        goToIndex();
    }
}
Пример #2
0
function getRestaurantesColoniaTipoComidaMetodoEntrega($idColonia, $tipoComida, $metodoEntrega)
{
    global $conex;
    $query = "SELECT r.* , h.*\n        FROM  restaurante r,restaurantecolonia rc, horariorestaurante h\n        WHERE rc.idColonia = :idColonia \n        AND r.idRestaurante = rc.idRestaurante \n        AND r.idRestaurante = h.idRestaurante\n        AND r.habilitado = 1 ";
    if (isset($metodoEntrega) && $metodoEntrega < 2) {
        $query = $query . "AND (r.metodoEntrega = " . $metodoEntrega . " OR r.metodoEntrega = 2 )";
    }
    if (isset($tipoComida) && sizeof($tipoComida) > 0) {
        $query = $query . " AND r.idRestaurante IN \n                            (SELECT idRestaurante \n                             FROM restaurantetipocomida\n                             WHERE ";
        $bandera = false;
        foreach ($tipoComida as $tipo) {
            if ($bandera) {
                $query = $query . " OR idTipoComida = " . $tipo;
            } else {
                $query = $query . " idTipoComida = " . $tipo;
                $bandera = true;
            }
        }
        $query = $query . " )";
    }
    $stmt = $conex->prepare($query);
    $stmt->bindParam(":idColonia", $idColonia);
    $restaurantes = array();
    if ($stmt->execute()) {
        require_once 'modulos/restaurantes/clases/Restaurante.php';
        require_once 'modulos/restaurantes/clases/Horario.php';
        $rows = $stmt->fetchAll();
        $i = 0;
        $horario = null;
        foreach ($rows as $row) {
            $restaurante = new Restaurante();
            $restaurante->idRestaurante = $row['idRestaurante'];
            $restaurante->calle = $row['calle'];
            $restaurante->descripcion = $row['descripcion'];
            $restaurante->email = $row['email'];
            $restaurante->formaPago = $row['formaPago'];
            $restaurante->gastoEnvio = $row['gastoEnvio'];
            $restaurante->idColonia = $row['idColonia'];
            $restaurante->idRestaurante = $row['idRestaurante'];
            $restaurante->logo = $row['logo'];
            $restaurante->metodoEntrega = $row['metodoEntrega'];
            $restaurante->nombre = $row['nombre'];
            $restaurante->numero = $row['numero'];
            $restaurante->numeroInt = $row['numeroInt'];
            $restaurante->paginaWeb = $row['paginaWeb'];
            $restaurante->password = $row['password'];
            $restaurante->pedidoMinimo = $row['pedidoMinimo'];
            $restaurante->razonSocial = $row['razonSocial'];
            $restaurante->referencia = $row['referencia'];
            $restaurante->rfc = $row['rfc'];
            $restaurante->telefono = $row['telefono'];
            $restaurante->usuario = $row['usuario'];
            $restaurante->tipoGastoEnvio = $row['tipoGastoEnvio'];
            $restaurante->informacion = $row['informacion'];
            $horario = new Horario();
            $horario->doFin = $row['doFin'];
            $horario->doIni = $row['doIni'];
            $horario->luFin = $row['luFin'];
            $horario->luIni = $row['luIni'];
            $horario->maFin = $row['maFin'];
            $horario->maIni = $row['maIni'];
            $horario->miFin = $row['miFin'];
            $horario->miIni = $row['miIni'];
            $horario->juFin = $row['juFin'];
            $horario->juIni = $row['juIni'];
            $horario->viFin = $row['viFin'];
            $horario->viIni = $row['viIni'];
            $horario->saFin = $row['saFin'];
            $horario->saIni = $row['saIni'];
            $restaurante->horario = $horario;
            $restaurante->tiposComida = getTipoComidaRestaurante($restaurante->idRestaurante);
            $restaurantes[$i] = $restaurante;
            $i++;
        }
        return $restaurantes;
    } else {
        print_r($stmt->errorInfo());
        return NULL;
    }
}