Viewing file: uv4.php (20.64 KB) -rw-rw-rw- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<img src="redaire/uv/banner.jpg">
<?php
//Archivo para manejo de fechas en español
include('redaire/fechanew2.php');
include('redaire/redaire_fechas.php');
require_once('redaire/fechaesp.php');
require_once('redaire/leyendauv.php');
echo $laleyenda;
?>
<?
//echo "FCONS: ".$fcons;
//echo "FCONS: ".$semback;
?>
<?php
if (isset($_GET['acc'])){
if ($_GET['acc']=='prev'){
$diax=$diax-1;
//echo $diax;
}else if ($_GET['acc']=='next'){
$diax=$diax+1;
//echo $diax;
}else{
$diax=$diax;
//echo $diax;
}
$timestamp1 = mktime(0,0,0,$mesx,$diax+1,$anox);
$fechainicial= date("d/m/Y", $timestamp1);
$timestamp2=$timestamp1 - 604800;
$fechafinal= date("d/m/Y", $timestamp2);
}else{
if($_POST[ok])
{
$f_1="$_POST[day]/$_POST[month]/$_POST[year]";
$variable = $f_1;
$partes = explode("/", $variable);
$timestamp1 = mktime(0,0,0,$partes[1],$partes[0]+1,$partes[2]);
$fechainicial= date("d/m/Y", $timestamp1);
$timestamp2=$timestamp1 - 604800;
$fechafinal= date("d/m/Y", $timestamp2);
}else{?>
<?php
// MANEJO DE FECHAS
if ($_GET['f_1']==""){
$fechainicial = date("d/m/Y", strtotime("now"));
$fechafinal= date("d/m/Y", strtotime("-7 day"));
$f_1=date("d/m/Y", strtotime("now"));
$variable = $f_1;
$partes = explode("/", $variable);
$mesx=$partes[1];
$diax=$partes[0];
$anox=$partes[2];
$timestamp1 = mktime(0,0,0,$partes[1],$partes[0],$partes[2]);
}else{
$f_1=$_GET['f_1'];
$variable = $_GET['f_1'];
$partes = explode("/", $variable);
$mesx=$partes[1];
$diax=$partes[0];
$anox=$partes[2];
$timestamp1 = mktime(0,0,0,$partes[1],$partes[0],$partes[2]);
$fechainicial= date("d/m/Y", $timestamp1);
$timestamp2=$timestamp1 - 604800;
$fechafinal= date("d/m/Y", $timestamp2);
}
?>
<?
}
}
?>
<?
//echo "<br/>Inicio Consulta ".$fechainicial."<br />";
//echo "<br/>Fin consulta ".$fechafinal;
$dia1=date("d", ($timestamp1 - (86400 * 1 )));
$dia2=date("d", ($timestamp1 - (86400 * 2 )));
$dia3=date("d", ($timestamp1 - (86400 * 3 )));
$dia4=date("d", ($timestamp1 - (86400 * 4 )));
$dia5=date("d", ($timestamp1 - (86400 * 5 )));
$dia6=date("d", ($timestamp1 - (86400 * 6 )));
$dia7=date("d", ($timestamp1 - (86400 * 7 )));
$fz1=date("M-d", ($timestamp1 - (86400 * 1 )));
$fz2=date("M-d", ($timestamp1 - (86400 * 2 )));
$fz3=date("M-d", ($timestamp1 - (86400 * 3 )));
$fz4=date("M-d", ($timestamp1 - (86400 * 4 )));
$fz5=date("M-d", ($timestamp1 - (86400 * 5 )));
$fz6=date("M-d", ($timestamp1 - (86400 * 6 )));
$fz7=date("M-d", ($timestamp1 - (86400 * 7 )));
$fenlace1=date("d/m/Y", ($timestamp1 - (86400 * 0 )));
$fenlace2=date("d/m/Y", ($timestamp1 - (86400 * 1 )));
$fenlace3=date("d/m/Y", ($timestamp1 - (86400 * 2 )));
$fenlace4=date("d/m/Y", ($timestamp1 - (86400 * 3 )));
$fenlace5=date("d/m/Y", ($timestamp1 - (86400 * 4 )));
$fenlace6=date("d/m/Y", ($timestamp1 - (86400 * 5 )));
$fenlace7=date("d/m/Y", ($timestamp1 - (86400 * 6 )));
$t1=($timestamp1 - (86400 * 1 ));
$t2=($timestamp1 - (86400 * 2 ));
$t3=($timestamp1 - (86400 * 3 ));
$t4=($timestamp1 - (86400 * 4 ));
$t5=($timestamp1 - (86400 * 5 ));
$t6=($timestamp1 - (86400 * 6 ));
$t7=($timestamp1 - (86400 * 7 ));
$tt1="<span class='fechas'>".datacastella($t1)."</span>";
$tt2="<span class='fechas'>".datacastella($t2)."</span>";
$tt3="<span class='fechas'>".datacastella($t3)."</span>";
$tt4="<span class='fechas'>".datacastella($t4)."</span>";
$tt5="<span class='fechas'>".datacastella($t5)."</span>";
$tt6="<span class='fechas'>".datacastella($t6)."</span>";
$tt7="<span class='fechas'>".datacastella($t7)."</span>";
//echo "<br />Mostrando datos para el día: ".$dia1;
?>
<?php
//LLAMO EL ARCHIVO DE CONEXIÓN ORACLE
//require('c:\phpscripts\conexion4.php'); ?>
<?
$imagen1="/php/imguv/1.jpg";
$imagen2='/php/imguv/2.jpg';
$imagen3='/php/imguv/3.jpg';
$imagen4='/php/imguv/4.jpg';
$imagen5='/php/imguv/5.jpg';
?>
<?
//DEFINIR EL NOMBRE DE LOS DOS ARRAYS QUE SE USARÁN para cada día
$horas7=array();
$datos7=array();
$horas6=array();
$datos6=array();
$horas5=array();
$datos5=array();
$horas4=array();
$datos4=array();
$horas3=array();
$datos3=array();
$horas2=array();
$datos2=array();
$horas1=array();
$datos1=array();
?>
<style type="text/css">
<!--
td { border-top: 1px solid #CCE3FD }
.blanca {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
font-weight: bold;
color: #ffffff;
}
A:link {text-decoration: none}
A:visited {text-decoration: none}
A:active {text-decoration: none; color: red;}
A:hover {text-decoration: underline; color: red;}
.datos {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 10px;
font-weight: bold;
color: #000000;
}
.leyendas {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 9px;
color: #000066;
}
.valores {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 11px;
font-weight: bold;
color: #000066;
}
.titulo {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 13px;
font-weight: bold;
color: #000066;
}
.fechas {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 9px;
font-weight: bold;
color: #000066;
}
.fechas {
font-family: Verdana, Arial, Helvetica, sans-serif;
font-size: 8px;
font-weight: normal;
color: #000066;
}
-->
</style>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_swapImgRestore() { //v3.0
var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
function MM_findObj(n, d) { //v4.01
var p,i,x; if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
if(!x && d.getElementById) x=d.getElementById(n); return x;
}
function MM_swapImage() { //v3.0
var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
</script>
<body>
<div id="SELECCION_FECHA" style="position:absolute; width:423px; height:48px; z-index:4; visibility: visible; left: 343px; top: 538px;">
<form name="form1" method="get" action="">
<div align="right"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">Ver
otra fecha:<br>
<strong>Día:
<select name="diax" id="diax">
<? include ('redaire\2006_fechas.php'); ?>
</select>
<input name="acc" type="hidden" id="acc" value="1">
<br>
<input type="submit" name="Submit2" value="Ver">
</strong></font> </div>
</form>
</div>
<div id="FECHAS" style="position:absolute; left:560px; top:443px; width:207px; height:90px; z-index:5; visibility: visible;">
<table width="100%" border="0" cellpadding="4">
<tr>
<td>
</td>
</tr>
<tr>
<td><table width="100%" border="1" cellpadding="3" cellspacing="0" bordercolor="#CCCCCC" bgcolor="#F4F4F4">
<tr>
<td><div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><img src="fizq.gif" width="9" height="12"><a href="#">
</a></font></div></td>
<td valign="middle"> <div align="center"><font size="1" face="Verdana, Arial, Helvetica, sans-serif">
<a href="
<?
if (isset($_GET['acc'])){ ?>
<? echo $destino?>?acc=prev&diax=<?php echo $mday; ?>&mesx=<?php echo $montho; ?>&anox=<?php echo $year; ?>
<?
}else{?>
<? echo $destino?>?acc=prev&diax=<?php echo $diax-1; ?>&mesx=<?php echo $mesx; ?>&anox=<?php echo $anox; ?>
<?
}
?>
">Día
Anterior</a> <strong> <font face="Arial, Helvetica, sans-serif">I</font></strong>
<a href="
<?
if (isset($_GET['acc'])){ ?>
<? echo $destino?>?acc=next&diax=<?php echo $mday; ?>&mesx=<?php echo $montho; ?>&anox=<?php echo $year; ?>
<?
}else{?>
<?
if (isset($_GET['f_1'])){?>
<? echo $destino?>?acc=next&diax=<?php echo $diax-1; ?>&mesx=<?php echo $mesx; ?>&anox=<?php echo $anox;
}else{?>
<? echo $destino?>?acc=next&diax=<?php echo $diax-1; ?>&mesx=<?php echo $mesx; ?>&anox=<?php echo $anox;
}
?>
<?
}
?>
">
Día Siguiente</a></font></div></td>
<td><font size="1" face="Verdana, Arial, Helvetica, sans-serif"><img src="fder.gif" width="9" height="12"></font></td>
</tr>
</table></td>
</tr>
</table>
</div>
<p class='titulo'><a href='#tabla'>Ver Tiempo máximo de exposición directa recomendada en minutos</a>
</p>
<?
//CONEXIÓN BD
$db = "AIRE";
$conn = OciLogon("PDW2","IDEAM_2002",$db);
$stmt = oci_parse($conn, "
select medias_horarias.valor * 2.33 as media,
to_number(TO_char(medias_horarias.fecha, 'HH24')) as hora,
to_number(TO_char(medias_horarias.fecha, 'DD')) DIA
from medias_horarias, estaciones_magnitudes , flags_datos
where medias_horarias.magnitud_indx=estaciones_magnitudes.magnitud_indx
and medias_horarias.estacion_id=estaciones_magnitudes.estacion_id
and estaciones_magnitudes.magnitud_id=134
and medias_horarias.fecha > TO_DATE('$fechafinal 00:00','DD/MM/YYYY HH24:MI')
and medias_horarias.fecha <= TO_DATE('$fechainicial 00:00','DD/MM/YYYY HH24:MI')
and to_number(TO_char(medias_horarias.fecha, 'HH24')) >5 and to_number(TO_char(medias_horarias.fecha, 'HH24')) < 19
AND medias_horarias.FLAG =FLAGS_DATOS.FLAG_ID
AND FLAGS_DATOS.VALIDO = 'S'order by medias_horarias.fecha
");
oci_execute($stmt);
//LLEVÓ LOS DATOS AL ARRAY RESULT -----------------------------------------------------------------------------//
$nrows = OCIFetchStatement($stmt, $result);
if($nrows==0){
echo "<br /><br /><br />La consulta para la fecha <b>".$fechainicial." no ha arrojado ningún resultado</b>";
}else{
$result = OCIExecute($stmt);
echo "<br /><span class='titulo'>".datacastella1($t1)."</span>";
echo '<table width="500" border="0" cellspacing="0" cellpadding="0" >';
echo "<tr class='datos'><td width='50' align='center'>Valor </td><td width='60' align='center'>Hora</td><td width='330' class='datos' align='center'>Gráfica</td><tr>";
while (OCIFetchInto($stmt, $value)) {
//arsort ($value);
if ($dia1==$value[2]){
$hor=$value[1].":00";
array_push($horas1,$hor);
$value[0]= str_replace(",",".",$value[0]);
$value[0]=number_format($value[0],2);
array_push($datos1,number_format($value[0],2));
//$contenido.='<table width="400" border="1" cellspacing="0" cellpadding="0"><tr>';
if (($value[0])<2.4){
$a= '<img src ="'.$imagen1.'"width="'.($value[0] * 20).'" height="12">';
}else if (($value[0])>2.4 && ($value[0])<4.49){
$a= '<img src ="'.$imagen2.'"width="'.($value[0] * 20).'" height="12">';
}else if (($value[0])>4.5 && ($value[0])<6.49){
$a= '<img src ="'.$imagen3.'"width="'.($value[0] * 20).'" height="12">';
}else if (($value[0])>6.5 && ($value[0])<9.49){
$a= '<img src ="'.$imagen4.'"width="'.($value[0] * 20).'" height="12">';
}else if (($value[0])>9.5){
$a= '<img src ="'.$imagen5.'"width="'.($value[0] * 20).'" height="12">';
}
$contenido= "<tr><td width='50' class='valores'>".$value[0]."</td>
<td width='100' class='valores'>".$value[1].":00</td><td width='350' class='datos'>".$a." ".$value[0]."--".$value[1].":00 </td><tr>";
//$contenido.=' </tr></table>';
echo $contenido;
}else if ($dia2==$value[2]){
$hor=$value[1].":00";
array_push($horas2,$hor);
$value[0]= str_replace(",",".",$value[0]);
$value[0]=number_format($value[0],2);
array_push($datos2,number_format($value[0],2));
}else if ($dia3==$value[2]){
$hor=$value[1].":00";
array_push($horas3,$hor);
$value[0]= str_replace(",",".",$value[0]);
$value[0]=number_format($value[0],2);
array_push($datos3,number_format($value[0],2));
}else if ($dia4==$value[2]){
$hor=$value[1].":00";
array_push($horas4,$hor);
$value[0]= str_replace(",",".",$value[0]);
$value[0]=number_format($value[0],2);
array_push($datos4,number_format($value[0],2));
}else if ($dia5==$value[2]){
$hor=$value[1].":00";
array_push($horas5,$hor);
$value[0]= str_replace(",",".",$value[0]);
$value[0]=number_format($value[0],2);
array_push($datos5,number_format($value[0],2));
}else if ($dia6==$value[2]){
$hor=$value[1].":00";
array_push($horas6,$hor);
$value[0]= str_replace(",",".",$value[0]);
$value[0]=number_format($value[0],2);
array_push($datos6,number_format($value[0],2));
}else if ($dia7==$value[2]){
$hor=$value[1].":00";
array_push($horas7,$hor);
$value[0]= str_replace(",",".",$value[0]);
$value[0]=number_format($value[0],2);
array_push($datos7,number_format($value[0],2));
}
}
}
echo '</table><br /><br />';
/////
//COMBINO LOS DOS ARRAYS EN UNO NUEVO
//$valores = array_combine($horas, $datos);
if (count($horas1) > 0){
$prom1= number_format((array_sum($datos1)/count($horas1)), 2);
$valores1 = array_combine($horas1, $datos1);
}
if (count($horas2) > 0){
$valores2 = array_combine($horas2, $datos2);
$prom2= number_format((array_sum($datos2)/count($horas2)), 2);
}
if (count($horas3) > 0){
$valores3 = array_combine($horas3, $datos3);
$prom3= number_format((array_sum($datos3)/count($horas3)), 2);
}
if (count($horas4) > 0){
$valores4 = array_combine($horas4, $datos4);
$prom4= number_format((array_sum($datos4)/count($horas4)), 2);
}
if (count($horas5) > 0){
$valores5 = array_combine($horas5, $datos5);
$prom5= number_format((array_sum($datos5)/count($horas5)), 2);
}
if (count($horas6) > 0){
$valores6 = array_combine($horas6, $datos6);
$prom6= number_format((array_sum($datos6)/count($horas6)), 2);
}
if (count($horas7) > 0){
$valores7 = array_combine($horas7, $datos7);
$prom7= number_format((array_sum($datos7)/count($horas7)), 2);
}
// Imprimo Máximo, mínimo, promedio o NO HAY DATOS
echo '<p class="titulo">Máximo Diario en la última semana</p><br />
<table width="350" border="0" cellspacing="0" cellpadding="1"><tr class="datos">';
$fila2="<tr>";
//CREAR EL CUADRO DE DATOS. LA TABLA 2
for($a=1; $a < 8; $a++){
$contador= count(${"valores".$a});
$enlace=${"fenlace".$a};
//$eldia=($f_1 - $a);
$eldia=${"tt".$a};
$datos=${"datos".$a};
$horas=${"horas".$a};
arsort ($datos);
if ($contador > 5 ){
//sort (${"valores".$a});
echo '<td width="50" height="100" align="center" valign="top" >';
echo "<a href='uv4.php?f_1=".($enlace)."'>".$eldia."</a><br>";
//" Datos: ".$contador." Promedio ".${"prom".$a}."
$xmayor=max($datos);
$my="Max: <strong>".$xmayor."</strong><br />";
while ($valor = current($datos)) {
if ($valor == $xmayor) {
$my.= "<br ><strong>".$horas[key($datos)].'</strong><br />';
//echo $elmayor;
}
next($datos);
}
//echo "l".$valor;
$valor=max($datos);
$fila2.= "<td width='50' height='200' align='center' valign='bottom' align = 'center'>";
if ($valor < 2.4){
$xx= "<span class='datos'>".$valor.'<img src ="'.$imagen1.'"height="'.($valor * 15).'" width="48" border="0" title="'.$eldia.'">';
}else if ($valor >= 2.4 && $valor < 4.5){
$xx= "<span class='datos'>".$valor.'<img src ="'.$imagen2.'"height="'.($valor * 15).'" width="48" border="0" title="'.$eldia.'">';
}else if ($valor >= 4.5 && $valor < 6.5){
$xx= "<span class='datos'>".$valor.'<img src ="'.$imagen3.'"height="'.($valor * 15).'" width="48" border="0" title="'.$eldia.'">';
}else if ($valor >= 6.5 && $valor < 9.5){
$xx= "<span class='datos'>".$valor.'<img src ="'.$imagen4.'"height="'.($valor * 15).'" width="48" border="0" title="'.$eldia.'">';
}else if ($valor >= 9.5){
$xx= "<span class='datos'>".$valor.'<img src ="'.$imagen5.'"height="'.($valor * 15).'" width="48" border="0" title="'.$eldia.'">';
}
echo $my;
$fila2.="<a href='uv4.php?f_1=".($enlace)."'>".$xx."</a></span></td>";
/*while (list ($clave, $valor)= each (${"valores".$a})){
if ($valor/100==max(${"valores".$a})/100){
echo "<br>Máximo <strong><p class='valores'>".$valor. "</p>
</strong>Hora: <p class='valores'>".$clave."</p>";
$fila2.= "<td width='50' height='250' align='center' valign='bottom'>";
if ($valor < 2.4){
$xx= '<img src ="'.$imagen1.'"height="'.($valor * 15).'" width="20">';
}else if ($valor > 2.4 && $valor < 4.49){
$xx= '<img src ="'.$imagen2.'"height="'.($valor * 15).'" width="20">';
}else if ($valor > 4.5 && $valor < 6.49){
$xx= '<img src ="'.$imagen3.'"height="'.($valor * 15).'" width="20">';
}else if ($valor > 6.5 && $valor < 9.49){
$xx= '<img src ="'.$imagen4.'"height="'.($valor * 15).'" width="20">';
}else if ($valor > 9.5){
$xx= '<img src ="'.$imagen5.'"height="'.($valor * 15).'" width="20">';
}
//}
$fila2.=$xx."</td>";
}
if ($valor/100==min(${"valores".$a})/100){
//echo "Mínimo <strong>".$valor. "</strong>. Registrado a las ".$clave."<br />";
}
}
*/
echo '</td>';
}else if ($contador >0 && $contador <5 ) {
echo '<td width="50" height="140" align="center" valign="top">';
echo "<strong>$eldia </strong><br /><br />Número insuf. de datos <br /> ". $contador." registros";
$xx= '<td><img src ="imguv/k.jpg"height="20" width="20"></td>';
$fila2.=$xx."</td>";
//echo '</td>';
}else{
echo '<td width="50" height="140" align="center" valign="top">';
echo "<strong>$eldia </strong><br/ ><br/ >No hay datos para esta fecha <br />";
$xx= '<td><img src ="imguv/k.jpg"height="20" width="20"></td>';
$fila2.=$xx."</td>";
//echo '</td>';
}
}
echo $fila2."</tr></table>"; ?>
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
//-->
</script>
<div id="Layer2" style="position:absolute; left:416px; top:136px; width:352px; height:203px; z-index:2">
<table width="350" border="1" cellspacing="0" cellpadding="0" class='leyendas'>
<tr>
<td width="120"><div align="center" class="datos">Tipo de Piel</div></td>
<td><div align="center" class="datos">Características</div></td>
</tr>
<tr>
<td width="120">Piel muy clara</td>
<td>Es extrasensitiva y siempre se quema, no resiste el bronceado </td>
</tr>
<tr>
<td width="120">Piel clara</td>
<td>Es sensitiva y siempre se quema con facilidad, raramente se logra un
mínimo bronceado. </td>
</tr>
<tr>
<td width="120">Piel morena clara </td>
<td>Se considera normal y se quema con moderación. El bronceado es
gradual. <br> </td>
</tr>
<tr>
<td width="120">Piel morena oscura.</td>
<td>Se considera normal y se quema mínimamente. Siempre se broncea
</td>
</tr>
<tr>
<td>Piel oscura</td>
<td>Se considera insensitiva y raramente se quema.</td>
</tr>
<tr>
<td width="120">Piel muy oscura (piel con profunda pigmentación)
</td>
<td>El bronceado es profundo. <br>
Se considera insensitiva y no se quema.</td>
</tr>
</table>
</div>
<a name="tabla"></a><? echo $tablafinal;?>
<? include ("redaire/uv/pie.php")?>
<?
//////////
//$conex=mysql_connect("localhost","jaime","123");
//mysql_select_db("fotos",$conex);
//$resultado=mysql_query("select hora, numero from aire order by hora", $conex);
//CREAR LOS ELEMENTOS PARA CADA UNO DE LOS DOS ARRAYS
//COMBINO LOS DOS ARRAYS EN UNO NUEVO
//$valores = array_combine($horas, $datos);
//var_dump ($c);
//echo $a??????ire[6][0]."<br />";
?>
|