<?php

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 {
 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();
 }