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++;
        }
    }
}
Exemplo n.º 2
0
function getProductosFullByConfiguracionId($id, $limit = false, $favorito = false)
{
    try {
        $productos = array();
        $productos_configuracion = DAOFactory::getConfiguracionEventoDAO()->queryByConfiguracionId($id);
        $counter = 0;
        if ($productos_configuracion && is_array($productos_configuracion)) {
            foreach ($productos_configuracion as $producto_c) {
                if ($limit && $counter >= $limit) {
                    break;
                }
                if ($producto_c->favorito || !$favorito) {
                    $productos[] = getEvento($producto_c->eventoId);
                    $counter++;
                }
            }
        }
        return $productos;
    } catch (Exception $e) {
        return false;
    }
}
Exemplo n.º 3
0
<?php

$logged = $usuario_core->validateUser();
if ($logged) {
    $usuario_core->hasAdminAccess('evento');
    $monedas = getAllMonedas();
    $destinos = getAllDestinos();
    $condiciones = getCondicionesByDistribuidor($usuario_core->getUsuario()->id);
    $smarty->assign('logged_user', $usuario_core->getUsuario());
    if (isset($_GET["id"])) {
        $eventoId = $_GET["id"];
        $evento = getEvento($eventoId);
        if ($evento->condiciones && count($evento->condiciones)) {
            foreach ($evento->condiciones as $c) {
                foreach ($condiciones as $cond) {
                    if ($cond->id == $c->condicionId) {
                        $cond->selected = true;
                    }
                }
            }
        }
        $smarty->assign('edit', true);
        $smarty->assign('evento', $evento);
    } else {
        $evento = new Evento();
        $evento->clave = substr(uniqid(), 6, 6);
        if (isset($_GET['c'])) {
            $campania = getCampania($_GET['c']);
            $evento->campania = $campania;
            $evento->campaniaId = $campania->id;
            $evento->inicioContrato = $campania->inicio;