<?
include("../fnc.php");
enlinea_c();

if(!$pid){
 alert("Parámetros incorrectos","javascript:history.go(-1)");
}

$id_ev=dec($ide);
$qev=mysql_query("select evaluaciones.nombre, cursos.curso as ncurso
                  from evaluaciones inner join cursos on cursos.codigo = evaluaciones.curso
                  where evaluaciones.id = $id_ev");
if(mysql_num_rows($qev)==0){
 alert("Error: la evaluacion no existe","javascript:history.go(-1)");
}else{
 $info=mysql_fetch_array($qev);
}

$id_pr=dec($pid);
$qpr=mysql_query("select * from ev_m_preguntas where id = $id_pr");
if(mysql_num_rows($qpr)==0){
 alert("Error: la pregunta no existe","javascript:history.go(-1)");
 // redireccionar a frm_login
}
$pregunta=mysql_fetch_array($qpr);

if(!$nops){
$qcop=mysql_query("select count(*) as cantidad from ev_m_opciones where pregunta = $id_pr");
$icop=mysql_fetch_array($qcop);

$nops=$icop[cantidad];
}

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title>e-Ducativo - Bienvenido</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="../estilo1.css" rel="stylesheet" type="text/css">
<script language="JavaScript" type="text/JavaScript">
<!--
function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}
//-->
</script>
</head>

<body>
<table width="750" border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#333333">
  <tr>
    <td bgcolor="#336699">    <table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0" bgcolor="#E5E5E5">
      <tr bgcolor="#FFFFFF">
        <td width="40%"><img src="../images/logo_5.gif" width="300" height="50"></td>
        <td width="60%" background="../images/back_header_cat.gif" bgcolor="#FFFFFF"><div align="right" class="usuario_nombre_enc"><strong><?echo "$unombre $uapellido";?><br>
          </strong>Tiene <?=mensajes(1);?> mensaje(s) sin leer</div></td>
      </tr>
      <tr bgcolor="#FFFFFF">
        <td height="15" colspan="2" background="../images/barra_encabezado.gif">&nbsp;</td>
        </tr>
    </table>
      <table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0">
        <tr>
          <td width="20%" valign="top" bgcolor="#FFFFCC"><?php include("menu.php"); ?>&nbsp;</td>
          <td width="80%" valign="top" bgcolor="#FFFFFF"><table width="100%"  border="0" cellpadding="0" cellspacing="0" bgcolor="#333333">
            <tr align="center" valign="middle" bgcolor="#FFFFCC">
              <td height="20" class="titulo_pagina"><div align="center" class="titulo_pagina"><strong> MODIFICACION DE PREGUNTAS DE SELECCION MULTIPLE </strong></div></td>
            </tr>
            <tr>
              <td align="left" valign="top" bgcolor="#ECE9D8"><div align="left" class="parrafo">
                <table width="100%"  border="0" align="center" cellpadding="0" cellspacing="0">
                  <tr>
                    <td bgcolor="#FFFFCC">
                    <table width="99%"  border="0" align="center" cellpadding="0" cellspacing="1" bgcolor="#333333">
                            <tr>
                              <td bgcolor="#FFFFFF"><form name="form1" method="post" action="mnt_m_pregunta.php">
                                <table width="100%"  border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#FFFFFF">
                                  <tr align="left" valign="middle" bgcolor="#336699">
                                    <td colspan="2" class="titulo_seccion_blanco">MODIFICAR PREGUNTA</td>
                                  </tr>
                                  <tr align="left" valign="middle" bgcolor="#FFFFFF">
                                    <td colspan="2" class="parrafo"><table width="100%"  border="0" cellspacing="0" cellpadding="0">
                                      <tr bgcolor="#FFFFFF">
                                        <td width="27%" class="lbl_formulario">NOMBRE DE LA EVALUACION:</td>
                                        <td width="73%" class="lbl_formulario"><strong>
                                          <?=$info[nombre];?>
                                        </strong></td>
                                      </tr>
                                      <tr bgcolor="#FFFFFF">
                                        <td class="lbl_formulario">CURSO:</td>
                                        <td class="lbl_formulario"><strong>
                                          <?=$info[ncurso];?>
                                        </strong></td>
                                      </tr>
                                    </table>                                                                                                                                                       </td>
                                  </tr>
                                  <tr align="left" valign="middle" bgcolor="#FFCC33">
                                    <td colspan="2" class="parrafo">
                                     <table width="100%"  border="0" cellspacing="0" cellpadding="0">
                                      <tr valign="middle">
                                        <td width="3%"><div align="right"><strong>
                                            <input name="txtcontiempo" type="checkbox" id="txtcontiempo" value="S" <?if($pregunta[con_tiempo]=="S"){echo "checked";}?>>
                                        </strong></div></td>
                                        <td width="45%"><div align="left"><strong> Deseo que esta pregunta tenga tiempo l&iacute;mite.</strong></div></td>
                                        <td width="52%"><div align="left">
                                          <input name="txtminutos" type="text" class="textbox" id="txtminutos" size="3" maxlength="3" value="<?=$pregunta[minutos];?>">
                                            <strong>minutos con
                                              <input name="txtsegundos" type="text" class="textbox" id="txtsegundos" size="3" maxlength="3"  value="<?=$pregunta[segundos];?>">
                                            segundos </strong></div></td>
                                      </tr>
                                     </table>
                                    </td>
                                  </tr>
                                  <tr align="left" valign="middle" bgcolor="#E9F2FE">
                                    <td width="64" class="lbl_formulario">Valor:</td>
                                    <td width="520" class="menu_enc"><strong>
                                      <input name="txtvalor" type="text" class="lbl_formulario" id="txtvalor" dir="rtl" size="4" maxlength="3" value="<?=$pregunta[valor];?>">
                                      <span class="lbl_formulario">puntos</span></strong></td>
                                  </tr>
                                  <tr align="left" valign="middle" bgcolor="#E9F2FE">
                                    <td class="lbl_formulario">Pregunta:</td>
                                    <td class="menu_enc"><strong>
                                      <input name="txtpregunta" type="text" class="lbl_formulario" id="txtpregunta" size="60"  value="<?=$pregunta[pregunta];?>">
                                    </strong></td>
                                  </tr>
                                  <tr align="left" valign="middle" bgcolor="#E9F2FE">
                                    <td colspan="2" class="lbl_formulario"><hr size="1"></td>
                                  </tr>
                                  <tr align="left" valign="middle" bgcolor="#E8E8E8">
                                    <td colspan="2" class="lbl_formulario"><table width="99%"  border="0" align="center" cellpadding="1" cellspacing="1" bgcolor="#009933">
                                      <tr>
                                        <td bgcolor="#FFFFFF">
                                        <table width="98%"  border="0" align="center" cellpadding="0" cellspacing="1">
                                          <tr>
                                            <td colspan="2">OPCIONES</td>
                                            <td><div align="right">Necesito
                                                  <select name="menu1" class="textbox" onChange="MM_jumpMenu('parent',this,0)">
                                                    <option value="#" selected>SELECCIONE</option>
                                                    <option value="frm_upd_m_pregunta.php?nops=2&ide=<?="$ide&pid=$pid";?>">2</option>
                                                    <option value="frm_upd_m_pregunta.php?nops=3&ide=<?="$ide&pid=$pid";?>">3</option>
                                                    <option value="frm_upd_m_pregunta.php?nops=4&ide=<?="$ide&pid=$pid";?>">4</option>
                                                    <option value="frm_upd_m_pregunta.php?nops=5&ide=<?="$ide&pid=$pid";?>">5</option>
                                                  </select> opciones </div></td>
                                          </tr>
                                          <?
                                          $j=0;
                                          $qopciones=mysql_query("select * from ev_m_opciones where pregunta = $id_pr order by id");
                                          while($opcion=mysql_fetch_array($qopciones) and $j<$nops){
                                          $j++;
                                          ?>
                                          <tr align="left" valign="middle">
                                            <td width="3%"><div align="left">#<?=$j;?> </div></td>
                                            <td width="47%"><input name="txtopcion[<?=$j;?>]" type="text" class="lbl_formulario" size="50" value="<?=$opcion[opcion];?>"></td>
                                            <td width="50%"><input name="txtcorrecta" type="radio" value="<?=$j;?>" <?if($opcion[correcta]=="S"){echo "checked";}?>><span class="font_red_11">Marque si &eacute;sta es la opci&oacute;n correcta</span></td>
                                          </tr>
                                          <?
                                          }

                                          for($i=$j+1;$i<=$nops;$i++){
                                          ?>
                                          <tr align="left" valign="middle">
                                            <td width="3%"><div align="left">#<?=$i;?> </div></td>
                                            <td width="47%"><input name="txtopcion[<?=$i;?>]" type="text" class="lbl_formulario" size="50"></td>
                                            <td width="50%"><input name="txtcorrecta" type="radio" value="<?=$i;?>"><span class="font_red_11">Marque si &eacute;sta es la opci&oacute;n correcta</span></td>
                                          </tr>
                                          <?
                                          }
                                          ?>
                                        </table></td>
                                      </tr>
                                    </table></td>
                                    </tr>
                                  <tr align="left" valign="middle" bgcolor="#E9F2FE">
                                    <td colspan="2" class="lbl_formulario"><hr size="1"></td>
                                  </tr>
                                  <tr align="left" valign="middle" bgcolor="#E8E8E8">
                                    <td colspan="2" class="lbl_formulario"><div align="center">
                                        <table width="100%"  border="0" cellpadding="0" cellspacing="0">
                                          <tr bgcolor="#FFFFFF">
                                            <td width="9%" align="left" valign="middle"><div align="left"><a href="frm_preguntas_evaluacion.php?ide=<?=$ide;?>"><img src="../images/regresar_c.png" alt="No guarda los cambios" width="32" height="32" border="0"></a><br>
                                              <span class="textbox">Regresar</span></div></td>
                                            <td width="27%">&nbsp;</td>
                                            <td width="34%"><div align="left">
                                              <input name="Submit" type="submit" class="boton_guardar" value="Guardar pregunta">
                                            </div></td>
                                            <td width="30%"><input name="ide" type="hidden" id="ide3" value="<?=$ide;?>">
                                              <input name="tipo_trn" type="hidden" id="tipo_trn3" value="Update">
                                              <input name="nops" type="hidden" id="nops" value="<?=$nops;?>">
                                              <input name="pid" type="hidden" id="ide" value="<?=$pid;?>"></td>
                                          </tr>
                                        </table>
                                        </div></td>
                                  </tr>
                                </table>
                              </form></td>
                            </tr>
                      </table> 
                    &nbsp;</td>
                  </tr>
                </table>
              </div></td>
              </tr>
          </table></td>
        </tr>
    </table>    </td>
  </tr>
</table>
</body>
</html>