<?php
// Created by Ardora www.webardora.net
//POLAROID-introDatos
//bajo licencia Attribution-NonCommercial-NoDerivatives 4.0 International (CC BY-NC-ND 4.0)
//para otros usos contacte con el autor
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/webardora4/ui.all.css" rel="stylesheet" />
<link rel="stylesheet" type="text/css" href="css/ardoraPolaroid.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="../ardoraFiles/ckeditor/ckeditor.js"></script>
<script type="text/javascript" src="../ardoraFiles/ckeditor/adapters/jquery.js"></script>
<script type="text/javascript" src="js/ardoraPolaroidIntro.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>Save word?  </p>
     </div>
     <div id="borrar" title="Borrar palabra  ">
         <span class="ui-icon ui-icon-check" style="float:left; margin:0 7px 20px 0;"></span><p>Delete word?  </p>
     </div>

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

     </div>

<div id="contenedor">
     <div id="cabeza">
           <div id="texto_form">
           <h1></h1>
           <p><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>
<?php $ele=$_GET["ele"];$ele=(int)$ele; ?>
<div id="clear"></div>
   <form id="entraDatos" name="entraDatos" class="formLogin" method="post" action="<?php echo ('gravaDatos.php?indi='.$ele)?>" enctype="multipart/form-data">
   <div id="traballos" class="ui-widget-header ui-corner-all">
   <p>Introduza os datos</p>
   <?php
   $path = "../ardoraWorkFiles/pratosTipico/";
   $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;">Jobs added  </label>');
   }
  ?>
</div>
<div id="clear"></div>
   <div id="datos_form">
     <div>
     <label for="titulo">Word  </label>
     <input type="text" name="titulo" id="titulo" placeholder="" required 
     value="<?php echo dameTitulo($ele,$slogin_Username);?>" maxlength="30"/>
     </div>
     <div id="clear"></div>
     <label for="descri">Descrición  </label>
     <input type="text" name="descricion" id="descricion" placeholder="" required 
     value="<?php echo $dameDescricion ?>" maxlength="500"/>
     <div id="clear"></div>
<div id="imaAr">
     <label for="imaxen" >Arquivo imaxe</label>
     <input name="imaxen" type="file" id="imaxen" class="ui-corner-all" />
     <label for="ancho" >Ancho</label>
     <input type="number" min="50" max="600" name="ancho" id="ancho" value="400" class="text ui-widget-content ui-corner-all" size="3" maxlength="3" />
</div>
     <div id="ima_form">
        <img src="../ardoraWorkFiles/pratosTipico/img/thumbs/<?php echo $nomeThumb ?>" />
     </div>
   </div>

<div id="procesador">
   <label for="comenta">Comentario:</label>
   <textarea id="comenta" name="comenta" class="jquery_ckeditor" cols="70" rows="10" ><?php echo $textoCom ?></textarea>
</div>
</form>
</div>
<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="Recharge ">
          <span class="ui-icon ui-icon-refresh" ></span>Recharge  </a>
     <?php
          if ($total<80){
          echo '<a href="#" class="fright fg-button ui-state-default fg-button-icon-solo  ui-corner-all" title="Gardar  " onclick="return showDialog()">';
          echo '<span class="ui-icon ui-icon-check"></span>Gardar </a>';
          }
     ?>
          <a id="b_borra" href="#" class="fright fg-button ui-state-default fg-button-icon-solo  ui-corner-all" title="Borrar palabra  " onclick="return showDialogBorrar()" margin-right:"30px">
          <span class="ui-icon ui-icon-trash"></span>Borrar palabra  </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>
