<?php
// Created by Ardora www.webardora.net
//TIMELINE-introdatos
session_start();
$slogin_noauthpage = 0;
$slogin_pagetitle = "";
include_once ("../usuariosDemostracion/usuariosDemostracion_lib.php");
include_once ("dameDatos.php");

session_cache_limiter('nocache,private');
?>
<html lang="gl">
<head><meta charset="utf-8"/><title></title>
<!--CSS--><link type="text/css" href="../ardoraFiles/ui-themes/header_watermelon/ui.all.css" rel="stylesheet" />
<link rel="stylesheet" type="text/css" href="css/ardoraTimeLine.css" />
<script type="text/javascript" src="../ardoraFiles/js/jquery-2.0.0.min.js"></script>
<script type="text/javascript" src="../ardoraFiles/js/jquery-ui.min.js"></script>
<script type="text/javascript" src="js/ardoraIntroDatos.js"></script>


</head>
<body>
     <div id="gravar" title="Gardar  ">
         <span class="ui-icon ui-icon-check" style="float:left; margin:0 7px 20px 0;"></span><p>Gardar entrada?  </p>
     </div>
     <div id="borrar" title="Borrar entrada  ">
         <span class="ui-icon ui-icon-check" style="float:left; margin:0 7px 20px 0;"></span><p>Borrar entrada?  </p>
     </div>

     <div id="profe" title="Alumnos e alumnas:  ">
     </div>

<div id="contenedor">
     <div id="cabeza">
           <div id="texto_form">
           <h1>Entrada de datos</h1>
           <p><SPAN style="font-size:12px; color:#000000">Antes de introducir unha nova entrada asegúrate de que o personaxe ou o feito que vas a escribir non fose xa posto por algún compañeiro ou compañeira.</SPAN><br>
<SPAN style="font-size:12px; color:#000000"><b></SPAN><SPAN style="font-size:12px; color:#000000">Non</b></SPAN><SPAN style="font-size:12px; color:#000000"> empregues <b></SPAN><SPAN style="font-size:12px; color:#000000">imaxes moi grandes</b></SPAN><SPAN style="font-size:12px; color:#000000">.</SPAN><br>
</p>
     </div>
     <div id="cabe_form" class="ui-widget-content ui-corner-all">
           <p class="ui-widget-header"><?php
           echo $slogin_Username; 
           ?> </p>
           <p><?php
           echo dameValor($slogin_Username, "NOM");
           ?> </p>
           <?php
           echo dameValor($slogin_Username, "CUR");
           echo dameValor($slogin_Username, "GRU")
           ?>
    </div>
</div>
<div id="clear"></div>
<?php
   $ele=$_GET['ele'];
   $ele=(int)$ele;
?>

   <form id="entraDatos" class="formLogin" name="entraDatos" method="post" action="<?php echo ('gravaDatos.php?indi='.$ele)?>" enctype="multipart/form-data">
   <div id="traballos" class="ui-widget-header ui-corner-all">
   <p>Escribe os datos</p>
   <?php
   $path = "../ardoraWorkFiles/LiteSeculo18/";
   $dir = opendir($path);
   $adiante=false;
   $total=0;
   while ($elemento = readdir($dir)){
       $extensiones = explode(".",$elemento) ;
       $nombre = $extensiones[0] ;
       $nombre2  = $extensiones[1] ;
       if (strpos($nombre,$slogin_Username)>-1){
          $adiante=true;
       }
   $total++;
   }
   $total=$total-3;
   closedir($dir);
   if ($adiante){
       echo ('<select name="speedA" id="speedA" onchange="window.location=\'introDatos.php?ele=\'+this.value">');
       if ($ele==0){
           echo ('<option value="0" selected="selected">----------------</option>'); 
       }
       else{
           echo ('<option value="0">----------------</option>');
       }

       $dir2 = opendir($path);
       while ($arquivo = readdir($dir2)){
            $extensiones = explode(".",$arquivo) ;
            $nome = $extensiones[0] ;
            if (strpos($nome,$slogin_Username)>-1){
                $datos_arquivo = file($path.$arquivo);
                $indiceV=str_replace(trim($datos_arquivo[0]).'_','',$nome)+1;
                if ($ele==$indiceV){
                    echo( '<option value="'.$indiceV.'" selected="selected">'.$datos_arquivo[1].'</option>');
                }
                else{ echo( '<option value="'.$indiceV.'">'.$datos_arquivo[1].'</option>');} 
            }
       }
       closedir($dir2);
       echo ('</select>');
       echo ('<label for="speedA" style="margin-right:10px;">Traballos engadidos  </label>');
   }
  ?>
</div>

<div id="datos_esquerda">
<div id="clear" style="border-bottom-width:1px; border-bottom-style:solid; margin-top:10px; margin-bottom:10px;"><strong>Data</strong></div>
      <div>
      <label for="titulo">Palabra</label>
     <input type="text" name="titulo" id="titulo" class="formLogin" placeholder="Escribe o nome dun personaxe ou acontecemento."
      value="<?php echo dameTitulo($ele,$slogin_Username);?>" maxlength="50" required/>
   </div>
   <div id="clear"></div>
   <label for="url1">Enderezo (URL)</label>
   <input class="formLogin" type="url" name="url1" id="url1" placeholder="" class="text ui-widget-content ui-corner-all" value="<?php echo $url ?>"/>
   <div id="clear"></div>
<div id="procesador">
   <label for="comenta">Texto</label>
   <textarea id="comenta" name="comenta" placeholder="Escribe un resumo sobre a túa entrada." class="formLogin" cols="70" rows="10" style="height:100px; width:400px;"><?php echo $textoCom ?></textarea>
</div>
</div>
<div id="datos_dereita">
   <div id="clear" style="border-bottom-width:1px; border-bottom-style:solid; margin-top:10px; margin-bottom:10px;"><strong>Inicio</strong></div>
   <div id="startDiv">
   <label>Ano</label> 
   <input type="number" min="1680"max="1820" name="anoI" id="anoI" value="<?php echo $gAnoI ?>" style="width:80px"/>
   <label>Mes</label>
   <input type="number" min="1" max="12" name="mesI" id="mesI" value="<?php echo $gMesI ?>" style="width:50px"/>
   <label for="diaI">Día</label>
   <input type="number" min="1" max="31" name="diaI" id="diaI" value="<?php echo $gDiaI ?>" style="width:50px"/>

   <div id="clear"></div>
   <label>Hora</label>
   <input type="number" min="0" max="23" name="horaI" id="horaI" value="<?php echo $gHoraI ?>" style="width:50px"/>
   <label>Min.</label>
   <input type="number" min="0" max="59" name="minutoI" id="minutoI" class="formLogin" value="<?php echo $gMinutoI ?>" style="width:50px"/>
   <label for="segundoI">Seg.</label>
   <input type="number" min="0" max="59" name="segundoI" id="segundoI" class="formLogin" value="<?php echo $gSegundoI ?>" style="width:50px"/>
   </div>
   <div id="clear"></div><div id="colorDiv">
   <p>
   <label>
   <?php
   if ($corBoton=="red"){
   echo ('<input name="bc" class="buttonsC" type="radio" value="red" checked="checked" />');
   } else{ echo ('<input name="bc" class="buttonsC" type="radio" value="red"/>');}
   ?>
   <img src="timeline/timeline_js/images/red-circle.png" alt="Red" width="10" height="10" longdesc="Red button" /></label>
   <?php
   if ($corBoton=="green"){
   echo ('<input name="bc" class="buttonsC" type="radio" value="green" checked="checked" />');
   } else{ echo ('<input name="bc" class="buttonsC" type="radio" value="green"/>');}
   ?>
   <label><img src="timeline/timeline_js/images/green-circle.png" alt="Green" width="10" height="10" longdesc="Green button" /></label>
   <?php
   if ($corBoton=="blue"){
   echo ('<input name="bc" class="buttonsC" type="radio" value="blue" checked="checked" />');
   } else{ echo ('<input name="bc" class="buttonsC" type="radio" value="blue"/>');}
   ?>
   <label><img src="timeline/timeline_js/images/blue-circle.png" alt="Blue" width="10" height="10" longdesc="Blue button" /></label>
   <?php
   if ($corBoton=="none"){
   echo ('<input name="bc" class="buttonsC" type="radio" value="none" checked="checked" />');
   } else{ echo ('<input name="bc" class="buttonsC" type="radio" value="none"/>');}
   ?>
   <label></label>
   </p>
   </div>
   <div id="clear"></div>

<div id="clear" style="border-bottom-width:1px; border-bottom-style:solid; margin-top:10px; margin-bottom:10px;"><strong>Fin</strong></div>
<div id="endDiv">
<label>Ano</label>
<input type="number" min="1680"max="1820" name="anoF" id="anoF" value="<?php echo $gAnoF ?>" style="float:left; margin-bottom:5px; width:80px"/>
<label>Mes</label>
<input type="number" min="1" max="12" name="mesF" id="mesF" value="<?php echo $gMesF ?>" style="width:50px"/>
<label>Día</label>
<input type="number" min="1" max="31" name="diaF" id="diaF" value="<?php echo $gDiaF ?>" style="width:50px"/>
<div id="clear"></div>
<label>Hora</label>
<input type="number" min="0" max="23" name="horaF" id="horaF" value="<?php echo $gHoraF ?>" style="width:50px"/>
<label>Min.</label>
<input type="number" min="0" max="59" name="minutoF" id="minutoF" value="<?php echo $gMinutoF ?>" style="width:50px"/>
<label>Seg.</label>
<input type="number" min="0" max="59" name="segundoF" id="segundoF" value="<?php echo $gSegundoF ?>" style="width:50px"/>
</div>
<div id="cSele">
<input type="color" name="cor" id="cor" value="<?php echo $corlinea ?>" style="width:25px"/>
</div>
<div id="clear"></div>
<div id="clear" style="border-bottom-width:1px; border-bottom-style:solid; margin-top:10px; margin-bottom:10px;"><strong>Arquivo imaxe</strong></div>
<input name="imaxen" type="file" id="imaxen" class="ui-corner-all" />
<div id="ima_form">
   <img src="../ardoraWorkFiles/LiteSeculo18/img/thumbs/<?php echo $nomeThumb ?>" />
</div>
<label for="ancho" style="float:left; margin-top:5px">Ancho</label>

<input type="number" min="20" max="1000" name="ancho" id="ancho" value="<?php echo $ancho ?>" style="width:80px" />
</div>
</form>
<div id="clear"></div>
<div class="fg-toolbar ui-widget-header ui-corner-all ui-helper-clearfix"> 
     <div class="fg-buttonset ui-helper-clearfix">
          <a href="index.php" class="fg-button ui-state-default fg-button-icon-solo  ui-corner-all" title="Recargar ">
          <span class="ui-icon ui-icon-refresh" style="float:left"></span>Recargar  </a>
     <?php
          if ($total<80){
          echo '<a href="#" class="fg-button ui-state-default fg-button-icon-solo  ui-corner-all" title="Gardar  " style="float:right" onclick="return showDialog()">';
          echo '<span class="ui-icon ui-icon-check"></span>Gardar </a>';
          }
     ?>
          <a id="b_borra" href="#" class="fg-button ui-state-default fg-button-icon-solo  ui-corner-all" title="Borrar entrada  " style="float:right" onclick="return showDialogBorrar()" margin-right:"30px">
          <span class="ui-icon ui-icon-trash"></span>Borrar entrada  </a>

     <?php
          $tipo=dameValor($slogin_Username, "TIP");
          if (($tipo=="profe") || ($tipo=="admin")){
             echo '<a href="#" class="fright fg-button ui-state-default fg-button-icon-solo ui-corner-all" title="Alumnos e alumnas:"  onclick="window.open(\'taboaAlumnado.php\',\'_blank\')" margin-right:"30px">';
             echo '<span class="ui-icon ui-icon-person"></span>Alumnos e alumnas:</a>';
          }
     ?>

</div>
</div></div></div></body></html>
