function scrapSemana($sem, $year) { $url = "http://www.congreso.es/portal/page/portal/Congreso/GenericPopUp?_piref73_2138150_73_2138147_2138147.next_page=/wc/agendaCompleta&semana=" . $sem . "-" . $year; $html_content = scraperwiki::scrape($url); $html_content = traducirHTML($html_content); $agendaHTML = str_get_html($html_content); $num = 1; for ($i = 1; $i < 8; $i++) { $dia = array(); $agendaDia = $agendaHTML->find('div[id=agenda' . $i . ']', 0); $fechadia = sinTNS($agendaDia->find('div[class=prog_dia]', 0)->plaintext); $dia["fecha"] = fechaNumerica($fechadia); $dia["nombre"] = substrHasta($fechadia, " "); foreach ($agendaDia->find('div[class=parrilla]') as $element) { $evento = array(); $evento["dia"] = $dia["nombre"]; $evento["fecha"] = $dia["fecha"]; //$evento["id"]=$num."-".$sem."-".$year; $evento["id"] = $num; $evento["hora"] = getHora($element); $evento["url"] = getURL($element); $evento["lugar"] = getLugar($element); $evento["event"] = getEvento($element, $evento["lugar"]); $evento["info"] = getInfo($element, $evento["event"], $evento["lugar"]); print_r(". scrapeado evento " . $evento["id"]); print_r(". evento: " . $evento["event"]); scraperwiki::save_sqlite(array("id"), array("id" => $evento["id"], "dia" => $evento["dia"], "fecha" => $evento["fecha"], "hora" => $evento["hora"], "url" => $evento["url"], "lugar" => $evento["lugar"], "info" => $evento["info"], "event" => $evento["event"])); $num++; } } }
} } } if ($submit == "editar") { $idLugar = $_GET["idLugar"]; $lugar = getLugar($idLugar); } if ($submit == "Modificar") { $lugar["idLugar"] = $_POST["idLugar"]; $lugar["titulo"] = $_POST["titulo"]; $lugar["descripcion"] = $_POST["descripcion"]; $foto = $_FILES['foto']; $lugar["foto"] = $foto['name']; $tipo_foto = $foto['type']; $tamano_foto = $foto['size']; $lugar_actual = getLugar($lugar["idLugar"]); $id = $lugar["idLugar"]; if (registrarEditarLugar($lugar)) { if (!$lugar["foto"] == "") { if (!(strpos($tipo_foto, 'jpeg') || strpos($tipo_foto, 'jpg') || strpos($tipo_foto, 'png') || strpos($tipo_foto, 'bmp')) || $tamano_foto > 1000000) { header("Location: ../View/Mantenimiento/Lugar/ListaLugar.php?rpta=incorrecto&mensaje=nuevo"); } else { unlink("../resources/img/lugares/" . $lugar_actual["foto"]); move_uploaded_file($foto["tmp_name"], "../resources/img/lugares/" . $foto["name"]); } } header("Location: ../View/Mantenimiento/Lugar/ListaLugar.php?rpta=correcto&mensaje=editar&id=" . $id); } else { header("Location: ../View/Mantenimiento/Lugar/ListaLugar.php?rpta=incorrecto&mensaje=editar&id=" . $id); } }
$usuario["username"] = $_POST["username"]; $usuario["password"] = $_POST["password"]; $usuario["rol"] = "cliente"; if ($idUsuario = registrarNuevoUsuario($usuario)) { header("Location: ../login.php?rpta=incorrecto&mensaje=error"); } $cliente["nombres"] = $_POST["nombres"]; $cliente["apellidoPaterno"] = $_POST["apellidoPaterno"]; $cliente["apellidoMaterno"] = $_POST["apellidoMaterno"]; $cliente["telefono"] = $_POST["telefono"]; $cliente["direccion"] = $_POST["direccion"]; $cliente["email"] = $_POST["email"]; $cliente["idUsuario"] = $idUsuario; if ($id = registrarNuevoCliente($cliente)) { header("Location: ../login.php?rpta=correcto&id=" . $id); } else { header("Location: ../login.php?rpta=incorrecto&mensaje=error"); } } } if (!defined('__ROOT__')) { define('__ROOT__', dirname(dirname(__FILE__))); } require_once __ROOT__ . '/DAO/ProductoDAO.php'; require_once __ROOT__ . '/DAO/LugarDAO.php'; if (isset($_GET["idProducto"])) { $producto = getProducto($_GET["idProducto"]); } if (isset($_GET["idLugar"])) { $lugar = getLugar($_GET["idLugar"]); }