function buscar()
 {
     $tp = new TemplatePower("templates/hoteles.html");
     $tp->prepare();
     $tp->gotoBlock("_ROOT");
     $mhotels = new MHotels();
     if ($_POST['hotel'] == "") {
         $tp->newblock("error");
         $tp->assign("msg", "No se ha ingresado nada");
     } else {
         $result = $mhotels->buscar_hoteles($_POST['hotel']);
         if ($result['found']) {
             foreach ($result['result'] as $r) {
                 $tp->newblock("hotels");
                 $tp->assign("idHotel", $r['id_hotel']);
                 $tp->assign("name", $r['nom_hotel']);
                 $tp->assign("prov", $r['provincia']);
                 $tp->assign("local", $r['localidad']);
                 $tp->assign("calle", $r['calle']);
                 $tp->assign("ncalle", $r['nro_calle']);
                 $tp->assign("tel", $r['telefono']);
                 $tp->assign("precio", $r['precio_persona']);
             }
         } else {
             $tp->newblock("no_hotels");
         }
     }
     echo $tp->getOutputContent();
 }
 public function registrar()
 {
     $proteccion = new Proteccion();
     $nombre = $proteccion->html($_POST['nombre']);
     $apellido = $proteccion->html($_POST['apellido']);
     $sexo = $proteccion->html($_POST['sexo']);
     $fecha_nacimiento = $proteccion->html($_POST['fecha_nacimiento']);
     $direccion = $proteccion->html($_POST['direccion']);
     $email = $proteccion->html($_POST['email']);
     $dni = $proteccion->html($_POST['dni']);
     $pass = $proteccion->html($_POST['password']);
     $persona = new Usuario($email, $pass);
     $existe = $persona->existe();
     if ($existe) {
         $tp = new TemplatePower("templates/registro.html");
         $tp->prepare();
         $tp->gotoBlock("_ROOT");
         $tp->newblock("no_registro");
         $tp->assign("usuario", $email);
         $webapp = $tp->getOutputContent();
     } else {
         $persona->setDatosUsuario($nombre, $apellido, $sexo, $fecha_nacimiento, $direccion, $dni);
         $persona->insertar();
         $_SESSION['user'] = $email;
         $tp = new TemplatePower("templates/index.html");
         $tp->prepare();
         $tp->gotoBlock("_ROOT");
         $tp->newBlock("sesion");
         $tp->assign("usuario", $_SESSION['user']);
         $webapp = $tp->getOutputContent();
     }
     echo $webapp;
 }
session_start();
include "inc.includes.php";
$db = new BaseDatos($config['dbhost'], $config['dbuser'], $config['dbpass'], $config['db']);
$tpl = new TemplatePower("templates/index.html");
$tpl->prepare();
$tpl->gotoBlock("_ROOT");
//isset determina si una variable esta definida o es null
//$_REQUEST tiene el contenido de get y post
if (!isset($_REQUEST["action"]) || $_REQUEST["action"] == "") {
    $tpl->newBlock("contenido");
    $mhotels = new MHotels();
    $result = $mhotels->allhoteles();
    if ($result['found']) {
        foreach ($result['result'] as $r) {
            $tpl->newblock("hotels");
            $tpl->assign("idHotel", $r['id_hotel']);
            $tpl->assign("name", $r['nom_hotel']);
            $tpl->assign("prov", $r['provincia']);
            $tpl->assign("local", $r['localidad']);
            $tpl->assign("calle", $r['calle']);
            $tpl->assign("ncalle", $r['nro_calle']);
            $tpl->assign("tel", $r['telefono']);
            $tpl->assign("precio", $r['precio_persona']);
        }
    } else {
        $tpl->newblock("no_hotels");
    }
    $webapp = $tpl->getOutputContent();
} else {
    if (!strpos($_REQUEST["action"], "::")) {
 public function bajaHotel()
 {
     $tp = new TemplatePower("templates/BajaHotel.html");
     $tp->prepare();
     $tp->gotoBlock("_ROOT");
     $tp->newBlock("tabla");
     $mhotels = new MHotels();
     $result = $mhotels->allhoteles();
     if ($result['found']) {
         foreach ($result['result'] as $r) {
             $tp->newblock("hotels");
             $tp->assign("idHotel", $r['id_hotel']);
             $tp->assign("name", $r['nom_hotel']);
             $tp->assign("prov", $r['provincia']);
             $tp->assign("local", $r['localidad']);
             $tp->assign("calle", $r['calle']);
             $tp->assign("ncalle", $r['nro_calle']);
             $tp->assign("tel", $r['telefono']);
             $tp->assign("precio", $r['precio_persona']);
         }
     } else {
         $tp->newblock("no_hotels");
     }
     echo $tp->getOutputContent();
 }
include $abs . "inc/db.php";
include $abs . "inc/template.php";
## Pagina opbouwen
register_shutdown_function("output_page");
## Moet er een global-model pagina opgebouwd worden ?
if (is_integer($pos = strpos($template, "/"))) {
    $globalTemplate = substr($template, 0, $pos) . "/";
    $template = substr($template, $pos + 1, strlen($template));
}
if (empty($globalTemplate)) {
    $tpl = new TemplatePower($abs . "tpl/" . $template . ".html");
} else {
    $tpl = new TemplatePower($abs . "tpl/" . $globalTemplate . "global.html");
    $tpl->assigninclude("include", $abs . "tpl/" . $globalTemplate . $template . ".html");
}
$tpl->prepare();
$tpl->assignglobal("url", $rel);
// Required for all pages
$qTijdschrift = "SELECT id, tijdschrift, waardering FROM tijdschrift";
$rTijdschrift = $sql->query($qTijdschrift);
if ($sql->num_rows($rTijdschrift) > 0) {
    while ($tijdschrift = $sql->fetch_assoc($rTijdschrift)) {
        if ($tijdschrift['waardering'] > 0) {
            $tpl->newblock("w.tijdschrift");
            $tpl->assign($tijdschrift);
        }
        $tpl->newblock("tijdschrift");
        $tpl->assign($tijdschrift);
    }
}
$tpl->gotoBlock('_ROOT');