<?php setcookie("login", $_COOKIE["login"] , time()+3600, "/", "deim.etse.urv.es", 1 ); ?>
<?php setcookie("sessio", $_COOKIE["sessio"] , time()+3600, "/", "deim.etse.urv.es", 1 ); ?>
<html>
  <head>
    <link rel="stylesheet" href="../estils/hoja.css" type="text/css" />
    <title>Modificar Deiminari</title>
  </head>

  <body leftmargin="0" topmargin="0" bgcolor="#8F0000">
    <table border="0" width="100%" height="100%" cellpadding="0" cellspacing="0">
      <tr>
        <!-- Menú dret -->
        <td align="left" valign="top" width="100" bgcolor="#4F0000">
          <?php include("../menu.inc") ?>
        </td>

        <!-- Capçalera -->
        <td align="left" valign="top" width="100%" class="centered">
        <h2>Departament d'Enginyeria Informàtica i Matemàtiques</h2>
        <img src="images/separador.gif">
        <br><br><div align="left"><blockquote>

        <!-- Començament del cos -->
        <?php 
              require("../private/connect.inc");
              require("../private/ident.inc");
              require("../private/text.inc");
              ident();
      	      autoritzar($_COOKIE["login"], "deiminaris");
              $link=Conectar();
              $did=addslashes($_POST["did"]);
              $result=mysql_query("SELECT * FROM deiminaris WHERE 
                did = $did",$link);
              $row = mysql_fetch_array($result);
              $dd = substr($row["data"], 8, 2);
              $mm = substr($row["data"], 5, 2);
              $yy = substr($row["data"], 0, 4);
              $hora = substr($row["hora"], 0, 2);
              $min = substr($row["hora"], 3, 2);
              mysql_free_result($result);
              // Si la data no esta determinada
              if (($dd==31)&&($mm==12)&&($yy=9999)&&($hora==23)&&($min==59)){
                $nodata="true";
                $data = getdate();
                $dd=""; $mm=1; $yy=$data["year"]; $hora=12; $min="00";
              }
        ?>
        <h2>Administració Deiminaris: Modificar</h2>
        <form action="preview-mod.php" method="post">
          <?php
            printf ("<input name=\"did\" type=hidden value=\"%s\">", $_POST["did"]);
          ?>  
          <b>Títol:</b><br>
          <input name="titol" size="65" maxlength="100" type="text"
          value="<?php echo $row["titol"]; ?>"><br><br>
          <b>Autor:</b><br>
          <input name="encarregat" size="65" maxlength="100" type="text" 
          value="<?php echo $row["encarregat"]; ?>"><br><br>
          <b>Institucio:</b><br>
          <input name="institucio" size="65" maxlength="100" type="text"
          value="<?php echo $row["institucio"]; ?>"><br><br>
          <b>Departament:</b><br>
          <input name="departament" size="65" maxlength="100" type="text"
          value="<?php echo $row["departament"]; ?>"><br><br>
          <table border="0">
          <tr>
            <td><b>Dia</b><br></td>
            <td>&nbsp;&nbsp;<b>Mes</b><br></td>
            <td>&nbsp;&nbsp;<b>Any</b><br></td>
            <td>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>Hora</b><br></td>
            <td>&nbsp;&nbsp;<b>Minuts</b><br></td>
          </tr>
          <tr>
            <td><input name="dia" size="2" maxlength="2" type="text"
            value="<?php echo $dd; ?>"><br><br></td>
            <td>&nbsp;&nbsp;
              <select name="mes">
                <option <?php if ($mm==1) { echo "SELECTED"; } ?>>Gen</option>
                <option <?php if ($mm==2) { echo "SELECTED"; } ?>>Feb</option>
                <option <?php if ($mm==3) { echo "SELECTED"; } ?>>Mar</option>
                <option <?php if ($mm==4) { echo "SELECTED"; } ?>>Abr</option>
                <option <?php if ($mm==5) { echo "SELECTED"; } ?>>Mai</option>
                <option <?php if ($mm==6) { echo "SELECTED"; } ?>>Jun</option>
                <option <?php if ($mm==7) { echo "SELECTED"; } ?>>Jul</option>
                <option <?php if ($mm==8) { echo "SELECTED"; } ?>>Ago</option>
                <option <?php if ($mm==9) { echo "SELECTED"; } ?>>Set</option>
                <option <?php if ($mm==10) { echo "SELECTED"; } ?>>Oct</option>
                <option <?php if ($mm==11) { echo "SELECTED"; } ?>>Nov</option>
                <option <?php if ($mm==12) { echo "SELECTED"; } ?>>Dec</option>
              </select>
              <br><br>
            </td>
            <td>&nbsp;&nbsp;<input name="any" size="4" maxlength="4" type="text"
            value="<?php echo $yy; ?>"><br><br></td>
            <td>&nbsp;&nbsp; - &nbsp;&nbsp;<input name="hora" size="2" maxlength="2" 
type="text" value ="<?php echo $hora;?>"><br><br></td>
            <td>&nbsp;&nbsp;<input name="minuts" size="2" maxlength="2" 
type="text" value="<?php echo $min; ?>"><br><br></td>
          </tr>
          </table>
          <input type="checkbox" name="nodata" value="true"
          <?php if ($nodata=="true") { echo "checked"; }?>>Data sense determinar<br><br>
          <b>Lloc:</b><br>
          <input name="lloc" size="65" maxlength="100" type="text"
          value="<?php echo $row["lloc"]; ?>"><br><br>
          <b>Obert a:</b><br>
          <input name="obert_a" size="65" maxlength="100" type="text"
          value="<?php echo $row["obert_a"]; ?>"><br><br>
          <table border="0" >
          <tr>
            <td><b>Idioma:</b><br></td>
            <td>&nbsp;&nbsp;<b>Cicle:</b> <i>Només primer any</i><br></td>
          </tr>
          <tr>
            <td>
              <select name="idioma">
                <option <?php if (strcmp($row["idioma"], "Català")==0) { echo "SELECTED"; }
                ?>>Català</option>
                <option <?php if (strcmp($row["idioma"], "Castellà")==0) { echo "SELECTED"; }
                ?>>Castellà</option>
                <option <?php if (strcmp($row["idioma"], "Anglés")==0) { echo "SELECTED"; }
                ?>>Anglés</option>
                <option <?php if (strcmp($row["idioma"], "Francés")==0) { echo "SELECTED"; }
                ?>>Francés</option>
                <option <?php if (strcmp($row["idioma"], "Alemany")==0) { echo "SELECTED"; }
                ?>>Alemany</option>
                <option <?php if (strcmp($row["idioma"], "No especificat")==0) { echo "SELECTED"; }
                ?>>No especificat</option>
              </select>
              <br><br>
            </td>
            <td>&nbsp;&nbsp;<input name="cicle" size="4" maxlength="4" 
type="text" value="<?php echo $row["cicle"]; ?>"><br><br></td>
          </tr>
          </table>
          <b>Resum:</b> <i>Insertar en format <a href="../ajuda/html.php">HTML</a></i><br>
          <textarea name="resum" cols="65" rows="15"><?php echo unformat_less($row["resum"]);?></textarea><br><br>
          &nbsp;&nbsp;<input type="image" border=0 src="images/vistaprevia.jpg">

        </form>
        <input type="image" onClick="history.go(-1)" src="images/tornar.jpg">
        </blockquote></div>
        </td>
        <td align="left" valign="top" width="100">
          <br />
          <br />
          <br />
          <br />
          <a href="../desconectar.php" class="link2"><img src="images/tancar.jpg" border="0"></a>
        </td>
      </tr>
    </table>
  </body>
</html>

