<file_sep><!DOCTYPE html>
<html>
	<head>
		<title>introduccion</title>
		<meta charset="UTF-8">
		<script src="http://maps.google.com/maps?file=api&v=2&key=COLOCAR_AQUI_NUESTRA_KEY" 
		type="text/javascript"></script>
		<script type="text/javascript">
			function iniciar() {
				var mapOptions = {
					center: new google.maps.LatLng(40.416728, -3.703801),
					zoom: 10,
					mapTypeId: google.maps.MapTypeId.HYBRID};
			var map = new google.maps.Map(document.getElementById("map"),mapOptions);}		
		</script>
	</head>
	<body>		
		<?php echo $_GET["latitud"]?>
		<?php echo $_GET["longitud"]?>
		<div id="map" style="width:500px;height:250px;"></div>
		<script src="http://maps.google.com/maps/api/js?sensor=false&callback=iniciar"></script>
		
	</body>
</html>




<?php/*enlaces
	https://developers.google.com/maps/documentation/javascript/examples/event-simple?hl=es
	* http://www.rubenalcaraz.es/pinakes/informatica/introduccion-a-google-maps-apiv3-parte-5-multiples-marcadores-con-infowindow/#codesyntax_4
	* http://w3.unpocodetodo.info/utiles/mapa-con-chincheta.php*/?>
	
	
<file_sep><?php 	
	$insertar = 1;
	$id = $_GET["id"];
	echo $id;
?>

<!DOCTYPE html>
<html>
	<head>
		<title>Añadir Estación</title>
		<meta charset="UTF-8">	
	</head>
	<body>
		<h1 align="center">Introduce los datos de una nueva Estación</h1><br><br><br><br><br>
		<form action="index.php" method="get">
			<p align = "center">Nombre de usuario: <input size="15" name="nom_usu" value="nom_usu"><br><br><br>
			Correo: <input size="15" name="correo_n" value="correo_n"><br><br><br><br>
			Cooredenadas de la estación meteorologica: <br><br>
			Latitud: <input size="15" name="latutid_n" value="latutid_n"><br><br><br>
			Longitud: <input size="15" name="longitud_n" value="longitud_n"><br><br><br><br>
			Nota: Asegurese de tener los siguientes sensores: <br><br>
			<input type=checkbox value=si name=temperatura> Temperatura<br>
			<input type=checkbox value=si name=presion> Presión<br>
			<input type=checkbox value=si name=humedad> Humedad<br><br><br><br>
			
			<input size="0" value=<?php echo $insertar?> name="insertar">
			<input size="0" value=<?php echo $id?> name="id">
			<input size="0" value="0" name=d_h>
			<input type="submit" value="Enviar"></p>
		</form>
	</body>
</html>
<file_sep><?php
require_once ('jpgraph/jpgraph.php');
require_once ('jpgraph/jpgraph_line.php');
include_once './clases.php';
include_once './conexion_consultas.php';

$k=0;
for($i=0; $i<=count($registroH); $i++){
	if ($registroH[$i]->idEstacion2 == $_GET["id2"]){
		$temperatura_g[$k] = $registroH[$i]->temperatura;
		$humeda_g[$k] = $registroH[$i]->humedad;
		$presion_g[$k] = $registroH[$i]->presion;
		$k++;
	}
}

 
// Setup the graph
$graph = new Graph(925,350);
$graph->SetScale("textlin");
 
$theme_class=new UniversalTheme;
 
$graph->SetTheme($theme_class);
$graph->img->SetAntiAliasing(false);
$graph->title->Set('Evolucion del clima por horas');
$graph->SetBox(false);
 
$graph->img->SetAntiAliasing();
 
$graph->yaxis->HideZeroLabel();
$graph->yaxis->HideLine(false);
$graph->yaxis->HideTicks(false,false);
 
$graph->xgrid->Show();
$graph->xgrid->SetLineStyle("solid");
$graph->xaxis->SetTickLabels(array('00:00','01:00','02:00','03:00', '04:00', '05:00', 
	'06:00', '07:00', '08:00', '09:00', '10:00', '11:00', '12:00', '13:00', '14:00', '15:00', '16:00', '17:00',
	'18:00', '19:00', '20:00', '21:00', '22:00', '23:00'));
$graph->xgrid->SetColor('#E3E3E3');
 
// Create the first line

$p1 = new LinePlot($temperatura_g);
$graph->Add($p1);
$p1->SetColor("#6495ED");
$p1->SetLegend('Temperatura');
 
// Create the second line
$p2 = new LinePlot($humeda_g);
$graph->Add($p2);
$p2->SetColor("#B22222");
$p2->SetLegend('Humedad');
 
// Create the third line
$p3 = new LinePlot($presion_g);
$graph->Add($p3);
$p3->SetColor("#FF1493");
$p3->SetLegend('Presion');
 
$graph->legend->SetFrameWeight(1);
 
$graph->legend->SetPos(0.5,0.98,'center','bottom');
 
// Output line
$graph->Stroke();
?>
<file_sep><?php 	
	include_once './clases.php';
	include_once './conexion_consultas.php';
	include './imagen.php';
	

?>

<!DOCTYPE html>
<html>
	<head>
		<title>Principal</title>
		<meta charset="UTF-8">
		
	</head>
	
	
	<body>
		
		 <img src="<?= "/trabajo_final/imagenes/".$imagen.".jpg"?>" width=100% height="200">
		
		
		
		
		
		
		
		<table height="70" width=100%>
			<tr>
			<?php if($inicio4 == 0){ ?>
				<form action="index.php?id=<?php echo $inicio3?>&d_h=1" method="post">
					<td width=33.33% align="center"><input type="submit" value="Registro Diario"></td>
					<td width=33.33% align="center">Te muestra el regitro por horas</td>
				</form>
			<?php }else{ ?>
				<form action="index.php?id=<?php echo $inicio3?>&d_h=0" method="post">
					<td width=33.33% align="center"><input type="submit" value="Registro Horario"></td>
					<td width=33.33% align="center">Te muestra el registro por dias</td>
				</form>
			<?php }; ?>
			<form action="anadir_estacion.php?id=<?php echo $inicio3?>" method="post">
				<td width=33.33% align="center"><input type="submit" value="Nueva Estación"></td>
			</form>
			</tr>
		</table>
		
		
		
		
		
		
		
		<?php include './mapa1.js'; ?>
		<div id="map" style="width:100%;height:400px;"></div>
		<script src="http://maps.google.com/maps/api/js?sensor=false&callback=iniciar"></script>

		
		
		
		
		
		
		<?php if($inicio4 == 0){ ?>
			<table height="80" width=100%>
				<tr>
					<td width=33.33% align="center">Ultima temperatura: <?php echo $final_temperatura;?></td>
					<td width=33.33% align="center">Ultima Presion: <?php echo $final_presion;?></td>
					<td width=33.33% align="center">Ultima humedad: <?php echo $final_humedad;?></td>
				</tr>
			</table>
		<?php }else{ ?>
			<table height="80" width=100%>
				<tr>
					<td width=33.33% align="center">Temperatura media del dia anterior anterior: <?php echo $final_temperatura;?></td>
					<td width=33.33% align="center">Presion media del dia anterioranterior: <?php echo $final_presion;?></td>
					<td width=33.33% align="center">humedad media del dia anterior anterior: <?php echo $final_humedad;?></td>
				</tr>
			</table>
			<table height="80" width=100%>
				<tr>
					<td width=50% align="center">Temperatura maxima del dia anteriror: <?php echo $ultimo_maximo;?></td>
					<td width=50% align="center">Temperatura minima del dia anterior: <?php echo $ultimo_minimo;?></td>
				</tr>
			</table>
		<?php }?>
		
		
		
		
		
		
		<?php if($inicio4 == 0){ ?>
			<img src="grafico.php?id2=<?php echo $inicio3?>" alt="" border=100% align="center">
		<?php }else{ ?>
			<img src="grafico_D.php?id2=<?php echo $inicio3?>" alt="" border=100% align="center">
		<?php }?>
		
	</body>
</html>
