<?php @session_start(); include_once "../Librerias/Datasource.php"; include_once "../Librerias/ArtesanoDao.php"; include_once "../Librerias/Artesano.php"; include_once "../Librerias/StandDao.php"; include_once "../Librerias/Stand.php"; include_once "../Librerias/Variables.php"; $conn = new Datasource($dbhost, $dbName, $dbUser, $dbPassword); $adao = new ArtesanoDao(); $sdao = new StandDao(); $artesano = new Artesano(); if (!isset($_SESSION["USER"])) { ?> <script type="text/javascript"> alert("No tienes permiso para ver este contenido"); </script> <META http-equiv="Refresh" content="0,url=index.php"> <?php } else { if ($_SESSION["ROL"] == "Artesano") { $artesano->setIdArtesano($_SESSION["ID"]); $list = $adao->searchMatching($conn, $artesano); $artesano = $list[0]; $artesano = $adao->encodificaraUTF($artesano); $lista = $sdao->loadAll($conn); $busqueda = new Stand(); $busqueda->setIdartesano($_SESSION["ID"]); //Lógica de control de si ha reservado algún stand $stands = $sdao->searchMatching($conn, $busqueda);
<?php include_once "../Librerias/Datasource.php"; include_once "../Librerias/ArtesanoDao.php"; include_once "../Librerias/Artesano.php"; include_once "../Librerias/SolicitudDao.php"; include_once "../Librerias/Solicitud.php"; include_once "../Librerias/StandDao.php"; include_once "../Librerias/Stand.php"; include_once "../Librerias/Variables.php"; $conn = new Datasource($dbhost, $dbName, $dbUser, $dbPassword); $adao = new ArtesanoDao(); $sdao = new SolicitudDao(); $standDao = new StandDao(); $idSolicitud = $_GET["id"]; $solicitud = $sdao->getObject($conn, $idSolicitud); $stand = $standDao->getObject($conn, $solicitud->getIdstand()); $stand->setReservado(1); $stand->setIdartesano($solicitud->getIdartesano()); if ($standDao->save($conn, $stand)) { $busqueda = new Solicitud(); $busqueda->setIdstand($solicitud->getIdstand()); $lista = $sdao->searchMatching($conn, $busqueda); $errores = false; for ($i = 0; $i < count($lista); $i++) { if (!$sdao->delete($conn, $lista[$i])) { $errores = true; break; } } if ($errores) {