function restauranteAbiertoAhorita($idRestaurante) { require_once 'modulos/restaurantes/modelos/RestauranteModelo.php'; $hora = getHorario($idRestaurante); return horarioDisponibleAhorita($hora); }
function actualizarHorario() { require_once 'modulos/restaurantes/modelos/RestauranteModelo.php'; $idRestaurante = $_POST['idRestaurante']; if (validarAdministrador() || validarRestauranteLoggeadoId($idRestaurante)) { $restaurante = getRestaurante($idRestaurante); require_once 'modulos/restaurantes/clases/Horario.php'; $horario = getHorario($idRestaurante); if (isset($_POST['LU'])) { switch ($_POST['horario']) { case 0: $horario->luIni = $_POST['iniH'] . ':' . $_POST['iniM'] . ':00'; $horario->luFin = $_POST['finH'] . ':' . $_POST['finM'] . ':00'; break; case 1: $horario->luIni = '00:00:00'; $horario->luFin = '23:59:00'; break; case 2: $horario->luIni = '00:00:00'; $horario->luFin = '00:00:00'; break; } } if (isset($_POST['MA'])) { switch ($_POST['horario']) { case 0: $horario->maIni = $_POST['iniH'] . ':' . $_POST['iniM'] . ':00'; $horario->maFin = $_POST['finH'] . ':' . $_POST['finM'] . ':00'; break; case 1: $horario->maIni = '00:00:00'; $horario->maFin = '23:59:00'; break; case 2: $horario->maIni = '00:00:00'; $horario->maFin = '00:00:00'; break; } } if (isset($_POST['MI'])) { switch ($_POST['horario']) { case 0: $horario->miIni = $_POST['iniH'] . ':' . $_POST['iniM'] . ':00'; $horario->miFin = $_POST['finH'] . ':' . $_POST['finM'] . ':00'; break; case 1: $horario->miIni = '00:00:00'; $horario->miFin = '23:59:00'; break; case 2: $horario->miIni = '00:00:00'; $horario->miFin = '00:00:00'; break; } } if (isset($_POST['JU'])) { switch ($_POST['horario']) { case 0: $horario->juIni = $_POST['iniH'] . ':' . $_POST['iniM'] . ':00'; $horario->juFin = $_POST['finH'] . ':' . $_POST['finM'] . ':00'; break; case 1: $horario->juIni = '00:00:00'; $horario->juFin = '23:59:00'; break; case 2: $horario->juIni = '00:00:00'; $horario->juFin = '00:00:00'; break; } } if (isset($_POST['VI'])) { switch ($_POST['horario']) { case 0: $horario->viIni = $_POST['iniH'] . ':' . $_POST['iniM'] . ':00'; $horario->viFin = $_POST['finH'] . ':' . $_POST['finM'] . ':00'; break; case 1: $horario->viIni = '00:00:00'; $horario->viFin = '23:59:00'; break; case 2: $horario->viIni = '00:00:00'; $horario->viFin = '00:00:00'; break; } } if (isset($_POST['SA'])) { switch ($_POST['horario']) { case 0: $horario->saIni = $_POST['iniH'] . ':' . $_POST['iniM'] . ':00'; $horario->saFin = $_POST['finH'] . ':' . $_POST['finM'] . ':00'; break; case 1: $horario->saIni = '00:00:00'; $horario->saFin = '23:59:00'; break; case 2: $horario->saIni = '00:00:00'; $horario->saFin = '00:00:00'; break; } } if (isset($_POST['DO'])) { switch ($_POST['horario']) { case 0: $horario->doIni = $_POST['iniH'] . ':' . $_POST['iniM'] . ':00'; $horario->doFin = $_POST['finH'] . ':' . $_POST['finM'] . ':00'; break; case 1: $horario->doIni = '00:00:00'; $horario->doFin = '23:59:00'; break; case 2: $horario->doIni = '00:00:00'; $horario->doFin = '00:00:00'; break; } } if (actualizaHorario($idRestaurante, $horario)) { $error = "Se actualizó correctamente el horario"; } else { $horario = getHorario($idRestaurante); $error = "Ocurrió un error al actualizar el horario"; } require_once 'modulos/restaurantes/vistas/horario.php'; } else { goToIndex(); } }
function copiarHorario() { require_once 'modulos/platillos/modelos/platilloModelo.php'; $idPlatillo = $_POST['idPlatillo']; $platillo = getPlatillo($idPlatillo); $platillos = getPlatillosDeRestaurante($platillo->idRestaurante); if (validarAdministrador() || validarRestauranteLoggeadoId($platillo->idRestaurante)) { $idPlatilloACopiar = $_POST['platilloPorCopiar']; $horario = getHorarioPlatillo($idPlatilloACopiar); if (actualizaHorarioPlatillo($idPlatillo, $horario)) { $error = "Se actualizó correctamente el horario"; } else { $horario = getHorario($idPlatillo); $error = "Ocurrió un error al actualizar el horario"; } require_once 'modulos/platillos/vistas/horario.php'; } else { goToIndex(); } }
function getRestaurante($idRestaurante) { global $conex; $stmt = $conex->prepare("SELECT * FROM restaurante\n WHERE idRestaurante = :idRestaurante"); $stmt->bindParam(":idRestaurante", $idRestaurante); if ($stmt->execute()) { $row = $stmt->fetch(); require_once 'modulos/restaurantes/clases/Restaurante.php'; $restaurante = new Restaurante(); $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->nombreContacto = $row['nombreContacto']; $restaurante->telefonoContacto = $row['telefonoContacto']; $restaurante->comision = $row['comision']; $restaurante->tipoGastoEnvio = $row['tipoGastoEnvio']; $restaurante->habilitado = $row['habilitado']; $restaurante->tipoComision = $row['tipoComision']; $restaurante->informacion = $row['informacion']; $restaurante->horario = getHorario($idRestaurante); $restaurante->tiposComida = getTipoComidaRestaurante($idRestaurante); return $restaurante; } else { return NULL; } }